Fix pusha tests
cover Fix pusha tests
The pusha tests fail on AMD, which virtualizes real mode correctly. Fix the tests.
Avi Kivity (3):
test: realmode: fix pusha test
test: realmode: initialize all bits of esp
test: realmode: fix pusha test stack
kvm/test/x86/realmode.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
PATCH 1/3 test: realmode: fix pusha test
'pop esp' destroys the stack, avoid it
--- kvm/test/x86/realmode.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
kvm/test/x86/realmode.c +2 -3
@@ -828,12 +828,11 @@ void test_pusha_popa()"pop %edi\n\t" "pop %esi\n\t" "pop %ebp\n\t" -"pop %eax\n\t" +"add $4, %esp\n\t" "pop %ebx\n\t" "pop %edx\n\t" "pop %ecx\n\t" -"pop %esp\n\t" -"xchg %esp, %eax\n\t" +"pop %eax\n\t" ); MK_INSN(popa, "push %eax\n\t"
Signature · 1 line
1.7.1
PATCH 2/3 test: realmode: initialize all bits of esp
In reply to Avi KivityInitializing just sp can leave the high bits of esp uninitialized.
--- kvm/test/x86/realmode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kvm/test/x86/realmode.c +1 -1
@@ -936,7 +936,7 @@ asm("mov %ax, %ss \n\t" "mov %ax, %fs \n\t" "mov %ax, %gs \n\t" -"mov $stacktop, %sp\n\t" +"mov $stacktop, %esp\n\t" "ljmp $0, $realmode_start \n\t" ".code16gcc \n\t"
Signature · 1 line
1.7.1
PATCH 3/3 test: realmode: fix pusha test stack
In reply to Avi Kivitypusha needs some stack space, or it will fault. The supplied value of 7 is too small.
Provide a real stack for pusha.
--- kvm/test/x86/realmode.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
kvm/test/x86/realmode.c +6 -1
@@ -820,9 +820,14 @@ void test_null(void)print_serial ("null test: PASS\n" ); } +struct { +char stack[500 ]; +char top[]; +} tmp_stack; +void test_pusha_popa () { -struct regs inregs = { .eax =0 , .ebx =1 , .ecx =2 , .edx =3 , .esi =4 , .edi =5 , .ebp =6 , .esp =7 }, outregs; +struct regs inregs = { .eax =0 , .ebx =1 , .ecx =2 , .edx =3 , .esi =4 , .edi =5 , .ebp =6 , .esp = (unsigned long )&tmp_stack.top }, outregs;MK_INSN (pusha,"pusha\n\t" "pop %edi\n\t"
Signature · 1 line
1.7.1
Marcelo Tosatti
AppliedQuoted 10 lines · Avi Kivity
The pusha tests fail on AMD, which virtualizes real mode correctly. Fix the tests.
Avi Kivity (3):
test: realmode: fix pusha test
test: realmode: initialize all bits of esp
test: realmode: fix pusha test stackkvm/test/x86/realmode.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
Applied, thanks.