11 #define DR_LOCAL_ENABLE_SHIFT 0
12 #define DR_GLOBAL_ENABLE_SHIFT 1
13 #define DR_ENABLE_SIZE 2
20 #define DR_CONTROL_RESERVED (0xFC00)
22 #define I386_DR_CONTROL_MASK (~DR_CONTROL_RESERVED)
24 #define DR_LOCAL_SLOWDOWN (0x100)
25 #define DR_GLOBAL_SLOWDOWN (0x200)
29 #define DR_CONTROL_SHIFT 16
31 #define DR_CONTROL_SIZE 4
33 #define DR_RW_EXECUTE (0x0)
34 #define DR_RW_WRITE (0x1)
35 #define DR_RW_IORW (0x2)
36 #define DR_RW_READ (0x3)
46 #define DR_LEN_1 (0 << 2)
47 #define DR_LEN_2 (1 << 2)
48 #define DR_LEN_4 (3 << 2)
49 #define DR_LEN_8 (2 << 2)
51 #define I386_DR_CONTROL_MASK (~DR_CONTROL_RESERVED)
54 #define I386_DR_VACANT(control, i) \
55 ((control & (3 << (DR_ENABLE_SIZE * (i)))) == 0)
57 #define I386_DR_LOCAL_ENABLE(control, i) \
58 control |= (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i)))
59 #define I386_DR_GLOBAL_ENABLE(control, i) \
60 control |= (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i)))
62 #define I386_DR_IS_LOCAL_ENABLED(control, i) \
63 (control & (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))))
65 #define I386_DR_IS_ENABLED(control, i) \
66 control &(3 << (DR_ENABLE_SIZE * (i)))
68 #define I386_DR_ENABLE(control, i) \
69 control |= (3 << (DR_ENABLE_SIZE * (i)))
70 #define I386_DR_DISABLE(control, i) \
71 control &= ~(3 << (DR_ENABLE_SIZE * (i)))
73 #define I386_DR_SET_RW_LEN(control, i, rwlen) \
75 control &= ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
76 control |= ((rwlen) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
78 #define I386_DR_GET_RW_LEN(control, i) \
79 ((control >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f)
90 case 1: rwx = 0;
break;
91 case 2: rwx = 1;
break;
92 case 4: rwx = 3;
break;
97 case 1:
len = 0;
break;
98 case 2:
len = 1 << 2;
break;
99 case 4:
len = 3 << 2;
break;
100 case 8:
len = 2 << 2;
break;
109 eprintf(
"Invalid DRX length (%d) must be 1, 2, 4, 8 bytes\n",
len);
139 default: *
len = 0;
break;
153 for (
i = 0;
i < 4;
i++) {
163 int i, rwx,
len,
g, en;
165 for (
i = 0;
i < 8;
i++) {
166 if (
i == 4 ||
i == 5) {
169 rwx =
len =
g = en = 0;
171 if (
addr == at_addr) {
180 int i, rwx,
len,
g, en;
181 for (
i = 0;
i < 8;
i++) {
182 if (
i == 4 ||
i == 5) {
185 rwx =
len =
g = en = 0;
188 en ?
'*' :
'-',
i,
g ?
'G' :
'L',
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
RZ_API int rz_debug_reg_sync(RzDebug *dbg, int type, int write)
#define I386_DR_ENABLE(control, i)
int drx_get_at(drxt *drx, ut64 at_addr)
bool drx_add(RzDebug *dbg, RzBreakpoint *bp, RzBreakpointItem *b)
#define I386_DR_SET_RW_LEN(control, i, rwlen)
#define I386_DR_DISABLE(control, i)
void drx_enable(drxt *r, int n, int enabled)
#define I386_DR_GET_RW_LEN(control, i)
#define I386_DR_LOCAL_ENABLE(control, i)
ut64 drx_get(drxt *drx, int n, int *rwx, int *len, int *global, int *enabled)
#define I386_DR_GLOBAL_ENABLE(control, i)
#define I386_DR_CONTROL_MASK
bool drx_del(RzDebug *dbg, RzBreakpoint *bp, RzBreakpointItem *b)
int drx_set(drxt *drx, int n, ut64 addr, int len, int rwx, int global)
#define I386_DR_IS_ENABLED(control, i)
#define I386_DR_IS_LOCAL_ENABLED(control, i)
return memset(p, 0, total)
RZ_API int rz_debug_drx_set(RzDebug *dbg, int idx, ut64 addr, int len, int rwx, int g)
RZ_API int rz_debug_drx_unset(RzDebug *dbg, int idx)
int main(int argc, char **argv)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()