Xen Test Framework
Functions | Variables
main.c File Reference

NMI Taskswitch with increasing privilege More...

#include <xtf.h>
+ Include dependency graph for main.c:

Go to the source code of this file.

Functions

void entry_NMI_task (void)
 
 asm ("exit_NMI_task:" "iretl;" "entry_NMI_task:;" "push $0;" "push $" STR(X86_EXC_NMI) ";" "push %es;" "push %ds;" "push %edi;" "push %esi;" "push %edx;" "push %ecx;" "push %eax;" "push %ebx;" "push %ebp;" "push %esp;" "call do_exception;" "add $1*4, %esp;" "pop %ebp;" "pop %ebx;" "pop %eax;" "pop %ecx;" "pop %edx;" "pop %esi;" "pop %edi;" "pop %ds;" "pop %es;" "add $2*4, %esp;" "jmp exit_NMI_task;")
 
bool do_unhandled_exception (struct cpu_regs *regs)
 May be implemented by a guest to provide custom exception handling. More...
 
static void user_inject_nmi (void)
 
void test_main (void)
 To be implemented by each test, as its entry point. More...
 

Variables

const char test_title [] = "Test nmi-taskswitch-priv"
 The title of the test. More...
 
bool test_wants_user_mappings = true
 Boolean indicating whether the test wants user mappings or not. More...
 
static uint8_t nmi_stack [PAGE_SIZE]
 
static env_tss nmi_tss
 

Detailed Description

NMI Taskswitch with increasing privilege

Definition in file main.c.

Function Documentation

◆ entry_NMI_task()

void entry_NMI_task ( void  )

◆ asm()

asm ( "exit_NMI_task:" "iretl;" "entry_NMI_task:;" "push $0;" "push $" STR(X86_EXC_NMI) ";" "push %es;" "push %ds;" "push %edi;" "push %esi;" "push %edx;" "push %ecx;" "push %eax;" "push %ebx;" "push %ebp;" "push %esp;" "call do_exception;" "add $1*  4,
%esp;" "pop %ebp;" "pop %ebx;" "pop %eax;" "pop %ecx;" "pop %edx;" "pop %esi;" "pop %edi;" "pop %ds;" "pop %es;" "add $2 *  4,
%esp;" "jmp exit_NMI_task;"   
)

◆ do_unhandled_exception()

bool do_unhandled_exception ( struct cpu_regs *  regs)

May be implemented by a guest to provide custom exception handling.

Definition at line 96 of file main.c.

+ Here is the call graph for this function:

◆ user_inject_nmi()

static void user_inject_nmi ( void  )
static

Definition at line 115 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_main()

void test_main ( void  )

To be implemented by each test, as its entry point.

Definition at line 120 of file main.c.

+ Here is the call graph for this function:

Variable Documentation

◆ test_title

const char test_title[] = "Test nmi-taskswitch-priv"

The title of the test.

Definition at line 34 of file main.c.

◆ test_wants_user_mappings

bool test_wants_user_mappings = true

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 36 of file main.c.

◆ nmi_stack

uint8_t nmi_stack[PAGE_SIZE]
static

Definition at line 38 of file main.c.

◆ nmi_tss

env_tss nmi_tss
static
Initial value:
=
{
.eip = _u(entry_NMI_task),
.cs = __KERN_CS,
.eflags = X86_EFLAGS_MBS,
.esp = _u(nmi_stack + PAGE_SIZE),
.ss = __KERN_DS,
.ds = __USER_DS,
.es = __USER_DS,
.fs = __USER_DS,
.gs = __USER_DS,
.cr3 = _u(cr3_target),
}
#define X86_EFLAGS_MBS
Definition: processor.h:8
#define _u(v)
Express an arbitrary value v as unsigned long.
Definition: numbers.h:53
static uint8_t nmi_stack[PAGE_SIZE]
Definition: main.c:38
#define X86_TSS_INVALID_IO_BITMAP
Definition: x86-tss.h:66
void entry_NMI_task(void)
#define PAGE_SIZE
Definition: page.h:11

Definition at line 79 of file main.c.