73 "jmp exit_NMI_task;");
89 .cr3 =
_u(cr3_target),
98 unsigned int curr_ts =
str();
100 xtf_failure(
"Fail: Running NMI handler with unexpected %%tr\n"
101 " Expected %04x, got %04x\n",
GDTE_AVAIL0 * 8, curr_ts);
106 printk(
" NMI at %04x:%p, stack %04x:%p\n",
107 t->cs,
_p(t->eip), t->ss,
_p(t->esp));
119 unsigned int curr_ts;
123 return xtf_error(
"Error: Unable to set up xapic mode: %d\n", rc);
141 printk(
"First self-nmi, from supervisor mode\n");
144 if ( (curr_ts =
str()) != TSS_SEL )
145 xtf_failure(
"Fail: Running main task with unexpected %%tr\n"
146 " Expected %04x, got %04x\n", TSS_SEL, curr_ts);
152 printk(
"Second self-nmi, from user mode\n");
155 if ( (curr_ts =
str()) != TSS_SEL )
156 xtf_failure(
"Fail: Running main task with unexpected %%tr\n"
157 " Expected %04x, got %04x\n", TSS_SEL, curr_ts);
int apic_init(enum apic_mode mode)
Discover and initialise the local APIC to the requested mode.
#define APIC_DEFAULT_BASE
static void apic_mmio_icr_write(uint64_t val)
static unsigned int str(void)
#define __page_aligned_bss
void printk(const char *fmt,...)
void test_main(void)
To be implemented by each test, as its entry point.
const char test_title[]
The title of the test.
static void pack_tss_desc(user_desc *d, const env_tss *t)
user_desc gdt[NR_GDT_ENTRIES]
static unsigned long user_desc_base(const user_desc *d)
static void exec_user_void(void(*fn)(void))
#define STR(x)
Stringise an expression, expanding preprocessor tokens.
static uint8_t nmi_stack[PAGE_SIZE]
static void user_inject_nmi(void)
void entry_NMI_task(void)
bool do_unhandled_exception(struct cpu_regs *regs)
May be implemented by a guest to provide custom exception handling.
#define _p(v)
Express an abitrary integer v as void *.
#define _u(v)
Express an arbitrary value v as unsigned long.
void xtf_failure(const char *fmt,...)
Report a test failure.
void xtf_error(const char *fmt,...)
Report a test error.
void xtf_success(const char *fmt,...)
Report test success.
static void pack_task_gate(env_gate *g, unsigned int selector)
#define X86_TSS_INVALID_IO_BITMAP