diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2010-09-18 05:53:14 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-09-18 05:53:14 +0000 |
commit | 093209cd681fe9fb65bd8a1c2ff711b8168bbfcd (patch) | |
tree | 1c5c53a93df58254c9b70f9ec910252f3414e75b | |
parent | dbf3c4b4baceb91eb64d09f787cbe92d65188813 (diff) | |
download | qemu-093209cd681fe9fb65bd8a1c2ff711b8168bbfcd.tar.gz qemu-093209cd681fe9fb65bd8a1c2ff711b8168bbfcd.tar.bz2 qemu-093209cd681fe9fb65bd8a1c2ff711b8168bbfcd.zip |
Check for errors during BIOS or kernel load
Because of the use of unsigned types, possible errors during
BIOS or kernel load were ignored.
Fix by using a signed type.
This also avoids some warnings with GCC flag -Wtype-limits.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r-- | hw/mips_fulong2e.c | 2 | ||||
-rw-r--r-- | hw/ppc405_boards.c | 23 | ||||
-rw-r--r-- | hw/ppc_newworld.c | 3 | ||||
-rw-r--r-- | hw/ppc_prep.c | 3 |
4 files changed, 18 insertions, 13 deletions
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index cbe71567a8..ac82067acb 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -258,7 +258,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, { char *filename; unsigned long ram_offset, bios_offset; - unsigned long bios_size; + long bios_size; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c index 662d7c4374..db8e5ecb74 100644 --- a/hw/ppc405_boards.c +++ b/hw/ppc405_boards.c @@ -182,10 +182,12 @@ static void ref405ep_init (ram_addr_t ram_size, qemu_irq *pic; ram_addr_t sram_offset, bios_offset, bdloc; target_phys_addr_t ram_bases[2], ram_sizes[2]; - target_ulong sram_size, bios_size; + target_ulong sram_size; + long bios_size; //int phy_addr = 0; //static int phy_addr = 1; - target_ulong kernel_base, kernel_size, initrd_base, initrd_size; + target_ulong kernel_base, initrd_base; + long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors, len; DriveInfo *dinfo; @@ -221,8 +223,8 @@ static void ref405ep_init (ram_addr_t ram_size, bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", bios_size); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT - printf("Register parallel flash %d size " TARGET_FMT_lx - " at offset %08lx addr " TARGET_FMT_lx " '%s' %d\n", + printf("Register parallel flash %d size %lx" + " at offset %08lx addr %lx '%s' %d\n", fl_idx, bios_size, bios_offset, -bios_size, bdrv_get_device_name(dinfo->bdrv), fl_sectors); #endif @@ -308,7 +310,7 @@ static void ref405ep_init (ram_addr_t ram_size, kernel_filename); exit(1); } - printf("Load kernel size " TARGET_FMT_ld " at " TARGET_FMT_lx, + printf("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base); /* load initrd */ if (initrd_filename) { @@ -503,8 +505,9 @@ static void taihu_405ep_init(ram_addr_t ram_size, qemu_irq *pic; ram_addr_t bios_offset; target_phys_addr_t ram_bases[2], ram_sizes[2]; - target_ulong bios_size; - target_ulong kernel_base, kernel_size, initrd_base, initrd_size; + long bios_size; + target_ulong kernel_base, initrd_base; + long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors; DriveInfo *dinfo; @@ -534,8 +537,8 @@ static void taihu_405ep_init(ram_addr_t ram_size, fl_sectors = (bios_size + 65535) >> 16; bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", bios_size); #ifdef DEBUG_BOARD_INIT - printf("Register parallel flash %d size " TARGET_FMT_lx - " at offset %08lx addr " TARGET_FMT_lx " '%s' %d\n", + printf("Register parallel flash %d size %lx" + " at offset %08lx addr %lx '%s' %d\n", fl_idx, bios_size, bios_offset, -bios_size, bdrv_get_device_name(dinfo->bdrv), fl_sectors); #endif @@ -576,7 +579,7 @@ static void taihu_405ep_init(ram_addr_t ram_size, bios_size = 32 * 1024 * 1024; fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT - printf("Register parallel flash %d size " TARGET_FMT_lx + printf("Register parallel flash %d size %lx" " at offset %08lx addr " TARGET_FMT_lx " '%s'\n", fl_idx, bios_size, bios_offset, (target_ulong)0xfc000000, bdrv_get_device_name(dinfo->bdrv)); diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index 809a1cfcbb..fb07c8316f 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -135,7 +135,8 @@ static void ppc_core99_init (ram_addr_t ram_size, int unin_memory; int linux_boot, i; ram_addr_t ram_offset, bios_offset, vga_bios_offset; - uint32_t kernel_base, kernel_size, initrd_base, initrd_size; + uint32_t kernel_base, initrd_base; + long kernel_size, initrd_size; PCIBus *pci_bus; MacIONVRAMState *nvr; int nvram_mem_index; diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 52fa9b6d90..0e5b88ce75 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -572,7 +572,8 @@ static void ppc_prep_init (ram_addr_t ram_size, int PPC_io_memory; int linux_boot, i, nb_nics1, bios_size; ram_addr_t ram_offset, bios_offset; - uint32_t kernel_base, kernel_size, initrd_base, initrd_size; + uint32_t kernel_base, initrd_base; + long kernel_size, initrd_size; PCIBus *pci_bus; qemu_irq *i8259; qemu_irq *cpu_exit_irq; |