From: Guillaume Thouvenin Subject: [PATCH] kvm testsuite: Add test for 'shld' instruction Date: Thu, 4 Dec 2008 14:38:22 +0100 Message-ID: <20081204143822.71bd46da@frecb000711> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Avi Kivity , guillaume.thouvenin@ext.bull.net To: kvm Return-path: Received: from ecfrec.frec.bull.fr ([129.183.4.8]:58735 "EHLO ecfrec.frec.bull.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751884AbYLDNi0 (ORCPT ); Thu, 4 Dec 2008 08:38:26 -0500 Sender: kvm-owner@vger.kernel.org List-ID: Add 'shld' instruction test in real mode test harness. Avi, on my computer this test is broken but the problem seems to be elsewhere because test_shld() works fine alone. I'm inspecting other test. Used alone shld gives the right values (shift is ok and bits are added). The error is the following: kvm_run: failed entry, reason 7 rax 000000000000000e rbx 0000000000001fa4 rcx 0000000000000000 rdx 00000000000000f1 rsi 000000000000218d rdi 0000000000001ff4 rsp 0000000000001f84 rbp 0000000000000000 r8 0000000000000000 r9 0000000000000000 r10 0000000000000000 r11 0000000000000000 r12 0000000000000000 r13 0000000000000000 r14 0000000000000000 r15 0000000000000000 rip 000000000000004b rflags 00023646 cs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) ds 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) es 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) ss 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) fs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) gs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) tr 0000 (fffbd000/00002088 p 1 dpl 0 db 0 s 0 type b l 0 g 0 avl 0) ldt 0000 (00000000/0000ffff p 1 dpl 0 db 0 s 0 type 2 l 0 g 0 avl 0) gdt 2000/17 idt 0/ffff cr0 60000010 cr2 0 cr3 0 cr4 0 cr8 0 efer 0 Signed-off-by: Guillaume Thouvenin --- user/test/x86/realmode.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/user/test/x86/realmode.c b/user/test/x86/realmode.c index 2c3be1e..a65f9f2 100644 --- a/user/test/x86/realmode.c +++ b/user/test/x86/realmode.c @@ -141,6 +141,19 @@ 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) +{ + MK_INSN(shld_test, "shld $8,%edx,%eax\n\t"); + + exec_in_big_real_mode(inregs, outregs, + insn_shld_test, + insn_shld_test_end - insn_shld_test); + if (outregs->eax != 0xbeef) + 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,11 +373,17 @@ void start(void) if (!regs_equal(&inregs, &outregs, 0)) print_serial("null test: FAIL\n"); test_call(&inregs, &outregs); + + inregs.eax = 0xbe; + inregs.edx = 0xef000000; + test_shld(&inregs, &outregs); + test_mov_imm(&inregs, &outregs); test_cmp_imm(&inregs, &outregs); test_add_imm(&inregs, &outregs); test_io(&inregs, &outregs); test_eflags_insn(&inregs, &outregs); + exit(0); } -- 1.6.0.4.623.g171d7