Xen Test Framework
Data Structures | Macros | Enumerations | Functions | Variables
main.c File Reference

Software Interrupt Emulation - Emulation of software interrupts. More...

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

Go to the source code of this file.

Data Structures

struct  insn
 

Macros

#define COND(_32, _64)   _64
 
#define EXINFO_TRAP   EXINFO_AVAIL0
 
#define TRAP(V)   EXINFO_SYM(V, 0) | EXINFO_TRAP
 
#define FAULT(V)   EXINFO_SYM(V, 0)
 
#define FAULT_EC(V, ...)   EXINFO_SYM(V, EXC_EC_SYM(__VA_ARGS__))
 

Enumerations

enum  mode { KERN , USER , KERN , USER }
 

Functions

bool ex_record_trap_eax (struct cpu_regs *regs, const struct extable_entry *ex)
 
void test_insn (enum mode user, const struct insn *insn, exinfo_t exp)
 
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...
 

Variables

const char test_title [] = "Software interrupt emulation"
 The title of the test. More...
 
const struct insn int3
 
const struct insn int_0x3
 
const struct insn icebp
 
const struct insn int_0x1
 
const struct insn into
 

Detailed Description

Software Interrupt Emulation - Emulation of software interrupts.

Definition in file main.c.

Macro Definition Documentation

◆ COND

#define COND (   _32,
  _64 
)    _64

Definition at line 56 of file main.c.

◆ EXINFO_TRAP

#define EXINFO_TRAP   EXINFO_AVAIL0

Definition at line 59 of file main.c.

◆ TRAP

#define TRAP (   V)    EXINFO_SYM(V, 0) | EXINFO_TRAP

Definition at line 197 of file main.c.

◆ FAULT

#define FAULT (   V)    EXINFO_SYM(V, 0)

Definition at line 198 of file main.c.

◆ FAULT_EC

#define FAULT_EC (   V,
  ... 
)    EXINFO_SYM(V, EXC_EC_SYM(__VA_ARGS__))

Definition at line 199 of file main.c.

Enumeration Type Documentation

◆ mode

enum mode
Enumerator
KERN 
USER 
KERN 
USER 

Definition at line 61 of file main.c.

Function Documentation

◆ ex_record_trap_eax()

bool ex_record_trap_eax ( struct cpu_regs *  regs,
const struct extable_entry ex 
)

Definition at line 63 of file main.c.

◆ test_insn()

void test_insn ( enum mode  user,
const struct insn insn,
exinfo_t  exp 
)

Definition at line 158 of file main.c.

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

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

+ Here is the caller graph for this function:

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

+ Here is the caller graph for this function:

◆ cpl3_tests()

void cpl3_tests ( void  )

Tests run in user mode.

Definition at line 202 of file main.c.

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

◆ cpl0_tests()

void cpl0_tests ( void  )

Tests run in supervisor mode.

Definition at line 241 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.

Todo:
Implement better command line infrastructure, but this will do for now.

Definition at line 266 of file main.c.

+ Here is the call graph for this function:

Variable Documentation

◆ test_title

const char test_title[] = "Software interrupt emulation"

The title of the test.

Definition at line 51 of file main.c.

◆ int3

const struct insn int3
Initial value:
= {
"int3",
{
},
{
},
}
unsigned long stub_int3(void)
unsigned long stub_user_int3_A(void)
unsigned long stub_user_int3_FA(void)
unsigned long stub_int3_FA(void)
unsigned long stub_user_int3(void)
unsigned long stub_int3_A(void)
unsigned long stub_int3_F(void)
unsigned long stub_user_int3_F(void)

Definition at line 78 of file main.c.

◆ int_0x3

const struct insn int_0x3
Initial value:
= {
"int $3",
{
},
{
},
}
unsigned long stub_int_0x3_A(void)
unsigned long stub_user_int_0x3_F(void)
unsigned long stub_int_0x3_FA(void)
unsigned long stub_user_int_0x3_A(void)
unsigned long stub_user_int_0x3_FA(void)
unsigned long stub_int_0x3(void)
unsigned long stub_int_0x3_F(void)
unsigned long stub_user_int_0x3(void)

Definition at line 94 of file main.c.

◆ icebp

const struct insn icebp
Initial value:
= {
"icebp",
{
},
{
},
}
unsigned long stub_user_icebp(void)
unsigned long stub_icebp_A(void)
unsigned long stub_user_icebp_A(void)
unsigned long stub_icebp(void)
unsigned long stub_user_icebp_FA(void)
unsigned long stub_icebp_F(void)
unsigned long stub_user_icebp_F(void)
unsigned long stub_icebp_FA(void)

Definition at line 110 of file main.c.

◆ int_0x1

const struct insn int_0x1
Initial value:
= {
"int $1",
{
},
{
},
}
unsigned long stub_int_0x1(void)
unsigned long stub_user_int_0x1_F(void)
unsigned long stub_int_0x1_F(void)
unsigned long stub_int_0x1_A(void)
unsigned long stub_user_int_0x1_A(void)
unsigned long stub_user_int_0x1_FA(void)
unsigned long stub_int_0x1_FA(void)
unsigned long stub_user_int_0x1(void)

Definition at line 126 of file main.c.

◆ into

const struct insn into
Initial value:
= {
"into",
{
},
{
},
}
unsigned long stub_user_into_FA(void)
unsigned long stub_into_F(void)
unsigned long stub_into_A(void)
unsigned long stub_into(void)
unsigned long stub_into_FA(void)
unsigned long stub_user_into_F(void)
unsigned long stub_user_into(void)
unsigned long stub_user_into_A(void)

Definition at line 142 of file main.c.