1 #ifndef _ASM_X86_DEBUGREG_H
2 #define _ASM_X86_DEBUGREG_H
6 #include <uapi/asm/debugreg.h>
8 DECLARE_PER_CPU(unsigned long, cpu_dr7
);
10 #ifndef CONFIG_PARAVIRT
12 * These special macros can be used to get or set a debugging register
14 #define get_debugreg(var, register) \
15 (var) = native_get_debugreg(register)
16 #define set_debugreg(value, register) \
17 native_set_debugreg(register, value)
20 static inline unsigned long native_get_debugreg(int regno
)
22 unsigned long val
= 0; /* Damn you, gcc! */
26 asm("mov %%db0, %0" :"=r" (val
));
29 asm("mov %%db1, %0" :"=r" (val
));
32 asm("mov %%db2, %0" :"=r" (val
));
35 asm("mov %%db3, %0" :"=r" (val
));
38 asm("mov %%db6, %0" :"=r" (val
));
41 asm("mov %%db7, %0" :"=r" (val
));
49 static inline void native_set_debugreg(int regno
, unsigned long value
)
53 asm("mov %0, %%db0" ::"r" (value
));
56 asm("mov %0, %%db1" ::"r" (value
));
59 asm("mov %0, %%db2" ::"r" (value
));
62 asm("mov %0, %%db3" ::"r" (value
));
65 asm("mov %0, %%db6" ::"r" (value
));
68 asm("mov %0, %%db7" ::"r" (value
));
75 static inline void hw_breakpoint_disable(void)
77 /* Zero the control register for HW Breakpoint */
80 /* Zero-out the individual HW breakpoint address registers */
87 static inline int hw_breakpoint_active(void)
89 return __this_cpu_read(cpu_dr7
) & DR_GLOBAL_ENABLE_MASK
;
92 extern void aout_dump_debugregs(struct user
*dump
);
94 extern void hw_breakpoint_restore(void);
97 DECLARE_PER_CPU(int, debug_stack_usage
);
98 static inline void debug_stack_usage_inc(void)
100 __get_cpu_var(debug_stack_usage
)++;
102 static inline void debug_stack_usage_dec(void)
104 __get_cpu_var(debug_stack_usage
)--;
106 int is_debug_stack(unsigned long addr
);
107 void debug_stack_set_zero(void);
108 void debug_stack_reset(void);
110 static inline int is_debug_stack(unsigned long addr
) { return 0; }
111 static inline void debug_stack_set_zero(void) { }
112 static inline void debug_stack_reset(void) { }
113 static inline void debug_stack_usage_inc(void) { }
114 static inline void debug_stack_usage_dec(void) { }
118 #endif /* _ASM_X86_DEBUGREG_H */