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