51 const char test_title[] =
"Software interrupt emulation";
171 void expect(
const void *prefix,
const void *ip,
172 unsigned int ev,
unsigned int ec)
185 xtf_failure(
"Fail %s: Expected 1 exception (vec %u at %p), got %u\n",
195 xtf_failure(
"Fail %s: Unable to retrieve exception log\n",
205 " Expected vec %2u[%04x] at %p\n" 206 " got vec %2u[%04x] at %p\n",
209 entry->
ev, entry->
ec,
_p(entry->
ip));
217 printk(
"Unhandled Exception at %p\n",
_p(regs));
225 unsigned int error,
bool fault)
257 unsigned int vector,
unsigned int error)
283 printk(
"Test cpl3: all perms ok\n");
296 printk(
"Test cpl3: p=0\n");
313 printk(
"Test cpl3: dpl=0\n");
337 printk(
"Test cpl0: all perms ok\n");
350 printk(
"Test cpl0: p=0\n");
375 xtf_skip(
"FEP support not detected - some tests will be skipped\n");
unsigned long label_int_0x1_red_fault[]
struct sequence int3
Sequence for int3.
void cpl3_tests(void)
Tests run in user mode.
exlog_entry_t * xtf_exlog_entry(unsigned int idx)
#define EXC_EC_SYM(exc,...)
Create an exception selector based error code using mnemonics, with implicit X86_EC_IDT.
A collection of subs for an instruction.
void xtf_exlog_dump_log(void)
void stub_int_0x3_reg(void)
static void set_idt_entries_dpl(unsigned int dpl)
Modify the descriptor privilege level on the IDT entries under test.
unsigned long label_int3_red_trap[]
unsigned long label_int3_force_trap[]
unsigned long label_into_forcered_fault[]
unsigned long label_int_0x3_forcered_trap[]
unsigned long label_int3_reg_trap[]
unsigned long label_int_0x3_forcered_fault[]
unsigned long label_int3_forcered_fault[]
void stub_int_0x1_red(void)
static void test_trap(struct sequence *seq, unsigned int vector)
test_seq() wrapper, for caller clarity.
struct sequence into
Sequence for into.
unsigned long label_icebp_reg_fault[]
unsigned long label_icebp_red_trap[]
unsigned long label_int_0x1_force_trap[]
unsigned long label_int_0x3_reg_fault[]
unsigned long label_icebp_red_fault[]
void printk(const char *fmt,...)
void stub_icebp_reg(void)
void stub_int_0x1_reg(void)
void check(void)
Check the exception long against the expected details.
bool xtf_has_fep
Boolean indicating whether generic Force Emulation Prefix support is available for the test to use...
unsigned int xtf_exlog_entries(void)
void stub_int_0x3_forcered(void)
unsigned long label_icebp_forcered_trap[]
void xtf_exlog_reset(void)
Declarations of stubs and labels in generated in lowlevel.S.
void stub_int_0x3_red(void)
unsigned long label_icebp_force_trap[]
unsigned long label_int_0x1_force_fault[]
void stub_into_force(void)
unsigned long label_int3_force_fault[]
Single stub's worth of information.
struct expectation expectation
Expected %eip, vector and error code from the stub under test.
unsigned long label_int_0x3_force_trap[]
unsigned long label_icebp_force_fault[]
void stub_int_0x3_force(void)
void xtf_success(const char *fmt,...)
Report test success.
unsigned long label_into_force_fault[]
static void exec_user_void(void(*fn)(void))
void stub_icebp_force(void)
void stub_int3_forcered(void)
unsigned long label_int_0x3_force_fault[]
void test_main(void)
To be implemented by each test, as its entry point.
void xtf_failure(const char *fmt,...)
Report a test failure.
unsigned long label_into_red_trap[]
bool test_wants_user_mappings
Boolean indicating whether the test wants user mappings or not.
unsigned long label_int3_red_fault[]
void stub_int_0x1_forcered(void)
static void test_fault(struct sequence *seq, unsigned int vector, unsigned int error)
test_seq() wrapper, for caller clarity.
unsigned long label_into_force_trap[]
void xtf_skip(const char *fmt,...)
Report a test skip.
void stub_icebp_forcered(void)
unsigned long label_int_0x3_red_fault[]
static bool user
Whether to run the stub in user or supervisor mode.
const char test_title[]
The title of the test.
unsigned long label_into_forcered_trap[]
unsigned long label_into_reg_trap[]
void cpl0_tests(void)
Tests run in supervisor mode.
void stub_into_forcered(void)
void stub_int3_force(void)
struct sequence int_0x1
Sequence for int $1.
void xtf_exlog_stop(void)
static void set_idt_entries_present(bool present)
Modify the present flag on the IDT entries under test.
unsigned long label_int3_reg_fault[]
unsigned long label_int_0x3_red_trap[]
#define _p(v)
Express an abitrary integer v as void *.
void xtf_exlog_start(void)
unsigned long label_icebp_reg_trap[]
void test_seq(struct sequence *seq, unsigned int vector, unsigned int error, bool fault)
Test a single sequence of related instructions.
void stub_int_0x1_force(void)
unsigned long label_int3_forcered_trap[]
unsigned long label_int_0x1_forcered_trap[]
unsigned long label_int_0x1_red_trap[]
struct sequence int_0x3
Sequence for int $3.
unsigned long label_into_reg_fault[]
void expect(const void *prefix, const void *ip, unsigned int ev, unsigned int ec)
Latch details of the stub under test.
unsigned long label_int_0x1_reg_trap[]
struct sequence icebp
Sequence for icebp.
unsigned long label_int_0x3_reg_trap[]
static const struct test tests[]
bool do_unhandled_exception(struct cpu_regs *regs)
May be implemented by a guest to provide custom exception handling.
unsigned long label_icebp_forcered_fault[]
unsigned long label_int_0x1_forcered_fault[]
unsigned long label_into_red_fault[]
unsigned long label_int_0x1_reg_fault[]
void stub_icebp_red(void)