From: "Reimar Döffinger" <Reimar.Doeffinger@gmx.de>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [HACK] make vmmouse work with KVM
Date: Mon, 17 Aug 2009 19:32:32 +0200 [thread overview]
Message-ID: <20090817173232.GA1961@1und1.de> (raw)
In-Reply-To: <4A899081.9010508@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
On Mon, Aug 17, 2009 at 07:16:49PM +0200, Paolo Bonzini wrote:
> On 08/17/2009 07:00 PM, Reimar Döffinger wrote:
> > On Mon, Aug 17, 2009 at 06:44:11PM +0200, Paolo Bonzini wrote:
> >> On 08/17/2009 05:45 PM, Reimar Döffinger wrote:
> >>> + cpu_synchronize_state(env, 0);
> >>> env->regs[R_EAX] = vmport_ioport_read(opaque, addr);
> >>> + cpu_synchronize_state(env, 1);
> >>
> >> This is not needed because the sync is done in vmport_ioport_read, isn't it?
> >
> > Well... The cpu_synchronize_state could be dropped you are right, but
> > here we write R_EAX so the cpu_synchronize_state(env, 1) is necessary.
> > It might be slightly cleaner to rename the vmport_ioport_read (any name
> > suggestions?) and add a wrapper for register_ioport_read that does the
> > cpu_synchronize_state (so it looks similar to vmport_ioport_write).
>
> Yes, that would look best and wouldn't have fooled me. Could
> vmport_ioport_trigger be a decent name?
Since what that function actually does is execute a specific command it
gets from ecx I went with vmport_ioport_command, but I'll happily leave
the naming to whoever applies it :-)
Greetings,
Reimar Döffinger
[-- Attachment #2: kvm_vmmouse2.diff --]
[-- Type: text/plain, Size: 1378 bytes --]
diff --git a/hw/vmport.c b/hw/vmport.c
index 884af3f..7ba6e2e 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -25,6 +25,7 @@
#include "isa.h"
#include "pc.h"
#include "sysemu.h"
+#include "kvm.h"
//#define VMPORT_DEBUG
@@ -51,7 +52,7 @@ void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque)
port_state.opaque[command] = opaque;
}
-static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
+static uint32_t vmport_ioport_command(void *opaque, uint32_t addr)
{
VMPortState *s = opaque;
CPUState *env = cpu_single_env;
@@ -76,11 +77,24 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
return s->func[command](s->opaque[command], addr);
}
+static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
+{
+ CPUState *env = cpu_single_env;
+ uint32_t result;
+
+ cpu_synchronize_state(env, 0);
+ result = vmport_ioport_command(opaque, addr);
+ cpu_synchronize_state(env, 1);
+ return result;
+}
+
static void vmport_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
CPUState *env = cpu_single_env;
- env->regs[R_EAX] = vmport_ioport_read(opaque, addr);
+ cpu_synchronize_state(env, 0);
+ env->regs[R_EAX] = vmport_ioport_command(opaque, addr);
+ cpu_synchronize_state(env, 1);
}
static uint32_t vmport_cmd_get_version(void *opaque, uint32_t addr)
next prev parent reply other threads:[~2009-08-17 17:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-17 14:47 [Qemu-devel] [HACK] make vmmouse work with KVM Reimar Döffinger
2009-08-17 15:11 ` 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 [this message]
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=20090817173232.GA1961@1und1.de \
--to=reimar.doeffinger@gmx.de \
--cc=bonzini@gnu.org \
--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).