Software Interrupt Emulation - Emulation of software interrupts.
More...
#include <xtf.h>
#include "lowlevel.h"
Go to the source code of this file.
|
void | expect (const void *prefix, const void *ip, unsigned int ev, unsigned int ec) |
| Latch details of the stub under test. More...
|
|
void | check (void) |
| Check the exception long against the expected details. More...
|
|
bool | do_unhandled_exception (struct cpu_regs *regs) |
| Print expected information in the case of an unexpected exception. More...
|
|
void | test_seq (struct sequence *seq, unsigned int vector, unsigned int error, bool fault) |
| Test a single sequence of related instructions. More...
|
|
static void | test_trap (struct sequence *seq, unsigned int vector) |
| test_seq() wrapper, for caller clarity. More...
|
|
static void | test_fault (struct sequence *seq, unsigned int vector, unsigned int error) |
| test_seq() wrapper, for caller clarity. More...
|
|
static void | set_idt_entries_present (bool present) |
| Modify the present flag on the IDT entries under test. More...
|
|
static void | set_idt_entries_dpl (unsigned int dpl) |
| Modify the descriptor privilege level on the IDT entries under test. More...
|
|
void | cpl3_tests (void) |
| Tests run in user mode. More...
|
|
void | cpl0_tests (void) |
| Tests run in supervisor mode. More...
|
|
void | test_main (void) |
| To be implemented by each test, as its entry point. More...
|
|
Software Interrupt Emulation - Emulation of software interrupts.
Definition in file main.c.
◆ expect()
void expect |
( |
const void * |
prefix, |
|
|
const void * |
ip, |
|
|
unsigned int |
ev, |
|
|
unsigned int |
ec |
|
) |
| |
Latch details of the stub under test.
Definition at line 171 of file main.c.
◆ check()
Check the exception long against the expected details.
Definition at line 179 of file main.c.
◆ do_unhandled_exception()
bool do_unhandled_exception |
( |
struct cpu_regs * |
regs | ) |
|
Print expected information in the case of an unexpected exception.
May be implemented by a guest to provide custom exception handling.
Definition at line 215 of file main.c.
◆ test_seq()
void test_seq |
( |
struct sequence * |
seq, |
|
|
unsigned int |
vector, |
|
|
unsigned int |
error, |
|
|
bool |
fault |
|
) |
| |
Test a single sequence of related instructions.
Definition at line 224 of file main.c.
◆ test_trap()
static void test_trap |
( |
struct sequence * |
seq, |
|
|
unsigned int |
vector |
|
) |
| |
|
static |
◆ test_fault()
static void test_fault |
( |
struct sequence * |
seq, |
|
|
unsigned int |
vector, |
|
|
unsigned int |
error |
|
) |
| |
|
static |
◆ set_idt_entries_present()
static void set_idt_entries_present |
( |
bool |
present | ) |
|
|
static |
Modify the present flag on the IDT entries under test.
Definition at line 263 of file main.c.
◆ set_idt_entries_dpl()
static void set_idt_entries_dpl |
( |
unsigned int |
dpl | ) |
|
|
static |
Modify the descriptor privilege level on the IDT entries under test.
Definition at line 271 of file main.c.
◆ cpl3_tests()
Tests run in user mode.
Definition at line 279 of file main.c.
◆ cpl0_tests()
Tests run in supervisor mode.
Definition at line 335 of file main.c.
◆ test_main()
To be implemented by each test, as its entry point.
- Todo:
- Implement better command line infrastructure, but this will do for now.
Definition at line 368 of file main.c.
◆ test_title
const char test_title[] = "Software interrupt emulation" |
The title of the test.
Definition at line 51 of file main.c.
◆ test_wants_user_mappings
Boolean indicating whether the test wants user mappings or not.
Some tests want an easy transition between supervisor and user modes. For such tests, this requires running on _PAGE_USER mappings, and they must opt-in.
- See also
- Errata
The framework variable is a weak reference, and may be overridden by a test wishing to change the default.
Definition at line 53 of file main.c.
◆ int3
Initial value:=
{ "int3",
{
},
}
unsigned long label_int3_red_trap[]
unsigned long label_int3_force_trap[]
unsigned long label_int3_reg_trap[]
unsigned long label_int3_forcered_fault[]
unsigned long label_int3_force_fault[]
void stub_int3_forcered(void)
unsigned long label_int3_red_fault[]
void stub_int3_force(void)
unsigned long label_int3_reg_fault[]
unsigned long label_int3_forcered_trap[]
Sequence for int3
.
Definition at line 71 of file main.c.
◆ int_0x3
Initial value:=
{ "int $3",
{
},
}
void stub_int_0x3_reg(void)
unsigned long label_int_0x3_forcered_trap[]
unsigned long label_int_0x3_forcered_fault[]
unsigned long label_int_0x3_reg_fault[]
void stub_int_0x3_forcered(void)
void stub_int_0x3_red(void)
unsigned long label_int_0x3_force_trap[]
void stub_int_0x3_force(void)
unsigned long label_int_0x3_force_fault[]
unsigned long label_int_0x3_red_fault[]
unsigned long label_int_0x3_red_trap[]
unsigned long label_int_0x3_reg_trap[]
Sequence for int $3
.
Definition at line 89 of file main.c.
◆ icebp
Initial value:=
{ "icebp",
{
},
}
unsigned long label_icebp_reg_fault[]
unsigned long label_icebp_red_trap[]
unsigned long label_icebp_red_fault[]
void stub_icebp_reg(void)
unsigned long label_icebp_forcered_trap[]
unsigned long label_icebp_force_trap[]
unsigned long label_icebp_force_fault[]
void stub_icebp_force(void)
void stub_icebp_forcered(void)
unsigned long label_icebp_reg_trap[]
unsigned long label_icebp_forcered_fault[]
void stub_icebp_red(void)
Sequence for icebp
.
Definition at line 107 of file main.c.
◆ int_0x1
Initial value:=
{ "int $1",
{
},
}
unsigned long label_int_0x1_red_fault[]
void stub_int_0x1_red(void)
unsigned long label_int_0x1_force_trap[]
void stub_int_0x1_reg(void)
unsigned long label_int_0x1_force_fault[]
void stub_int_0x1_forcered(void)
void stub_int_0x1_force(void)
unsigned long label_int_0x1_forcered_trap[]
unsigned long label_int_0x1_red_trap[]
unsigned long label_int_0x1_reg_trap[]
unsigned long label_int_0x1_forcered_fault[]
unsigned long label_int_0x1_reg_fault[]
Sequence for int $1
.
Definition at line 125 of file main.c.
◆ into
Initial value:=
{ "into",
{
},
}
unsigned long label_into_forcered_fault[]
void stub_into_force(void)
unsigned long label_into_force_fault[]
unsigned long label_into_red_trap[]
unsigned long label_into_force_trap[]
unsigned long label_into_forcered_trap[]
unsigned long label_into_reg_trap[]
void stub_into_forcered(void)
unsigned long label_into_reg_fault[]
unsigned long label_into_red_fault[]
Sequence for into
.
Definition at line 143 of file main.c.
◆ user
Whether to run the stub in user or supervisor mode.
Definition at line 161 of file main.c.
◆ expectation
Expected %eip, vector and error code from the stub under test.