qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Reimar Döffinger" <Reimar.Doeffinger@gmx.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [HACK] make vmmouse work with KVM
Date: Mon, 17 Aug 2009 16:47:54 +0200	[thread overview]
Message-ID: <20090817144754.GA31553@1und1.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

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 <Reimar.Doeffinger@gmx.de>

[-- Attachment #2: kvm_vmmouse.diff --]
[-- Type: text/plain, Size: 1003 bytes --]

diff --git a/kvm-all.c b/kvm-all.c
index f669c3a..207378b 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");
+#if defined(TARGET_I386) || defined(TARGET_X86_64)
+            // 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);
+#if defined(TARGET_I386) || defined(TARGET_X86_64)
+            // 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");

             reply	other threads:[~2009-08-17 14:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17 14:47 Reimar Döffinger [this message]
2009-08-17 15:11 ` [Qemu-devel] [HACK] make vmmouse work with KVM Anthony Liguori
2009-08-17 15:45   ` Reimar Döffinger
2009-08-17 16:44     ` [Qemu-devel] " Paolo Bonzini
2009-08-17 17:00       ` Reimar Döffinger
     [not found]       ` <20090817170017.GB1835@1und1.de>
2009-08-17 17:16         ` Paolo Bonzini
2009-08-17 17:32           ` Reimar Döffinger
2009-08-28 15:53             ` Reimar Döffinger
2009-08-28 17:16               ` Anthony Liguori
2009-08-17 15:29 ` [Qemu-devel] " Reimar Döffinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090817144754.GA31553@1und1.de \
    --to=reimar.doeffinger@gmx.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).