]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
vl: Round argument of -m up to multiple of 8KiB
authorMarkus Armbruster <armbru@redhat.com>
Wed, 15 Aug 2012 11:12:19 +0000 (13:12 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 18 Aug 2012 16:53:21 +0000 (16:53 +0000)
Partial pages make little sense and don't work.  Ensure the RAM size
is a multiple of any possible target's page size.

Fixes

    $ qemu-system-x86_64 -nodefaults -S -vnc :0 -m 0.8
    qemu-system-x86_64: /work/armbru/qemu/exec.c:2255: register_subpage: Assertion `existing->mr->subpage || existing->mr == &io_mem_unassigned' failed.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
vl.c

diff --git a/vl.c b/vl.c
index 67f5813e75e4945c0daeb3dc9dc0f0798e87e555..7c577fa54474e631aa926b473df1d46b9db7ab15 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2735,6 +2735,7 @@ int main(int argc, char **argv, char **envp)
                 break;
             case QEMU_OPTION_m: {
                 int64_t value;
+                uint64_t sz;
                 char *end;
 
                 value = strtosz(optarg, &end);
@@ -2742,12 +2743,12 @@ int main(int argc, char **argv, char **envp)
                     fprintf(stderr, "qemu: invalid ram size: %s\n", optarg);
                     exit(1);
                 }
-
-                if (value != (uint64_t)(ram_addr_t)value) {
+                sz = QEMU_ALIGN_UP((uint64_t)value, 8192);
+                ram_size = sz;
+                if (ram_size != sz) {
                     fprintf(stderr, "qemu: ram size too large\n");
                     exit(1);
                 }
-                ram_size = value;
                 break;
             }
             case QEMU_OPTION_mempath: