x86: Enable KVM mode for Android x86 emulator (update/rebase)

This patch enables KVM mode on x86 Linux to boost performance of x86 emulaiton
if the hardware-based virtualization feature is present on the host machine.

Change-Id: I4b24474b3ec115a3b9a7bf017801f4f610253b09
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
diff --git a/disas.c b/disas.c
index 79a98de..475aa86 100644
--- a/disas.c
+++ b/disas.c
@@ -8,6 +8,10 @@
 #include "exec-all.h"
 #include "disas.h"
 
+#ifdef TARGET_I386
+#include "kvm.h"
+#endif
+
 /* Filled in by elfload.c.  Simplistic, but will do for now. */
 struct syminfo *syminfos = NULL;
 
@@ -33,6 +37,10 @@
                     int length,
                     struct disassemble_info *info)
 {
+#ifdef TARGET_I386
+    if (kvm_enabled())
+        cpu_synchronize_state(cpu_single_env, 0);
+#endif
     cpu_memory_rw_debug(cpu_single_env, memaddr, myaddr, length, 0);
     return 0;
 }