@@ -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 $0x10000, %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 $0x10000, %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 != 0x10000)
+ 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);
}