[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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




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. */
x86_emulate_memop(&context.args);

/* 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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.