diff options
Diffstat (limited to 'hw/mips_fulong2e.c')
-rw-r--r-- | hw/mips_fulong2e.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index ec8c88e..abe3056 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -38,6 +38,7 @@ #include "vt82c686.h" #include "mc146818rtc.h" #include "blockdev.h" +#include "exec-memory.h" #define DEBUG_FULONG2E_INIT @@ -256,7 +257,9 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, const char *initrd_filename, const char *cpu_model) { char *filename; - unsigned long ram_offset, bios_offset; + MemoryRegion *address_space_mem = get_system_memory(); + MemoryRegion *ram = g_new(MemoryRegion, 1); + MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; qemu_irq *i8259; @@ -288,12 +291,12 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, bios_size = 1024 * 1024; /* allocate RAM */ - ram_offset = qemu_ram_alloc(NULL, "fulong2e.ram", ram_size); - bios_offset = qemu_ram_alloc(NULL, "fulong2e.bios", bios_size); + memory_region_init_ram(ram, NULL, "fulong2e.ram", ram_size); + memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size); + memory_region_set_readonly(bios, true); - cpu_register_physical_memory(0, ram_size, ram_offset); - cpu_register_physical_memory(0x1fc00000LL, - bios_size, bios_offset | IO_MEM_ROM); + memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); /* We do not support flash operation, just loading pmon.bin as raw BIOS. * Please use -L to set the BIOS path and -bios to set bios name. */ @@ -304,7 +307,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); - write_bootloader(env, qemu_get_ram_ptr(bios_offset), kernel_entry); + write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; |