Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169801
b: refs/heads/master
c: 2c31b79
h: refs/heads/master
i:
  169799: f802763
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Nov 26, 2009
1 parent 324b07b commit 9da1807
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 605bfaee9078cd0b01d83402315389839ee4bb5c
refs/heads/master: 2c31b7958fd21df9fa04e5c36cda0f063ac70b27
22 changes: 14 additions & 8 deletions trunk/arch/x86/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,27 @@ static DEFINE_PER_CPU(unsigned long, cpu_debugreg[HBP_NUM]);
static DEFINE_PER_CPU(struct perf_event *, bp_per_reg[HBP_NUM]);


/*
* Encode the length, type, Exact, and Enable bits for a particular breakpoint
* as stored in debug register 7.
*/
unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type)
static inline unsigned long
__encode_dr7(int drnum, unsigned int len, unsigned int type)
{
unsigned long bp_info;

bp_info = (len | type) & 0xf;
bp_info <<= (DR_CONTROL_SHIFT + drnum * DR_CONTROL_SIZE);
bp_info |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE)) |
DR_GLOBAL_SLOWDOWN;
bp_info |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE));

return bp_info;
}

/*
* Encode the length, type, Exact, and Enable bits for a particular breakpoint
* as stored in debug register 7.
*/
unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type)
{
return __encode_dr7(drnum, len, type) | DR_GLOBAL_SLOWDOWN;
}

/*
* Decode the length and type bits for a particular breakpoint as
* stored in debug register 7. Return the "enabled" status.
Expand Down Expand Up @@ -154,7 +160,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
return;

dr7 = &__get_cpu_var(cpu_dr7);
*dr7 &= ~encode_dr7(i, info->len, info->type);
*dr7 &= ~__encode_dr7(i, info->len, info->type);

set_debugreg(*dr7, 7);
}
Expand Down

0 comments on commit 9da1807

Please sign in to comment.