aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/kernel/kprobes.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-11-27 07:50:45 -0500
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2008-01-25 02:31:39 -0500
commit13b54a50525a9685065684e1e11258d27dd27bdf (patch)
tree5cc2dbceb4efff1810e5425617ce9bc850e1e8cb /arch/avr32/kernel/kprobes.c
parent6ea6dd93c9454cc9521134f907bc970d09f460e4 (diff)
[AVR32] Enable debugging only when needed
Keep track of processes being debugged (including the kernel itself) and turn the OCD system on and off as appropriate. Since enabling debugging turns off some optimizations in the CPU core, this fixes the issue that enabling KProbes support or simply running a program under gdbserver will reduce system performance significantly until the next reboot. The CPU performance will still be reduced for all processes while a process is being debugged, but this is a lot better than reducing the performance forever. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/kernel/kprobes.c')
-rw-r--r--arch/avr32/kernel/kprobes.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/avr32/kernel/kprobes.c b/arch/avr32/kernel/kprobes.c
index 799ba89b07a8..f820e9f25520 100644
--- a/arch/avr32/kernel/kprobes.c
+++ b/arch/avr32/kernel/kprobes.c
@@ -48,6 +48,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
48void __kprobes arch_arm_kprobe(struct kprobe *p) 48void __kprobes arch_arm_kprobe(struct kprobe *p)
49{ 49{
50 pr_debug("arming kprobe at %p\n", p->addr); 50 pr_debug("arming kprobe at %p\n", p->addr);
51 ocd_enable(NULL);
51 *p->addr = BREAKPOINT_INSTRUCTION; 52 *p->addr = BREAKPOINT_INSTRUCTION;
52 flush_icache_range((unsigned long)p->addr, 53 flush_icache_range((unsigned long)p->addr,
53 (unsigned long)p->addr + sizeof(kprobe_opcode_t)); 54 (unsigned long)p->addr + sizeof(kprobe_opcode_t));
@@ -56,6 +57,7 @@ void __kprobes arch_arm_kprobe(struct kprobe *p)
56void __kprobes arch_disarm_kprobe(struct kprobe *p) 57void __kprobes arch_disarm_kprobe(struct kprobe *p)
57{ 58{
58 pr_debug("disarming kprobe at %p\n", p->addr); 59 pr_debug("disarming kprobe at %p\n", p->addr);
60 ocd_disable(NULL);
59 *p->addr = p->opcode; 61 *p->addr = p->opcode;
60 flush_icache_range((unsigned long)p->addr, 62 flush_icache_range((unsigned long)p->addr,
61 (unsigned long)p->addr + sizeof(kprobe_opcode_t)); 63 (unsigned long)p->addr + sizeof(kprobe_opcode_t));
@@ -260,9 +262,6 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
260 262
261int __init arch_init_kprobes(void) 263int __init arch_init_kprobes(void)
262{ 264{
263 printk("KPROBES: Enabling monitor mode (MM|DBE)...\n");
264 ocd_write(DC, (1 << OCD_DC_MM_BIT) | (1 << OCD_DC_DBE_BIT));
265
266 /* TODO: Register kretprobe trampoline */ 265 /* TODO: Register kretprobe trampoline */
267 return 0; 266 return 0;
268} 267}