Commit 4edebb0e8e14a5b934114b5ff74cb86437bb2532
1 parent
3d29fbef
Set limits for memory size to avoid overlap with devices
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2823 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
8 additions
and
3 deletions
hw/sun4m.c
| @@ -478,8 +478,13 @@ static const struct hwdef hwdefs[] = { | @@ -478,8 +478,13 @@ static const struct hwdef hwdefs[] = { | ||
| 478 | static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, | 478 | static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, |
| 479 | const char *kernel_filename, const char *kernel_cmdline, | 479 | const char *kernel_filename, const char *kernel_cmdline, |
| 480 | const char *initrd_filename, const char *cpu_model, | 480 | const char *initrd_filename, const char *cpu_model, |
| 481 | - unsigned int machine) | 481 | + unsigned int machine, int max_ram) |
| 482 | { | 482 | { |
| 483 | + if (ram_size > max_ram) { | ||
| 484 | + fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n", | ||
| 485 | + ram_size / (1024 * 1024), max_ram / (1024 * 1024)); | ||
| 486 | + exit(1); | ||
| 487 | + } | ||
| 483 | sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); | 488 | sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); |
| 484 | 489 | ||
| 485 | sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, | 490 | sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, |
| @@ -497,7 +502,7 @@ static void ss5_init(int ram_size, int vga_ram_size, int boot_device, | @@ -497,7 +502,7 @@ static void ss5_init(int ram_size, int vga_ram_size, int boot_device, | ||
| 497 | cpu_model = "Fujitsu MB86904"; | 502 | cpu_model = "Fujitsu MB86904"; |
| 498 | sun4m_common_init(ram_size, boot_device, ds, kernel_filename, | 503 | sun4m_common_init(ram_size, boot_device, ds, kernel_filename, |
| 499 | kernel_cmdline, initrd_filename, cpu_model, | 504 | kernel_cmdline, initrd_filename, cpu_model, |
| 500 | - 0); | 505 | + 0, 0x10000000); |
| 501 | } | 506 | } |
| 502 | 507 | ||
| 503 | /* SPARCstation 10 hardware initialisation */ | 508 | /* SPARCstation 10 hardware initialisation */ |
| @@ -510,7 +515,7 @@ static void ss10_init(int ram_size, int vga_ram_size, int boot_device, | @@ -510,7 +515,7 @@ static void ss10_init(int ram_size, int vga_ram_size, int boot_device, | ||
| 510 | cpu_model = "TI SuperSparc II"; | 515 | cpu_model = "TI SuperSparc II"; |
| 511 | sun4m_common_init(ram_size, boot_device, ds, kernel_filename, | 516 | sun4m_common_init(ram_size, boot_device, ds, kernel_filename, |
| 512 | kernel_cmdline, initrd_filename, cpu_model, | 517 | kernel_cmdline, initrd_filename, cpu_model, |
| 513 | - 1); | 518 | + 1, 0x20000000); // XXX tcx overlap, actually first 4GB ok |
| 514 | } | 519 | } |
| 515 | 520 | ||
| 516 | QEMUMachine ss5_machine = { | 521 | QEMUMachine ss5_machine = { |