diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2012-11-18 23:30:15 -0500 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2012-12-19 00:10:22 -0500 |
commit | 28570e8dac5c86ab10ce2a7e9c02d3aaece63760 (patch) | |
tree | 29a915825b1851c1377d88bdb008a0eb7993d78f /arch/xtensa | |
parent | c622b29d1f38021411965b7e0170ab055551b257 (diff) |
xtensa: add trap_set_handler function
trap_set_handler sets new C-handler in the exception table and returns
previous handler.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/include/asm/traps.h | 23 | ||||
-rw-r--r-- | arch/xtensa/kernel/traps.c | 11 |
2 files changed, 34 insertions, 0 deletions
diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h new file mode 100644 index 000000000000..54f70440185e --- /dev/null +++ b/arch/xtensa/include/asm/traps.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * arch/xtensa/include/asm/traps.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2012 Tensilica Inc. | ||
9 | */ | ||
10 | #ifndef _XTENSA_TRAPS_H | ||
11 | #define _XTENSA_TRAPS_H | ||
12 | |||
13 | #include <asm/ptrace.h> | ||
14 | |||
15 | /* | ||
16 | * handler must be either of the following: | ||
17 | * void (*)(struct pt_regs *regs); | ||
18 | * void (*)(struct pt_regs *regs, unsigned long exccause); | ||
19 | */ | ||
20 | extern void * __init trap_set_handler(int cause, void *handler); | ||
21 | extern void do_unhandled(struct pt_regs *regs, unsigned long exccause); | ||
22 | |||
23 | #endif /* _XTENSA_TRAPS_H */ | ||
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 5caf2b64d43a..691a792b01d3 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -293,6 +293,17 @@ do_debug(struct pt_regs *regs) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | /* Set exception C handler - for temporary use when probing exceptions */ | ||
297 | |||
298 | void * __init trap_set_handler(int cause, void *handler) | ||
299 | { | ||
300 | unsigned long *entry = &exc_table[EXC_TABLE_DEFAULT / 4 + cause]; | ||
301 | void *previous = (void *)*entry; | ||
302 | *entry = (unsigned long)handler; | ||
303 | return previous; | ||
304 | } | ||
305 | |||
306 | |||
296 | /* | 307 | /* |
297 | * Initialize dispatch tables. | 308 | * Initialize dispatch tables. |
298 | * | 309 | * |