Commit 0ccff151b42a5b684ce22473b68972a94bc708fb

Authored by aurel32
1 parent fc2e7aa3

mips: limit RAM size to 256MB on malta and qemu boards

This avoid crash when a bigger RAM size is requested (the devices are
mapped at 0x01000000).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6419 c046a42c-6fe2-441c-8c8c-71466251a162
hw/mips_malta.c
... ... @@ -802,6 +802,12 @@ void mips_malta_init (ram_addr_t ram_size, int vga_ram_size,
802 802 qemu_register_reset(main_cpu_reset, env);
803 803  
804 804 /* allocate RAM */
  805 + if (ram_size > (256 << 20)) {
  806 + fprintf(stderr,
  807 + "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n",
  808 + ((unsigned int)ram_size / (1 << 20)));
  809 + exit(1);
  810 + }
805 811 cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
806 812  
807 813 /* Map the bios at two physical locations, as on the real board. */
... ...
hw/mips_r4k.c
... ... @@ -178,6 +178,12 @@ void mips_r4k_init (ram_addr_t ram_size, int vga_ram_size,
178 178 qemu_register_reset(main_cpu_reset, env);
179 179  
180 180 /* allocate RAM */
  181 + if (ram_size > (256 << 20)) {
  182 + fprintf(stderr,
  183 + "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n",
  184 + ((unsigned int)ram_size / (1 << 20)));
  185 + exit(1);
  186 + }
181 187 cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
182 188  
183 189 if (!mips_qemu_iomemtype) {
... ...