source: rtems/c/src/lib/libcpu/powerpc/ppc403/vectors/vectors.S @ 545f7786

4.104.114.84.95
Last change on this file since 545f7786 was 545f7786, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/09/05 at 15:14:57

2005-02-09 Ralf Corsepius <ralf.corsepius@…>

  • ppc403/vectors/vectors.S: Remove XCOFF support.
  • Property mode set to 100644
File size: 6.6 KB
Line 
1/*  vectors.s   1.1 - 95/12/04
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.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 variable 'PPC_VECTOR_FILE_BASE' must be defined to be the
33 *  offset from 0x????0000 to the first location in the file.  This
34 *  will usually be 0x0000 or 0x0100.
35 *
36 *  $Id$
37 */
38
39#include <bsp.h> /* PPC_VECTOR_FILE_BASE */
40#include <rtems/asm.h>
41
42#ifndef PPC_VECTOR_FILE_BASE
43#error "PPC_VECTOR_FILE_BASE is not defined."
44#endif
45
46        /* Where this file will be loaded */
47        .set    file_base, PPC_VECTOR_FILE_BASE
48
49        /* Offset to store reg 0 */
50
51        .set    IP_LINK, 0
52#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
53        .set    IP_0, (IP_LINK + 56)
54#else
55        .set    IP_0, (IP_LINK + 8)
56#endif
57        .set    IP_2, (IP_0 + 4)
58
59        .set    IP_3, (IP_2 + 4)
60        .set    IP_4, (IP_3 + 4)
61        .set    IP_5, (IP_4 + 4)
62        .set    IP_6, (IP_5 + 4)
63       
64        .set    IP_7, (IP_6 + 4)
65        .set    IP_8, (IP_7 + 4)
66        .set    IP_9, (IP_8 + 4)
67        .set    IP_10, (IP_9 + 4)
68       
69        .set    IP_11, (IP_10 + 4)
70        .set    IP_12, (IP_11 + 4)
71        .set    IP_13, (IP_12 + 4)
72        .set    IP_28, (IP_13 + 4)
73       
74        .set    IP_29, (IP_28 + 4)
75        .set    IP_30, (IP_29 + 4)
76        .set    IP_31, (IP_30 + 4)
77        .set    IP_CR, (IP_31 + 4)
78       
79        .set    IP_CTR, (IP_CR + 4)
80        .set    IP_XER, (IP_CTR + 4)
81        .set    IP_LR, (IP_XER + 4)
82        .set    IP_PC, (IP_LR + 4)
83       
84        .set    IP_MSR, (IP_PC + 4)
85       
86        .set    IP_END, (IP_MSR + 16)
87
88        /* Vector offsets                        */
89        .set    begin_vector,0x0000
90        .set    crit_vector,0x0100
91        .set    mach_vector,0x0200
92        .set    prot_vector,0x0300
93        .set    ext_vector,0x0500
94        .set    align_vector,0x0600
95        .set    prog_vector,0x0700
96        .set    dec_vector,0x0900
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#endif
107
108        PUBLIC_VAR (__vectors)
109SYM (__vectors):
110       
111/* Critical error handling */
112        .org    crit_vector - file_base
113#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
114#if (PPC_HAS_FPU)
115        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
116#else
117        stwu    r1, -(20*4 + IP_END)(r1)
118#endif
119#else
120        stwu    r1, -(IP_END)(r1)
121#endif
122        stw     r0, IP_0(r1)
123
124        li      r0, PPC_IRQ_CRIT
125        b       PROC (_ISR_HandlerC)
126       
127/* Machine check exception */
128        .org    mach_vector - file_base
129#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
130#if (PPC_HAS_FPU)
131        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
132#else
133        stwu    r1, -(20*4 + IP_END)(r1)
134#endif
135#else
136        stwu    r1, -(IP_END)(r1)
137#endif
138        stw     r0, IP_0(r1)
139
140        li      r0, PPC_IRQ_MCHECK
141        b       PROC (_ISR_HandlerC)
142       
143/* Protection exception */
144        .org    prot_vector - file_base
145#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
146#if (PPC_HAS_FPU)
147        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
148#else
149        stwu    r1, -(20*4 + IP_END)(r1)
150#endif
151#else
152        stwu    r1, -(IP_END)(r1)
153#endif
154        stw     r0, IP_0(r1)
155
156        li      r0, PPC_IRQ_PROTECT
157        b       PROC (_ISR_Handler)
158
159/* External interrupt */
160        .org    ext_vector - file_base
161#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
162#if (PPC_HAS_FPU)
163        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
164#else
165        stwu    r1, -(20*4 + IP_END)(r1)
166#endif
167#else
168        stwu    r1, -(IP_END)(r1)
169#endif
170        stw     r0, IP_0(r1)
171
172        li      r0, PPC_IRQ_EXTERNAL
173        b       PROC (_ISR_Handler)
174       
175/* Align exception */
176        .org    align_vector - file_base
177        .extern align_h
178        b       align_h
179       
180/* Program exception */
181        .org    prog_vector - file_base
182#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
183#if (PPC_HAS_FPU)
184        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
185#else
186        stwu    r1, -(20*4 + IP_END)(r1)
187#endif
188#else
189        stwu    r1, -(IP_END)(r1)
190#endif
191        stw     r0, IP_0(r1)
192
193        li      r0, PPC_IRQ_PROGRAM
194        b       PROC (_ISR_Handler)
195       
196/* Decrementer exception */
197        .org    dec_vector - file_base
198#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
199#if (PPC_HAS_FPU)
200        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
201#else
202        stwu    r1, -(20*4 + IP_END)(r1)
203#endif
204#else
205        stwu    r1, -(IP_END)(r1)
206#endif
207        stw     r0, IP_0(r1)
208
209        li      r0, PPC_IRQ_PROGRAM
210        b       PROC (_ISR_Handler)
211       
212/* System call */
213        .org    sys_vector - file_base
214#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
215#if (PPC_HAS_FPU)
216        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
217#else
218        stwu    r1, -(20*4 + IP_END)(r1)
219#endif
220#else
221        stwu    r1, -(IP_END)(r1)
222#endif
223        stw     r0, IP_0(r1)
224
225        li      r0, PPC_IRQ_SCALL
226        b       PROC (_ISR_Handler)
227                       
228/* PIT interrupt */
229        .org    pit_vector - file_base
230#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
231#if (PPC_HAS_FPU)
232        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
233#else
234        stwu    r1, -(20*4 + IP_END)(r1)
235#endif
236#else
237        stwu    r1, -(IP_END)(r1)
238#endif
239        stw     r0, IP_0(r1)
240
241        li      r0, PPC_IRQ_PIT
242        b       PROC (_ISR_Handler)
243                       
244/* FIT interrupt */
245        .org    fit_vector - file_base
246#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
247#if (PPC_HAS_FPU)
248        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
249#else
250        stwu    r1, -(20*4 + IP_END)(r1)
251#endif
252#else
253        stwu    r1, -(IP_END)(r1)
254#endif
255        stw     r0, IP_0(r1)
256
257        li      r0, PPC_IRQ_FIT
258        b       PROC (_ISR_Handler)
259                       
260/* Watchdog interrupt */
261        .org    wadt_vector - file_base
262#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
263#if (PPC_HAS_FPU)
264        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
265#else
266        stwu    r1, -(20*4 + IP_END)(r1)
267#endif
268#else
269        stwu    r1, -(IP_END)(r1)
270#endif
271        stw     r0, IP_0(r1)
272
273        li      r0, PPC_IRQ_WATCHDOG
274        b       PROC (_ISR_HandlerC)
275       
276/* Debug exception */
277debug:
278#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27)
279#if (PPC_HAS_FPU)
280        stwu    r1, -(20*4 + 18*8 + IP_END)(r1)
281#else
282        stwu    r1, -(20*4 + IP_END)(r1)
283#endif
284#else
285        stwu    r1, -(IP_END)(r1)
286#endif
287        stw     r0, IP_0(r1)
288
289        li      r0, PPC_IRQ_DEBUG
290        b       PROC (_ISR_HandlerC)
291
292/* Debug exception */
293        .org    debug_vector - file_base
294        b       debug
Note: See TracBrowser for help on using the repository browser.