Commit 326f578f authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Gleb Natapov

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: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: stable@vger.kernel.org # 3.9
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
parent 7fa57952
...@@ -535,6 +535,9 @@ FOP_SETCC(setle) ...@@ -535,6 +535,9 @@ FOP_SETCC(setle)
FOP_SETCC(setnle) FOP_SETCC(setnle)
FOP_END; FOP_END;
FOP_START(salc) "pushf; sbb %al, %al; popf \n\t" FOP_RET
FOP_END;
#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \ #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \
do { \ do { \
unsigned long _tmp; \ unsigned long _tmp; \
...@@ -3961,7 +3964,8 @@ static const struct opcode opcode_table[256] = { ...@@ -3961,7 +3964,8 @@ static const struct opcode opcode_table[256] = {
G(Src2One | ByteOp, group2), G(Src2One, group2), G(Src2One | ByteOp, group2), G(Src2One, group2),
G(Src2CL | ByteOp, group2), G(Src2CL, group2), G(Src2CL | ByteOp, group2), G(Src2CL, group2),
I(DstAcc | SrcImmUByte | No64, em_aam), I(DstAcc | SrcImmUByte | No64, em_aam),
I(DstAcc | SrcImmUByte | No64, em_aad), N, I(DstAcc | SrcImmUByte | No64, em_aad),
F(DstAcc | ByteOp | No64, em_salc),
I(DstAcc | SrcXLat | ByteOp, em_mov), I(DstAcc | SrcXLat | ByteOp, em_mov),
/* 0xD8 - 0xDF */ /* 0xD8 - 0xDF */
N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment