From 5ce6889efd28cc00238b6ba6d74cd3757098f27c Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Thu, 11 Dec 2014 15:10:20 +0900 Subject: [PATCH] hax: executed 'hax_populate_ram()' in more proper position Change-Id: I8bd616077d223ffebba8b4287cd6f675486ad806 Signed-off-by: SeokYeon Hwang --- exec.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/exec.c b/exec.c index c54be02..bce0d85 100644 --- a/exec.c +++ b/exec.c @@ -1314,21 +1314,6 @@ static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp) } else { new_block->host = phys_mem_alloc(new_block->length, &new_block->mr->align); -#ifdef CONFIG_HAX - /* - * In Hax, the qemu allocate the virtual address, and HAX kernel - * populate the memory with physical memory. Currently we have no - * paging, so user should make sure enough free memory in advance - */ - if (hax_enabled()) { - int ret; - ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, size); - if (ret < 0) { - fprintf(stderr, "Hax failed to populate ram\n"); - exit(-1); - } - } -#endif if (!new_block->host) { error_setg_errno(errp, errno, "cannot set up guest memory '%s'", @@ -1375,6 +1360,21 @@ static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp) if (kvm_enabled()) { kvm_setup_guest_memory(new_block->host, new_block->length); } +#ifdef CONFIG_HAX + /* + * In Hax, the qemu allocate the virtual address, and HAX kernel + * populate the memory with physical memory. Currently we have no + * paging, so user should make sure enough free memory in advance + */ + if (hax_enabled()) { + int ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, + new_block->length); + if (ret < 0) { + fprintf(stderr, "HAX failed to populate ram\n"); + exit(-1); + } + } +#endif return new_block->offset; } -- 2.7.4