Wed Jun 8 05:11:07 2011 UTC ()
In INIT_CPUINFO, make L_CPU to set the cpu_info (just to be safe).


(matt)
diff -r1.37 -r1.38 src/sys/arch/powerpc/include/asm.h

cvs diff -r1.37 -r1.38 src/sys/arch/powerpc/include/asm.h (switch to unified diff)

--- src/sys/arch/powerpc/include/asm.h 2011/06/05 16:52:25 1.37
+++ src/sys/arch/powerpc/include/asm.h 2011/06/08 05:11:07 1.38
@@ -1,404 +1,405 @@ @@ -1,404 +1,405 @@
1/* $NetBSD: asm.h,v 1.37 2011/06/05 16:52:25 matt Exp $ */ 1/* $NetBSD: asm.h,v 1.38 2011/06/08 05:11:07 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH. 5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution. 15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software 16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement: 17 * must display the following acknowledgement:
18 * This product includes software developed by TooLs GmbH. 18 * This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products 19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 * derived from this software without specific prior written permission. 20 * derived from this software without specific prior written permission.
21 * 21 *
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#ifndef _PPC_ASM_H_ 34#ifndef _PPC_ASM_H_
35#define _PPC_ASM_H_ 35#define _PPC_ASM_H_
36 36
37#ifdef _LP64 37#ifdef _LP64
38 38
39/* ppc64 is always PIC, r2 is always the TOC */ 39/* ppc64 is always PIC, r2 is always the TOC */
40 40
41#define PIC_PLT(x) .x 41#define PIC_PLT(x) .x
42 42
43#else 43#else
44 44
45#ifdef PIC 45#ifdef PIC
46#define PIC_PROLOGUE XXX 46#define PIC_PROLOGUE XXX
47#define PIC_EPILOGUE XXX 47#define PIC_EPILOGUE XXX
48#define PIC_PLT(x) x+32768@plt 48#define PIC_PLT(x) x+32768@plt
49#ifdef __STDC__ 49#ifdef __STDC__
50#define PIC_TOCNAME(name) .LCTOC_##name 50#define PIC_TOCNAME(name) .LCTOC_##name
51#else 51#else
52#define PIC_TOCNAME(name) .LCTOC_/**/name 52#define PIC_TOCNAME(name) .LCTOC_/**/name
53#endif 53#endif
54#define PIC_TOCSETUP(name, reg) \ 54#define PIC_TOCSETUP(name, reg) \
55 .pushsection ".got2","aw" ;\ 55 .pushsection ".got2","aw" ;\
56 PIC_TOCNAME(name) = . + 32768 ;\ 56 PIC_TOCNAME(name) = . + 32768 ;\
57 .popsection ;\ 57 .popsection ;\
58 bcl 20,31,1001f ;\ 58 bcl 20,31,1001f ;\
59 1001: mflr reg ;\ 59 1001: mflr reg ;\
60 addis reg,reg,PIC_TOCNAME(name)-1001b@ha ;\ 60 addis reg,reg,PIC_TOCNAME(name)-1001b@ha ;\
61 addi reg,reg,PIC_TOCNAME(name)-1001b@l 61 addi reg,reg,PIC_TOCNAME(name)-1001b@l
62#define PIC_GOTSETUP(reg) \ 62#define PIC_GOTSETUP(reg) \
63 bcl 20,31,2002f ;\ 63 bcl 20,31,2002f ;\
64 2002: mflr reg ;\ 64 2002: mflr reg ;\
65 addis reg,reg,_GLOBAL_OFFSET_TABLE_-2002b@ha ;\ 65 addis reg,reg,_GLOBAL_OFFSET_TABLE_-2002b@ha ;\
66 addi reg,reg,_GLOBAL_OFFSET_TABLE_-2002b@l 66 addi reg,reg,_GLOBAL_OFFSET_TABLE_-2002b@l
67#ifdef __STDC__ 67#ifdef __STDC__
68#define PIC_GOT(x) XXX 68#define PIC_GOT(x) XXX
69#define PIC_GOTOFF(x) XXX 69#define PIC_GOTOFF(x) XXX
70#else /* not __STDC__ */ 70#else /* not __STDC__ */
71#define PIC_GOT(x) XXX 71#define PIC_GOT(x) XXX
72#define PIC_GOTOFF(x) XXX 72#define PIC_GOTOFF(x) XXX
73#endif /* __STDC__ */ 73#endif /* __STDC__ */
74#else 74#else
75#define PIC_PROLOGUE 75#define PIC_PROLOGUE
76#define PIC_EPILOGUE 76#define PIC_EPILOGUE
77#define PIC_PLT(x) x 77#define PIC_PLT(x) x
78#define PIC_GOT(x) x 78#define PIC_GOT(x) x
79#define PIC_GOTOFF(x) x 79#define PIC_GOTOFF(x) x
80#define PIC_GOTSETUP(r) 80#define PIC_GOTSETUP(r)
81#define PIC_TOCSETUP(n, r) 81#define PIC_TOCSETUP(n, r)
82#endif 82#endif
83 83
84#endif 84#endif
85 85
86#define _C_LABEL(x) x 86#define _C_LABEL(x) x
87#define _ASM_LABEL(x) x 87#define _ASM_LABEL(x) x
88 88
89#define _GLOBAL(x) \ 89#define _GLOBAL(x) \
90 .data; .align 2; .globl x; x: 90 .data; .align 2; .globl x; x:
91 91
92#ifdef GPROF 92#ifdef GPROF
93# define _PROF_PROLOGUE mflr 0; stw 0,4(1); bl _mcount 93# define _PROF_PROLOGUE mflr 0; stw 0,4(1); bl _mcount
94#else 94#else
95# define _PROF_PROLOGUE 95# define _PROF_PROLOGUE
96#endif 96#endif
97 97
98#ifdef _LP64 98#ifdef _LP64
99 99
100#define SF_HEADER_SZ 48 100#define SF_HEADER_SZ 48
101#define SF_PARAM_SZ 64 101#define SF_PARAM_SZ 64
102#define SF_SZ (SF_HEADER_SZ + SF_PARAM_SZ) 102#define SF_SZ (SF_HEADER_SZ + SF_PARAM_SZ)
103 103
104#define SF_SP 0 104#define SF_SP 0
105#define SF_CR 8 105#define SF_CR 8
106#define SF_LR 16 106#define SF_LR 16
107#define SF_PARAM SF_HEADER_SZ 107#define SF_PARAM SF_HEADER_SZ
108 108
109#define ENTRY(y) \ 109#define ENTRY(y) \
110 .globl y; \ 110 .globl y; \
111 .section ".opd","aw"; \ 111 .section ".opd","aw"; \
112 .align 3; \ 112 .align 3; \
113y: .quad .y,.TOC.@tocbase,0; \ 113y: .quad .y,.TOC.@tocbase,0; \
114 .previous; \ 114 .previous; \
115 .size y,24; \ 115 .size y,24; \
116 .type .y,@function; \ 116 .type .y,@function; \
117 .globl .y; \ 117 .globl .y; \
118 .align 3; \ 118 .align 3; \
119.y: 119.y:
120 120
121#define CALL(y) \ 121#define CALL(y) \
122 bl .y; \ 122 bl .y; \
123 nop 123 nop
124 124
125#define ENTRY_NOPROFILE(y) ENTRY(y) 125#define ENTRY_NOPROFILE(y) ENTRY(y)
126#define ASENTRY(y) ENTRY(y) 126#define ASENTRY(y) ENTRY(y)
127#else 127#else
128 128
129#define _ENTRY(x) \ 129#define _ENTRY(x) \
130 .text; .align 2; .globl x; .type x,@function; x: 130 .text; .align 2; .globl x; .type x,@function; x:
131 131
132#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE 132#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
133#define END(y) .size _C_LABEL(y),.-_C_LABEL(y) 133#define END(y) .size _C_LABEL(y),.-_C_LABEL(y)
134 134
135#define ENTRY_NOPROFILE(y) _ENTRY(_C_LABEL(y)) 135#define ENTRY_NOPROFILE(y) _ENTRY(_C_LABEL(y))
136 136
137#define CALL(y) \ 137#define CALL(y) \
138 bl y 138 bl y
139 139
140#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE 140#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
141#endif 141#endif
142 142
143#define GLOBAL(y) _GLOBAL(_C_LABEL(y)) 143#define GLOBAL(y) _GLOBAL(_C_LABEL(y))
144 144
145#define ASMSTR .asciz 145#define ASMSTR .asciz
146 146
147#undef __RCSID 147#undef __RCSID
148#define RCSID(x) __RCSID(x) 148#define RCSID(x) __RCSID(x)
149#define __RCSID(x) .pushsection .ident; .asciz x; .popsection 149#define __RCSID(x) .pushsection .ident; .asciz x; .popsection
150 150
151#ifdef __ELF__ 151#ifdef __ELF__
152#define WEAK_ALIAS(alias,sym) \ 152#define WEAK_ALIAS(alias,sym) \
153 .weak alias; \ 153 .weak alias; \
154 alias = sym 154 alias = sym
155#endif 155#endif
156/* 156/*
157 * STRONG_ALIAS: create a strong alias. 157 * STRONG_ALIAS: create a strong alias.
158 */ 158 */
159#define STRONG_ALIAS(alias,sym) \ 159#define STRONG_ALIAS(alias,sym) \
160 .globl alias; \ 160 .globl alias; \
161 alias = sym 161 alias = sym
162 162
163#ifdef __STDC__ 163#ifdef __STDC__
164#define WARN_REFERENCES(sym,msg) \ 164#define WARN_REFERENCES(sym,msg) \
165 .pushsection .gnu.warning. ## sym; \ 165 .pushsection .gnu.warning. ## sym; \
166 .ascii msg; \ 166 .ascii msg; \
167 .popsection 167 .popsection
168#else 168#else
169#define WARN_REFERENCES(sym,msg) \ 169#define WARN_REFERENCES(sym,msg) \
170 .pushsection .gnu.warning./**/sym; \ 170 .pushsection .gnu.warning./**/sym; \
171 .ascii msg; \ 171 .ascii msg; \
172 .popsection 172 .popsection
173#endif /* __STDC__ */ 173#endif /* __STDC__ */
174 174
175#ifdef _KERNEL 175#ifdef _KERNEL
176/* 176/*
177 * Get cpu_info pointer for current processor. Always in SPRG0. *ALWAYS* 177 * Get cpu_info pointer for current processor. Always in SPRG0. *ALWAYS*
178 */ 178 */
179#define GET_CPUINFO(r) mfsprg r,0 179#define GET_CPUINFO(r) mfsprg r,0
180/* 180/*
181 * IN: 181 * IN:
182 * R4[er] = first free byte beyond end/esym. 182 * R4[er] = first free byte beyond end/esym.
183 * 183 *
184 * OUT: 184 * OUT:
185 * R1[sp] = new kernel stack 185 * R1[sp] = new kernel stack
186 * R4[er] = kernelend 186 * R4[er] = kernelend
187 */ 187 */
188 188
189#ifdef CI_INTSTK 189#ifdef CI_INTSTK
190#define INIT_CPUINFO_INTSTK(er,tmp1) \ 190#define INIT_CPUINFO_INTSTK(er,tmp1) \
191 addi er,er,INTSTK; \ 191 addi er,er,INTSTK; \
192 stptr er,CI_INTSTK(tmp1) 192 stptr er,CI_INTSTK(tmp1)
193#else 193#else
194#define INIT_CPUINFO_INTSTK(er,tmp1) /* nothing */ 194#define INIT_CPUINFO_INTSTK(er,tmp1) /* nothing */
195#endif 195#endif
196 196
197/* 197/*
198 * We use lis/ori instead of lis/addi in case tmp2 is r0. 198 * We use lis/ori instead of lis/addi in case tmp2 is r0.
199 */ 199 */
200#define INIT_CPUINFO(er,sp,tmp1,tmp2) \ 200#define INIT_CPUINFO(er,sp,tmp1,tmp2) \
201 li tmp1,PAGE_MASK; \ 201 li tmp1,PAGE_MASK; \
202 add er,er,tmp1; \ 202 add er,er,tmp1; \
203 andc er,er,tmp1; /* page align */ \ 203 andc er,er,tmp1; /* page align */ \
204 lis tmp1,_C_LABEL(cpu_info)@ha; \ 204 lis tmp1,_C_LABEL(cpu_info)@ha; \
205 addi tmp1,tmp1,_C_LABEL(cpu_info)@l; \ 205 addi tmp1,tmp1,_C_LABEL(cpu_info)@l; \
206 mtsprg0 tmp1; /* save for later use */ \ 206 mtsprg0 tmp1; /* save for later use */ \
207 INIT_CPUINFO_INTSTK(er,tmp1); \ 207 INIT_CPUINFO_INTSTK(er,tmp1); \
208 lis tmp2,_C_LABEL(emptyidlespin)@h; \ 208 lis tmp2,_C_LABEL(emptyidlespin)@h; \
209 ori tmp2,tmp2,_C_LABEL(emptyidlespin)@l; \ 209 ori tmp2,tmp2,_C_LABEL(emptyidlespin)@l; \
210 stptr tmp2,CI_IDLESPIN(tmp1); \ 210 stptr tmp2,CI_IDLESPIN(tmp1); \
211 li tmp2,-1; \ 211 li tmp2,-1; \
212 stint tmp2,CI_IDEPTH(tmp1); \ 212 stint tmp2,CI_IDEPTH(tmp1); \
213 li tmp2,0; \ 213 li tmp2,0; \
214 lis %r13,_C_LABEL(lwp0)@h; \ 214 lis %r13,_C_LABEL(lwp0)@h; \
215 ori %r13,%r13,_C_LABEL(lwp0)@l; \ 215 ori %r13,%r13,_C_LABEL(lwp0)@l; \
216 stptr er,L_PCB(%r13); /* XXXuvm_lwp_getuarea */ \ 216 stptr er,L_PCB(%r13); /* XXXuvm_lwp_getuarea */ \
 217 stptr tmp1,L_CPU(%r13); \
217 addi er,er,USPACE; /* stackpointer for lwp0 */ \ 218 addi er,er,USPACE; /* stackpointer for lwp0 */ \
218 addi sp,er,-FRAMELEN-CALLFRAMELEN; /* stackpointer for lwp0 */ \ 219 addi sp,er,-FRAMELEN-CALLFRAMELEN; /* stackpointer for lwp0 */ \
219 stptr sp,L_MD_UTF(%r13); /* save in lwp0.l_md.md_utf */ \ 220 stptr sp,L_MD_UTF(%r13); /* save in lwp0.l_md.md_utf */ \
220 /* er = end of mem reserved for kernel */ \ 221 /* er = end of mem reserved for kernel */ \
221 li tmp2,0; \ 222 li tmp2,0; \
222 stptr tmp2,-CALLFRAMELEN(er); /* end of stack chain */ \ 223 stptr tmp2,-CALLFRAMELEN(er); /* end of stack chain */ \
223 stptru tmp2,-CALLFRAMELEN(sp) /* end of stack chain */ 224 stptru tmp2,-CALLFRAMELEN(sp) /* end of stack chain */
224 225
225#endif 226#endif
226 227
227/* Condition Register Bit Fields */ 228/* Condition Register Bit Fields */
228 229
229#if defined(_REGNAMES) 230#if defined(_REGNAMES)
230#if defined(_KERNEL) || defined(_STANDALONE) 231#if defined(_KERNEL) || defined(_STANDALONE)
231#define cr0 0 232#define cr0 0
232#define cr1 1 233#define cr1 1
233#define cr2 2 234#define cr2 2
234#define cr3 3 235#define cr3 3
235#define cr4 4 236#define cr4 4
236#define cr5 5 237#define cr5 5
237#define cr6 6 238#define cr6 6
238#define cr7 7 239#define cr7 7
239#endif 240#endif
240 241
241/* General Purpose Registers (GPRs) */ 242/* General Purpose Registers (GPRs) */
242 243
243#if defined(_KERNEL) || defined(_STANDALONE) 244#if defined(_KERNEL) || defined(_STANDALONE)
244#define r0 0 245#define r0 0
245#define r1 1 246#define r1 1
246#define r2 2 247#define r2 2
247#define r3 3 248#define r3 3
248#define r4 4 249#define r4 4
249#define r5 5 250#define r5 5
250#define r6 6 251#define r6 6
251#define r7 7 252#define r7 7
252#define r8 8 253#define r8 8
253#define r9 9 254#define r9 9
254#define r10 10 255#define r10 10
255#define r11 11 256#define r11 11
256#define r12 12 257#define r12 12
257#define r13 13 258#define r13 13
258#define r14 14 259#define r14 14
259#define r15 15 260#define r15 15
260#define r16 16 261#define r16 16
261#define r17 17 262#define r17 17
262#define r18 18 263#define r18 18
263#define r19 19 264#define r19 19
264#define r20 20 265#define r20 20
265#define r21 21 266#define r21 21
266#define r22 22 267#define r22 22
267#define r23 23 268#define r23 23
268#define r24 24 269#define r24 24
269#define r25 25 270#define r25 25
270#define r26 26 271#define r26 26
271#define r27 27 272#define r27 27
272#define r28 28 273#define r28 28
273#define r29 29 274#define r29 29
274#define r30 30 275#define r30 30
275#define r31 31 276#define r31 31
276#endif 277#endif
277 278
278/* Floating Point Registers (FPRs) */ 279/* Floating Point Registers (FPRs) */
279 280
280#if defined(_KERNEL) || defined(_STANDALONE) 281#if defined(_KERNEL) || defined(_STANDALONE)
281#define fr0 0 282#define fr0 0
282#define fr1 1 283#define fr1 1
283#define fr2 2 284#define fr2 2
284#define fr3 3 285#define fr3 3
285#define fr4 4 286#define fr4 4
286#define fr5 5 287#define fr5 5
287#define fr6 6 288#define fr6 6
288#define fr7 7 289#define fr7 7
289#define fr8 8 290#define fr8 8
290#define fr9 9 291#define fr9 9
291#define fr10 10 292#define fr10 10
292#define fr11 11 293#define fr11 11
293#define fr12 12 294#define fr12 12
294#define fr13 13 295#define fr13 13
295#define fr14 14 296#define fr14 14
296#define fr15 15 297#define fr15 15
297#define fr16 16 298#define fr16 16
298#define fr17 17 299#define fr17 17
299#define fr18 18 300#define fr18 18
300#define fr19 19 301#define fr19 19
301#define fr20 20 302#define fr20 20
302#define fr21 21 303#define fr21 21
303#define fr22 22 304#define fr22 22
304#define fr23 23 305#define fr23 23
305#define fr24 24 306#define fr24 24
306#define fr25 25 307#define fr25 25
307#define fr26 26 308#define fr26 26
308#define fr27 27 309#define fr27 27
309#define fr28 28 310#define fr28 28
310#define fr29 29 311#define fr29 29
311#define fr30 30 312#define fr30 30
312#define fr31 31 313#define fr31 31
313#endif 314#endif
314#endif /* _REGNAMES */ 315#endif /* _REGNAMES */
315 316
316/* 317/*
317 * Add some psuedo instructions to made sharing of assembly versions of 318 * Add some psuedo instructions to made sharing of assembly versions of
318 * ILP32 and LP64 code possible. 319 * ILP32 and LP64 code possible.
319 */ 320 */
320#define ldint lwz /* not needed but for completeness */ 321#define ldint lwz /* not needed but for completeness */
321#define ldintu lwzu /* not needed but for completeness */ 322#define ldintu lwzu /* not needed but for completeness */
322#define stint stw /* not needed but for completeness */ 323#define stint stw /* not needed but for completeness */
323#define stintu stwu /* not needed but for completeness */ 324#define stintu stwu /* not needed but for completeness */
324 325
325#ifndef _LP64 326#ifndef _LP64
326 327
327#define ldlong lwz /* load "C" long */ 328#define ldlong lwz /* load "C" long */
328#define ldlongu lwzu /* load "C" long with udpate */ 329#define ldlongu lwzu /* load "C" long with udpate */
329#define stlong stw /* load "C" long */ 330#define stlong stw /* load "C" long */
330#define stlongu stwu /* load "C" long with udpate */ 331#define stlongu stwu /* load "C" long with udpate */
331#define ldptr lwz /* load "C" pointer */ 332#define ldptr lwz /* load "C" pointer */
332#define ldptru lwzu /* load "C" pointer with udpate */ 333#define ldptru lwzu /* load "C" pointer with udpate */
333#define stptr stw /* load "C" pointer */ 334#define stptr stw /* load "C" pointer */
334#define stptru stwu /* load "C" pointer with udpate */ 335#define stptru stwu /* load "C" pointer with udpate */
335#define ldreg lwz /* load PPC general register */ 336#define ldreg lwz /* load PPC general register */
336#define ldregu lwzu /* load PPC general register with udpate */ 337#define ldregu lwzu /* load PPC general register with udpate */
337#define streg stw /* load PPC general register */ 338#define streg stw /* load PPC general register */
338#define stregu stwu /* load PPC general register with udpate */ 339#define stregu stwu /* load PPC general register with udpate */
339#define SZREG 4 /* 4 byte registers */ 340#define SZREG 4 /* 4 byte registers */
340 341
341#define lptrarx lwarx /* load "C" pointer with reservation */ 342#define lptrarx lwarx /* load "C" pointer with reservation */
342#define llongarx lwarx /* load "C" long with reservation */ 343#define llongarx lwarx /* load "C" long with reservation */
343#define lregarx lwarx /* load PPC general register with reservation */ 344#define lregarx lwarx /* load PPC general register with reservation */
344 345
345#define stptrcx stwcx /* store "C" pointer conditional */ 346#define stptrcx stwcx /* store "C" pointer conditional */
346#define stlongcx stwcx /* store "C" long conditional */ 347#define stlongcx stwcx /* store "C" long conditional */
347#define stregcx stwcx /* store PPC general register conditional */ 348#define stregcx stwcx /* store PPC general register conditional */
348 349
349#define clrrptri clrrwi /* clear right "C" pointer immediate */ 350#define clrrptri clrrwi /* clear right "C" pointer immediate */
350#define clrrlongi clrrwi /* clear right "C" long immediate */ 351#define clrrlongi clrrwi /* clear right "C" long immediate */
351#define clrrregi clrrwi /* clear right PPC general register immediate */ 352#define clrrregi clrrwi /* clear right PPC general register immediate */
352 353
353#else 354#else
354 355
355#define ldlong ld /* load "C" long */ 356#define ldlong ld /* load "C" long */
356#define ldlongu ldu /* load "C" long with update */ 357#define ldlongu ldu /* load "C" long with update */
357#define stlong std /* store "C" long */ 358#define stlong std /* store "C" long */
358#define stlongu stdu /* store "C" long with update */ 359#define stlongu stdu /* store "C" long with update */
359#define ldptr ld /* load "C" pointer */ 360#define ldptr ld /* load "C" pointer */
360#define ldptru ldu /* load "C" pointer with update */ 361#define ldptru ldu /* load "C" pointer with update */
361#define stptr std /* store "C" pointer */ 362#define stptr std /* store "C" pointer */
362#define stptru stdu /* store "C" pointer with update */ 363#define stptru stdu /* store "C" pointer with update */
363#define ldreg ld /* load PPC general register */ 364#define ldreg ld /* load PPC general register */
364#define ldregu ldu /* load PPC general register with update */ 365#define ldregu ldu /* load PPC general register with update */
365#define streg std /* store PPC general register */ 366#define streg std /* store PPC general register */
366#define stregu stdu /* store PPC general register with update */ 367#define stregu stdu /* store PPC general register with update */
367/* redefined this to force an error on PPC64 to catch their use. */ 368/* redefined this to force an error on PPC64 to catch their use. */
368#define lmw lmd /* load multiple PPC general registers */ 369#define lmw lmd /* load multiple PPC general registers */
369#define stmw stmd /* store multiple PPC general registers */ 370#define stmw stmd /* store multiple PPC general registers */
370#define SZREG 8 /* 8 byte registers */ 371#define SZREG 8 /* 8 byte registers */
371 372
372#define lptrarx ldarx /* load "C" pointer with reservation */ 373#define lptrarx ldarx /* load "C" pointer with reservation */
373#define llongarx ldarx /* load "C" long with reservation */ 374#define llongarx ldarx /* load "C" long with reservation */
374#define lregarx ldarx /* load PPC general register with reservation */ 375#define lregarx ldarx /* load PPC general register with reservation */
375 376
376#define stptrcx stdcx /* store "C" pointer conditional */ 377#define stptrcx stdcx /* store "C" pointer conditional */
377#define stlongcx stdcx /* store "C" long conditional */ 378#define stlongcx stdcx /* store "C" long conditional */
378#define stregax stdcx /* store PPC general register conditional */ 379#define stregax stdcx /* store PPC general register conditional */
379 380
380#define clrrptri clrrdi /* clear right "C" pointer immediate */ 381#define clrrptri clrrdi /* clear right "C" pointer immediate */
381#define clrrlongi clrrdi /* clear right "C" long immediate */ 382#define clrrlongi clrrdi /* clear right "C" long immediate */
382#define clrrregi clrrdi /* clear right PPC general register immediate */ 383#define clrrregi clrrdi /* clear right PPC general register immediate */
383 384
384#endif 385#endif
385 386
386#ifdef _LOCORE 387#ifdef _LOCORE
387.macro stmd r,dst 388.macro stmd r,dst
388 i = 0 389 i = 0
389 .rept 32-\r 390 .rept 32-\r
390 std i+\r, i*8+\dst 391 std i+\r, i*8+\dst
391 i = i + 1 392 i = i + 1
392 .endr 393 .endr
393.endm 394.endm
394 395
395.macro lmd r,dst 396.macro lmd r,dst
396 i = 0 397 i = 0
397 .rept 32-\r 398 .rept 32-\r
398 ld i+\r, i*8+\dst 399 ld i+\r, i*8+\dst
399 i = i + 1 400 i = i + 1
400 .endr 401 .endr
401.endm 402.endm
402#endif 403#endif
403 404
404#endif /* !_PPC_ASM_H_ */ 405#endif /* !_PPC_ASM_H_ */