diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-05-09 05:32:51 -0400 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-05-09 06:15:08 -0400 |
commit | 326f578f7e1443bac2333712dd130a261ec15288 (patch) | |
tree | 7d1e6123f831b6789f68d4e9ea0f7f10a904230b /arch | |
parent | 7fa57952d70f5737513d8319395e471d107e4e0d (diff) |
KVM: emulator: emulate SALC
This is an almost-undocumented instruction available in 32-bit mode.
I say "almost" undocumented because AMD documents it in their opcode
maps just to say that it is unavailable in 64-bit mode (sections
"A.2.1 One-Byte Opcodes" and "B.3 Invalid and Reassigned Instructions
in 64-Bit Mode").
It is roughly equivalent to "sbb %al, %al" except it does not
set the flags. Use fastop to emulate it, but do not use the opcode
directly because it would fail if the host is 64-bit!
Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: stable@vger.kernel.org # 3.9
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/emulate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a06a550c2db8..8db0010ed150 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -535,6 +535,9 @@ FOP_SETCC(setle) | |||
535 | FOP_SETCC(setnle) | 535 | FOP_SETCC(setnle) |
536 | FOP_END; | 536 | FOP_END; |
537 | 537 | ||
538 | FOP_START(salc) "pushf; sbb %al, %al; popf \n\t" FOP_RET | ||
539 | FOP_END; | ||
540 | |||
538 | #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \ | 541 | #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \ |
539 | do { \ | 542 | do { \ |
540 | unsigned long _tmp; \ | 543 | unsigned long _tmp; \ |
@@ -3961,7 +3964,8 @@ static const struct opcode opcode_table[256] = { | |||
3961 | G(Src2One | ByteOp, group2), G(Src2One, group2), | 3964 | G(Src2One | ByteOp, group2), G(Src2One, group2), |
3962 | G(Src2CL | ByteOp, group2), G(Src2CL, group2), | 3965 | G(Src2CL | ByteOp, group2), G(Src2CL, group2), |
3963 | I(DstAcc | SrcImmUByte | No64, em_aam), | 3966 | I(DstAcc | SrcImmUByte | No64, em_aam), |
3964 | I(DstAcc | SrcImmUByte | No64, em_aad), N, | 3967 | I(DstAcc | SrcImmUByte | No64, em_aad), |
3968 | F(DstAcc | ByteOp | No64, em_salc), | ||
3965 | I(DstAcc | SrcXLat | ByteOp, em_mov), | 3969 | I(DstAcc | SrcXLat | ByteOp, em_mov), |
3966 | /* 0xD8 - 0xDF */ | 3970 | /* 0xD8 - 0xDF */ |
3967 | N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, | 3971 | N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, |