source: rtems/c/src/lib/libcpu/powerpc/ppc403/vectors/vectors.s @ 3235ad9

4.104.114.84.95
Last change on this file since 3235ad9 was 3235ad9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 19:30:23

Support for variable length names added to Object Handler. This supports
both fixed length "raw" names and strings from the API's point of view.

Both inline and macro implementations were tested.

  • Property mode set to 100644
File size: 6.9 KB
Line 
1/*  vectors.s   1.0 - 95/08/08
2 *
3 *  This file contains the assembly code for the PowerPC 403
4 *  interrupt veneers for RTEMS.
5 *
6 *  Author:     Andrew Bray <andy@i-cubed.demon.co.uk>
7 *
8 *  COPYRIGHT (c) 1995 by i-cubed ltd.
9 *
10 *  To anyone who acknowledges that this file is provided "AS IS"
11 *  without any express or implied warranty:
12 *      permission to use, copy, modify, and distribute this file
13 *      for any purpose is hereby granted without fee, provided that
14 *      the above copyright notice and this notice appears in all
15 *      copies, and that the name of i-cubed limited not be used in
16 *      advertising or publicity pertaining to distribution of the
17 *      software without specific, written prior permission.
18 *      i-cubed limited makes no representations about the suitability
19 *      of this software for any purpose.
20 *
21 */
22
23/*
24 *  The issue with this file is getting it loaded at the right place.
25 *  The first vector MUST be at address 0x????0100.
26 *  How this is achieved is dependant on the tool chain.
27 *
28 *  However the basic mechanism for ELF assemblers is to create a
29 *  section called ".vectors", which will be loaded to an address
30 *  between 0x????0000 and 0x????0100 (inclusive) via a link script.
31 *
32 *  The basic mechanism for XCOFF assemblers is to place it in the
33 *  normal text section, and arrange for this file to be located
34 *  at an appropriate position on the linker command line.
35 *
36 *  The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the
37 *  offset from 0x????0000 to the first location in the file.  This
38 *  will usually be 0x0000 or 0x0100.
39 */
40
41#include "asm.h"
42
43#ifndef PPC_VECTOR_FILE_BASE
44#error "PPC_VECTOR_FILE_BASE is not defined."
45#endif
46
47        /* Where this file will be loaded */
48        .set    file_base, PPC_VECTOR_FILE_BASE
49
50        /* Offset to store reg 0 */
51
52        .set    IP_LINK, 0
53#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
54        .set    IP_0, (IP_LINK + 56)
55#else
56        .set    IP_0, (IP_LINK + 8)
57#endif
58        .set    IP_2, (IP_0 + 4)
59
60        .set    IP_3, (IP_2 + 4)
61        .set    IP_4, (IP_3 + 4)
62        .set    IP_5, (IP_4 + 4)
63        .set    IP_6, (IP_5 + 4)
64       
65        .set    IP_7, (IP_6 + 4)
66        .set    IP_8, (IP_7 + 4)
67        .set    IP_9, (IP_8 + 4)
68        .set    IP_10, (IP_9 + 4)
69       
70        .set    IP_11, (IP_10 + 4)
71        .set    IP_12, (IP_11 + 4)
72        .set    IP_13, (IP_12 + 4)
73        .set    IP_28, (IP_13 + 4)
74       
75        .set    IP_29, (IP_28 + 4)
76        .set    IP_30, (IP_29 + 4)
77        .set    IP_31, (IP_30 + 4)
78        .set    IP_CR, (IP_31 + 4)
79       
80        .set    IP_CTR, (IP_CR + 4)
81        .set    IP_XER, (IP_CTR + 4)
82        .set    IP_LR, (IP_XER + 4)
83        .set    IP_PC, (IP_LR + 4)
84       
85        .set    IP_MSR, (IP_PC + 4)
86       
87        .set    IP_END, (IP_MSR + 16)
88
89        /* Vector offsets                        */
90        .set    begin_vector,0x0000
91        .set    crit_vector,0x0100
92        .set    mach_vector,0x0200
93        .set    prot_vector,0x0300
94        .set    ext_vector,0x0500
95        .set    align_vector,0x0600
96        .set    prog_vector,0x0700
97        .set    sys_vector,0x0C00
98        .set    pit_vector,0x1000
99        .set    fit_vector,0x1010
100        .set    wadt_vector,0x1020
101        .set    debug_vector,0x2000
102
103/* Go to the right section */
104#if PPC_ASM == PPC_ASM_ELF
105        .section .vectors,"awx",@progbits
106#elif PPC_ASM == PPC_ASM_XCOFF
107        .csect  .text[PR]
108#endif
109
110        PUBLIC_VAR (__vectors)
111SYM (__vectors):
112       
113/* Critical error handling */
114        .org    crit_vector - file_base
115        mtsprg1 r0
116        mfsprg2 r0
117        mtmsr   r0
118#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
119#if (PPC_HAS_FPU)
120        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
121#else
122        stwu    r1, -(20*4 + IP_END)(r1)
123#endif
124#else
125        stwu    r1, -(IP_END)(r1)
126#endif
127        mfsprg1 r0
128        stw     r0, IP_0(r1)
129
130        li      r0, PPC_IRQ_CRIT
131        b       PROC (_ISR_HandlerC)
132       
133/* Machine check exception */
134        .org    mach_vector - file_base
135        mtsprg1 r0
136        mfsprg2 r0
137        mtmsr   r0
138#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
139#if (PPC_HAS_FPU)
140        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
141#else
142        stwu    r1, -(20*4 + IP_END)(r1)
143#endif
144#else
145        stwu    r1, -(IP_END)(r1)
146#endif
147        mfsprg1 r0
148        stw     r0, IP_0(r1)
149
150        li      r0, PPC_IRQ_MCHECK
151        b       PROC (_ISR_HandlerC)
152       
153/* Protection exception */
154        .org    prot_vector - file_base
155        mtsprg0 r0
156        mfsprg2 r0
157        mtmsr   r0
158#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
159#if (PPC_HAS_FPU)
160        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
161#else
162        stwu    r1, -(20*4 + IP_END)(r1)
163#endif
164#else
165        stwu    r1, -(IP_END)(r1)
166#endif
167        mfsprg0 r0
168        stw     r0, IP_0(r1)
169
170        li      r0, PPC_IRQ_PROTECT
171        b       PROC (_ISR_Handler)
172
173/* External interrupt */
174        .org    ext_vector - file_base
175        mtsprg0 r0
176        mfsprg2 r0
177        mtmsr   r0
178#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
179#if (PPC_HAS_FPU)
180        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
181#else
182        stwu    r1, -(20*4 + IP_END)(r1)
183#endif
184#else
185        stwu    r1, -(IP_END)(r1)
186#endif
187        mfsprg0 r0
188        stw     r0, IP_0(r1)
189
190        li      r0, PPC_IRQ_EXTERNAL
191        b       PROC (_ISR_Handler)
192       
193/* Align exception */
194        .org    align_vector - file_base
195        .extern align_h
196        b       align_h
197       
198/* Program exception */
199        .org    prog_vector - file_base
200        mtsprg0 r0
201        mfsprg2 r0
202        mtmsr   r0
203#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
204#if (PPC_HAS_FPU)
205        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
206#else
207        stwu    r1, -(20*4 + IP_END)(r1)
208#endif
209#else
210        stwu    r1, -(IP_END)(r1)
211#endif
212        mfsprg0 r0
213        stw     r0, IP_0(r1)
214
215        li      r0, PPC_IRQ_PROGRAM
216        b       PROC (_ISR_Handler)
217       
218/* System call */
219        .org    sys_vector - file_base
220        mtsprg0 r0
221        mfsprg2 r0
222        mtmsr   r0
223#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
224#if (PPC_HAS_FPU)
225        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
226#else
227        stwu    r1, -(20*4 + IP_END)(r1)
228#endif
229#else
230        stwu    r1, -(IP_END)(r1)
231#endif
232        mfsprg0 r0
233        stw     r0, IP_0(r1)
234
235        li      r0, PPC_IRQ_SCALL
236        b       PROC (_ISR_Handler)
237                       
238/* PIT interrupt */
239        .org    pit_vector - file_base
240        b       pit
241                       
242/* FIT interrupt */
243        .org    fit_vector - file_base
244        b       fit
245                       
246/* Watchdog interrupt */
247        .org    wadt_vector - file_base
248        b       watch
249               
250/* PIT interrupt */
251pit:
252        mtsprg0 r0
253        mfsprg2 r0
254        mtmsr   r0
255#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
256#if (PPC_HAS_FPU)
257        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
258#else
259        stwu    r1, -(20*4 + IP_END)(r1)
260#endif
261#else
262        stwu    r1, -(IP_END)(r1)
263#endif
264        mfsprg0 r0
265        stw     r0, IP_0(r1)
266
267        li      r0, PPC_IRQ_PIT
268        b       PROC (_ISR_Handler)
269       
270/* FIT interrupt */
271fit:
272        mtsprg0 r0
273        mfsprg2 r0
274        mtmsr   r0
275#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
276#if (PPC_HAS_FPU)
277        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
278#else
279        stwu    r1, -(20*4 + IP_END)(r1)
280#endif
281#else
282        stwu    r1, -(IP_END)(r1)
283#endif
284        mfsprg0 r0
285        stw     r0, IP_0(r1)
286
287        li      r0, PPC_IRQ_FIT
288        b       PROC (_ISR_Handler)
289
290/* Watchdog interrupt */
291watch:
292        mtsprg1 r0
293        mfsprg2 r0
294        mtmsr   r0
295#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
296#if (PPC_HAS_FPU)
297        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
298#else
299        stwu    r1, -(20*4 + IP_END)(r1)
300#endif
301#else
302        stwu    r1, -(IP_END)(r1)
303#endif
304        mfsprg1 r0
305        stw     r0, IP_0(r1)
306
307        li      r0, PPC_IRQ_WATCHDOG
308        b       PROC (_ISR_HandlerC)
309       
310/* Debug exception */
311debug:
312        mtsprg1 r0
313        mfsprg2 r0
314        mtmsr   r0
315#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
316#if (PPC_HAS_FPU)
317        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
318#else
319        stwu    r1, -(20*4 + IP_END)(r1)
320#endif
321#else
322        stwu    r1, -(IP_END)(r1)
323#endif
324        mfsprg1 r0
325        stw     r0, IP_0(r1)
326
327        li      r0, PPC_IRQ_DEBUG
328        b       PROC (_ISR_HandlerC)
329
330/* Debug exception */
331        .org    debug_vector - file_base
332        b       debug
Note: See TracBrowser for help on using the repository browser.