HACK
[asbestos.git] / stage2 / exc_vector.S
blob0e5b953e76d0620176c97c6076d13f13be28e425
1 /*  exc_vector.S - exception handling vector
3 Copyright (C) 2010-2011  Hector Martin "marcan" <hector@marcansoft.com>
5 This code is licensed to you under the terms of the GNU GPL, version 2;
6 see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
7 */
9 #include "../common/assembly.h"
11         .text
12         .section .start,"ax",@progbits
13         .align 3
15         .global _exc_vec, _exc_vec_end, _exception_start
17 _exc_vec:
18         std r0, 0x2000(0)
19         mflr r0
20         std r0, 0x2110(0)
21         lis r0, _exception_start@h
22         ori r0, r0, _exception_start@l
23         mtlr r0
24         li r0, 0 /* exception number */
25         blr
26 _exc_vec_end:
28 _exception_start:
29         std r1, 0x2008(0)
30         std r2, 0x2010(0)
31         std r3, 0x2018(0)
32         std r4, 0x2020(0)
33         std r5, 0x2028(0)
34         std r6, 0x2030(0)
35         std r7, 0x2038(0)
36         std r8, 0x2040(0)
37         std r9, 0x2048(0)
38         std r10, 0x2050(0)
39         std r11, 0x2058(0)
40         std r12, 0x2060(0)
41         std r13, 0x2068(0)
42         std r14, 0x2070(0)
43         std r15, 0x2078(0)
44         std r16, 0x2080(0)
45         std r17, 0x2088(0)
46         std r18, 0x2090(0)
47         std r19, 0x2098(0)
48         std r20, 0x20a0(0)
49         std r21, 0x20a8(0)
50         std r22, 0x20b0(0)
51         std r23, 0x20b8(0)
52         std r24, 0x20c0(0)
53         std r25, 0x20c8(0)
54         std r26, 0x20d0(0)
55         std r27, 0x20d8(0)
56         std r28, 0x20e0(0)
57         std r29, 0x20e8(0)
58         std r30, 0x20f0(0)
59         std r31, 0x20f8(0)
61         mfcr r3         ; std r3, 0x2100(0)
62         mfxer r3        ; std r3, 0x2108(0)
63         mfctr r3        ; std r3, 0x2118(0)
64         mfsrr0 r3       ; std r3, 0x2120(0)
65         mfsrr1 r3       ; std r3, 0x2128(0)
66         mfdar r3        ; std r3, 0x2130(0)
67         mfdsisr r3      ; std r3, 0x2138(0)
69         /* make stack space (at least 288 bytes required per ABI */
70         addi sp, sp, -512
71         std r0, 0(sp)
72         /* exception number = arg */
73         mr r3, r0
74         /* set up the TOC register */
75         lis r2, (__toc_start+0x8000)@h
76         ori r2, r2, (__toc_start+0x8000)@l
77         bl exception_handler
79         ld r3, 0x2100(0) ; mtcr r3
80         ld r3, 0x2108(0) ; mtxer r3
81         ld r3, 0x2110(0) ; mtlr r3
82         ld r3, 0x2118(0) ; mtctr r3
83         ld r3, 0x2120(0) ; mtsrr0 r3
84         ld r3, 0x2128(0) ; mtsrr1 r3
86         ld r0, 0x2000(0)
87         ld r1, 0x2008(0)
88         ld r2, 0x2010(0)
89         ld r3, 0x2018(0)
90         ld r4, 0x2020(0)
91         ld r5, 0x2028(0)
92         ld r6, 0x2030(0)
93         ld r7, 0x2038(0)
94         ld r8, 0x2040(0)
95         ld r9, 0x2048(0)
96         ld r10, 0x2050(0)
97         ld r11, 0x2058(0)
98         ld r12, 0x2060(0)
99         ld r13, 0x2068(0)
100         ld r14, 0x2070(0)
101         ld r15, 0x2078(0)
102         ld r16, 0x2080(0)
103         ld r17, 0x2088(0)
104         ld r18, 0x2090(0)
105         ld r19, 0x2098(0)
106         ld r20, 0x20a0(0)
107         ld r21, 0x20a8(0)
108         ld r22, 0x20b0(0)
109         ld r23, 0x20b8(0)
110         ld r24, 0x20c0(0)
111         ld r25, 0x20c8(0)
112         ld r26, 0x20d0(0)
113         ld r27, 0x20d8(0)
114         ld r28, 0x20e0(0)
115         ld r29, 0x20e8(0)
116         ld r30, 0x20f0(0)
117         ld r31, 0x20f8(0)
119         rfid