diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2007-11-27 07:50:45 -0500 |
---|---|---|
committer | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2008-01-25 02:31:39 -0500 |
commit | 13b54a50525a9685065684e1e11258d27dd27bdf (patch) | |
tree | 5cc2dbceb4efff1810e5425617ce9bc850e1e8cb /include/asm-avr32 | |
parent | 6ea6dd93c9454cc9521134f907bc970d09f460e4 (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 'include/asm-avr32')
-rw-r--r-- | include/asm-avr32/ocd.h | 5 | ||||
-rw-r--r-- | include/asm-avr32/ptrace.h | 13 | ||||
-rw-r--r-- | include/asm-avr32/thread_info.h | 1 |
3 files changed, 15 insertions, 4 deletions
diff --git a/include/asm-avr32/ocd.h b/include/asm-avr32/ocd.h index 996405e0393f..6bef09490235 100644 --- a/include/asm-avr32/ocd.h +++ b/include/asm-avr32/ocd.h | |||
@@ -533,6 +533,11 @@ static inline void __ocd_write(unsigned int reg, unsigned long value) | |||
533 | #define ocd_read(reg) __ocd_read(OCD_##reg) | 533 | #define ocd_read(reg) __ocd_read(OCD_##reg) |
534 | #define ocd_write(reg, value) __ocd_write(OCD_##reg, value) | 534 | #define ocd_write(reg, value) __ocd_write(OCD_##reg, value) |
535 | 535 | ||
536 | struct task_struct; | ||
537 | |||
538 | void ocd_enable(struct task_struct *child); | ||
539 | void ocd_disable(struct task_struct *child); | ||
540 | |||
536 | #endif /* !__ASSEMBLER__ */ | 541 | #endif /* !__ASSEMBLER__ */ |
537 | 542 | ||
538 | #endif /* __ASM_AVR32_OCD_H */ | 543 | #endif /* __ASM_AVR32_OCD_H */ |
diff --git a/include/asm-avr32/ptrace.h b/include/asm-avr32/ptrace.h index 8c5dba5e33df..9e2d44f4e0fe 100644 --- a/include/asm-avr32/ptrace.h +++ b/include/asm-avr32/ptrace.h | |||
@@ -121,7 +121,15 @@ struct pt_regs { | |||
121 | }; | 121 | }; |
122 | 122 | ||
123 | #ifdef __KERNEL__ | 123 | #ifdef __KERNEL__ |
124 | # define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER) | 124 | |
125 | #include <asm/ocd.h> | ||
126 | |||
127 | #define arch_ptrace_attach(child) ocd_enable(child) | ||
128 | |||
129 | #define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER) | ||
130 | #define instruction_pointer(regs) ((regs)->pc) | ||
131 | #define profile_pc(regs) instruction_pointer(regs) | ||
132 | |||
125 | extern void show_regs (struct pt_regs *); | 133 | extern void show_regs (struct pt_regs *); |
126 | 134 | ||
127 | static __inline__ int valid_user_regs(struct pt_regs *regs) | 135 | static __inline__ int valid_user_regs(struct pt_regs *regs) |
@@ -141,9 +149,6 @@ static __inline__ int valid_user_regs(struct pt_regs *regs) | |||
141 | return 0; | 149 | return 0; |
142 | } | 150 | } |
143 | 151 | ||
144 | #define instruction_pointer(regs) ((regs)->pc) | ||
145 | |||
146 | #define profile_pc(regs) instruction_pointer(regs) | ||
147 | 152 | ||
148 | #endif /* __KERNEL__ */ | 153 | #endif /* __KERNEL__ */ |
149 | 154 | ||
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h index 184b574289b4..07049f6c0d41 100644 --- a/include/asm-avr32/thread_info.h +++ b/include/asm-avr32/thread_info.h | |||
@@ -88,6 +88,7 @@ static inline struct thread_info *current_thread_info(void) | |||
88 | #define TIF_MEMDIE 6 | 88 | #define TIF_MEMDIE 6 |
89 | #define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */ | 89 | #define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */ |
90 | #define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */ | 90 | #define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */ |
91 | #define TIF_DEBUG 30 /* debugging enabled */ | ||
91 | #define TIF_USERSPACE 31 /* true if FS sets userspace */ | 92 | #define TIF_USERSPACE 31 /* true if FS sets userspace */ |
92 | 93 | ||
93 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 94 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |