Revision 23ebf23d hw/mips_mipssim.c

b/hw/mips_mipssim.c
137 137
                   const char *initrd_filename, const char *cpu_model)
138 138
{
139 139
    char *filename;
140
    ram_addr_t ram_offset;
141
    ram_addr_t bios_offset;
140
    MemoryRegion *address_space_mem = get_system_memory();
141
    MemoryRegion *ram = g_new(MemoryRegion, 1);
142
    MemoryRegion *bios = g_new(MemoryRegion, 1);
142 143
    CPUState *env;
143 144
    ResetData *reset_info;
144 145
    int bios_size;
......
162 163
    qemu_register_reset(main_cpu_reset, reset_info);
163 164

  
164 165
    /* Allocate RAM. */
165
    ram_offset = qemu_ram_alloc(NULL, "mips_mipssim.ram", ram_size);
166
    bios_offset = qemu_ram_alloc(NULL, "mips_mipssim.bios", BIOS_SIZE);
166
    memory_region_init_ram(ram, NULL, "mips_mipssim.ram", ram_size);
167
    memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE);
168
    memory_region_set_readonly(bios, true);
167 169

  
168
    cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM);
170
    memory_region_add_subregion(address_space_mem, 0, ram);
169 171

  
170 172
    /* Map the BIOS / boot exception handler. */
171
    cpu_register_physical_memory(0x1fc00000LL,
172
                                 BIOS_SIZE, bios_offset | IO_MEM_ROM);
173
    memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
173 174
    /* Load a BIOS / boot exception handler image. */
174 175
    if (bios_name == NULL)
175 176
        bios_name = BIOS_FILENAME;

Also available in: Unified diff