aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorMohammed Gamal <m.gamal005@gmail.com>2008-08-31 21:52:24 -0400
committerAvi Kivity <avi@qumranet.com>2008-10-15 04:15:25 -0400
commitfb4616f43148c5b3f3e453a47657572d1bda39ee (patch)
tree875be2a5ef494832a577de867db623c3177ffe27 /arch/x86
parent20766c083e6ab3c33125f07c7ffe39914c106d98 (diff)
KVM: x86 emulator: Add std and cld instructions (opcodes 0xfc-0xfd)
This adds the std and cld instructions to the emulator. Encountered while running the BIOS with invalid guest state emulation enabled. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/x86_emulate.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 66e0bd6c628b..944f1f4d4be4 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -187,7 +187,7 @@ static u16 opcode_table[256] = {
187 ImplicitOps, ImplicitOps, Group | Group3_Byte, Group | Group3, 187 ImplicitOps, ImplicitOps, Group | Group3_Byte, Group | Group3,
188 /* 0xF8 - 0xFF */ 188 /* 0xF8 - 0xFF */
189 ImplicitOps, 0, ImplicitOps, ImplicitOps, 189 ImplicitOps, 0, ImplicitOps, ImplicitOps,
190 0, 0, Group | Group4, Group | Group5, 190 ImplicitOps, ImplicitOps, Group | Group4, Group | Group5,
191}; 191};
192 192
193static u16 twobyte_table[256] = { 193static u16 twobyte_table[256] = {
@@ -1762,6 +1762,14 @@ special_insn:
1762 ctxt->eflags |= X86_EFLAGS_IF; 1762 ctxt->eflags |= X86_EFLAGS_IF;
1763 c->dst.type = OP_NONE; /* Disable writeback. */ 1763 c->dst.type = OP_NONE; /* Disable writeback. */
1764 break; 1764 break;
1765 case 0xfc: /* cld */
1766 ctxt->eflags &= ~EFLG_DF;
1767 c->dst.type = OP_NONE; /* Disable writeback. */
1768 break;
1769 case 0xfd: /* std */
1770 ctxt->eflags |= EFLG_DF;
1771 c->dst.type = OP_NONE; /* Disable writeback. */
1772 break;
1765 case 0xfe ... 0xff: /* Grp4/Grp5 */ 1773 case 0xfe ... 0xff: /* Grp4/Grp5 */
1766 rc = emulate_grp45(ctxt, ops); 1774 rc = emulate_grp45(ctxt, ops);
1767 if (rc != 0) 1775 if (rc != 0)