From 1321c76d96910c2c807207f3fdfeb560c598ca60 Mon Sep 17 00:00:00 2001 From: Jun Nakajima Date: Fri, 4 Mar 2011 17:17:45 -0800 Subject: 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 Signed-off-by: Yunhong Jiang Signed-off-by: Jun Nakajima --- hw/goldfish_tty.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'hw/goldfish_tty.c') diff --git a/hw/goldfish_tty.c b/hw/goldfish_tty.c index 904a07b..fd8eca8 100644 --- a/hw/goldfish_tty.c +++ b/hw/goldfish_tty.c @@ -13,6 +13,10 @@ #include "qemu-char.h" #include "goldfish_device.h" +#ifdef TARGET_I386 +#include "kvm.h" +#endif + enum { TTY_PUT_CHAR = 0x00, TTY_BYTES_READY = 0x04, @@ -126,6 +130,10 @@ static void goldfish_tty_write(void *opaque, target_phys_addr_t offset, uint32_t if (to_write > len) to_write = len; +#ifdef TARGET_I386 + if (kvm_enabled()) + cpu_synchronize_state(cpu_single_env, 0); +#endif cpu_memory_rw_debug(cpu_single_env, buf, (uint8_t*)temp, to_write, 0); qemu_chr_write(s->cs, (const uint8_t*)temp, to_write); buf += to_write; @@ -138,6 +146,10 @@ static void goldfish_tty_write(void *opaque, target_phys_addr_t offset, uint32_t case TTY_CMD_READ_BUFFER: if(s->ptr_len > s->data_count) cpu_abort (cpu_single_env, "goldfish_tty_write: reading more data than available %d %d\n", s->ptr_len, s->data_count); +#ifdef TARGET_I386 + if (kvm_enabled()) + cpu_synchronize_state(cpu_single_env, 0); +#endif cpu_memory_rw_debug(cpu_single_env,s->ptr, s->data, s->ptr_len,1); //printf("goldfish_tty_write: read %d bytes to %x\n", s->ptr_len, s->ptr); if(s->data_count > s->ptr_len) -- cgit v1.1