Petersson, Mats
2006-May-26 18:23 UTC
[Xen-devel] [PATCH] Add instruction fetching function to x86_emulate_ops.
Attached patch introduces a separate function to fetch instruction bytes, comapared to the read_std. It has the same parameters as the read_std call, so there''s actually no change to the behaviour in the existing code, but when we introduce x86_emulate.c into QEMU, we will benefit from knowing that it''s instruction bytes being fetched, compared to regular byte(s)-from-memory fetching. Signed off by: Mats Petersson <mats.petersson@amd.com> -- Mats _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Muli Ben-Yehuda
2006-May-26 18:32 UTC
Re: [Xen-devel] [PATCH] Add instruction fetching function to x86_emulate_ops.
On Fri, May 26, 2006 at 08:23:45PM +0200, Petersson, Mats wrote:> Attached patch introduces a separate function to fetch instruction > bytes, comapared to the read_std. It has the same parameters as the > read_std call, so there''s actually no change to the behaviour in the > existing code, but when we introduce x86_emulate.c into QEMU, we will > benefit from knowing that it''s instruction bytes being fetched, compared > to regular byte(s)-from-memory fetching. > > Signed off by: Mats Petersson <mats.petersson@amd.com>[snip]> +#define insn_fetch(_type, _size, _eip) \ > +({ unsigned long _x; \ > + rc = ops->fetch_insn_bytes((unsigned long)(_eip), &_x, (_size), ctxt); \ > + if ( rc != 0 ) \ > + goto done; \ > + (_eip) += (_size); \ > + (_type)_x;I realized you only changed the op call here, but using goto from inside a macro is EVIL. Can this be done more sanely? Cheers, Muli _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel