Revision dcac9679 hw/mips_r4k.c

b/hw/mips_r4k.c
107 107
                        loaderparams.initrd_filename);
108 108
                exit(1);
109 109
            }
110
            initrd_size = load_image(loaderparams.initrd_filename,
111
                                     phys_ram_base + initrd_offset);
110
            initrd_size = load_image_targphys(loaderparams.initrd_filename,
111
                                              initrd_offset,
112
                                              ram_size - initrd_offset);
112 113
        }
113 114
        if (initrd_size == (target_ulong) -1) {
114 115
            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
......
153 154
                    const char *initrd_filename, const char *cpu_model)
154 155
{
155 156
    char buf[1024];
156
    unsigned long bios_offset;
157
    ram_addr_t ram_offset;
158
    ram_addr_t vga_ram_offset;
159
    ram_addr_t bios_offset;
157 160
    int bios_size;
158 161
    CPUState *env;
159 162
    RTCState *rtc_state;
......
184 187
                ((unsigned int)ram_size / (1 << 20)));
185 188
        exit(1);
186 189
    }
187
    cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
190
    ram_offset = qemu_ram_alloc(ram_size);
191
    vga_ram_offset = qemu_ram_alloc(vga_ram_size);
192

  
193
    cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM);
188 194

  
189 195
    if (!mips_qemu_iomemtype) {
190 196
        mips_qemu_iomemtype = cpu_register_io_memory(0, mips_qemu_read,
......
196 202
       but initialize the hardware ourselves. When a kernel gets
197 203
       preloaded we also initialize the hardware, since the BIOS wasn't
198 204
       run. */
199
    bios_offset = ram_size + vga_ram_size;
200 205
    if (bios_name == NULL)
201 206
        bios_name = BIOS_FILENAME;
202 207
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
203
    bios_size = load_image(buf, phys_ram_base + bios_offset);
208
    bios_size = get_image_size(buf);
204 209
    if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
205
	cpu_register_physical_memory(0x1fc00000,
206
				     BIOS_SIZE, bios_offset | IO_MEM_ROM);
210
        bios_offset = qemu_ram_alloc(BIOS_SIZE);
211
	cpu_register_physical_memory(0x1fc00000, BIOS_SIZE,
212
                                     bios_offset | IO_MEM_ROM);
213

  
214
        load_image_targphys(buf, 0x1fc00000, BIOS_SIZE);
207 215
    } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) {
208 216
        uint32_t mips_rom = 0x00400000;
209
        cpu_register_physical_memory(0x1fc00000, mips_rom,
210
	                     qemu_ram_alloc(mips_rom) | IO_MEM_ROM);
211
        if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom),
217
        bios_offset = qemu_ram_alloc(mips_rom);
218
        if (!pflash_cfi01_register(0x1fc00000, bios_offset,
212 219
            drives_table[index].bdrv, sector_len, mips_rom / sector_len,
213 220
            4, 0, 0, 0, 0)) {
214 221
            fprintf(stderr, "qemu: Error registering flash memory.\n");
......
250 257
        }
251 258
    }
252 259

  
253
    isa_vga_init(phys_ram_base + ram_size, ram_size,
260
    isa_vga_init(phys_ram_base + vga_ram_offset, ram_size,
254 261
                 vga_ram_size);
255 262

  
256 263
    if (nd_table[0].vlan)

Also available in: Unified diff