|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2004, 2008 IBM Corporation
3: * All rights reserved.
4: * This program and the accompanying materials
5: * are made available under the terms of the BSD License
6: * which accompanies this distribution, and is available at
7: * http://www.opensource.org/licenses/bsd-license.php
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
13:
14: #include <macros.h>
15: .section .lowmem,"aw",@progbits
16:
17: .irp i, 0x0200,0x0300,0x0380,0x0400,0x0480,0x0500,0x0600,0x0700, \
18: 0x0800,0x0900,0x0a00,0x0b00
19: . = \i - 0x200
20: // 0
21: stdu r1, -0x58(r1)
22: std r0, 0x30(r1)
23: mflr r0
24: std r0, 0x38(r1)
25: // 10
26: mfsrr0 r0
27: std r0, 0x48(r1)
28: mfsrr1 r0
29: std r0, 0x50(r1)
30: // 20
31: std r11, 0x40(r1)
32: li r0, \i
33: ld r11, 0x60 + \i(0)
34: bl _exception_handler
35:
36: // 30
37: ld r0, 0x48(r1)
38: mtsrr0 r0
39: ld r0, 0x50(r1)
40: mtsrr1 r0
41:
42: // 40
43: ld r0, 0x38(r1)
44: mtlr r0
45: ld r0, 0x30(r1)
46: ld r11, 0x40(r1)
47: // 50
48: addi r1, r1, 0x58
49: rfid
50: nop
51: nop
52: // 60
53: // .quad \i+0x68
54: .quad .exception_forward
55: // 68
56: blr
57: .endr
58:
59: # System call entry
60: . = 0xc00 - 0x200
61:
62: stdu r1, -0x50(r1)
63: mflr r11
64: std r11, 0x30(r1)
65: mfsrr0 r11
66: std r11, 0x40(r1)
67: mfsrr1 r11
68: std r11, 0x48(r1)
69: ld r11, _system_call@got(r2)
70: ld r11, 0(r11)
71: mtctr r11
72: mr r10, r0
73: bctrl
74: ld r11, 0x30(r1)
75: mtlr r11
76: ld r11, 0x40(r1)
77: mtsrr0 r11
78: ld r11, 0x48(r1)
79: mtsrr1 r11
80: addi r1, r1, 0x50
81: rfid
82:
83: .irp i, 0x0d00,0x0e00,0x0f00, \
84: 0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,0x1700, \
85: 0x1800,0x1900,0x1a00,0x1b00,0x1c00,0x1d00,0x1e00,0x1f00, \
86: 0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,0x2600,0x2700, \
87: 0x2800,0x2900,0x2a00,0x2b00,0x2c00,0x2d00,0x2e00,0x2f00
88: . = \i - 0x200
89: // 0
90: stdu r1, -0x58(r1)
91: std r0, 0x30(r1)
92: mflr r0
93: std r0, 0x38(r1)
94: // 10
95: mfsrr0 r0
96: std r0, 0x48(r1)
97: mfsrr1 r0
98: std r0, 0x50(r1)
99: // 20
100: std r11, 0x40(r1)
101: li r0, \i
102: ld r11, 0x60 + \i(0)
103: bl _exception_handler
104:
105: // 30
106: ld r0, 0x48(r1)
107: mtsrr0 r0
108: ld r0, 0x50(r1)
109: mtsrr1 r0
110:
111: // 40
112: ld r0, 0x38(r1)
113: mtlr r0
114: ld r0, 0x30(r1)
115: ld r11, 0x40(r1)
116: // 50
117: addi r1, r1, 0x58
118: rfid
119: nop
120: nop
121: // 60
122: // .quad \i+0x68
123: .quad .exception_forward
124: // 68
125: blr
126: .endr
127:
128: /* Saves all register potential clobbered in exception handler.
129: In r0 the pointer to the function is passed.
130: */
131:
132: _exception_handler:
133: stdu r1, -0x130(r1)
134: .irp i, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, \
135: 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, \
136: 27, 28, 29, 30, 31
137: std r\i, 0x30+\i*8 (r1)
138: .endr
139: mfctr r14
140: std r14,0x130(r1)
141: mtctr r11
142:
143: LOAD64(r3,_entry)
144: ld r2,8(r3)
145:
146: ld r3,exception_stack_frame@got(r2)
147: std r1,0(r3)
148:
149:
150: mflr r14
151: bctrl
152: mtlr r14
153:
154: ld r14,0x130(r1)
155: mtctr r14
156: /*
157: mfsrr0 r2
158: addi r2, r2, 4
159: mtsrr0 r2
160: */
161: .irp i, 2,3,4,5,6,7,8,9,10,12,13,14,15,16, \
162: 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, \
163: 27, 28, 29, 30, 31
164: ld r\i, 0x30+\i*8 (r1)
165: .endr
166: addi r1, r1, 0x130
167: blr
168:
169: .text
170:
171: /* Set exception handler for given exception vector.
172: r3: exception vector offset
173: r4: exception handler
174: */
175: .globl .set_exception
176: .set_exception:
177: .globl set_exception
178: set_exception:
179: ld r4,0x0(r4)
180: .globl .set_exception_asm
181: .set_exception_asm:
182: .globl set_exception_asm
183: set_exception_asm:
184: std r4, 0x60(r3) # fixme diff 1f - 0b
185: blr
186:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.