* [PATCH 1/2] test: Add test for sub acc,imm
@ 2010-05-12 14:00 Mohammed Gamal
2010-05-12 14:00 ` [PATCH 2/2] test: Add test for xor acc, imm Mohammed Gamal
2010-05-14 22:49 ` [PATCH 1/2] test: Add test for sub acc,imm Marcelo Tosatti
0 siblings, 2 replies; 3+ messages in thread
From: Mohammed Gamal @ 2010-05-12 14:00 UTC (permalink / raw)
To: avi; +Cc: mtosatti, kvm, Mohammed Gamal
Adds tests fot sub acc, imm
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
kvm/user/test/x86/realmode.c | 44 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index bc4ed97..41e2aea 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -307,6 +307,49 @@ void test_mov_imm(void)
print_serial("mov test 5: PASS\n");
}
+void test_sub_imm(void)
+{
+ struct regs inregs = { 0 }, outregs;
+ MK_INSN(sub_r32_imm_1, "mov $1234567890, %eax\n\t" "sub $10, %eax\n\t");
+ MK_INSN(sub_r16_imm_1, "mov $1234, %ax\n\t" "sub $10, %ax\n\t");
+ MK_INSN(sub_r8_imm_1, "mov $0x12, %ah\n\t" "sub $0x10, %ah\n\t");
+ MK_INSN(sub_r8_imm_2, "mov $0x34, %al\n\t" "sub $0x10, %al\n\t");
+
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_sub_r16_imm_1,
+ insn_sub_r16_imm_1_end - insn_sub_r16_imm_1);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1224)
+ print_serial("sub test 1: FAIL\n");
+ else
+ print_serial("sub test 1: PASS\n");
+
+ /* test mov $imm, %eax */
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_sub_r32_imm_1,
+ insn_sub_r32_imm_1_end - insn_sub_r32_imm_1);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234567880)
+ print_serial("sub test 2: FAIL\n");
+ else
+ print_serial("sub test 2: PASS\n");
+
+ /* test mov $imm, %al/%ah */
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_sub_r8_imm_1,
+ insn_sub_r8_imm_1_end - insn_sub_r8_imm_1);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x0200)
+ print_serial("sub test 3: FAIL\n");
+ else
+ print_serial("sub test 3: PASS\n");
+
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_sub_r8_imm_2,
+ insn_sub_r8_imm_2_end - insn_sub_r8_imm_2);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x24)
+ print_serial("sub test 4: FAIL\n");
+ else
+ print_serial("sub test 4: PASS\n");
+}
+
void test_cmp_imm(void)
{
struct regs inregs = { 0 }, outregs;
@@ -742,6 +785,7 @@ void realmode_start(void)
test_mov_imm();
test_cmp_imm();
test_add_imm();
+ test_sub_imm();
test_io();
test_eflags_insn();
test_jcc_short();
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] test: Add test for xor acc, imm
2010-05-12 14:00 [PATCH 1/2] test: Add test for sub acc,imm Mohammed Gamal
@ 2010-05-12 14:00 ` Mohammed Gamal
2010-05-14 22:49 ` [PATCH 1/2] test: Add test for sub acc,imm Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Mohammed Gamal @ 2010-05-12 14:00 UTC (permalink / raw)
To: avi; +Cc: mtosatti, kvm, Mohammed Gamal
Adds test for xor acc, imm
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
kvm/user/test/x86/realmode.c | 45 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c
index 41e2aea..70a1e05 100644
--- a/kvm/user/test/x86/realmode.c
+++ b/kvm/user/test/x86/realmode.c
@@ -350,6 +350,50 @@ void test_sub_imm(void)
print_serial("sub test 4: PASS\n");
}
+
+void test_xor_imm(void)
+{
+ struct regs inregs = { 0 }, outregs;
+ MK_INSN(xor_r32_imm_1, "mov $1234567890, %eax\n\t" "xor $1234567890, %eax\n\t");
+ MK_INSN(xor_r16_imm_1, "mov $1234, %ax\n\t" "xor $1234, %ax\n\t");
+ MK_INSN(xor_r8_imm_1, "mov $0x12, %ah\n\t" "xor $0x12, %ah\n\t");
+ MK_INSN(xor_r8_imm_2, "mov $0x34, %al\n\t" "xor $0x34, %al\n\t");
+
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_xor_r16_imm_1,
+ insn_xor_r16_imm_1_end - insn_xor_r16_imm_1);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0)
+ print_serial("xor test 1: FAIL\n");
+ else
+ print_serial("xor test 1: PASS\n");
+
+ /* test mov $imm, %eax */
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_xor_r32_imm_1,
+ insn_xor_r32_imm_1_end - insn_xor_r32_imm_1);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0)
+ print_serial("xor test 2: FAIL\n");
+ else
+ print_serial("xor test 2: PASS\n");
+
+ /* test mov $imm, %al/%ah */
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_xor_r8_imm_1,
+ insn_xor_r8_imm_1_end - insn_xor_r8_imm_1);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0)
+ print_serial("xor test 3: FAIL\n");
+ else
+ print_serial("xor test 3: PASS\n");
+
+ exec_in_big_real_mode(&inregs, &outregs,
+ insn_xor_r8_imm_2,
+ insn_xor_r8_imm_2_end - insn_xor_r8_imm_2);
+ if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0)
+ print_serial("xor test 4: FAIL\n");
+ else
+ print_serial("xor test 4: PASS\n");
+}
+
void test_cmp_imm(void)
{
struct regs inregs = { 0 }, outregs;
@@ -786,6 +830,7 @@ void realmode_start(void)
test_cmp_imm();
test_add_imm();
test_sub_imm();
+ test_xor_imm();
test_io();
test_eflags_insn();
test_jcc_short();
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] test: Add test for sub acc,imm
2010-05-12 14:00 [PATCH 1/2] test: Add test for sub acc,imm Mohammed Gamal
2010-05-12 14:00 ` [PATCH 2/2] test: Add test for xor acc, imm Mohammed Gamal
@ 2010-05-14 22:49 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2010-05-14 22:49 UTC (permalink / raw)
To: Mohammed Gamal; +Cc: avi, kvm
On Wed, May 12, 2010 at 05:00:43PM +0300, Mohammed Gamal wrote:
> Adds tests fot sub acc, imm
>
> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
> ---
> kvm/user/test/x86/realmode.c | 44 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 44 insertions(+), 0 deletions(-)
Applied both, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-15 0:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 14:00 [PATCH 1/2] test: Add test for sub acc,imm Mohammed Gamal
2010-05-12 14:00 ` [PATCH 2/2] test: Add test for xor acc, imm Mohammed Gamal
2010-05-14 22:49 ` [PATCH 1/2] test: Add test for sub acc,imm Marcelo Tosatti
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).