Add 'shld' instruction test in real mode test harness.

Signed-off-by: Guillaume Thouvenin <[EMAIL PROTECTED]>
--- 
 realmode.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/user/test/x86/realmode.c b/user/test/x86/realmode.c
index 2c3be1e..89857ae 100644
--- a/user/test/x86/realmode.c
+++ b/user/test/x86/realmode.c
@@ -141,6 +141,25 @@ int regs_equal(const struct regs *r1, const struct regs 
*r2, int ignore)
                );                                 \
        extern u8 insn_##name[], insn_##name##_end[]
 
+void test_shld(const struct regs *inregs, struct regs *outregs)
+{
+       int shift;
+       int width = 32;
+       u32 res;
+
+       MK_INSN(shld_test, "shld $4,%ecx,%ebx\n\t");
+
+       exec_in_big_real_mode(inregs, outregs,
+                             insn_shld_test,
+                             insn_shld_test_end - insn_shld_test);
+       shift = 4;
+       res = (inregs->ebx << shift) | (inregs->ecx << (width - shift));
+       if (outregs->ebx != res)
+               print_serial("shld: failure\n");
+       else
+               print_serial("shld: success\n");
+}
+
 void test_mov_imm(const struct regs *inregs, struct regs *outregs)
 {
        MK_INSN(mov_r32_imm_1, "mov $1234567890, %eax");
@@ -360,6 +379,11 @@ void start(void)
        if (!regs_equal(&inregs, &outregs, 0))
                print_serial("null test: FAIL\n");
        test_call(&inregs, &outregs);
+
+       inregs.ebx = 0xbe;
+       inregs.ecx = 0xef000000;
+       test_shld(&inregs, &outregs);
+
        test_mov_imm(&inregs, &outregs);
        test_cmp_imm(&inregs, &outregs);
        test_add_imm(&inregs, &outregs);
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to