aboutsummaryrefslogtreecommitdiff
path: root/hw/mips_fulong2e.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-08-08 21:46:13 +0300
committerAvi Kivity <avi@redhat.com>2011-09-04 17:46:50 +0300
commit13faf2a71f88d90c1c51e3cc76eebc9c6e120437 (patch)
treef023f6953aaa66299f50f0b76cf93dbbd1331d73 /hw/mips_fulong2e.c
parent9f8d2a093fa5c8d29934a5f5f2ff611907a83cef (diff)
mips_fulong2e: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/mips_fulong2e.c')
-rw-r--r--hw/mips_fulong2e.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c
index ec8c88e2e1..abe30569f2 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;