aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/emulate.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 7fd25763b0e0..f95d242ee9f7 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3133,35 +3133,13 @@ static int em_btc(struct x86_emulate_ctxt *ctxt)
3133 3133
3134static int em_bsf(struct x86_emulate_ctxt *ctxt) 3134static int em_bsf(struct x86_emulate_ctxt *ctxt)
3135{ 3135{
3136 u8 zf; 3136 emulate_2op_SrcV_nobyte(ctxt, "bsf");
3137
3138 __asm__ ("bsf %2, %0; setz %1"
3139 : "=r"(ctxt->dst.val), "=q"(zf)
3140 : "r"(ctxt->src.val));
3141
3142 ctxt->eflags &= ~X86_EFLAGS_ZF;
3143 if (zf) {
3144 ctxt->eflags |= X86_EFLAGS_ZF;
3145 /* Disable writeback. */
3146 ctxt->dst.type = OP_NONE;
3147 }
3148 return X86EMUL_CONTINUE; 3137 return X86EMUL_CONTINUE;
3149} 3138}
3150 3139
3151static int em_bsr(struct x86_emulate_ctxt *ctxt) 3140static int em_bsr(struct x86_emulate_ctxt *ctxt)
3152{ 3141{
3153 u8 zf; 3142 emulate_2op_SrcV_nobyte(ctxt, "bsr");
3154
3155 __asm__ ("bsr %2, %0; setz %1"
3156 : "=r"(ctxt->dst.val), "=q"(zf)
3157 : "r"(ctxt->src.val));
3158
3159 ctxt->eflags &= ~X86_EFLAGS_ZF;
3160 if (zf) {
3161 ctxt->eflags |= X86_EFLAGS_ZF;
3162 /* Disable writeback. */
3163 ctxt->dst.type = OP_NONE;
3164 }
3165 return X86EMUL_CONTINUE; 3143 return X86EMUL_CONTINUE;
3166} 3144}
3167 3145