From: SeokYeon Hwang Date: Thu, 11 Dec 2014 06:10:20 +0000 (+0900) Subject: hax: executed 'hax_populate_ram()' in more proper position X-Git-Tag: TizenStudio_2.0_p3.0~386^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F31844%2F3;p=sdk%2Femulator%2Fqemu.git hax: executed 'hax_populate_ram()' in more proper position Change-Id: I8bd616077d223ffebba8b4287cd6f675486ad806 Signed-off-by: SeokYeon Hwang --- 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; }