aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/exceptions.c
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-08-03 05:26:51 -0400
committerMichal Simek <monstr@monstr.eu>2010-08-04 04:45:16 -0400
commit751f1605e03533a6279ccf456e938e9595c7d888 (patch)
tree1bff483f2d0f1151c5794d409c00e1c5293656b4 /arch/microblaze/kernel/exceptions.c
parent958063e67b775bc1be85eb3761c85202597a87aa (diff)
microblaze: Support brki rX, 0x18 for user application debugging
This is the first patch which add support for user application debugging through brki rX, 0x18 vector. This patch has side effect which also remove security issue to use brki rX, 0x18 to freeze kernel. Support for old gdb support via priviledged exception (brk r0, r0) is still there. It will be remove in future. Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel/exceptions.c')
-rw-r--r--arch/microblaze/kernel/exceptions.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c
index 02cbdfe5aa8d..e0c6f8c2bd9d 100644
--- a/arch/microblaze/kernel/exceptions.c
+++ b/arch/microblaze/kernel/exceptions.c
@@ -48,6 +48,12 @@ void die(const char *str, struct pt_regs *fp, long err)
48 do_exit(err); 48 do_exit(err);
49} 49}
50 50
51/* for user application debugging */
52void sw_exception(struct pt_regs *regs)
53{
54 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->r16);
55}
56
51void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) 57void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
52{ 58{
53 siginfo_t info; 59 siginfo_t info;
@@ -143,7 +149,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
143#ifdef CONFIG_MMU 149#ifdef CONFIG_MMU
144 case MICROBLAZE_PRIVILEGED_EXCEPTION: 150 case MICROBLAZE_PRIVILEGED_EXCEPTION:
145 pr_debug(KERN_WARNING "Privileged exception\n"); 151 pr_debug(KERN_WARNING "Privileged exception\n");
146 /* "brk r0,r0" - used as debug breakpoint */ 152 /* "brk r0,r0" - used as debug breakpoint - old toolchain */
147 if (get_user(code, (unsigned long *)regs->pc) == 0 153 if (get_user(code, (unsigned long *)regs->pc) == 0
148 && code == 0x980c0000) { 154 && code == 0x980c0000) {
149 _exception(SIGTRAP, regs, TRAP_BRKPT, addr); 155 _exception(SIGTRAP, regs, TRAP_BRKPT, addr);