diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-04-22 20:37:34 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-04-22 20:37:34 +0000 |
commit | 967032c3d5547a9973465f495f8f25e3c7967633 (patch) | |
tree | aa6577c8726bacb9b49ec6a30545c02cdb64fa23 /hw/pc.c | |
parent | acb98efbbff1c51cd9a594af7daa4fe8b4560916 (diff) |
Use correct types to enable > 2G support, based on a patch from
Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4238 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pc.c')
-rw-r--r-- | hw/pc.c | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -188,7 +188,8 @@ static int boot_device2nibble(char boot_device) } /* hd_table must contain 4 block drivers */ -static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **hd_table) +static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, + const char *boot_device, BlockDriverState **hd_table) { RTCState *s = rtc_state; int nbds, bds[3] = { 0, }; @@ -211,6 +212,12 @@ static void cmos_init(int ram_size, const char *boot_device, BlockDriverState ** rtc_set_memory(s, 0x30, val); rtc_set_memory(s, 0x31, val >> 8); + if (above_4g_mem_size) { + rtc_set_memory(s, 0x5b, (unsigned int)above_4g_mem_size >> 16); + rtc_set_memory(s, 0x5c, (unsigned int)above_4g_mem_size >> 24); + rtc_set_memory(s, 0x5d, (uint64_t)above_4g_mem_size >> 32); + } + if (ram_size > (16 * 1024 * 1024)) val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536); else @@ -676,7 +683,7 @@ static void pc_init_ne2k_isa(NICInfo *nd, qemu_irq *pic) } /* PC hardware initialisation */ -static void pc_init1(int ram_size, int vga_ram_size, +static void pc_init1(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, @@ -685,6 +692,7 @@ static void pc_init1(int ram_size, int vga_ram_size, char buf[1024]; int ret, linux_boot, i; ram_addr_t ram_addr, vga_ram_addr, bios_offset, vga_bios_offset; + ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size, vga_bios_size; PCIBus *pci_bus; int piix3_devfn = -1; @@ -696,6 +704,13 @@ static void pc_init1(int ram_size, int vga_ram_size, BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BlockDriverState *fd[MAX_FD]; + if (ram_size >= 0xe0000000 ) { + above_4g_mem_size = ram_size - 0xe0000000; + below_4g_mem_size = 0xe0000000; + } else { + below_4g_mem_size = ram_size; + } + linux_boot = (kernel_filename != NULL); /* init CPUs */ @@ -730,7 +745,13 @@ static void pc_init1(int ram_size, int vga_ram_size, /* allocate RAM */ ram_addr = qemu_ram_alloc(ram_size); - cpu_register_physical_memory(0, ram_size, ram_addr); + cpu_register_physical_memory(0, below_4g_mem_size, ram_addr); + + /* above 4giga memory allocation */ + if (above_4g_mem_size > 0) { + cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size, + ram_addr + below_4g_mem_size); + } /* allocate VGA RAM */ vga_ram_addr = qemu_ram_alloc(vga_ram_size); @@ -950,7 +971,7 @@ static void pc_init1(int ram_size, int vga_ram_size, } floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd); - cmos_init(ram_size, boot_device, hd); + cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd); if (pci_enabled && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); @@ -990,7 +1011,7 @@ static void pc_init1(int ram_size, int vga_ram_size, } } -static void pc_init_pci(int ram_size, int vga_ram_size, +static void pc_init_pci(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, @@ -1002,7 +1023,7 @@ static void pc_init_pci(int ram_size, int vga_ram_size, initrd_filename, 1, cpu_model); } -static void pc_init_isa(int ram_size, int vga_ram_size, +static void pc_init_isa(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, |