+2013-12-17 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Use %I64 and not %ll when using OS printf if compiling for windows.
+
2013-12-17 Vladimir Serbinenko <phcoder@gmail.com>
Update Mac code to match new register_efi prototype.
(unsigned long long) grub_disk_get_size (disk),
array->name, diskfilter->name);
#ifdef GRUB_UTIL
- grub_util_info ("Inserting %s (+%lld,%lld) into %s (%s)\n", disk->name,
+ grub_util_info ("Inserting %s (+%" GRUB_HOST_PRIuLONG_LONG ",%"
+ GRUB_HOST_PRIuLONG_LONG ") into %s (%s)\n", disk->name,
(unsigned long long) grub_partition_get_start (disk->partition),
(unsigned long long) grub_disk_get_size (disk),
array->name, diskfilter->name);
grub_util_fd_close (fd);
- grub_util_info ("the size of %s is %" PRIuGRUB_UINT64_T,
- name, disk->total_sectors);
+ grub_util_info ("the size of %s is %" GRUB_HOST_PRIuLONG_LONG,
+ name, (unsigned long long) disk->total_sectors);
return GRUB_ERR_NONE;
}
grub_util_error ("unsupported fs for blocklist under windows: %s",
fs->name);
- grub_util_info ("sec_per_lcn = %lld, first_lcn=%lld",
- (long long) sec_per_lcn, (long long) first_lcn);
+ grub_util_info ("sec_per_lcn = %" GRUB_HOST_PRIuLONG_LONG
+ ", first_lcn=%" GRUB_HOST_PRIuLONG_LONG,
+ (unsigned long long) sec_per_lcn,
+ (unsigned long long) first_lcn);
first_lcn += grub_partition_get_start (root_dev->disk->partition);
int
grub_util_device_is_mapped (const char *dev);
+#ifdef __MINGW32__
+#define GRUB_HOST_PRIuLONG_LONG "I64u"
+#define GRUB_HOST_PRIxLONG_LONG "I64x"
+#else
+#define GRUB_HOST_PRIuLONG_LONG "llu"
+#define GRUB_HOST_PRIxLONG_LONG "llx"
+#endif
+
void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
{
struct grub_util_biosdisk_get_grub_dev_ctx *ctx = data;
grub_disk_addr_t part_start = 0;
- grub_util_info ("Partition %d starts from %" PRIuGRUB_UINT64_T,
- partition->number, partition->start);
+ grub_util_info ("Partition %d starts from %" GRUB_HOST_PRIuLONG_LONG,
+ partition->number, (unsigned long long) partition->start);
part_start = grub_partition_get_start (partition);
}
#endif
- grub_util_info ("%s starts from %" PRIuGRUB_UINT64_T, os_dev, ctx.start);
+ grub_util_info ("%s starts from %" GRUB_HOST_PRIuLONG_LONG,
+ os_dev, (unsigned long long) ctx.start);
if (ctx.start == 0 && !is_part)
return name;
if ((! dev) || (! dev->disk))
grub_util_error ("%s", grub_errmsg);
- grub_util_info ("total sectors : %lld",
+ grub_util_info ("total sectors : %" GRUB_HOST_PRIuLONG_LONG,
(unsigned long long) dev->disk->total_sectors);
if (! leng)
return;
}
- grub_util_info ("file size : %lld", (unsigned long long) file->size);
+ grub_util_info ("file size : %" GRUB_HOST_PRIuLONG_LONG,
+ (unsigned long long) file->size);
if (skip > file->size)
{
*jptr = 0;
jptr++;
}
- grub_util_info ("locating %s at 0x%llx (0x%llx)", name,
+ grub_util_info ("locating %s at 0x%" GRUB_HOST_PRIxLONG_LONG
+ " (0x%" GRUB_HOST_PRIxLONG_LONG ")", name,
(unsigned long long) sym->st_value,
(unsigned long long) section_addresses[cur_index]);
/* This is absolute. */
*target = grub_host_to_target32 (grub_target_to_host32 (*target)
+ addend + sym_addr);
- grub_util_info ("relocating an R_386_32 entry to 0x%llx at the offset 0x%llx",
+ grub_util_info ("relocating an R_386_32 entry to 0x%"
+ GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) *target,
(unsigned long long) offset);
break;
+ addend + sym_addr
- target_section_addr - offset
- image_target->vaddr_offset);
- grub_util_info ("relocating an R_386_PC32 entry to 0x%llx at the offset 0x%llx",
+ grub_util_info ("relocating an R_386_PC32 entry to 0x%"
+ GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) *target,
(unsigned long long) offset);
break;
case R_X86_64_64:
*target = grub_host_to_target64 (grub_target_to_host64 (*target)
+ addend + sym_addr);
- grub_util_info ("relocating an R_X86_64_64 entry to 0x%llx at the offset 0x%llx",
+ grub_util_info ("relocating an R_X86_64_64 entry to 0x%"
+ GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) *target,
(unsigned long long) offset);
break;
+ addend + sym_addr
- target_section_addr - offset
- image_target->vaddr_offset);
- grub_util_info ("relocating an R_X86_64_PC32 entry to 0x%x at the offset 0x%llx",
+ grub_util_info ("relocating an R_X86_64_PC32 entry to 0x%x at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
*t32, (unsigned long long) offset);
break;
}
+ addend + sym_addr
- target_section_addr - offset
- image_target->vaddr_offset);
- grub_util_info ("relocating an R_X86_64_PC64 entry to 0x%llx at the offset 0x%llx",
+ grub_util_info ("relocating an R_X86_64_PC64 entry to 0x%"
+ GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) *target,
(unsigned long long) offset);
break;
grub_uint32_t *t32 = (grub_uint32_t *) target;
*t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
+ addend + sym_addr);
- grub_util_info ("relocating an R_X86_64_32(S) entry to 0x%x at the offset 0x%llx",
+ grub_util_info ("relocating an R_X86_64_32(S) entry to 0x%x at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
*t32, (unsigned long long) offset);
break;
}
tr++;
if (noff & ~MASK19)
grub_util_error ("trampoline offset too big (%"
- PRIxGRUB_UINT64_T ")", noff);
+ GRUB_HOST_PRIxLONG_LONG ")",
+ (unsigned long long) noff);
grub_ia64_add_value_to_slot_20b ((grub_addr_t) target, noff);
}
break;
*target = grub_host_to_target64 (grub_target_to_host64 (*target)
+ addend + sym_addr);
grub_util_info ("relocating a direct entry to 0x%"
- PRIxGRUB_UINT64_T " at the offset 0x%llx",
+ GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
+ (unsigned long long)
grub_target_to_host64 (*target),
(unsigned long long) offset);
break;
Elf_Addr addr;
addr = section_address + offset;
- grub_util_info ("adding a relocation entry for 0x%llx",
+ grub_util_info ("adding a relocation entry for 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) addr);
current_address
= SUFFIX (add_fixup_entry) (&lst,
Elf_Addr addr;
addr = section_address + offset;
- grub_util_info ("adding a relocation entry for 0x%llx",
+ grub_util_info ("adding a relocation entry for 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) addr);
current_address
= SUFFIX (add_fixup_entry) (&lst,
Elf_Addr addr;
addr = section_address + offset;
- grub_util_info ("adding a relocation entry for 0x%llx",
+ grub_util_info ("adding a relocation entry for 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) addr);
current_address
= SUFFIX (add_fixup_entry) (&lst,
if (align)
current_address = ALIGN_UP (current_address + image_target->vaddr_offset,
align) - image_target->vaddr_offset;
- grub_util_info ("locating the section %s at 0x%llx",
+ grub_util_info ("locating the section %s at 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
name, (unsigned long long) current_address);
if (image_target->id != IMAGE_EFI)
{
align)
- image_target->vaddr_offset;
- grub_util_info ("locating the section %s at 0x%llx",
+ grub_util_info ("locating the section %s at 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
name, (unsigned long long) current_address);
if (image_target->id != IMAGE_EFI)
current_address = grub_host_to_target_addr (s->sh_addr)
sec_align)
- image_target->vaddr_offset;
- grub_util_info ("locating the section %s at 0x%llx",
+ grub_util_info ("locating the section %s at 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
name, (unsigned long long) current_address);
if (image_target->id != IMAGE_EFI)
current_address = grub_host_to_target_addr (s->sh_addr)
grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out,
const char *name)
{
- grub_util_info ("writing 0x%llx bytes at offset 0x%llx",
+ grub_util_info ("writing 0x%" GRUB_HOST_PRIxLONG_LONG " bytes at offset 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) size, (unsigned long long) offset);
if (fseeko (out, offset, SEEK_SET) == -1)
grub_util_error (_("cannot seek `%s': %s"),
grub_util_write_image (const char *img, size_t size, FILE *out,
const char *name)
{
- grub_util_info ("writing 0x%llx bytes", (unsigned long long) size);
+ grub_util_info ("writing 0x%" GRUB_HOST_PRIxLONG_LONG " bytes", (unsigned long long) size);
if (fwrite (img, 1, size, out) != size)
{
if (!name)
{
size_t curs;
curs = ALIGN_ADDR (grub_util_get_image_size (pubkey_paths[i]));
- grub_util_info ("the size of public key %zd is 0x%llx",
- i, (unsigned long long) curs);
+ grub_util_info ("the size of public key %u is 0x%"
+ GRUB_HOST_PRIxLONG_LONG,
+ (unsigned) i, (unsigned long long) curs);
total_module_size += curs + sizeof (struct grub_module_header);
}
}
if (memdisk_path)
{
memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512);
- grub_util_info ("the size of memory disk is 0x%llx",
+ grub_util_info ("the size of memory disk is 0x%" GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) memdisk_size);
total_module_size += memdisk_size + sizeof (struct grub_module_header);
}
{
config_size_pure = grub_util_get_image_size (config_path) + 1;
config_size = ALIGN_ADDR (config_size_pure);
- grub_util_info ("the size of config file is 0x%llx",
+ grub_util_info ("the size of config file is 0x%" GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) config_size);
total_module_size += config_size + sizeof (struct grub_module_header);
}
total_module_size += (ALIGN_ADDR (grub_util_get_image_size (p->name))
+ sizeof (struct grub_module_header));
- grub_util_info ("the total module size is 0x%llx",
+ grub_util_info ("the total module size is 0x%" GRUB_HOST_PRIxLONG_LONG,
(unsigned long long) total_module_size);
if (image_target->voidp_sizeof == 4)
offset += prefix_size;
}
- grub_util_info ("kernel_img=%p, kernel_size=0x%llx", kernel_img,
+ grub_util_info ("kernel_img=%p, kernel_size=0x%" GRUB_HOST_PRIxLONG_LONG,
+ kernel_img,
(unsigned long long) kernel_size);
compress_kernel (image_target, kernel_img, kernel_size + total_module_size,
&core_img, &core_size, comp);
free (kernel_img);
- grub_util_info ("the core size is 0x%llx", (unsigned long long) core_size);
+ grub_util_info ("the core size is 0x%" GRUB_HOST_PRIxLONG_LONG,
+ (unsigned long long) core_size);
if (!(image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
&& image_target->total_module_size != TARGET_NO_FIELD)
struct grub_boot_blocklist *prev = bl->block + 1;
grub_uint64_t seclen;
- grub_util_info ("saving <%" PRIuGRUB_UINT64_T ",%u,%u>",
- sector, offset, length);
+ grub_util_info ("saving <%" GRUB_HOST_PRIuLONG_LONG ",%u,%u>",
+ (unsigned long long) sector, offset, length);
if (bl->first_sector == (grub_disk_addr_t) -1)
{