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
This commit is contained in:
blueswir1 2007-05-17 19:25:14 +00:00
parent 3d29fbef06
commit 4edebb0e8e

View File

@ -478,8 +478,13 @@ static const struct hwdef hwdefs[] = {
static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds,
const char *kernel_filename, const char *kernel_cmdline, const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model, const char *initrd_filename, const char *cpu_model,
unsigned int machine) unsigned int machine, int max_ram)
{ {
if (ram_size > max_ram) {
fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n",
ram_size / (1024 * 1024), max_ram / (1024 * 1024));
exit(1);
}
sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model);
sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, 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,
cpu_model = "Fujitsu MB86904"; cpu_model = "Fujitsu MB86904";
sun4m_common_init(ram_size, boot_device, ds, kernel_filename, sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
kernel_cmdline, initrd_filename, cpu_model, kernel_cmdline, initrd_filename, cpu_model,
0); 0, 0x10000000);
} }
/* SPARCstation 10 hardware initialisation */ /* SPARCstation 10 hardware initialisation */
@ -510,7 +515,7 @@ static void ss10_init(int ram_size, int vga_ram_size, int boot_device,
cpu_model = "TI SuperSparc II"; cpu_model = "TI SuperSparc II";
sun4m_common_init(ram_size, boot_device, ds, kernel_filename, sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
kernel_cmdline, initrd_filename, cpu_model, kernel_cmdline, initrd_filename, cpu_model,
1); 1, 0x20000000); // XXX tcx overlap, actually first 4GB ok
} }
QEMUMachine ss5_machine = { QEMUMachine ss5_machine = {