kvm testsuite: Add test for 'shld' instruction
PATCH 1/1 kvm testsuite: Add test for 'shld' instruction
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
--- user/test/x86/realmode.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
user/test/x86/realmode.c +19 -0
@@ -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 ); }
Signature · 1 line
1.6.0.4.623.g171d7
Avi Kivity
AppliedQuoted 3 lines · Guillaume Thouvenin
Add 'shld' instruction test in real mode test harness.
Applied, thanks.
Quoted 5 lines
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).
I see a different failure, due to leakage of register values from one test to another. I fixed it up. If you see the failure after the fix, we can reexamine it.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Quoted 12 lines · On Fri, 05 Dec 2008 19:17:17 +0200 Avi Kivity <[email protected]> wrote:
Quoted 3 lines · Guillaume Thouvenin
Add 'shld' instruction test in real mode test harness.
Applied, thanks.
Quoted 5 lines
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).
Quoted 4 lines
I see a different failure, due to leakage of register values from one test to another. I fixed it up. If you see the failure after the fix, we can reexamine it.
Cool it works fine now. On the other hand eax and edx registers are initialized twice now, once is enough ;)
--- user/test/x86/realmode.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
user/test/x86/realmode.c +0 -2
@@ -146,8 +146,6 @@ void test_shld(void)struct regs inregs = { .eax =0xbe , .edx =0xef000000 }, outregs;MK_INSN (shld_test,"shld $8,%edx,%eax\n\t" ); - inregs.eax =0xbe ; - inregs.edx =0xef000000 ;exec_in_big_real_mode (&inregs, &outregs, insn_shld_test, insn_shld_test_end - insn_shld_test);
Signature · 1 line
1.6.0.4.623.g171d7