This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Re: X86_emulate to be moved into qemu...

To: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Subject: Re: [Xen-devel] Re: X86_emulate to be moved into qemu...
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Thu, 18 May 2006 14:14:52 +0100
Cc: Xen devel list <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 18 May 2006 06:15:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <907625E08839C4409CE5768403633E0BA7FC92@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <907625E08839C4409CE5768403633E0BA7FC92@xxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On 18 May 2006, at 13:58, Petersson, Mats wrote:

So, that would be a struct that could have the "struct ioreq" field in
it, which is optionally filled in depending on where it's called from,
for example?

Yes, I agree with this.

I'll work on something that uses this method, and I'll send you a patch
before I go any further.

My model would be that any *extra* stuff you want to just pass through to the callback functions, you'd do as follows (roughly):

/* This is a container for all emulation context. */
struct mydevice_emulator_context {
    /* The actual args structure for the emulator. */
    struct x86_emulate args;
/* Extra handy stuff for this particular call site and set of callback functions. */
    struct ioreq *ioreq;

/* This is a call to the emulator. */

/* This is an example of how a callback func gets at the caller-specific goodies. */
int emulate_read(..., struct x86_emulate_memop *args) {
    struct mydevice_emulator_context *context;
context = container_of(args, struct mydevice_emulator_context, args);

Xen-devel mailing list