aboutsummaryrefslogtreecommitdiff
path: root/hw/leon3.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-07-25 15:07:22 +0300
committerAvi Kivity <avi@redhat.com>2011-09-04 17:46:51 +0300
commita4911d642532f8ca1c1353e47de0ec0d5b19ef86 (patch)
tree8a529d511ef203e725f5b385fefb138df1c660a6 /hw/leon3.c
parent211adf4d51c2540915bf1d970fcb2a425e37cbd5 (diff)
leon3: convert to memory API
Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/leon3.c')
-rw-r--r--hw/leon3.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/leon3.c b/hw/leon3.c
index a62a9419f3..607ec852fe 100644
--- a/hw/leon3.c
+++ b/hw/leon3.c
@@ -29,6 +29,7 @@
#include "loader.h"
#include "elf.h"
#include "trace.h"
+#include "exec-memory.h"
#include "grlib.h"
@@ -100,7 +101,9 @@ static void leon3_generic_hw_init(ram_addr_t ram_size,
const char *cpu_model)
{
CPUState *env;
- ram_addr_t ram_offset, prom_offset;
+ MemoryRegion *address_space_mem = get_system_memory();
+ MemoryRegion *ram = g_new(MemoryRegion, 1);
+ MemoryRegion *prom = g_new(MemoryRegion, 1);
int ret;
char *filename;
qemu_irq *cpu_irqs = NULL;
@@ -139,14 +142,14 @@ static void leon3_generic_hw_init(ram_addr_t ram_size,
exit(1);
}
- ram_offset = qemu_ram_alloc(NULL, "leon3.ram", ram_size);
- cpu_register_physical_memory(0x40000000, ram_size, ram_offset | IO_MEM_RAM);
+ memory_region_init_ram(ram, NULL, "leon3.ram", ram_size);
+ memory_region_add_subregion(address_space_mem, 0x40000000, ram);
/* Allocate BIOS */
prom_size = 8 * 1024 * 1024; /* 8Mb */
- prom_offset = qemu_ram_alloc(NULL, "Leon3.bios", prom_size);
- cpu_register_physical_memory(0x00000000, prom_size,
- prom_offset | IO_MEM_ROM);
+ memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size);
+ memory_region_set_readonly(prom, true);
+ memory_region_add_subregion(address_space_mem, 0x00000000, prom);
/* Load boot prom */
if (bios_name == NULL) {