kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add push es instruction test in test harness
@ 2009-08-16  0:54 Mohammed Gamal
  2009-08-16  8:44 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammed Gamal @ 2009-08-16  0:54 UTC (permalink / raw)
  To: avi; +Cc: kvm

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 kvm/user/test/x86/realmode.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 755b5d1..8db2c7a 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -468,6 +468,21 @@ void test_long_jmp()
 		print_serial("Long JMP Test: FAIL\n");
 }
 
+void test_push_es()
+{
+	struct regs inregs = { 0 }, outregs;
+	
+	MK_INSN(push_es, "mov $0x1234, %ax\n\t"
+			 "mov %ax, %es\n\t"
+			 "push %es\n\t"
+			 "movw (%esp), %bx \n\t"); 
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_push_es,
+			      insn_push_es_end - insn_push_es);
+	if(!regs_equal(&inregs, &outregs, R_AX|R_BX|R_SP) || outregs.eax != 0x1234)
+		print_serial("Push ES Test: FAIL\n");
+}
+
 void test_null(void)
 {
 	struct regs inregs = { 0 }, outregs;
@@ -492,6 +507,7 @@ void start(void)
 	test_call();
 	/* long jmp test uses call near so test it after testing call */
 	test_long_jmp();
+	test_push_es();
 
 	exit(0);
 }
-- 
1.6.0.4



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

* Re: [PATCH] Add push es instruction test in test harness
  2009-08-16  0:54 [PATCH] Add push es instruction test in test harness Mohammed Gamal
@ 2009-08-16  8:44 ` Avi Kivity
  0 siblings, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2009-08-16  8:44 UTC (permalink / raw)
  To: Mohammed Gamal; +Cc: kvm

On 08/16/2009 03:54 AM, Mohammed Gamal wrote:
> Signed-off-by: Mohammed Gamal<m.gamal005@gmail.com>
> ---
>   kvm/user/test/x86/realmode.c |   16 ++++++++++++++++
>   1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
> index 755b5d1..8db2c7a 100644
> --- a/kvm/user/test/x86/realmode.c
> +++ b/kvm/user/test/x86/realmode.c
> @@ -468,6 +468,21 @@ void test_long_jmp()
>   		print_serial("Long JMP Test: FAIL\n");
>   }
>
> +void test_push_es()
> +{
> +	struct regs inregs = { 0 }, outregs;
> +	
> +	MK_INSN(push_es, "mov $0x1234, %ax\n\t"
> +			 "mov %ax, %es\n\t"
> +			 "push %es\n\t"
> +			 "movw (%esp), %bx \n\t");
> +	exec_in_big_real_mode(&inregs,&outregs,
> +			      insn_push_es,
> +			      insn_push_es_end - insn_push_es);
> +	if(!regs_equal(&inregs,&outregs, R_AX|R_BX|R_SP) || outregs.eax != 0x1234)
>    

You need to check bx here, otherwise the test will always succeed.

> +		print_serial("Push ES Test: FAIL\n");
> +}
> +
>    
error compiling committee.c: too many arguments to function


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

* [PATCH] Add push es instruction test in test harness
@ 2009-08-16 17:51 Mohammed Gamal
  0 siblings, 0 replies; 3+ messages in thread
From: Mohammed Gamal @ 2009-08-16 17:51 UTC (permalink / raw)
  To: avi; +Cc: kvm

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 kvm/user/test/x86/realmode.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 755b5d1..041f0a5 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -468,6 +468,22 @@ void test_long_jmp()
 		print_serial("Long JMP Test: FAIL\n");
 }
 
+void test_push_es()
+{
+	struct regs inregs = { 0 }, outregs;
+	
+	MK_INSN(push_es, "mov $0x231, %bx\n\t" //Just write a dummy value to see if it gets overwritten
+			 "mov %ax, %es\n\t"
+			 "push %es\n\t"
+			 "pop %bx \n\t"
+			 ); 
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_push_es,
+			      insn_push_es_end - insn_push_es);
+	if(!regs_equal(&inregs, &outregs, R_AX|R_BX) ||  outregs.ebx != outregs.eax)
+		print_serial("Push ES Test: FAIL\n");
+}
+
 void test_null(void)
 {
 	struct regs inregs = { 0 }, outregs;
@@ -481,6 +497,7 @@ void start(void)
 	test_null();
 
 	test_shld();
+	test_push_es();
 	test_mov_imm();
 	test_cmp_imm();
 	test_add_imm();
-- 
1.6.0.4


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

end of thread, other threads:[~2009-08-16 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-16  0:54 [PATCH] Add push es instruction test in test harness Mohammed Gamal
2009-08-16  8:44 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2009-08-16 17:51 Mohammed Gamal

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).