33#define TEST_APIC_MODE APIC_MODE_XAPIC
76 "jmp exit_NMI_task;");
92 .cr3 =
_u(cr3_target),
101 unsigned int curr_ts =
str();
103 xtf_failure(
"Fail: Running NMI handler with unexpected %%tr\n"
104 " Expected %04x, got %04x\n",
GDTE_AVAIL0 * 8, curr_ts);
109 printk(
" NMI at %04x:%p, stack %04x:%p\n",
110 t->cs,
_p(t->eip), t->ss,
_p(t->esp));
122 unsigned int curr_ts;
126 return xtf_error(
"Error: Unable to set up xapic mode: %d\n", rc);
144 printk(
"First self-nmi, from supervisor mode\n");
147 if ( (curr_ts =
str()) != TSS_SEL )
148 xtf_failure(
"Fail: Running main task with unexpected %%tr\n"
149 " Expected %04x, got %04x\n", TSS_SEL, curr_ts);
155 printk(
"Second self-nmi, from user mode\n");
158 if ( (curr_ts =
str()) != TSS_SEL )
159 xtf_failure(
"Fail: Running main task with unexpected %%tr\n"
160 " 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_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