Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Md49X-0006pH-EH for qemu-devel@nongnu.org; Mon, 17 Aug 2009 11:29:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Md49S-0006l8-Kx for qemu-devel@nongnu.org; Mon, 17 Aug 2009 11:29:42 -0400 Received: from [199.232.76.173] (port=44517 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Md49S-0006kc-Bt for qemu-devel@nongnu.org; Mon, 17 Aug 2009 11:29:38 -0400 Received: from mail.gmx.net ([213.165.64.20]:43443) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Md49R-0003Dc-Of for qemu-devel@nongnu.org; Mon, 17 Aug 2009 11:29:38 -0400 Date: Mon, 17 Aug 2009 17:29:34 +0200 From: Reimar =?iso-8859-1?Q?D=F6ffinger?= Subject: Re: [Qemu-devel] [HACK] make vmmouse work with KVM Message-ID: <20090817152934.GB31650@1und1.de> References: <20090817144754.GA31553@1und1.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20090817144754.GA31553@1und1.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon, Aug 17, 2009 at 04:47:54PM +0200, Reimar Döffinger wrote: > Hello, > vmmouse uses a giant hack: it uses io ports (in instruction) but passes > data via registers. > This currently does not work since the qemu CPU registers are > (understandably) not kept in sync with the real KVM registers for this > operation. > Attached patch detects access to the vmmouse port and loads/stores CPU > registers into/from the QEMU state. > > Signed-off-by: Reimar Döffinger Slightly simplified since TARGET_X86_64 implies TARGET_I386. --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="kvm_vmmouse.diff" diff --git a/kvm-all.c b/kvm-all.c index f669c3a..639bd77 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -611,11 +611,21 @@ int kvm_cpu_exec(CPUState *env) switch (run->exit_reason) { case KVM_EXIT_IO: dprintf("handle_io\n"); +#ifdef TARGET_I386 + // HACK to make vmport/vmmouse work + if (run->io.port == 0x5658) + kvm_arch_get_registers(env); +#endif ret = kvm_handle_io(env, run->io.port, (uint8_t *)run + run->io.data_offset, run->io.direction, run->io.size, run->io.count); +#ifdef TARGET_I386 + // HACK to make vmport/vmmouse work + if (run->io.port == 0x5658) + kvm_arch_put_registers(env); +#endif break; case KVM_EXIT_MMIO: dprintf("handle_mmio\n"); --a8Wt8u1KmwUX3Y2C--