From: Nadav Amit <namit@cs.technion.ac.il>
To: pbonzini@redhat.com
Cc: gleb@kernel.org, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, Nadav Amit <namit@cs.technion.ac.il>
Subject: [PATCH kvm-unit-tests 1/5] x86: Testing nop instruction on 64-bit
Date: Wed, 18 Jun 2014 17:19:50 +0300 [thread overview]
Message-ID: <1403101194-23707-2-git-send-email-namit@cs.technion.ac.il> (raw)
In-Reply-To: <1403101194-23707-1-git-send-email-namit@cs.technion.ac.il>
Previously, nop instruction emulation on 64-bit caused RAX bits [63:32] to be
cleared. This test checks the behavior is correct and RAX is unmodified.
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
x86/emulator.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/x86/emulator.c b/x86/emulator.c
index f653127..bf8a873 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -845,6 +845,15 @@ static void test_smsw_reg(uint64_t *mem, uint8_t *insn_page,
report("64-bit smsw reg", outregs.rax == cr0);
}
+static void test_nop(uint64_t *mem, uint8_t *insn_page,
+ uint8_t *alt_insn_page, void *insn_ram)
+{
+ inregs = (struct regs){ .rax = 0x1234567890abcdeful };
+ MK_INSN(nop, "nop\n\t");
+ trap_emulator(mem, alt_insn_page, &insn_nop);
+ report("nop", outregs.rax == inregs.rax);
+}
+
static void test_crosspage_mmio(volatile uint8_t *mem)
{
volatile uint16_t w, *pw;
@@ -1045,6 +1054,7 @@ int main()
test_mmx_movq_mf(mem, insn_page, alt_insn_page, insn_ram);
test_movabs(mem, insn_page, alt_insn_page, insn_ram);
test_smsw_reg(mem, insn_page, alt_insn_page, insn_ram);
+ test_nop(mem, insn_page, alt_insn_page, insn_ram);
test_crosspage_mmio(mem);
--
1.9.1
next prev parent reply other threads:[~2014-06-18 14:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 14:19 [PATCH kvm-unit-tests 0/5] x86: Tests for recent emulator bugs Nadav Amit
2014-06-18 14:19 ` Nadav Amit [this message]
2014-06-18 14:19 ` [PATCH kvm-unit-tests 2/5] x86: test xadd with two identical operands Nadav Amit
2014-06-18 14:19 ` [PATCH kvm-unit-tests 3/5] x86: Test btcq with operand larger than 64 Nadav Amit
2014-06-18 14:19 ` [PATCH kvm-unit-tests 4/5] x86: check cmov instruction on 64-bit Nadav Amit
2014-06-18 14:19 ` [PATCH kvm-unit-tests 5/5] x86: Test monitor and mwait on real-mode Nadav Amit
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=1403101194-23707-2-git-send-email-namit@cs.technion.ac.il \
--to=namit@cs.technion.ac.il \
--cc=gleb@kernel.org \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®