00001 #ifndef _LINUX_DEBUGREG_H 00002 #define _LINUX_DEBUGREG_H 00003 00004 00005 /** 00006 * 00007 Indicate the register numbers for a number of the specific 00008 00009 00010 */ 00011 #define DR_FIRSTADDR 0 ///< u_debugreg[DR_FIRSTADDR] 00012 #define DR_LASTADDR 3 ///< u_debugreg[DR_LASTADDR] 00013 00014 #define DR_STATUS 6 ///< u_debugreg[DR_STATUS] 00015 #define DR_CONTROL 7 ///< u_debugreg[DR_CONTROL] 00016 00017 /** 00018 * 00019 Define a few things for the status register. We can use this to determine 00020 which debugging register was responsible for the trap. The other bits 00021 00022 00023 */ 00024 00025 #define DR_TRAP0 (0x1) ///< Trap due to db0 00026 #define DR_TRAP1 (0x2) ///< Trap due to db1 00027 #define DR_TRAP2 (0x4) ///< Trap due to db2 00028 #define DR_TRAP3 (0x8) ///< Trap due to db3 00029 00030 /** 00031 * 00032 Now define a bunch of things for manipulating the control register. 00033 The top two bytes of the control register consist of 4 fields of 4 00034 bytes - each field corresponds to one of the four debug registers, 00035 and indicates what types of access we trap on, and how large the data 00036 00037 00038 */ 00039 00040 #define DR_CONTROL_SHIFT 16 ///< Skip this many bits in ctl register 00041 #define DR_CONTROL_SIZE 4 ///< 4 control bits per register 00042 00043 #define DR_RW_EXECUTE (0x0) ///< Settings for the access types to trap on 00044 #define DR_RW_WRITE (0x1) 00045 #define DR_RW_READ (0x3) 00046 00047 #define DR_LEN_1 (0x0) ///< Settings for data length to trap on 00048 #define DR_LEN_2 (0x4) 00049 #define DR_LEN_4 (0xC) 00050 00051 /** 00052 * 00053 The low byte to the control register determine which registers are 00054 enabled. There are 4 fields of two bits. One bit is "local", meaning 00055 that the processor will reset the bit after a task switch and the other 00056 is global meaning that we have to explicitly reset the bit. With linux, 00057 you can use either one, since we explicitly zero the register when we enter 00058 00059 00060 */ 00061 00062 #define DR_LOCAL_ENABLE_SHIFT 0 ///< Extra shift to the local enable bit 00063 #define DR_GLOBAL_ENABLE_SHIFT 1 ///< Extra shift to the global enable bit 00064 #define DR_ENABLE_SIZE 2 ///< 2 enable bits per register 00065 00066 #define DR_LOCAL_ENABLE_MASK (0x55) ///< Set local bits for all 4 regs 00067 #define DR_GLOBAL_ENABLE_MASK (0xAA) ///< Set global bits for all 4 regs 00068 00069 /** 00070 * 00071 The second byte to the control register has a few special things. 00072 We can slow the instruction pipeline for instructions coming via the 00073 00074 00075 */ 00076 00077 #define DR_CONTROL_RESERVED (0xFC00) ///< Reserved by Intel 00078 #define DR_LOCAL_SLOWDOWN (0x100) ///< Local slow the pipeline 00079 #define DR_GLOBAL_SLOWDOWN (0x200) ///< Global slow the pipeline 00080 00081 #endif
1.4.6-5