7#ifndef XTF_X86_DBG_REG_H
8#define XTF_X86_DBG_REG_H
15#define X86_DR6_B0 (1u << 0)
16#define X86_DR6_B1 (1u << 1)
17#define X86_DR6_B2 (1u << 2)
18#define X86_DR6_B3 (1u << 3)
19#define X86_DR6_BD (1u << 13)
20#define X86_DR6_BS (1u << 14)
21#define X86_DR6_BT (1u << 15)
22#define X86_DR6_RTM (1u << 16)
24#define X86_DR6_DEFAULT 0xffff0ff0
29#define X86_DR7_LE (1u << 8)
30#define X86_DR7_GE (1u << 9)
31#define X86_DR7_RTM (1u << 11)
32#define X86_DR7_GD (1u << 13)
34#define X86_DR7_DEFAULT 0x00000400
39#define X86_DR7_0_L (1u << 0)
40#define X86_DR7_1_L (1u << 2)
41#define X86_DR7_2_L (1u << 4)
42#define X86_DR7_3_L (1u << 6)
44#define X86_DR7_0_G (1u << 1)
45#define X86_DR7_1_G (1u << 3)
46#define X86_DR7_2_G (1u << 5)
47#define X86_DR7_3_G (1u << 7)
49#define X86_DR7_0_X (0u << 16)
50#define X86_DR7_0_W (1u << 16)
51#define X86_DR7_0_IO (2u << 16)
52#define X86_DR7_0_RW (3u << 16)
54#define X86_DR7_0_8 (0u << 18)
55#define X86_DR7_0_16 (1u << 18)
56#define X86_DR7_0_64 (2u << 18)
57#define X86_DR7_0_32 (3u << 18)
59#define X86_DR7_1_X (0u << 20)
60#define X86_DR7_1_W (1u << 20)
61#define X86_DR7_1_IO (2u << 20)
62#define X86_DR7_1_RW (3u << 20)
64#define X86_DR7_1_8 (0u << 22)
65#define X86_DR7_1_16 (1u << 22)
66#define X86_DR7_1_64 (2u << 22)
67#define X86_DR7_1_32 (3u << 22)
69#define X86_DR7_2_X (0u << 24)
70#define X86_DR7_2_W (1u << 24)
71#define X86_DR7_2_IO (2u << 24)
72#define X86_DR7_2_RW (3u << 24)
74#define X86_DR7_2_8 (0u << 26)
75#define X86_DR7_2_16 (1u << 26)
76#define X86_DR7_2_64 (2u << 26)
77#define X86_DR7_2_32 (3u << 26)
79#define X86_DR7_3_X (0u << 28)
80#define X86_DR7_3_W (1u << 28)
81#define X86_DR7_3_IO (2u << 28)
82#define X86_DR7_3_RW (3u << 28)
84#define X86_DR7_3_8 (0u << 30)
85#define X86_DR7_3_16 (1u << 30)
86#define X86_DR7_3_64 (2u << 30)
87#define X86_DR7_3_32 (3u << 30)
100#define DR7_SYM(bp, ...) TOK_OR(X86_DR7_ ## bp ## _, ##__VA_ARGS__)
106 asm volatile (
"mov %%dr0, %0" :
"=r" (val));
113 asm volatile (
"mov %0, %%dr0" ::
"r" (linear));
120 asm volatile (
"mov %%dr1, %0" :
"=r" (val));
127 asm volatile (
"mov %0, %%dr1" ::
"r" (linear));
134 asm volatile (
"mov %%dr2, %0" :
"=r" (val));
141 asm volatile (
"mov %0, %%dr2" ::
"r" (linear));
148 asm volatile (
"mov %%dr3, %0" :
"=r" (val));
155 asm volatile (
"mov %0, %%dr3" ::
"r" (linear));
162 asm volatile (
"mov %%dr6, %0" :
"=r" (val));
169 asm volatile (
"mov %0, %%dr6" ::
"r" (val));
176 asm volatile (
"mov %%dr7, %0" :
"=r" (val));
183 asm volatile (
"mov %0, %%dr7" ::
"r" (val));
Varadic macro helpers - Here be many dragons.
static unsigned long read_dr3(void)
static void write_dr0(unsigned long linear)
static unsigned long read_dr6(void)
static unsigned long read_dr7(void)
static void write_dr1(unsigned long linear)
static void write_dr3(unsigned long linear)
static unsigned long read_dr1(void)
static void write_dr7(unsigned long val)
static void write_dr2(unsigned long linear)
static unsigned long read_dr2(void)
static void write_dr6(unsigned long val)
static unsigned long read_dr0(void)