Re: [PATCH] kvm: testsuite: Add test for 'call near absolute'

Avi Kivity
2008-09-09T13:39:10Z

Mohammed Gamal wrote:
> Add test for 'call near abolsute' instruction to the real mode test harness
>
>
> +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).

> +}
> +
> +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.

--
error compiling committee.c: too many arguments to function