OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [cpu/] [powerpc/] [shared/] [asm.h] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  asm.h
2
 *
3
 *  This include file attempts to address the problems
4
 *  caused by incompatible flavors of assemblers and
5
 *  toolsets.  It primarily addresses variations in the
6
 *  use of leading underscores on symbols and the requirement
7
 *  that register names be preceded by a %.
8
 *
9
 *
10
 *  NOTE: The spacing in the use of these macros
11
 *        is critical to them working as advertised.
12
 *
13
 *  COPYRIGHT:
14
 *
15
 *  This file is based on similar code found in newlib available
16
 *  from ftp.cygnus.com.  The file which was used had no copyright
17
 *  notice.  This file is freely distributable as long as the source
18
 *  of the file is noted.  This file is:
19
 *
20
 *  COPYRIGHT (c) 1995.
21
 *  i-cubed ltd.
22
 *
23
 *  COPYRIGHT (c) 1994.
24
 *  On-Line Applications Research Corporation (OAR).
25
 *
26
 *  $Id: asm.h,v 1.2 2001-09-27 11:59:30 chris Exp $
27
 */
28
 
29
#ifndef __PPC_ASM_h
30
#define __PPC_ASM_h
31
 
32
/*
33
 *  Indicate we are in an assembly file and get the basic CPU definitions.
34
 */
35
 
36
#ifndef ASM
37
#define ASM
38
#endif
39
#include <rtems/score/targopts.h>
40
#include <rtems/score/ppc.h>
41
 
42
/*
43
 *  Recent versions of GNU cpp define variables which indicate the
44
 *  need for underscores and percents.  If not using GNU cpp or
45
 *  the version does not support this, then you will obviously
46
 *  have to define these as appropriate.
47
 */
48
 
49
#ifndef __USER_LABEL_PREFIX__
50
#define __USER_LABEL_PREFIX__ 
51
#endif
52
 
53
#ifndef __REGISTER_PREFIX__
54
#define __REGISTER_PREFIX__
55
#endif
56
 
57
#ifndef __FLOAT_REGISTER_PREFIX__
58
#define __FLOAT_REGISTER_PREFIX__  __REGISTER_PREFIX__
59
#endif
60
 
61
#if (PPC_ABI == PPC_ABI_POWEROPEN)
62
#ifndef __PROC_LABEL_PREFIX__
63
#define __PROC_LABEL_PREFIX__ .
64
#endif
65
#endif
66
 
67
#ifndef __PROC_LABEL_PREFIX__
68
#define __PROC_LABEL_PREFIX__  __USER_LABEL_PREFIX__
69
#endif
70
 
71
/* ANSI concatenation macros.  */
72
 
73
#define CONCAT1(a, b) CONCAT2(a, b)
74
#define CONCAT2(a, b) a ## b
75
 
76
/* Use the right prefix for global labels.  */
77
 
78
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
79
 
80
/* Use the right prefix for procedure labels.  */
81
 
82
#define PROC(x) CONCAT1 (__PROC_LABEL_PREFIX__, x)
83
 
84
/* Use the right prefix for registers.  */
85
 
86
#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
87
 
88
/* Use the right prefix for floating point registers.  */
89
 
90
#define FREG(x) CONCAT1 (__FLOAT_REGISTER_PREFIX__, x)
91
 
92
/*
93
 *  define macros for all of the registers on this CPU
94
 *
95
 *  EXAMPLE:     #define d0 REG (d0)
96
 */
97
#define r0 REG(0)
98
#define r1 REG(1)
99
#define r2 REG(2)
100
#define r3 REG(3)
101
#define r4 REG(4)
102
#define r5 REG(5)
103
#define r6 REG(6)
104
#define r7 REG(7)
105
#define r8 REG(8)
106
#define r9 REG(9)
107
#define r10 REG(10)
108
#define r11 REG(11)
109
#define r12 REG(12)
110
#define r13 REG(13)
111
#define r14 REG(14)
112
#define r15 REG(15)
113
#define r16 REG(16)
114
#define r17 REG(17)
115
#define r18 REG(18)
116
#define r19 REG(19)
117
#define r20 REG(20)
118
#define r21 REG(21)
119
#define r22 REG(22)
120
#define r23 REG(23)
121
#define r24 REG(24)
122
#define r25 REG(25)
123
#define r26 REG(26)
124
#define r27 REG(27)
125
#define r28 REG(28)
126
#define r29 REG(29)
127
#define r30 REG(30)
128
#define r31 REG(31)
129
#define f0 FREG(0)
130
#define f1 FREG(1)
131
#define f2 FREG(2)
132
#define f3 FREG(3)
133
#define f4 FREG(4)
134
#define f5 FREG(5)
135
#define f6 FREG(6)
136
#define f7 FREG(7)
137
#define f8 FREG(8)
138
#define f9 FREG(9)
139
#define f10 FREG(10)
140
#define f11 FREG(11)
141
#define f12 FREG(12)
142
#define f13 FREG(13)
143
#define f14 FREG(14)
144
#define f15 FREG(15)
145
#define f16 FREG(16)
146
#define f17 FREG(17)
147
#define f18 FREG(18)
148
#define f19 FREG(19)
149
#define f20 FREG(20)
150
#define f21 FREG(21)
151
#define f22 FREG(22)
152
#define f23 FREG(23)
153
#define f24 FREG(24)
154
#define f25 FREG(25)
155
#define f26 FREG(26)
156
#define f27 FREG(27)
157
#define f28 FREG(28)
158
#define f29 FREG(29)
159
#define f30 FREG(30)
160
#define f31 FREG(31)
161
 
162
/*
163
 * Some special purpose registers (SPRs).
164
 */
165
#define srr0    0x01a
166
#define srr1    0x01b
167
#define srr2    0x3de   /* IBM 400 series only */
168
#define srr3    0x3df   /* IBM 400 series only */
169
#define sprg0   0x110
170
#define sprg1   0x111
171
#define sprg2   0x112
172
#define sprg3   0x113
173
 
174
 
175
/* the following SPR/DCR registers exist only in IBM 400 series */
176
#define dear    0x3d5   
177
#define evpr    0x3d6   /* SPR: exception vector prefix register   */
178
#define iccr    0x3fb   /* SPR: instruction cache control reg.     */
179
#define dccr    0x3fa   /* SPR: data cache control reg.            */
180
 
181
#define exisr   0x040   /* DCR: external interrupt status register */
182
#define exier   0x042   /* DCR: external interrupt enable register */
183
#define br0     0x080   /* DCR: memory bank register 0             */
184
#define br1     0x081   /* DCR: memory bank register 1             */
185
#define br2     0x082   /* DCR: memory bank register 2             */
186
#define br3     0x083   /* DCR: memory bank register 3             */
187
#define br4     0x084   /* DCR: memory bank register 4             */
188
#define br5     0x085   /* DCR: memory bank register 5             */
189
#define br6     0x086   /* DCR: memory bank register 6             */
190
#define br7     0x087   /* DCR: memory bank register 7             */
191
/* end of IBM400 series register definitions */
192
 
193
/* The following registers are for the MPC8x0 */
194
#define der     0x095   /* Debug Enable Register */
195
/* end of MPC8x0 registers */
196
 
197
/*
198
 *  Following must be tailor for a particular flavor of the C compiler.
199
 *  They may need to put underscores in front of the symbols.
200
 */
201
 
202
#define PUBLIC_VAR(sym) .globl SYM (sym)
203
#define EXTERN_VAR(sym) .extern SYM (sym)
204
#define PUBLIC_PROC(sym) .globl PROC (sym)
205
#define EXTERN_PROC(sym) .extern PROC (sym)
206
 
207
/* Other potentially assembler specific operations */
208
#if PPC_ASM == PPC_ASM_ELF
209
#define ALIGN(n,p)      .align  p
210
#define DESCRIPTOR(x)   \
211
        .section .descriptors,"aw";     \
212
        PUBLIC_VAR (x);                 \
213
SYM (x):;                               \
214
        .long   PROC (x);               \
215
        .long   s.got;                  \
216
        .long   0
217
 
218
#define EXT_SYM_REF(x)  .long x
219
#define EXT_PROC_REF(x) .long x
220
 
221
/*
222
 *  Define macros to handle section beginning and ends.
223
 */
224
 
225
#define BEGIN_CODE_DCL .text
226
#define END_CODE_DCL
227
#define BEGIN_DATA_DCL .data
228
#define END_DATA_DCL
229
#define BEGIN_CODE .text
230
#define END_CODE
231
#define BEGIN_DATA .data
232
#define END_DATA
233
#define BEGIN_BSS  .bss
234
#define END_BSS
235
#define END
236
 
237
#elif PPC_ASM == PPC_ASM_XCOFF
238
#define ALIGN(n,p)      .align  p
239
#define DESCRIPTOR(x)   \
240
        .csect  x[DS];          \
241
        .globl  x[DS];          \
242
        .long   PROC (x)[PR];   \
243
        .long   TOC[tc0]
244
 
245
#define EXT_SYM_REF(x)  .long x[RW]
246
#define EXT_PROC_REF(x) .long x[DS]
247
 
248
/*
249
 *  Define macros to handle section beginning and ends.
250
 */
251
 
252
#define BEGIN_CODE_DCL .csect .text[PR]
253
#define END_CODE_DCL
254
#define BEGIN_DATA_DCL .csect .data[RW]
255
#define END_DATA_DCL
256
#define BEGIN_CODE .csect .text[PR]
257
#define END_CODE
258
#define BEGIN_DATA .csect .data[RW]
259
#define END_DATA
260
#define BEGIN_BSS  .bss
261
#define END_BSS
262
#define END
263
 
264
#else
265
#error "PPC_ASM_TYPE is not properly defined"
266
#endif
267
#ifndef PPC_ASM
268
#error "PPC_ASM_TYPE is not properly defined"
269
#endif
270
 
271
 
272
#endif
273
/* end of include file */
274
 
275
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.