aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-05-17 19:25:14 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-05-17 19:25:14 +0000
commit4edebb0e8e14a5b934114b5ff74cb86437bb2532 (patch)
treef254d16d87c6da5121748ea6fb1d98e1f590281f
parent3d29fbef063ab1e8bfb9bc759ca94ab0becca9fa (diff)
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
-rw-r--r--hw/sun4m.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/sun4m.c b/hw/sun4m.c
index fc410bdd7f..ec195def4a 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -478,8 +478,13 @@ static const struct hwdef hwdefs[] = {
static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds,
const char *kernel_filename, const char *kernel_cmdline,
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_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";
sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
kernel_cmdline, initrd_filename, cpu_model,
- 0);
+ 0, 0x10000000);
}
/* 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";
sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
kernel_cmdline, initrd_filename, cpu_model,
- 1);
+ 1, 0x20000000); // XXX tcx overlap, actually first 4GB ok
}
QEMUMachine ss5_machine = {