diff options
author | Dongdong Deng <dongdong.deng@windriver.com> | 2010-08-05 10:22:25 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-08-05 10:22:25 -0400 |
commit | df4939350b345ebb44937902827aa75b8ad4998c (patch) | |
tree | eac83368c659160c6e4bd919abc2fe8a7f9edd77 | |
parent | 7aeb48b70b077375cdd2fe22f7a8b63ed6a98f25 (diff) |
kgdb,x86: use macro HBP_NUM to replace magic number 4
Use the macros provided by the HW breakpoint API.
Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
-rw-r--r-- | arch/x86/kernel/kgdb.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index a8b80979ceb8..ef10940e1af0 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -195,7 +195,7 @@ static struct hw_breakpoint { | |||
195 | int len; | 195 | int len; |
196 | int type; | 196 | int type; |
197 | struct perf_event **pev; | 197 | struct perf_event **pev; |
198 | } breakinfo[4]; | 198 | } breakinfo[HBP_NUM]; |
199 | 199 | ||
200 | static unsigned long early_dr7; | 200 | static unsigned long early_dr7; |
201 | 201 | ||
@@ -203,7 +203,7 @@ static void kgdb_correct_hw_break(void) | |||
203 | { | 203 | { |
204 | int breakno; | 204 | int breakno; |
205 | 205 | ||
206 | for (breakno = 0; breakno < 4; breakno++) { | 206 | for (breakno = 0; breakno < HBP_NUM; breakno++) { |
207 | struct perf_event *bp; | 207 | struct perf_event *bp; |
208 | struct arch_hw_breakpoint *info; | 208 | struct arch_hw_breakpoint *info; |
209 | int val; | 209 | int val; |
@@ -290,10 +290,10 @@ kgdb_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype) | |||
290 | { | 290 | { |
291 | int i; | 291 | int i; |
292 | 292 | ||
293 | for (i = 0; i < 4; i++) | 293 | for (i = 0; i < HBP_NUM; i++) |
294 | if (breakinfo[i].addr == addr && breakinfo[i].enabled) | 294 | if (breakinfo[i].addr == addr && breakinfo[i].enabled) |
295 | break; | 295 | break; |
296 | if (i == 4) | 296 | if (i == HBP_NUM) |
297 | return -1; | 297 | return -1; |
298 | 298 | ||
299 | if (hw_break_release_slot(i)) { | 299 | if (hw_break_release_slot(i)) { |
@@ -311,7 +311,7 @@ static void kgdb_remove_all_hw_break(void) | |||
311 | int cpu = raw_smp_processor_id(); | 311 | int cpu = raw_smp_processor_id(); |
312 | struct perf_event *bp; | 312 | struct perf_event *bp; |
313 | 313 | ||
314 | for (i = 0; i < 4; i++) { | 314 | for (i = 0; i < HBP_NUM; i++) { |
315 | if (!breakinfo[i].enabled) | 315 | if (!breakinfo[i].enabled) |
316 | continue; | 316 | continue; |
317 | bp = *per_cpu_ptr(breakinfo[i].pev, cpu); | 317 | bp = *per_cpu_ptr(breakinfo[i].pev, cpu); |
@@ -331,10 +331,10 @@ kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype) | |||
331 | { | 331 | { |
332 | int i; | 332 | int i; |
333 | 333 | ||
334 | for (i = 0; i < 4; i++) | 334 | for (i = 0; i < HBP_NUM; i++) |
335 | if (!breakinfo[i].enabled) | 335 | if (!breakinfo[i].enabled) |
336 | break; | 336 | break; |
337 | if (i == 4) | 337 | if (i == HBP_NUM) |
338 | return -1; | 338 | return -1; |
339 | 339 | ||
340 | switch (bptype) { | 340 | switch (bptype) { |
@@ -395,7 +395,7 @@ void kgdb_disable_hw_debug(struct pt_regs *regs) | |||
395 | 395 | ||
396 | /* Disable hardware debugging while we are in kgdb: */ | 396 | /* Disable hardware debugging while we are in kgdb: */ |
397 | set_debugreg(0UL, 7); | 397 | set_debugreg(0UL, 7); |
398 | for (i = 0; i < 4; i++) { | 398 | for (i = 0; i < HBP_NUM; i++) { |
399 | if (!breakinfo[i].enabled) | 399 | if (!breakinfo[i].enabled) |
400 | continue; | 400 | continue; |
401 | if (dbg_is_early) { | 401 | if (dbg_is_early) { |
@@ -640,7 +640,7 @@ void kgdb_arch_late(void) | |||
640 | attr.bp_len = HW_BREAKPOINT_LEN_1; | 640 | attr.bp_len = HW_BREAKPOINT_LEN_1; |
641 | attr.bp_type = HW_BREAKPOINT_W; | 641 | attr.bp_type = HW_BREAKPOINT_W; |
642 | attr.disabled = 1; | 642 | attr.disabled = 1; |
643 | for (i = 0; i < 4; i++) { | 643 | for (i = 0; i < HBP_NUM; i++) { |
644 | if (breakinfo[i].pev) | 644 | if (breakinfo[i].pev) |
645 | continue; | 645 | continue; |
646 | breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL); | 646 | breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL); |