diff options
author | Avi Kivity <avi.kivity@gmail.com> | 2013-01-19 12:51:55 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-01-23 19:15:38 -0500 |
commit | 4d7583493e1777f42cc0fda9573d312e4753aa3c (patch) | |
tree | a5242f87ae090d8bb401e11ae4ee32956cb1a112 /arch/x86/kvm | |
parent | 11c363ba8f8eb163c275920b4a27697eb43da6e9 (diff) |
KVM: x86 emulator: convert 2-operand IMUL to fastop
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/emulate.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 62014dca9e26..45ddec8b7566 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -441,6 +441,8 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt) | |||
441 | } \ | 441 | } \ |
442 | } while (0) | 442 | } while (0) |
443 | 443 | ||
444 | static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)); | ||
445 | |||
444 | #define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t" | 446 | #define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t" |
445 | #define FOP_RET "ret \n\t" | 447 | #define FOP_RET "ret \n\t" |
446 | 448 | ||
@@ -3051,6 +3053,8 @@ FASTOP2(test); | |||
3051 | FASTOP3WCL(shld); | 3053 | FASTOP3WCL(shld); |
3052 | FASTOP3WCL(shrd); | 3054 | FASTOP3WCL(shrd); |
3053 | 3055 | ||
3056 | FASTOP2W(imul); | ||
3057 | |||
3054 | static int em_xchg(struct x86_emulate_ctxt *ctxt) | 3058 | static int em_xchg(struct x86_emulate_ctxt *ctxt) |
3055 | { | 3059 | { |
3056 | /* Write back the register source. */ | 3060 | /* Write back the register source. */ |
@@ -3063,16 +3067,10 @@ static int em_xchg(struct x86_emulate_ctxt *ctxt) | |||
3063 | return X86EMUL_CONTINUE; | 3067 | return X86EMUL_CONTINUE; |
3064 | } | 3068 | } |
3065 | 3069 | ||
3066 | static int em_imul(struct x86_emulate_ctxt *ctxt) | ||
3067 | { | ||
3068 | emulate_2op_SrcV_nobyte(ctxt, "imul"); | ||
3069 | return X86EMUL_CONTINUE; | ||
3070 | } | ||
3071 | |||
3072 | static int em_imul_3op(struct x86_emulate_ctxt *ctxt) | 3070 | static int em_imul_3op(struct x86_emulate_ctxt *ctxt) |
3073 | { | 3071 | { |
3074 | ctxt->dst.val = ctxt->src2.val; | 3072 | ctxt->dst.val = ctxt->src2.val; |
3075 | return em_imul(ctxt); | 3073 | return fastop(ctxt, em_imul); |
3076 | } | 3074 | } |
3077 | 3075 | ||
3078 | static int em_cwd(struct x86_emulate_ctxt *ctxt) | 3076 | static int em_cwd(struct x86_emulate_ctxt *ctxt) |
@@ -4010,7 +4008,7 @@ static const struct opcode twobyte_table[256] = { | |||
4010 | F(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable, em_bts), | 4008 | F(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable, em_bts), |
4011 | F(DstMem | SrcReg | Src2ImmByte | ModRM, em_shrd), | 4009 | F(DstMem | SrcReg | Src2ImmByte | ModRM, em_shrd), |
4012 | F(DstMem | SrcReg | Src2CL | ModRM, em_shrd), | 4010 | F(DstMem | SrcReg | Src2CL | ModRM, em_shrd), |
4013 | D(ModRM), I(DstReg | SrcMem | ModRM, em_imul), | 4011 | D(ModRM), F(DstReg | SrcMem | ModRM, em_imul), |
4014 | /* 0xB0 - 0xB7 */ | 4012 | /* 0xB0 - 0xB7 */ |
4015 | I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_cmpxchg), | 4013 | I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_cmpxchg), |
4016 | I(DstReg | SrcMemFAddr | ModRM | Src2SS, em_lseg), | 4014 | I(DstReg | SrcMemFAddr | ModRM | Src2SS, em_lseg), |