initial import
[patches.git] / blackfin-set-ex-handler.patch
CommitLineData
5e993f12 1Index: include/asm-blackfin/irq_handler.h
2===================================================================
3--- include/asm-blackfin/irq_handler.h (revision 3481)
4+++ include/asm-blackfin/irq_handler.h (working copy)
5@@ -18,5 +18,8 @@ asmlinkage void evt_evt13(void);
6 asmlinkage void evt_soft_int1(void);
7 asmlinkage void evt_system_call(void);
8 asmlinkage void init_exception_buff(void);
9+asmlinkage void return_from_exception(void);
10+
11+asmlinkage void *(*bfin_replace_exception_vector)(int exception, void (*handler)(void));
12
13 #endif
14Index: arch/blackfin/mach-common/entry.S
15===================================================================
16--- arch/blackfin/mach-common/entry.S (revision 3481)
17+++ arch/blackfin/mach-common/entry.S (working copy)
18@@ -135,7 +135,7 @@ ENTRY(_ex_single_step)
19 cc = r6 == r7;
20 if !cc jump _ex_trap_c;
21
22-_return_from_exception:
23+ENTRY(_return_from_exception)
24 DEBUG_START_HWTRACE(p5, r7)
25 #if ANOMALY_05000257
26 R7=LC0;
27@@ -717,6 +717,33 @@ _schedule_and_signal:
28 rti;
29 ENDPROC(_lower_to_irq14)
30
31+/* void *bfin_replace_exception_vector(int exception, void *handler) */
32+ENTRY(_bfin_replace_exception_vector)
33+ [--sp] = (P5:4);
34+ [--sp] = ASTAT;
35+
36+ /* make sure exception # is valid */
37+ P4 = R0;
38+ P5 = 0x3F;
39+ CC = P4 <= P5;
40+ IF CC jump .Lpass (bp);
41+ R0 = -ERANGE;
42+ jump .Lfail;
43+
44+ /* set new handler and return old one */
45+.Lpass:
46+ P5.L = _extable;
47+ P5.H = _extable;
48+ P5 = P5 + (P4 << 2);
49+ R0 = [P5];
50+ [P5] = R1;
51+
52+.Lfail:
53+ ASTAT = [sp++];
54+ (P5:4) = [sp++];
55+ rts;
56+ENDPROC(_bfin_replace_exception_vector)
57+
58 /* Make sure when we start, that the circular buffer is initialized properly
59 * R0 and P0 are call clobbered, so we can use them here.
60 */
61Index: arch/blackfin/kernel/bfin_ksyms.c
62===================================================================
63--- arch/blackfin/kernel/bfin_ksyms.c (revision 3481)
64+++ arch/blackfin/kernel/bfin_ksyms.c (working copy)
65@@ -118,3 +118,6 @@ EXPORT_SYMBOL(_etext_l1);
66 EXPORT_SYMBOL(_sdata_l1);
67 EXPORT_SYMBOL(_ebss_b_l1);
68 EXPORT_SYMBOL(_sdata_b_l1);
69+
70+EXPORT_SYMBOL(bfin_replace_exception_vector);
71+EXPORT_SYMBOL(return_from_exception);