From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH 1/5] KVM: x86 emulator: emulate BSWAP
Date: Wed, 13 Jun 2012 17:30:04 +0300 [thread overview]
Message-ID: <1339597808-10695-2-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1339597808-10695-1-git-send-email-avi@redhat.com>
Opcodes 0F C8 - 0F CF.
Used by the SeaBIOS cdrom code (though not in big real mode).
Signed-off-by: Avi Kivity <avi@redhat.com>
---
arch/x86/kvm/emulate.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index c804db2..4eea1e4 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3255,6 +3255,21 @@ static int em_lahf(struct x86_emulate_ctxt *ctxt)
return X86EMUL_CONTINUE;
}
+static int em_bswap(struct x86_emulate_ctxt *ctxt)
+{
+ switch (ctxt->op_bytes) {
+#ifdef CONFIG_X86_64
+ case 8:
+ asm("bswap %0" : "+r"(ctxt->dst.val));
+ break;
+#endif
+ default:
+ asm("bswap %0" : "+r"(*(u32 *)&ctxt->dst.val));
+ break;
+ }
+ return X86EMUL_CONTINUE;
+}
+
static bool valid_cr(int nr)
{
switch (nr) {
@@ -3771,11 +3786,12 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt)
I(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable, em_btc),
I(DstReg | SrcMem | ModRM, em_bsf), I(DstReg | SrcMem | ModRM, em_bsr),
D(DstReg | SrcMem8 | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov),
- /* 0xC0 - 0xCF */
+ /* 0xC0 - 0xC7 */
D2bv(DstMem | SrcReg | ModRM | Lock),
N, D(DstMem | SrcReg | ModRM | Mov),
N, N, N, GD(0, &group9),
- N, N, N, N, N, N, N, N,
+ /* 0xC8 - 0xCF */
+ X8(I(DstReg, em_bswap)),
/* 0xD0 - 0xDF */
N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N,
/* 0xE0 - 0xEF */
--
1.7.10.1
next prev parent reply other threads:[~2012-06-13 14:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 14:30 [PATCH 0/5] Big real mode - addendum Avi Kivity
2012-06-13 14:30 ` Avi Kivity [this message]
2012-06-13 14:30 ` [PATCH 2/5] KVM: x86 emulator: emulate LLDT Avi Kivity
2012-06-13 14:30 ` [PATCH 3/5] KVM: x86 emulator: make read_segment_descriptor() return the address Avi Kivity
2012-06-13 14:30 ` [PATCH 4/5] KVM: x86 emulator: make loading TR set the busy bit Avi Kivity
2012-06-13 14:30 ` [PATCH 5/5] KVM: x86 emulator: implement LTR Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2012-06-27 15:18 [PATCH v2 00/26] Big big real mode improvements Avi Kivity
2012-06-27 15:19 ` [PATCH 1/5] KVM: x86 emulator: emulate BSWAP Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339597808-10695-2-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox