]> Git Repo - qemu.git/commitdiff
versatilepb: do not run if user asks for more than 256MB RAM
authorJean-Christophe Dubois <[email protected]>
Fri, 28 Oct 2016 13:12:31 +0000 (14:12 +0100)
committerPeter Maydell <[email protected]>
Fri, 28 Oct 2016 14:51:27 +0000 (15:51 +0100)
The versatilepb physical address space layout only has
a 256MB region for RAM before the devices. Without a guard
on the amount of RAM requested by the user we would happily
create a RAM area that overlapped with the devices, resulting
in very confusing behaviour (typically a guest crash).

Report the problem to the user if they try to request more
RAM than the board can handle (as we do already for some
other board models).

Signed-off-by: Jean-Christophe Dubois <[email protected]>
Message-id: 20161025093711[email protected]
[PMM: tidied up commit message, comments. Use error_report()
 rather than fprintf(stderr, ...).]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
hw/arm/versatilepb.c

index 8ae5392bcc162fff49bb2c905d0576addb648d60..7b5cb36d5ac13552027cc23f3fa330b44622851b 100644 (file)
@@ -198,6 +198,15 @@ static void versatile_init(MachineState *machine, int board_id)
     int done_smc = 0;
     DriveInfo *dinfo;
 
+    if (machine->ram_size > 0x10000000) {
+        /* Device starting at address 0x10000000,
+         * and memory cannot overlap with devices.
+         * Refuse to run rather than behaving very confusingly.
+         */
+        error_report("versatilepb: memory size must not exceed 256MB");
+        exit(1);
+    }
+
     if (!machine->cpu_model) {
         machine->cpu_model = "arm926";
     }
This page took 0.027747 seconds and 4 git commands to generate.