kvm: testsuite: Add test for 'call near absolute'
PATCH 1/1 kvm: testsuite: Add test for 'call near absolute'
Add test for 'call near abolsute' instruction to the real mode test harness
Signed-off-by Mohammed Gamal <[email protected]>
--- user/test/x86/realmode.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
user/test/x86/realmode.c +19 -0
@@ -279,6 +279,24 @@ void test_io(struct regs *inregs, struct regs *outregs) } +void test_call (struct regs *inregs,struct regs *outregs) +{ +MK_INSN (call1,"mov $0x4000, %eax \n\t" +"call *%eax\n\t" ); + +exec_in_big_real_mode (inregs, outregs, + insn_call1, + insn_call1_end - insn_call1); +} + +void line_out () +{ +/* Just output a blank line */ + asm(".org 0x4000 \n\t" +"mov $10, %al \n\t" +"out %al, $0xf1 \n\t" ); +} +void start (void ) {struct regs inregs = {0 }, outregs;
@@ -287,6 +305,7 @@ void start(void)exec_in_big_real_mode (&inregs, &outregs,0 ,0 );if (!regs_equal (&inregs, &outregs,0 ))print_serial ("null test: FAIL\n" ); +test_call (&inregs, &outregs);test_mov_imm (&inregs, &outregs);test_io (&inregs, &outregs);test_eflags_insn (&inregs, &outregs);
Signature · 1 line
1.5.4.3
user/test/x86/realmode.c void test_io(struct regs *inregs, struct regs *outregs) · line 289
Quoted 12 lines · Mohammed Gamal
Add test for 'call near abolsute' instruction to the real mode test harness
user/test/x86/realmode.c +8
-0+void test_call (struct regs *inregs,struct regs *outregs) +{ +MK_INSN (call1,"mov $0x4000, %eax \n\t" +"call *%eax\n\t" ); + +exec_in_big_real_mode (inregs, outregs, + insn_call1, + insn_call1_end - insn_call1);
Please test registers for damage (using regs_equal).
user/test/x86/realmode.c void test_io(struct regs *inregs, struct regs *outregs) · line 298
Quoted 10 lines
user/test/x86/realmode.c +9
-0+} + +void line_out () +{ +/* Just output a blank line */ + asm(".org 0x4000 \n\t" +"mov $10, %al \n\t" +"out %al, $0xf1 \n\t" ); +}
When the code grows and occupies address 0x4000, this will break.
I suggest:
void test_function(void);
asm ("test_function: mov $1234, %eax; ret");
This sets up a register to see that the call actually did something, and avoids the gcc function prologue/epilogue which may clobber registers.
Signature · 1 line
error compiling committee.c: too many arguments to function