kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add pusha/popa instructions to the realmode test harness
@ 2009-08-29 13:27 Mohammed Gamal
  0 siblings, 0 replies; 6+ messages in thread
From: Mohammed Gamal @ 2009-08-29 13:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, Mohammed Gamal

This adds tests for pusha/popa to the test harness. Added some new typedefs
while as well.

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

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 0db09b8..20d038e 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -4,6 +4,10 @@ typedef unsigned char u8;
 typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed s32;
+typedef signed long long s64;
 
 void test_function(void);
 
@@ -470,6 +474,7 @@ void test_long_jmp()
 void test_push_pop()
 {
 	struct regs inregs = { 0 }, outregs;
+
 	MK_INSN(push32, "mov $0x12345678, %eax\n\t"
 			"push %eax\n\t"
 			"pop %ebx\n\t");
@@ -499,6 +504,10 @@ void test_push_pop()
 			     "mov %fs, %ebx\n\t"
 			     "pop %fs\n\t"
 			);
+	MK_INSN(pusha,  "pushaw\n\t");
+	MK_INSN(pushad, "pushal\n\t");
+	MK_INSN(popa, "popaw\n\t");
+	MK_INSN(popad, "popal\n\t");
 
 	exec_in_big_real_mode(&inregs, &outregs,
 			      insn_push32,
@@ -539,6 +548,34 @@ void test_push_pop()
 
 	if (!regs_equal(&inregs, &outregs, R_AX|R_BX) || outregs.ebx != outregs.eax)
 		print_serial("Push/Pop Test 6: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			     insn_pusha,
+			     insn_pusha_end - insn_pusha);
+	if (!regs_equal(&inregs, &outregs, R_SP) 
+				|| (s16)outregs.esp != (s16)(inregs.esp - 16))
+		print_serial("Push/Pop Test 7: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popa,
+			      insn_popa_end - insn_popa);
+	if (outregs.esp != (inregs.esp + 16))
+		print_serial("Push/Pop Test 8: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_pushad,
+			      insn_pushad_end - insn_pushad);
+
+	if (!regs_equal(&inregs, &outregs, R_SP)
+				|| (s16)outregs.esp != (s16)(inregs.esp - 32))
+		print_serial("Push/Pop Test 9: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popad,
+			      insn_popad_end - insn_popad);
+
+	if (outregs.esp != (inregs.esp + 32))
+		print_serial("Push/Pop Test 10: FAIL\n");
 }
 
 void test_null(void)
-- 
1.6.0.4


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

* [PATCH] Add pusha/popa instructions to the realmode test harness
@ 2009-08-29 13:29 Mohammed Gamal
  0 siblings, 0 replies; 6+ messages in thread
From: Mohammed Gamal @ 2009-08-29 13:29 UTC (permalink / raw)
  To: avi; +Cc: kvm, Mohammed Gamal

This adds tests for pusha/popa to the test harness. Added some new typedefs
while as well.

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

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 0db09b8..20d038e 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -4,6 +4,10 @@ typedef unsigned char u8;
 typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed s32;
+typedef signed long long s64;
 
 void test_function(void);
 
@@ -470,6 +474,7 @@ void test_long_jmp()
 void test_push_pop()
 {
 	struct regs inregs = { 0 }, outregs;
+
 	MK_INSN(push32, "mov $0x12345678, %eax\n\t"
 			"push %eax\n\t"
 			"pop %ebx\n\t");
@@ -499,6 +504,10 @@ void test_push_pop()
 			     "mov %fs, %ebx\n\t"
 			     "pop %fs\n\t"
 			);
+	MK_INSN(pusha,  "pushaw\n\t");
+	MK_INSN(pushad, "pushal\n\t");
+	MK_INSN(popa, "popaw\n\t");
+	MK_INSN(popad, "popal\n\t");
 
 	exec_in_big_real_mode(&inregs, &outregs,
 			      insn_push32,
@@ -539,6 +548,34 @@ void test_push_pop()
 
 	if (!regs_equal(&inregs, &outregs, R_AX|R_BX) || outregs.ebx != outregs.eax)
 		print_serial("Push/Pop Test 6: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			     insn_pusha,
+			     insn_pusha_end - insn_pusha);
+	if (!regs_equal(&inregs, &outregs, R_SP) 
+				|| (s16)outregs.esp != (s16)(inregs.esp - 16))
+		print_serial("Push/Pop Test 7: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popa,
+			      insn_popa_end - insn_popa);
+	if (outregs.esp != (inregs.esp + 16))
+		print_serial("Push/Pop Test 8: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_pushad,
+			      insn_pushad_end - insn_pushad);
+
+	if (!regs_equal(&inregs, &outregs, R_SP)
+				|| (s16)outregs.esp != (s16)(inregs.esp - 32))
+		print_serial("Push/Pop Test 9: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popad,
+			      insn_popad_end - insn_popad);
+
+	if (outregs.esp != (inregs.esp + 32))
+		print_serial("Push/Pop Test 10: FAIL\n");
 }
 
 void test_null(void)
-- 
1.6.0.4


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

* [PATCH] Add pusha/popa instructions to the realmode test harness
@ 2009-08-29 13:29 Mohammed Gamal
  0 siblings, 0 replies; 6+ messages in thread
From: Mohammed Gamal @ 2009-08-29 13:29 UTC (permalink / raw)
  To: avi; +Cc: kvm, Mohammed Gamal

This adds tests for pusha/popa to the test harness. Added some new typedefs
while as well.

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

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 0db09b8..20d038e 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -4,6 +4,10 @@ typedef unsigned char u8;
 typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed s32;
+typedef signed long long s64;
 
 void test_function(void);
 
@@ -470,6 +474,7 @@ void test_long_jmp()
 void test_push_pop()
 {
 	struct regs inregs = { 0 }, outregs;
+
 	MK_INSN(push32, "mov $0x12345678, %eax\n\t"
 			"push %eax\n\t"
 			"pop %ebx\n\t");
@@ -499,6 +504,10 @@ void test_push_pop()
 			     "mov %fs, %ebx\n\t"
 			     "pop %fs\n\t"
 			);
+	MK_INSN(pusha,  "pushaw\n\t");
+	MK_INSN(pushad, "pushal\n\t");
+	MK_INSN(popa, "popaw\n\t");
+	MK_INSN(popad, "popal\n\t");
 
 	exec_in_big_real_mode(&inregs, &outregs,
 			      insn_push32,
@@ -539,6 +548,34 @@ void test_push_pop()
 
 	if (!regs_equal(&inregs, &outregs, R_AX|R_BX) || outregs.ebx != outregs.eax)
 		print_serial("Push/Pop Test 6: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			     insn_pusha,
+			     insn_pusha_end - insn_pusha);
+	if (!regs_equal(&inregs, &outregs, R_SP) 
+				|| (s16)outregs.esp != (s16)(inregs.esp - 16))
+		print_serial("Push/Pop Test 7: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popa,
+			      insn_popa_end - insn_popa);
+	if (outregs.esp != (inregs.esp + 16))
+		print_serial("Push/Pop Test 8: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_pushad,
+			      insn_pushad_end - insn_pushad);
+
+	if (!regs_equal(&inregs, &outregs, R_SP)
+				|| (s16)outregs.esp != (s16)(inregs.esp - 32))
+		print_serial("Push/Pop Test 9: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popad,
+			      insn_popad_end - insn_popad);
+
+	if (outregs.esp != (inregs.esp + 32))
+		print_serial("Push/Pop Test 10: FAIL\n");
 }
 
 void test_null(void)
-- 
1.6.0.4


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

* [PATCH] Add pusha/popa instructions to the realmode test harness
@ 2009-08-29 13:30 Mohammed Gamal
  0 siblings, 0 replies; 6+ messages in thread
From: Mohammed Gamal @ 2009-08-29 13:30 UTC (permalink / raw)
  To: avi; +Cc: kvm, Mohammed Gamal

This adds tests for pusha/popa to the test harness. Added some new typedefs
as well.

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

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 0db09b8..20d038e 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -4,6 +4,10 @@ typedef unsigned char u8;
 typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed s32;
+typedef signed long long s64;
 
 void test_function(void);
 
@@ -470,6 +474,7 @@ void test_long_jmp()
 void test_push_pop()
 {
 	struct regs inregs = { 0 }, outregs;
+
 	MK_INSN(push32, "mov $0x12345678, %eax\n\t"
 			"push %eax\n\t"
 			"pop %ebx\n\t");
@@ -499,6 +504,10 @@ void test_push_pop()
 			     "mov %fs, %ebx\n\t"
 			     "pop %fs\n\t"
 			);
+	MK_INSN(pusha,  "pushaw\n\t");
+	MK_INSN(pushad, "pushal\n\t");
+	MK_INSN(popa, "popaw\n\t");
+	MK_INSN(popad, "popal\n\t");
 
 	exec_in_big_real_mode(&inregs, &outregs,
 			      insn_push32,
@@ -539,6 +548,34 @@ void test_push_pop()
 
 	if (!regs_equal(&inregs, &outregs, R_AX|R_BX) || outregs.ebx != outregs.eax)
 		print_serial("Push/Pop Test 6: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			     insn_pusha,
+			     insn_pusha_end - insn_pusha);
+	if (!regs_equal(&inregs, &outregs, R_SP) 
+				|| (s16)outregs.esp != (s16)(inregs.esp - 16))
+		print_serial("Push/Pop Test 7: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popa,
+			      insn_popa_end - insn_popa);
+	if (outregs.esp != (inregs.esp + 16))
+		print_serial("Push/Pop Test 8: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_pushad,
+			      insn_pushad_end - insn_pushad);
+
+	if (!regs_equal(&inregs, &outregs, R_SP)
+				|| (s16)outregs.esp != (s16)(inregs.esp - 32))
+		print_serial("Push/Pop Test 9: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popad,
+			      insn_popad_end - insn_popad);
+
+	if (outregs.esp != (inregs.esp + 32))
+		print_serial("Push/Pop Test 10: FAIL\n");
 }
 
 void test_null(void)
-- 
1.6.0.4


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

* [PATCH] Add pusha/popa instructions to the realmode test harness
@ 2009-09-01 22:47 Mohammed Gamal
  2009-09-02 19:13 ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: Mohammed Gamal @ 2009-09-01 22:47 UTC (permalink / raw)
  To: mtosatti; +Cc: avi, kvm, Mohammed Gamal

This adds tests for pusha/popa to the test harness. Added some new typedefs
as well.

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

diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 0db09b8..20d038e 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -4,6 +4,10 @@ typedef unsigned char u8;
 typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed s32;
+typedef signed long long s64;
 
 void test_function(void);
 
@@ -470,6 +474,7 @@ void test_long_jmp()
 void test_push_pop()
 {
 	struct regs inregs = { 0 }, outregs;
+
 	MK_INSN(push32, "mov $0x12345678, %eax\n\t"
 			"push %eax\n\t"
 			"pop %ebx\n\t");
@@ -499,6 +504,10 @@ void test_push_pop()
 			     "mov %fs, %ebx\n\t"
 			     "pop %fs\n\t"
 			);
+	MK_INSN(pusha,  "pushaw\n\t");
+	MK_INSN(pushad, "pushal\n\t");
+	MK_INSN(popa, "popaw\n\t");
+	MK_INSN(popad, "popal\n\t");
 
 	exec_in_big_real_mode(&inregs, &outregs,
 			      insn_push32,
@@ -539,6 +548,34 @@ void test_push_pop()
 
 	if (!regs_equal(&inregs, &outregs, R_AX|R_BX) || outregs.ebx != outregs.eax)
 		print_serial("Push/Pop Test 6: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			     insn_pusha,
+			     insn_pusha_end - insn_pusha);
+	if (!regs_equal(&inregs, &outregs, R_SP) 
+				|| (s16)outregs.esp != (s16)(inregs.esp - 16))
+		print_serial("Push/Pop Test 7: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popa,
+			      insn_popa_end - insn_popa);
+	if (outregs.esp != (inregs.esp + 16))
+		print_serial("Push/Pop Test 8: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_pushad,
+			      insn_pushad_end - insn_pushad);
+
+	if (!regs_equal(&inregs, &outregs, R_SP)
+				|| (s16)outregs.esp != (s16)(inregs.esp - 32))
+		print_serial("Push/Pop Test 9: FAIL\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_popad,
+			      insn_popad_end - insn_popad);
+
+	if (outregs.esp != (inregs.esp + 32))
+		print_serial("Push/Pop Test 10: FAIL\n");
 }
 
 void test_null(void)
-- 
1.6.0.4


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

* Re: [PATCH] Add pusha/popa instructions to the realmode test harness
  2009-09-01 22:47 [PATCH] Add pusha/popa instructions to the realmode test harness Mohammed Gamal
@ 2009-09-02 19:13 ` Avi Kivity
  0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-09-02 19:13 UTC (permalink / raw)
  To: Mohammed Gamal; +Cc: mtosatti, kvm

On 09/02/2009 01:47 AM, Mohammed Gamal wrote:
> This adds tests for pusha/popa to the test harness. Added some new typedefs
> as well.
>    

It would be good to test memory contents after pusha, and register 
contents after popa.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

end of thread, other threads:[~2009-09-02 19:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-01 22:47 [PATCH] Add pusha/popa instructions to the realmode test harness Mohammed Gamal
2009-09-02 19:13 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2009-08-29 13:30 Mohammed Gamal
2009-08-29 13:29 Mohammed Gamal
2009-08-29 13:29 Mohammed Gamal
2009-08-29 13:27 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).