kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: yzt356@gmail.com
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, gleb@redhat.com,
	Arthur Chunqi Li <yzt356@gmail.com>
Subject: [PATCH] Test case of emulating multibyte NOP
Date: Thu,  6 Jun 2013 00:07:45 +0800	[thread overview]
Message-ID: <1370448465-23068-1-git-send-email-yzt356@gmail.com> (raw)

From: Arthur Chunqi Li <yzt356@gmail.com>

Add multibyte NOP test case to kvm-unit-tests. This version adds test cases into x86/realmode.c. This can test one of bugs when booting RHEL5.9 64-bit.

Signed-off-by: Arthur Chunqi Li <yzt356@gmail.com>
---
 x86/realmode.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/x86/realmode.c b/x86/realmode.c
index 981be08..e103ca6 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1504,6 +1504,29 @@ static void test_fninit(void)
 	report("fninit", 0, fsw == 0 && (fcw & 0x103f) == 0x003f);
 }
 
+static void test_nopl(void)
+{
+	MK_INSN(nopl1, ".byte 0x90\n\r"); // 1 byte nop
+	MK_INSN(nopl2, ".byte 0x66, 0x90\n\r"); // 2 bytes nop
+	MK_INSN(nopl3, ".byte 0x0f, 0x1f, 0x00\n\r"); // 3 bytes nop
+	MK_INSN(nopl4, ".byte 0x0f, 0x1f, 0x40, 0x00\n\r"); // 4 bytes nop
+	MK_INSN(nopl5, ".byte 0x0f, 0x1f, 0x44, 0x00, 0x00\n\r"); // 5 bytes nop
+	MK_INSN(nopl6, ".byte 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00\n\r"); // 6 bytes nop
+	MK_INSN(nopl7, ".byte 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00\n\r"); // 7 bytes nop
+	MK_INSN(nopl8, ".byte 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00\n\r"); // 8 bytes nop
+	MK_INSN(nopl9, ".byte 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00\n\r"); // 9 bytes nop
+	exec_in_big_real_mode(&insn_nopl1);
+	exec_in_big_real_mode(&insn_nopl2);
+	exec_in_big_real_mode(&insn_nopl3);
+	exec_in_big_real_mode(&insn_nopl4);
+	exec_in_big_real_mode(&insn_nopl5);
+	exec_in_big_real_mode(&insn_nopl6);
+	exec_in_big_real_mode(&insn_nopl7);
+	exec_in_big_real_mode(&insn_nopl8);
+	exec_in_big_real_mode(&insn_nopl9);
+	report("nopl", 0, 1);
+}
+
 void realmode_start(void)
 {
 	test_null();
@@ -1548,6 +1571,7 @@ void realmode_start(void)
 	test_xlat();
 	test_salc();
 	test_fninit();
+	test_nopl();
 
 	exit(0);
 }
-- 
1.7.9.5


             reply	other threads:[~2013-06-05 16:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 16:07 yzt356 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-06-05 16:02 [PATCH] Test case of emulating multibyte NOP Arthur Chunqi Li
2013-06-05 16:13 ` Gleb Natapov
2013-06-05 16:28   ` 李春奇 <Arthur Chunqi Li>
2013-06-06  5:40     ` Gleb Natapov
2013-06-06  6:49       ` 李春奇 <Arthur Chunqi Li>
2013-06-06  7:02         ` Gleb Natapov
2013-06-06  7:17           ` 李春奇 <Arthur Chunqi Li>
2013-06-06  7:22             ` 李春奇 <Arthur Chunqi Li>
2013-06-06  7:28               ` Gleb Natapov
     [not found] <1370444091-8814-1-git-send-email-yzt356@gmail.com>
2013-06-05 14:56 ` 李春奇 <Arthur Chunqi Li>
2013-06-05 15:11   ` Gleb Natapov
2013-06-05 15:13     ` 李春奇 <Arthur Chunqi Li>
2013-06-05 15:17       ` Gleb Natapov
2013-06-05 15:22         ` 李春奇 <Arthur Chunqi Li>
2013-06-05 15:29           ` Gleb Natapov
2013-06-05  9:41 李春奇 <Arthur Chunqi Li>
2013-06-05 13:22 ` Gleb Natapov

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=1370448465-23068-1-git-send-email-yzt356@gmail.com \
    --to=yzt356@gmail.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@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;
as well as URLs for NNTP newsgroup(s).