46static void check_init_dr(
unsigned int dr,
unsigned long exp,
unsigned long got)
50 dr,
_p(exp),
_p(got));
62 printk(
"Test initial debug state\n");
65 xtf_failure(
" Fail: %%cr4.de expected to be clear\n");
92 unsigned int dummy, i;
95 printk(
"Test PV %%dr7 latch\n");
109 for ( i = 0; i < 10; ++i )
113 asm volatile (
"mov %[dr7], %%dr7;"
114 "movl $0, %[ptr]; 1:"
126 xtf_failure(
" Fail: Single write to %%dr7 failed to latch\n");
131 xtf_error(
" Error: Unexpected fault %#x, %pe\n",
147 unsigned long io0, io1, dr7, cr4 =
read_cr4();
149 printk(
"Test PV %%dr7 IO breakpoints\n");
179 asm volatile (
"1: mov %[val], %%dr7; 2:"
186 xtf_error(
"Error: Unexpected fault %pe\n",
_p(fault));
bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %eax.
static unsigned long read_cr4(void)
static void write_cr4(unsigned long cr4)
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 test_pv_dr7_latch(void)
static void check_init_msr(const char *name, uint64_t exp, uint64_t got)
static void test_pv_dr7_io_breakpoints(void)
static void check_init_dr(unsigned int dr, unsigned long exp, unsigned long got)
static void test_initial_debug_state(void)
#define EXINFO_SYM(exc, ec)
unsigned int exinfo_t
Packed exception and error code information.
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
#define IS_DEFINED(x)
Evalute whether the CONFIG_ token x is defined.
#define MSR_DR0_ADDR_MASK
#define MSR_DR2_ADDR_MASK
#define MSR_DR1_ADDR_MASK
#define MSR_DR3_ADDR_MASK
static uint64_t rdmsr(uint32_t idx)
Thin wrapper around an rdmsr instruction.
#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 unsigned long read_dr3(void)
static void write_dr0(unsigned long linear)
static unsigned long read_dr6(void)
#define DR7_SYM(bp,...)
Create a partial %dr7 setting for a particular breakpoint based on mnemonics.
static unsigned long read_dr7(void)
static unsigned long read_dr1(void)
static void write_dr7(unsigned long val)
static unsigned long read_dr2(void)
static void write_dr6(unsigned long val)
static unsigned long read_dr0(void)