aboutsummaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorJun Nakajima <jun.nakajima@intel.com>2011-12-17 19:13:25 -0800
committerJiang, Yunhong <yunhong.jiang@intel.com>2012-01-17 06:15:06 +0800
commita381ef07088ce479610129e37bfef42538f397da (patch)
tree523581dd6c18ddd42bb3980483778a3dd5d6154d /exec.c
parente7e8b324a626a4ba112c3ad47d54eb9cfd3025ba (diff)
downloadexternal_qemu-a381ef07088ce479610129e37bfef42538f397da.zip
external_qemu-a381ef07088ce479610129e37bfef42538f397da.tar.gz
external_qemu-a381ef07088ce479610129e37bfef42538f397da.tar.bz2
Changes to existing files to add HAX support
HAX (Hardware-based Accelerated eXecution) employes hardware virtualization technology to boost performance of the Android emulator on Mac OS X or Windows hosts. This changeset includes the changes required to the existing files. To pass the compilation, hax.h is added, but CONFIG_HAX is disabled so that no real changes added. Change-Id: Ifa5777e8788e6698747c1ec4cd91315161c2ca0b Signed-off-by: Zhang, Xiantao <xiantao.zhang@intel.com> Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com> Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Nakajima, Jun <jun.nakajima@intel.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index f650a9e..b8a473f 100644
--- a/exec.c
+++ b/exec.c
@@ -39,6 +39,7 @@
#include "hw/hw.h"
#include "osdep.h"
#include "kvm.h"
+#include "hax.h"
#include "qemu-timer.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
@@ -2379,6 +2380,10 @@ void cpu_register_physical_memory_log(target_phys_addr_t start_addr,
if (kvm_enabled())
kvm_set_phys_mem(start_addr, size, phys_offset);
+#ifdef CONFIG_HAX
+ if (hax_enabled())
+ hax_set_phys_mem(start_addr, size, phys_offset);
+#endif
if (phys_offset == IO_MEM_UNASSIGNED) {
region_offset = start_addr;
@@ -2561,6 +2566,27 @@ ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
#else
new_block->host = qemu_vmalloc(size);
+
+#ifdef CONFIG_HAX
+ /*
+ * In HAX, qemu allocates the virtual address, and HAX kernel
+ * module populates the region with physical memory. Currently
+ * we don’t populate guest memory on demand, thus we should
+ * make sure that sufficient amount of memory is available in
+ * advance.
+ */
+ if (hax_enabled())
+ {
+ int ret;
+ ret = hax_populate_ram((uint64_t)new_block->host, size);
+ if (ret < 0)
+ {
+ fprintf(stderr, "Hax failed to populate ram\n");
+ exit(-1);
+ }
+ }
+#endif
+
#endif
#ifdef MADV_MERGEABLE
madvise(new_block->host, size, MADV_MERGEABLE);