hax: HAX needs ram_size when initialize 43/31843/4
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 11 Dec 2014 06:05:26 +0000 (15:05 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 15 Dec 2014 13:19:05 +0000 (22:19 +0900)
HAX needs ram_size when initialize, but init function should have
only MachineState structure. So, we assigned 'ram_size' to 'MachineState'
before 'configure_accelerator()'. Then init function can get 'ram_size'
from 'MachineState'.

Change-Id: I53b6567e411b5bb5d28df30392279245ab93e9af
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
target-i386/hax-all.c
vl.c

index 62e4ffa..8a01517 100644 (file)
@@ -26,7 +26,8 @@
 
 #include "strings.h"
 #include "hax-i386.h"
-#include "sysemu/kvm.h"
+#include "hw/boards.h"
+#include "sysemu/accel.h"
 #include "exec/address-spaces.h"
 #include "qemu/main-loop.h"
 
@@ -517,13 +518,11 @@ static int hax_init(MachineState *ms)
 {
     struct hax_state *hax = NULL;
     int ret = 0;
-    uint64_t ram_size =
-        qemu_opt_get_number(qemu_find_opts_singleton("memory"), "size");
 
     hax = &hax_global;
     memset(hax, 0, sizeof(struct hax_state));
-    hax->mem_quota = ram_size;
-    dprint("ram_size %llx\n", ram_size);
+    hax->mem_quota = (uint64_t)ms->ram_size;
+    dprint("ram_size 0x%llx\n", (uint64_t)ms->ram_size);
 
     ret = hax_init_internal();
     // It is better to fail than to transit implicitly.
diff --git a/vl.c b/vl.c
index 62b711a..e1946dd 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -4209,6 +4209,8 @@ int main(int argc, char **argv, char **envp)
     /* store value for the future use */
     qemu_opt_set_number(qemu_find_opts_singleton("memory"), "size", ram_size);
 
+    current_machine->ram_size = ram_size;
+
     if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0)
         != 0) {
         exit(0);
@@ -4412,7 +4414,6 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->ram_size = ram_size;
     current_machine->maxram_size = maxram_size;
     current_machine->ram_slots = ram_slots;
     current_machine->boot_order = boot_order;