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