Xen Test Framework
Software Interrupt Emulation

Tests for the exception frame generated from emulated software interrupt instructions, in situations which will results in traps and faults.

This test requires a debug Xen, booted with "hvm_fep" to allow the test to directly invoke the x86 instruction emulator.

Each of the following instructions are tested:

with and without a redundant prefix (address size override specifically, as it has no effect on instructs like these). Each combination is executed both normally, and via the instruction emulator, to confirm that hardware and the instruction emulator are behaving identically.

Injection of software interrupts by Xen is complicated by differing available of hardware support. Intel VT-x and AMD SVM (both with and without NextRIP support) all provide different levels of hardware support, which affects how much Xen must emulate in software to cause the guest to observe architectural behaviour.

Each instruction/prefix combination is executed in the following conditions:

Handling of into is more complicated. In 32bit it is tested as normal, but the instruction isn't recognised in 64bit. Instead, it is just tested to unconditionally generate a #UD fault.

In all cases, the exception frame is verified to be correct.

See also
tests/swint-emulation/main.c