Permalink
Browse files

[COMMANDS] Fixed prints on xxx_addr_t and xxx_size_t to handle both 3…

…2bit and 64bit values.

Signed-off-by: Anup Patel <anup@brainfault.org>
  • Loading branch information...
1 parent 5a37d9b commit 8d033da7ad58a3bc4136b43c9c692e087834f958 @avpatel avpatel committed Apr 21, 2012
Showing with 29 additions and 9 deletions.
  1. +4 −4 commands/cmd_devtree.c
  2. +1 −1 commands/cmd_guest.c
  3. +24 −4 commands/cmd_host.c
View
@@ -89,7 +89,7 @@ void cmd_devtree_print_attribute(struct vmm_chardev *cdev,
vmm_cprintf(cdev, " ");
}
if (sizeof(u64) == sizeof(physical_addr_t)) {
- vmm_cprintf(cdev, "0x%llx",
+ vmm_cprintf(cdev, "0x%llxULL",
((physical_addr_t *)attr->value)[i >> 3]);
} else {
vmm_cprintf(cdev, "0x%x",
@@ -104,7 +104,7 @@ void cmd_devtree_print_attribute(struct vmm_chardev *cdev,
vmm_cprintf(cdev, " ");
}
if (sizeof(u64) == sizeof(physical_size_t)) {
- vmm_cprintf(cdev, "0x%llx",
+ vmm_cprintf(cdev, "0x%llxULL",
((physical_size_t *)attr->value)[i >> 3]);
} else {
vmm_cprintf(cdev, "0x%x",
@@ -119,7 +119,7 @@ void cmd_devtree_print_attribute(struct vmm_chardev *cdev,
vmm_cprintf(cdev, " ");
}
if (sizeof(u64) == sizeof(virtual_addr_t)) {
- vmm_cprintf(cdev, "0x%llx",
+ vmm_cprintf(cdev, "0x%llxULL",
((virtual_addr_t *)attr->value)[i >> 3]);
} else {
vmm_cprintf(cdev, "0x%x",
@@ -134,7 +134,7 @@ void cmd_devtree_print_attribute(struct vmm_chardev *cdev,
vmm_cprintf(cdev, " ");
}
if (sizeof(u64) == sizeof(virtual_size_t)) {
- vmm_cprintf(cdev, "0x%llx",
+ vmm_cprintf(cdev, "0x%llxULL",
((virtual_size_t *)attr->value)[i >> 3]);
} else {
vmm_cprintf(cdev, "0x%x",
View
@@ -416,7 +416,7 @@ int cmd_guest_exec(struct vmm_chardev *cdev, int argc, char **argv)
}
src_addr = (physical_addr_t)vmm_str2ulonglong(argv[3], 10);
if (argc > 4)
- size = (physical_size_t)vmm_str2uint(argv[4], 10);
+ size = (physical_size_t)vmm_str2ulonglong(argv[4], 10);
else
size = 64;
return cmd_guest_dumpmem(cdev, id, src_addr, size);
View
@@ -84,7 +84,11 @@ void cmd_host_ram_stats(struct vmm_chardev *cdev)
u32 free = vmm_host_ram_free_frame_count();
u32 total = vmm_host_ram_total_frame_count();
physical_addr_t base = vmm_host_ram_base();
- vmm_cprintf(cdev, "Base Address : 0x%08x\n", base);
+ if (sizeof(u64) == sizeof(physical_addr_t)) {
+ vmm_cprintf(cdev, "Base Address : 0x%016llx\n", base);
+ } else {
+ vmm_cprintf(cdev, "Base Address : 0x%08x\n", base);
+ }
vmm_cprintf(cdev, "Frame Size : %d (0x%08x)\n",
VMM_PAGE_SIZE, VMM_PAGE_SIZE);
vmm_cprintf(cdev, "Free Frames : %d (0x%08x)\n", free, free);
@@ -99,7 +103,13 @@ void cmd_host_ram_bitmap(struct vmm_chardev *cdev, int colcnt)
vmm_cprintf(cdev, "1 : used");
for (ite = 0; ite < total; ite++) {
if (vmm_umod32(ite, colcnt) == 0) {
- vmm_cprintf(cdev, "\n0x%08x: ", base + ite * VMM_PAGE_SIZE);
+ if (sizeof(u64) == sizeof(physical_addr_t)) {
+ vmm_cprintf(cdev, "\n0x%016llx: ",
+ base + ite * VMM_PAGE_SIZE);
+ } else {
+ vmm_cprintf(cdev, "\n0x%08x: ",
+ base + ite * VMM_PAGE_SIZE);
+ }
}
if (vmm_host_ram_frame_isfree(base + ite * VMM_PAGE_SIZE)) {
vmm_cprintf(cdev, "0");
@@ -115,7 +125,11 @@ void cmd_host_vapool_stats(struct vmm_chardev *cdev)
u32 free = vmm_host_vapool_free_page_count();
u32 total = vmm_host_vapool_total_page_count();
virtual_addr_t base = vmm_host_vapool_base();
- vmm_cprintf(cdev, "Base Address : 0x%08x\n", base);
+ if (sizeof(u64) == sizeof(virtual_addr_t)) {
+ vmm_cprintf(cdev, "Base Address : 0x%016llx\n", base);
+ } else {
+ vmm_cprintf(cdev, "Base Address : 0x%08x\n", base);
+ }
vmm_cprintf(cdev, "Page Size : %d (0x%08x)\n",
VMM_PAGE_SIZE, VMM_PAGE_SIZE);
vmm_cprintf(cdev, "Free Pages : %d (0x%08x)\n", free, free);
@@ -130,7 +144,13 @@ void cmd_host_vapool_bitmap(struct vmm_chardev *cdev, int colcnt)
vmm_cprintf(cdev, "1 : used");
for (ite = 0; ite < total; ite++) {
if (vmm_umod32(ite, colcnt) == 0) {
- vmm_cprintf(cdev, "\n0x%08x: ", base + ite * VMM_PAGE_SIZE);
+ if (sizeof(u64) == sizeof(virtual_addr_t)) {
+ vmm_cprintf(cdev, "\n0x%016llx: ",
+ base + ite * VMM_PAGE_SIZE);
+ } else {
+ vmm_cprintf(cdev, "\n0x%08x: ",
+ base + ite * VMM_PAGE_SIZE);
+ }
}
if (vmm_host_vapool_page_isfree(base + ite * VMM_PAGE_SIZE)) {
vmm_cprintf(cdev, "0");

0 comments on commit 8d033da

Please sign in to comment.