From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mohammed Gamal Subject: [PATCH][RESEND] x86 emulator: Add std and cld instructions (opcodes 0xfc-0xfd) Date: Mon, 18 Aug 2008 21:50:46 +0300 Message-ID: <20080818185046.GA25191@mohd-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@qumranet.com, riel@surriel.com To: kvm@vger.kernel.org Return-path: Received: from wr-out-0506.google.com ([64.233.184.231]:31121 "EHLO wr-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756896AbYHRSuz (ORCPT ); Mon, 18 Aug 2008 14:50:55 -0400 Received: by wr-out-0506.google.com with SMTP id 69so2198057wri.5 for ; Mon, 18 Aug 2008 11:50:54 -0700 (PDT) Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: This adds the std and cld instructions to the emulator. Encountered while running the BIOS with the invalid guest state emulation patch. Signed-off-by: Mohammed Gamal --- arch/x86/kvm/x86_emulate.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index d5da7f1..005f1db 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -180,7 +180,7 @@ static u16 opcode_table[256] = { ImplicitOps, ImplicitOps, Group | Group3_Byte, Group | Group3, /* 0xF8 - 0xFF */ ImplicitOps, 0, ImplicitOps, ImplicitOps, - 0, 0, Group | Group4, Group | Group5, + ImplicitOps, ImplicitOps, Group | Group4, Group | Group5, }; static u16 twobyte_table[256] = { @@ -1755,6 +1755,14 @@ special_insn: ctxt->eflags |= X86_EFLAGS_IF; c->dst.type = OP_NONE; /* Disable writeback. */ break; + case 0xfc: /* cld */ + ctxt->eflags &= ~EFLG_DF; + c->dst.type = OP_NONE; /* Disable writeback. */ + break; + case 0xfd: /* std */ + ctxt->eflags |= EFLG_DF; + c->dst.type = OP_NONE; /* Disable writeback. */ + break; case 0xfe ... 0xff: /* Grp4/Grp5 */ rc = emulate_grp45(ctxt, ops); if (rc != 0) -- 1.5.4.3