diff options
-rw-r--r-- | arch/x86/kernel/hw_breakpoint.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 92ea5aad0b5c..d42f65ac4927 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c | |||
@@ -59,22 +59,28 @@ static DEFINE_PER_CPU(unsigned long, cpu_debugreg[HBP_NUM]); | |||
59 | static DEFINE_PER_CPU(struct perf_event *, bp_per_reg[HBP_NUM]); | 59 | static DEFINE_PER_CPU(struct perf_event *, bp_per_reg[HBP_NUM]); |
60 | 60 | ||
61 | 61 | ||
62 | /* | 62 | static inline unsigned long |
63 | * Encode the length, type, Exact, and Enable bits for a particular breakpoint | 63 | __encode_dr7(int drnum, unsigned int len, unsigned int type) |
64 | * as stored in debug register 7. | ||
65 | */ | ||
66 | unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type) | ||
67 | { | 64 | { |
68 | unsigned long bp_info; | 65 | unsigned long bp_info; |
69 | 66 | ||
70 | bp_info = (len | type) & 0xf; | 67 | bp_info = (len | type) & 0xf; |
71 | bp_info <<= (DR_CONTROL_SHIFT + drnum * DR_CONTROL_SIZE); | 68 | bp_info <<= (DR_CONTROL_SHIFT + drnum * DR_CONTROL_SIZE); |
72 | bp_info |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE)) | | 69 | bp_info |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE)); |
73 | DR_GLOBAL_SLOWDOWN; | 70 | |
74 | return bp_info; | 71 | return bp_info; |
75 | } | 72 | } |
76 | 73 | ||
77 | /* | 74 | /* |
75 | * Encode the length, type, Exact, and Enable bits for a particular breakpoint | ||
76 | * as stored in debug register 7. | ||
77 | */ | ||
78 | unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type) | ||
79 | { | ||
80 | return __encode_dr7(drnum, len, type) | DR_GLOBAL_SLOWDOWN; | ||
81 | } | ||
82 | |||
83 | /* | ||
78 | * Decode the length and type bits for a particular breakpoint as | 84 | * Decode the length and type bits for a particular breakpoint as |
79 | * stored in debug register 7. Return the "enabled" status. | 85 | * stored in debug register 7. Return the "enabled" status. |
80 | */ | 86 | */ |
@@ -154,7 +160,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp) | |||
154 | return; | 160 | return; |
155 | 161 | ||
156 | dr7 = &__get_cpu_var(cpu_dr7); | 162 | dr7 = &__get_cpu_var(cpu_dr7); |
157 | *dr7 &= ~encode_dr7(i, info->len, info->type); | 163 | *dr7 &= ~__encode_dr7(i, info->len, info->type); |
158 | 164 | ||
159 | set_debugreg(*dr7, 7); | 165 | set_debugreg(*dr7, 7); |
160 | } | 166 | } |