All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP
@ 2013-06-06  7:38 Arthur Chunqi Li
  2013-06-06  7:46 ` Gleb Natapov
  0 siblings, 1 reply; 2+ messages in thread
From: Arthur Chunqi Li @ 2013-06-06  7:38 UTC (permalink / raw)
  To: kvm; +Cc: gleb, pbonzini, Arthur Chunqi Li

Add multibyte (1 to 4-bytes) NOPL test case to kvm-unit-tests
x86/realmode.c. This test only consist of 16-bit NOPL insn,
other test cases (5 to 9-bytes NOPL) should be placed
in x86/emulator.c.

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

diff --git a/x86/realmode.c b/x86/realmode.c
index 981be08..3546771 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1504,6 +1504,19 @@ 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
+	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);
+	report("nopl", 0, 1);
+}
+
 void realmode_start(void)
 {
 	test_null();
@@ -1548,6 +1561,7 @@ void realmode_start(void)
 	test_xlat();
 	test_salc();
 	test_fninit();
+	test_nopl();
 
 	exit(0);
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP
  2013-06-06  7:38 [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP Arthur Chunqi Li
@ 2013-06-06  7:46 ` Gleb Natapov
  0 siblings, 0 replies; 2+ messages in thread
From: Gleb Natapov @ 2013-06-06  7:46 UTC (permalink / raw)
  To: Arthur Chunqi Li; +Cc: kvm, pbonzini

On Thu, Jun 06, 2013 at 03:38:29PM +0800, Arthur Chunqi Li wrote:
> Add multibyte (1 to 4-bytes) NOPL test case to kvm-unit-tests
> x86/realmode.c. This test only consist of 16-bit NOPL insn,
> other test cases (5 to 9-bytes NOPL) should be placed
> in x86/emulator.c.
> 
Applied, thanks!

> Signed-off-by: Arthur Chunqi Li <yzt356@gmail.com>
> ---
>  x86/realmode.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/x86/realmode.c b/x86/realmode.c
> index 981be08..3546771 100644
> --- a/x86/realmode.c
> +++ b/x86/realmode.c
> @@ -1504,6 +1504,19 @@ 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
> +	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);
> +	report("nopl", 0, 1);
> +}
> +
>  void realmode_start(void)
>  {
>  	test_null();
> @@ -1548,6 +1561,7 @@ void realmode_start(void)
>  	test_xlat();
>  	test_salc();
>  	test_fninit();
> +	test_nopl();
>  
>  	exit(0);
>  }
> -- 
> 1.7.9.5

--
			Gleb.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-06  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06  7:38 [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP Arthur Chunqi Li
2013-06-06  7:46 ` Gleb Natapov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.