Re: [PATCH v2] Add realmode test for jcxz instruction

2010-08-23 Thread Marcelo Tosatti
On Fri, Aug 20, 2010 at 08:52:56AM +0800, Wei Yongjun wrote:
 Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
 ---
  x86/realmode.c |   62 
 
  1 files changed, 62 insertions(+), 0 deletions(-)

Please rebase.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] Add realmode test for jcxz instruction

2010-08-19 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
---
 x86/realmode.c |   62 
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/x86/realmode.c b/x86/realmode.c
index ce8fb18..75d77bd 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1262,6 +1262,67 @@ void test_cbw(void)
print_serial(cwde test 1: PASS\n);
 }
 
+void test_jcxz(void)
+{
+   struct regs inregs = { 0 }, outregs;
+
+   MK_INSN(jcxz1, jcxz 1f\n\t
+  mov $0x1234, %eax\n\t
+  1:\n\t);
+   MK_INSN(jcxz2, mov $0x100, %ecx\n\t
+  jcxz 1f\n\t
+  mov $0x1234, %eax\n\t
+  mov $0, %ecx\n\t
+  1:\n\t);
+   MK_INSN(jcxz3, mov $0x1, %ecx\n\t
+  jcxz 1f\n\t
+  mov $0x1234, %eax\n\t
+  1:\n\t);
+   MK_INSN(jecxz1, jecxz 1f\n\t
+   mov $0x1234, %eax\n\t
+   1:\n\t);
+   MK_INSN(jecxz2, mov $0x1, %ecx\n\t
+   jecxz 1f\n\t
+   mov $0x1234, %eax\n\t
+   mov $0, %ecx\n\t
+   1:\n\t);
+
+   exec_in_big_real_mode(inregs, outregs,
+   insn_jcxz1, insn_jcxz1_end - insn_jcxz1);
+   if(!regs_equal(inregs, outregs, 0))
+   print_serial(JCXZ short Test 1: FAIL\n);
+   else
+   print_serial(JCXZ short Test 1: PASS\n);
+
+   exec_in_big_real_mode(inregs, outregs,
+   insn_jcxz2, insn_jcxz2_end - insn_jcxz2);
+   if(!regs_equal(inregs, outregs, R_AX) || outregs.eax != 0x1234)
+   print_serial(JCXZ short Test 2: FAIL\n);
+   else
+   print_serial(JCXZ short Test 2: PASS\n);
+
+   exec_in_big_real_mode(inregs, outregs,
+   insn_jcxz3, insn_jcxz3_end - insn_jcxz3);
+   if(!regs_equal(inregs, outregs, R_CX) || outregs.ecx != 0x1)
+   print_serial(JCXZ short Test 3: FAIL\n);
+   else
+   print_serial(JCXZ short Test 3: PASS\n);
+
+   exec_in_big_real_mode(inregs, outregs,
+   insn_jecxz1, insn_jecxz1_end - insn_jecxz1);
+   if(!regs_equal(inregs, outregs, 0))
+   print_serial(JECXZ short Test 1: FAIL\n);
+   else
+   print_serial(JECXZ short Test 1: PASS\n);
+
+   exec_in_big_real_mode(inregs, outregs,
+   insn_jecxz2, insn_jecxz2_end - insn_jecxz2);
+   if(!regs_equal(inregs, outregs, R_AX) || outregs.eax != 0x1234)
+   print_serial(JECXZ short Test 2: FAIL\n);
+   else
+   print_serial(JECXZ short Test 2: PASS\n);
+}
+
 void realmode_start(void)
 {
test_null();
@@ -1291,6 +1352,7 @@ void realmode_start(void)
test_idiv();
test_loopcc();
test_cbw();
+   test_jcxz();
 
exit(0);
 }
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html