From 88d1eac4cd1de6baf13994c9fda8d98929e9956e Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Thu, 11 Dec 2014 15:05:26 +0900 Subject: [PATCH] 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 --- target-i386/hax-all.c | 9 ++++----- vl.c | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index 62e4ffa..8a01517 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 62b711a..e1946dd 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; -- 2.7.4