Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement emulation of instruction aas
>
> + case 0x3f: /* aas */ {
> + u8 al, ah, af, cf;
> + al = c->regs[VCPU_REGS_RAX] & 0xff;
> + ah = (c->regs[VCPU_REGS_RAX] >> 8) & 0xff;
> + af = (ctxt->eflags & EFLG_AF);
> + cf = (ctxt->eflags & EFLG_CF);
> + if (((al & 0x0f) > 9) || af) {
> + al = al - 6;
> + ah = ah - 1;
> + af = cf = 1;
> + } else {
> + cf = af = 0;
> + }
> + al = al & 0x0f;
> + if (af)
> + ctxt->eflags |= EFLG_AF;
> + else
> + ctxt->eflags &= ~EFLG_AF;
> + if (cf)
> + ctxt->eflags |= EFLG_CF;
> + else
> + ctxt->eflags &= ~EFLG_CF;
> + *(u16 *) &c->regs[VCPU_REGS_RAX] = (ah << 8) & al;
> + }
> + break;
Please move the whole thing to a static function in order to reduce clutter.
Also, a helper
static void set_flag_value(struct emulate_context *ctxt, u32 mask,
int value) {... }
can simplify some of the code.
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel