Since ____emulate_2op() changed to use register for destination, we can now simplify BSF/BSR instruction to use it. Signed-off-by: Wei Yongjun <yjwei@xxxxxxxxxxxxxx> --- arch/x86/kvm/emulate.c | 30 ++++++++---------------------- 1 files changed, 8 insertions(+), 22 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7d99cbe..77da7b6 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3727,30 +3727,16 @@ twobyte_insn: btc: /* btc */ emulate_2op_SrcV_nobyte("btc", c->src, c->dst, ctxt->eflags); break; - case 0xbc: { /* bsf */ - u8 zf; - __asm__ ("bsf %2, %0; setz %1" - : "=r"(c->dst.val), "=q"(zf) - : "r"(c->src.val)); - ctxt->eflags &= ~X86_EFLAGS_ZF; - if (zf) { - ctxt->eflags |= X86_EFLAGS_ZF; - c->dst.type = OP_NONE; /* Disable writeback. */ - } + case 0xbc: /* bsf */ + emulate_2op_SrcV_nobyte("bsf", c->src, c->dst, ctxt->eflags); + if (ctxt->eflags & X86_EFLAGS_ZF) + c->dst.type = OP_NONE; /* Disable writeback. */ break; - } - case 0xbd: { /* bsr */ - u8 zf; - __asm__ ("bsr %2, %0; setz %1" - : "=r"(c->dst.val), "=q"(zf) - : "r"(c->src.val)); - ctxt->eflags &= ~X86_EFLAGS_ZF; - if (zf) { - ctxt->eflags |= X86_EFLAGS_ZF; - c->dst.type = OP_NONE; /* Disable writeback. */ - } + case 0xbd: /* bsr */ + emulate_2op_SrcV_nobyte("bsr", c->src, c->dst, ctxt->eflags); + if (ctxt->eflags & X86_EFLAGS_ZF) + c->dst.type = OP_NONE; /* Disable writeback. */ break; - } case 0xbe ... 0xbf: /* movsx */ c->dst.bytes = c->op_bytes; c->dst.val = (c->d & ByteOp) ? (s8) c->src.val : -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html