asm.h revision 1.8.8.2 1 1.8.8.2 nathanw /* $NetBSD: asm.h,v 1.8.8.2 2002/08/01 02:43:02 nathanw Exp $ */
2 1.8.8.2 nathanw
3 1.8.8.2 nathanw /*
4 1.8.8.2 nathanw * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 1.8.8.2 nathanw * Copyright (C) 1995, 1996 TooLs GmbH.
6 1.8.8.2 nathanw * All rights reserved.
7 1.8.8.2 nathanw *
8 1.8.8.2 nathanw * Redistribution and use in source and binary forms, with or without
9 1.8.8.2 nathanw * modification, are permitted provided that the following conditions
10 1.8.8.2 nathanw * are met:
11 1.8.8.2 nathanw * 1. Redistributions of source code must retain the above copyright
12 1.8.8.2 nathanw * notice, this list of conditions and the following disclaimer.
13 1.8.8.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
14 1.8.8.2 nathanw * notice, this list of conditions and the following disclaimer in the
15 1.8.8.2 nathanw * documentation and/or other materials provided with the distribution.
16 1.8.8.2 nathanw * 3. All advertising materials mentioning features or use of this software
17 1.8.8.2 nathanw * must display the following acknowledgement:
18 1.8.8.2 nathanw * This product includes software developed by TooLs GmbH.
19 1.8.8.2 nathanw * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 1.8.8.2 nathanw * derived from this software without specific prior written permission.
21 1.8.8.2 nathanw *
22 1.8.8.2 nathanw * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 1.8.8.2 nathanw * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.8.8.2 nathanw * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.8.8.2 nathanw * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 1.8.8.2 nathanw * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 1.8.8.2 nathanw * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 1.8.8.2 nathanw * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 1.8.8.2 nathanw * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 1.8.8.2 nathanw * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 1.8.8.2 nathanw * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.8.8.2 nathanw */
33 1.8.8.2 nathanw
34 1.8.8.2 nathanw #ifndef _PPC_ASM_H_
35 1.8.8.2 nathanw #define _PPC_ASM_H_
36 1.8.8.2 nathanw
37 1.8.8.2 nathanw #ifdef PIC
38 1.8.8.2 nathanw #define PIC_PROLOGUE XXX
39 1.8.8.2 nathanw #define PIC_EPILOGUE XXX
40 1.8.8.2 nathanw #define PIC_PLT(x) x@plt
41 1.8.8.2 nathanw #ifdef __STDC__
42 1.8.8.2 nathanw #define PIC_GOT(x) XXX
43 1.8.8.2 nathanw #define PIC_GOTOFF(x) XXX
44 1.8.8.2 nathanw #else /* not __STDC__ */
45 1.8.8.2 nathanw #define PIC_GOT(x) XXX
46 1.8.8.2 nathanw #define PIC_GOTOFF(x) XXX
47 1.8.8.2 nathanw #endif /* __STDC__ */
48 1.8.8.2 nathanw #else
49 1.8.8.2 nathanw #define PIC_PROLOGUE
50 1.8.8.2 nathanw #define PIC_EPILOGUE
51 1.8.8.2 nathanw #define PIC_PLT(x) x
52 1.8.8.2 nathanw #define PIC_GOT(x) x
53 1.8.8.2 nathanw #define PIC_GOTOFF(x) x
54 1.8.8.2 nathanw #endif
55 1.8.8.2 nathanw
56 1.8.8.2 nathanw #define _C_LABEL(x) x
57 1.8.8.2 nathanw #define _ASM_LABEL(x) x
58 1.8.8.2 nathanw
59 1.8.8.2 nathanw #define _GLOBAL(x) \
60 1.8.8.2 nathanw .data; .align 2; .globl x; x:
61 1.8.8.2 nathanw
62 1.8.8.2 nathanw #define _ENTRY(x) \
63 1.8.8.2 nathanw .text; .align 2; .globl x; .type x,@function; x:
64 1.8.8.2 nathanw
65 1.8.8.2 nathanw #ifdef GPROF
66 1.8.8.2 nathanw # define _PROF_PROLOGUE mflr 0; stw 0,4(1); bl _mcount
67 1.8.8.2 nathanw #else
68 1.8.8.2 nathanw # define _PROF_PROLOGUE
69 1.8.8.2 nathanw #endif
70 1.8.8.2 nathanw
71 1.8.8.2 nathanw #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
72 1.8.8.2 nathanw #define ENTRY_NOPROFILE(y) _ENTRY(_C_LABEL(y))
73 1.8.8.2 nathanw
74 1.8.8.2 nathanw #define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
75 1.8.8.2 nathanw #define GLOBAL(y) _GLOBAL(_C_LABEL(y))
76 1.8.8.2 nathanw
77 1.8.8.2 nathanw #define ASMSTR .asciz
78 1.8.8.2 nathanw
79 1.8.8.2 nathanw #define RCSID(x) .text; .asciz x
80 1.8.8.2 nathanw
81 1.8.8.2 nathanw #ifdef __ELF__
82 1.8.8.2 nathanw #define WEAK_ALIAS(alias,sym) \
83 1.8.8.2 nathanw .weak alias; \
84 1.8.8.2 nathanw alias = sym
85 1.8.8.2 nathanw #endif
86 1.8.8.2 nathanw
87 1.8.8.2 nathanw #ifdef __STDC__
88 1.8.8.2 nathanw #define WARN_REFERENCES(_sym,_msg) \
89 1.8.8.2 nathanw .section .gnu.warning. ## _sym ; .ascii _msg ; .text
90 1.8.8.2 nathanw #else
91 1.8.8.2 nathanw #define WARN_REFERENCES(_sym,_msg) \
92 1.8.8.2 nathanw .section .gnu.warning./**/_sym ; .ascii _msg ; .text
93 1.8.8.2 nathanw #endif /* __STDC__ */
94 1.8.8.2 nathanw
95 1.8.8.2 nathanw /* Condition Register Bit Fields */
96 1.8.8.2 nathanw
97 1.8.8.2 nathanw #if defined(_KERNEL) || defined(_STANDALONE)
98 1.8.8.2 nathanw #define cr0 0
99 1.8.8.2 nathanw #define cr1 1
100 1.8.8.2 nathanw #define cr2 2
101 1.8.8.2 nathanw #define cr3 3
102 1.8.8.2 nathanw #define cr4 4
103 1.8.8.2 nathanw #define cr5 5
104 1.8.8.2 nathanw #define cr6 6
105 1.8.8.2 nathanw #define cr7 7
106 1.8.8.2 nathanw #endif
107 1.8.8.2 nathanw
108 1.8.8.2 nathanw /* General Purpose Registers (GPRs) */
109 1.8.8.2 nathanw
110 1.8.8.2 nathanw #if defined(_KERNEL) || defined(_STANDALONE)
111 1.8.8.2 nathanw #define r0 0
112 1.8.8.2 nathanw #define r1 1
113 1.8.8.2 nathanw #define r2 2
114 1.8.8.2 nathanw #define r3 3
115 1.8.8.2 nathanw #define r4 4
116 1.8.8.2 nathanw #define r5 5
117 1.8.8.2 nathanw #define r6 6
118 1.8.8.2 nathanw #define r7 7
119 1.8.8.2 nathanw #define r8 8
120 1.8.8.2 nathanw #define r9 9
121 1.8.8.2 nathanw #define r10 10
122 1.8.8.2 nathanw #define r11 11
123 1.8.8.2 nathanw #define r12 12
124 1.8.8.2 nathanw #define r13 13
125 1.8.8.2 nathanw #define r14 14
126 1.8.8.2 nathanw #define r15 15
127 1.8.8.2 nathanw #define r16 16
128 1.8.8.2 nathanw #define r17 17
129 1.8.8.2 nathanw #define r18 18
130 1.8.8.2 nathanw #define r19 19
131 1.8.8.2 nathanw #define r20 20
132 1.8.8.2 nathanw #define r21 21
133 1.8.8.2 nathanw #define r22 22
134 1.8.8.2 nathanw #define r23 23
135 1.8.8.2 nathanw #define r24 24
136 1.8.8.2 nathanw #define r25 25
137 1.8.8.2 nathanw #define r26 26
138 1.8.8.2 nathanw #define r27 27
139 1.8.8.2 nathanw #define r28 28
140 1.8.8.2 nathanw #define r29 29
141 1.8.8.2 nathanw #define r30 30
142 1.8.8.2 nathanw #define r31 31
143 1.8.8.2 nathanw #endif
144 1.8.8.2 nathanw
145 1.8.8.2 nathanw /* Floating Point Registers (FPRs) */
146 1.8.8.2 nathanw
147 1.8.8.2 nathanw #if defined(_KERNEL) || defined(_STANDALONE)
148 1.8.8.2 nathanw #define fr0 0
149 1.8.8.2 nathanw #define fr1 1
150 1.8.8.2 nathanw #define fr2 2
151 1.8.8.2 nathanw #define fr3 3
152 1.8.8.2 nathanw #define fr4 4
153 1.8.8.2 nathanw #define fr5 5
154 1.8.8.2 nathanw #define fr6 6
155 1.8.8.2 nathanw #define fr7 7
156 1.8.8.2 nathanw #define fr8 8
157 1.8.8.2 nathanw #define fr9 9
158 1.8.8.2 nathanw #define fr10 10
159 1.8.8.2 nathanw #define fr11 11
160 1.8.8.2 nathanw #define fr12 12
161 1.8.8.2 nathanw #define fr13 13
162 1.8.8.2 nathanw #define fr14 14
163 1.8.8.2 nathanw #define fr15 15
164 1.8.8.2 nathanw #define fr16 16
165 1.8.8.2 nathanw #define fr17 17
166 1.8.8.2 nathanw #define fr18 18
167 1.8.8.2 nathanw #define fr19 19
168 1.8.8.2 nathanw #define fr20 20
169 1.8.8.2 nathanw #define fr21 21
170 1.8.8.2 nathanw #define fr22 22
171 1.8.8.2 nathanw #define fr23 23
172 1.8.8.2 nathanw #define fr24 24
173 1.8.8.2 nathanw #define fr25 25
174 1.8.8.2 nathanw #define fr26 26
175 1.8.8.2 nathanw #define fr27 27
176 1.8.8.2 nathanw #define fr28 28
177 1.8.8.2 nathanw #define fr29 29
178 1.8.8.2 nathanw #define fr30 30
179 1.8.8.2 nathanw #define fr31 31
180 1.8.8.2 nathanw #endif
181 1.8.8.2 nathanw
182 1.8.8.2 nathanw #endif /* !_PPC_ASM_H_ */
183