/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_ASM_X86_DEBUGREG_H #define _UAPI_ASM_X86_DEBUGREG_H /* Indicate the register numbers for a number of the specific debug registers. Registers 0-3 contain the addresses we wish to trap on */ #define DR_FIRSTADDR … #define DR_LASTADDR … #define DR_STATUS … #define DR_CONTROL … /* Define a few things for the status register. We can use this to determine which debugging register was responsible for the trap. The other bits are either reserved or not of interest to us. */ /* Define reserved bits in DR6 which are always set to 1 */ #define DR6_RESERVED … #define DR_TRAP0 … #define DR_TRAP1 … #define DR_TRAP2 … #define DR_TRAP3 … #define DR_TRAP_BITS … #define DR_BUS_LOCK … #define DR_STEP … #define DR_SWITCH … /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 bits - each field corresponds to one of the four debug registers, and indicates what types of access we trap on, and how large the data field is that we are looking at */ #define DR_CONTROL_SHIFT … #define DR_CONTROL_SIZE … #define DR_RW_EXECUTE … #define DR_RW_WRITE … #define DR_RW_READ … #define DR_LEN_1 … #define DR_LEN_2 … #define DR_LEN_4 … #define DR_LEN_8 … /* The low byte to the control register determine which registers are enabled. There are 4 fields of two bits. One bit is "local", meaning that the processor will reset the bit after a task switch and the other is global meaning that we have to explicitly reset the bit. With linux, you can use either one, since we explicitly zero the register when we enter kernel mode. */ #define DR_LOCAL_ENABLE_SHIFT … #define DR_GLOBAL_ENABLE_SHIFT … #define DR_LOCAL_ENABLE … #define DR_GLOBAL_ENABLE … #define DR_ENABLE_SIZE … #define DR_LOCAL_ENABLE_MASK … #define DR_GLOBAL_ENABLE_MASK … /* The second byte to the control register has a few special things. We can slow the instruction pipeline for instructions coming via the gdt or the ldt if we want to. I am not sure why this is an advantage */ #ifdef __i386__ #define DR_CONTROL_RESERVED … #else #define DR_CONTROL_RESERVED … #endif #define DR_LOCAL_SLOWDOWN … #define DR_GLOBAL_SLOWDOWN … /* * HW breakpoint additions */ #endif /* _UAPI_ASM_X86_DEBUGREG_H */