From: SeokYeon Hwang Date: Thu, 11 Dec 2014 06:05:26 +0000 (+0900) Subject: hax: HAX needs ram_size when initialize X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~608^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=88d1eac4cd1de6baf13994c9fda8d98929e9956e;p=sdk%2Femulator%2Fqemu.git hax: HAX needs ram_size when initialize 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 --- diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index 62e4ffae35..8a0151778e 100644 --- a/target-i386/hax-all.c +++ b/target-i386/hax-all.c @@ -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 62b711a519..e1946ddbb0 100644 --- 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;