1 /*
2  * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan.
3  */
4 #ifndef _ASM_POWERPC_PPC_ASM_H
5 #define _ASM_POWERPC_PPC_ASM_H
6 
7 #include <linux/init.h>
8 #include <linux/stringify.h>
9 #include <asm/asm-compat.h>
10 #include <asm/processor.h>
11 #include <asm/ppc-opcode.h>
12 #include <asm/firmware.h>
13 
14 #ifndef __ASSEMBLY__
15 #error __FILE__ should only be used in assembler files
16 #else
17 
18 #define SZL			(BITS_PER_LONG/8)
19 
20 /*
21  * Stuff for accurate CPU time accounting.
22  * These macros handle transitions between user and system state
23  * in exception entry and exit and accumulate time to the
24  * user_time and system_time fields in the paca.
25  */
26 
27 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
28 #define ACCOUNT_CPU_USER_ENTRY(ra, rb)
29 #define ACCOUNT_CPU_USER_EXIT(ra, rb)
30 #define ACCOUNT_STOLEN_TIME
31 #else
32 #define ACCOUNT_CPU_USER_ENTRY(ra, rb)					\
33 	beq	2f;			/* if from kernel mode */	\
34 	MFTB(ra);			/* get timebase */		\
35 	ld	rb,PACA_STARTTIME_USER(r13);				\
36 	std	ra,PACA_STARTTIME(r13);					\
37 	subf	rb,rb,ra;		/* subtract start value */	\
38 	ld	ra,PACA_USER_TIME(r13);					\
39 	add	ra,ra,rb;		/* add on to user time */	\
40 	std	ra,PACA_USER_TIME(r13);					\
41 2:
42 
43 #define ACCOUNT_CPU_USER_EXIT(ra, rb)					\
44 	MFTB(ra);			/* get timebase */		\
45 	ld	rb,PACA_STARTTIME(r13);					\
46 	std	ra,PACA_STARTTIME_USER(r13);				\
47 	subf	rb,rb,ra;		/* subtract start value */	\
48 	ld	ra,PACA_SYSTEM_TIME(r13);				\
49 	add	ra,ra,rb;		/* add on to system time */	\
50 	std	ra,PACA_SYSTEM_TIME(r13)
51 
52 #ifdef CONFIG_PPC_SPLPAR
53 #define ACCOUNT_STOLEN_TIME						\
54 BEGIN_FW_FTR_SECTION;							\
55 	beq	33f;							\
56 	/* from user - see if there are any DTL entries to process */	\
57 	ld	r10,PACALPPACAPTR(r13);	/* get ptr to VPA */		\
58 	ld	r11,PACA_DTL_RIDX(r13);	/* get log read index */	\
59 	ld	r10,LPPACA_DTLIDX(r10);	/* get log write index */	\
60 	cmpd	cr1,r11,r10;						\
61 	beq+	cr1,33f;						\
62 	bl	.accumulate_stolen_time;				\
63 	ld	r12,_MSR(r1);						\
64 	andi.	r10,r12,MSR_PR;		/* Restore cr0 (coming from user) */ \
65 33:									\
66 END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
67 
68 #else  /* CONFIG_PPC_SPLPAR */
69 #define ACCOUNT_STOLEN_TIME
70 
71 #endif /* CONFIG_PPC_SPLPAR */
72 
73 #endif /* CONFIG_VIRT_CPU_ACCOUNTING */
74 
75 /*
76  * Macros for storing registers into and loading registers from
77  * exception frames.
78  */
79 #ifdef __powerpc64__
80 #define SAVE_GPR(n, base)	std	n,GPR0+8*(n)(base)
81 #define REST_GPR(n, base)	ld	n,GPR0+8*(n)(base)
82 #define SAVE_NVGPRS(base)	SAVE_8GPRS(14, base); SAVE_10GPRS(22, base)
83 #define REST_NVGPRS(base)	REST_8GPRS(14, base); REST_10GPRS(22, base)
84 #else
85 #define SAVE_GPR(n, base)	stw	n,GPR0+4*(n)(base)
86 #define REST_GPR(n, base)	lwz	n,GPR0+4*(n)(base)
87 #define SAVE_NVGPRS(base)	SAVE_GPR(13, base); SAVE_8GPRS(14, base); \
88 				SAVE_10GPRS(22, base)
89 #define REST_NVGPRS(base)	REST_GPR(13, base); REST_8GPRS(14, base); \
90 				REST_10GPRS(22, base)
91 #endif
92 
93 #define SAVE_2GPRS(n, base)	SAVE_GPR(n, base); SAVE_GPR(n+1, base)
94 #define SAVE_4GPRS(n, base)	SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base)
95 #define SAVE_8GPRS(n, base)	SAVE_4GPRS(n, base); SAVE_4GPRS(n+4, base)
96 #define SAVE_10GPRS(n, base)	SAVE_8GPRS(n, base); SAVE_2GPRS(n+8, base)
97 #define REST_2GPRS(n, base)	REST_GPR(n, base); REST_GPR(n+1, base)
98 #define REST_4GPRS(n, base)	REST_2GPRS(n, base); REST_2GPRS(n+2, base)
99 #define REST_8GPRS(n, base)	REST_4GPRS(n, base); REST_4GPRS(n+4, base)
100 #define REST_10GPRS(n, base)	REST_8GPRS(n, base); REST_2GPRS(n+8, base)
101 
102 #define SAVE_FPR(n, base)	stfd	n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base)
103 #define SAVE_2FPRS(n, base)	SAVE_FPR(n, base); SAVE_FPR(n+1, base)
104 #define SAVE_4FPRS(n, base)	SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base)
105 #define SAVE_8FPRS(n, base)	SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base)
106 #define SAVE_16FPRS(n, base)	SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base)
107 #define SAVE_32FPRS(n, base)	SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base)
108 #define REST_FPR(n, base)	lfd	n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base)
109 #define REST_2FPRS(n, base)	REST_FPR(n, base); REST_FPR(n+1, base)
110 #define REST_4FPRS(n, base)	REST_2FPRS(n, base); REST_2FPRS(n+2, base)
111 #define REST_8FPRS(n, base)	REST_4FPRS(n, base); REST_4FPRS(n+4, base)
112 #define REST_16FPRS(n, base)	REST_8FPRS(n, base); REST_8FPRS(n+8, base)
113 #define REST_32FPRS(n, base)	REST_16FPRS(n, base); REST_16FPRS(n+16, base)
114 
115 #define SAVE_VR(n,b,base)	li b,THREAD_VR0+(16*(n));  stvx n,base,b
116 #define SAVE_2VRS(n,b,base)	SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
117 #define SAVE_4VRS(n,b,base)	SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base)
118 #define SAVE_8VRS(n,b,base)	SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base)
119 #define SAVE_16VRS(n,b,base)	SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base)
120 #define SAVE_32VRS(n,b,base)	SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base)
121 #define REST_VR(n,b,base)	li b,THREAD_VR0+(16*(n)); lvx n,base,b
122 #define REST_2VRS(n,b,base)	REST_VR(n,b,base); REST_VR(n+1,b,base)
123 #define REST_4VRS(n,b,base)	REST_2VRS(n,b,base); REST_2VRS(n+2,b,base)
124 #define REST_8VRS(n,b,base)	REST_4VRS(n,b,base); REST_4VRS(n+4,b,base)
125 #define REST_16VRS(n,b,base)	REST_8VRS(n,b,base); REST_8VRS(n+8,b,base)
126 #define REST_32VRS(n,b,base)	REST_16VRS(n,b,base); REST_16VRS(n+16,b,base)
127 
128 /* Save the lower 32 VSRs in the thread VSR region */
129 #define SAVE_VSR(n,b,base)	li b,THREAD_VSR0+(16*(n));  STXVD2X(n,base,b)
130 #define SAVE_2VSRS(n,b,base)	SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base)
131 #define SAVE_4VSRS(n,b,base)	SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base)
132 #define SAVE_8VSRS(n,b,base)	SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base)
133 #define SAVE_16VSRS(n,b,base)	SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base)
134 #define SAVE_32VSRS(n,b,base)	SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base)
135 #define REST_VSR(n,b,base)	li b,THREAD_VSR0+(16*(n)); LXVD2X(n,base,b)
136 #define REST_2VSRS(n,b,base)	REST_VSR(n,b,base); REST_VSR(n+1,b,base)
137 #define REST_4VSRS(n,b,base)	REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base)
138 #define REST_8VSRS(n,b,base)	REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base)
139 #define REST_16VSRS(n,b,base)	REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base)
140 #define REST_32VSRS(n,b,base)	REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base)
141 /* Save the upper 32 VSRs (32-63) in the thread VSX region (0-31) */
142 #define SAVE_VSRU(n,b,base)	li b,THREAD_VR0+(16*(n));  STXVD2X(n+32,base,b)
143 #define SAVE_2VSRSU(n,b,base)	SAVE_VSRU(n,b,base); SAVE_VSRU(n+1,b,base)
144 #define SAVE_4VSRSU(n,b,base)	SAVE_2VSRSU(n,b,base); SAVE_2VSRSU(n+2,b,base)
145 #define SAVE_8VSRSU(n,b,base)	SAVE_4VSRSU(n,b,base); SAVE_4VSRSU(n+4,b,base)
146 #define SAVE_16VSRSU(n,b,base)	SAVE_8VSRSU(n,b,base); SAVE_8VSRSU(n+8,b,base)
147 #define SAVE_32VSRSU(n,b,base)	SAVE_16VSRSU(n,b,base); SAVE_16VSRSU(n+16,b,base)
148 #define REST_VSRU(n,b,base)	li b,THREAD_VR0+(16*(n)); LXVD2X(n+32,base,b)
149 #define REST_2VSRSU(n,b,base)	REST_VSRU(n,b,base); REST_VSRU(n+1,b,base)
150 #define REST_4VSRSU(n,b,base)	REST_2VSRSU(n,b,base); REST_2VSRSU(n+2,b,base)
151 #define REST_8VSRSU(n,b,base)	REST_4VSRSU(n,b,base); REST_4VSRSU(n+4,b,base)
152 #define REST_16VSRSU(n,b,base)	REST_8VSRSU(n,b,base); REST_8VSRSU(n+8,b,base)
153 #define REST_32VSRSU(n,b,base)	REST_16VSRSU(n,b,base); REST_16VSRSU(n+16,b,base)
154 
155 /*
156  * b = base register for addressing, o = base offset from register of 1st EVR
157  * n = first EVR, s = scratch
158  */
159 #define SAVE_EVR(n,s,b,o)	evmergehi s,s,n; stw s,o+4*(n)(b)
160 #define SAVE_2EVRS(n,s,b,o)	SAVE_EVR(n,s,b,o); SAVE_EVR(n+1,s,b,o)
161 #define SAVE_4EVRS(n,s,b,o)	SAVE_2EVRS(n,s,b,o); SAVE_2EVRS(n+2,s,b,o)
162 #define SAVE_8EVRS(n,s,b,o)	SAVE_4EVRS(n,s,b,o); SAVE_4EVRS(n+4,s,b,o)
163 #define SAVE_16EVRS(n,s,b,o)	SAVE_8EVRS(n,s,b,o); SAVE_8EVRS(n+8,s,b,o)
164 #define SAVE_32EVRS(n,s,b,o)	SAVE_16EVRS(n,s,b,o); SAVE_16EVRS(n+16,s,b,o)
165 #define REST_EVR(n,s,b,o)	lwz s,o+4*(n)(b); evmergelo n,s,n
166 #define REST_2EVRS(n,s,b,o)	REST_EVR(n,s,b,o); REST_EVR(n+1,s,b,o)
167 #define REST_4EVRS(n,s,b,o)	REST_2EVRS(n,s,b,o); REST_2EVRS(n+2,s,b,o)
168 #define REST_8EVRS(n,s,b,o)	REST_4EVRS(n,s,b,o); REST_4EVRS(n+4,s,b,o)
169 #define REST_16EVRS(n,s,b,o)	REST_8EVRS(n,s,b,o); REST_8EVRS(n+8,s,b,o)
170 #define REST_32EVRS(n,s,b,o)	REST_16EVRS(n,s,b,o); REST_16EVRS(n+16,s,b,o)
171 
172 /* Macros to adjust thread priority for hardware multithreading */
173 #define HMT_VERY_LOW	or	31,31,31	# very low priority
174 #define HMT_LOW		or	1,1,1
175 #define HMT_MEDIUM_LOW  or	6,6,6		# medium low priority
176 #define HMT_MEDIUM	or	2,2,2
177 #define HMT_MEDIUM_HIGH or	5,5,5		# medium high priority
178 #define HMT_HIGH	or	3,3,3
179 #define HMT_EXTRA_HIGH	or	7,7,7		# power7 only
180 
181 #ifdef __KERNEL__
182 #ifdef CONFIG_PPC64
183 
184 #define XGLUE(a,b) a##b
185 #define GLUE(a,b) XGLUE(a,b)
186 
187 #define _GLOBAL(name) \
188 	.section ".text"; \
189 	.align 2 ; \
190 	.globl name; \
191 	.globl GLUE(.,name); \
192 	.section ".opd","aw"; \
193 name: \
194 	.quad GLUE(.,name); \
195 	.quad .TOC.@tocbase; \
196 	.quad 0; \
197 	.previous; \
198 	.type GLUE(.,name),@function; \
199 GLUE(.,name):
200 
201 #define _INIT_GLOBAL(name) \
202 	__REF; \
203 	.align 2 ; \
204 	.globl name; \
205 	.globl GLUE(.,name); \
206 	.section ".opd","aw"; \
207 name: \
208 	.quad GLUE(.,name); \
209 	.quad .TOC.@tocbase; \
210 	.quad 0; \
211 	.previous; \
212 	.type GLUE(.,name),@function; \
213 GLUE(.,name):
214 
215 #define _KPROBE(name) \
216 	.section ".kprobes.text","a"; \
217 	.align 2 ; \
218 	.globl name; \
219 	.globl GLUE(.,name); \
220 	.section ".opd","aw"; \
221 name: \
222 	.quad GLUE(.,name); \
223 	.quad .TOC.@tocbase; \
224 	.quad 0; \
225 	.previous; \
226 	.type GLUE(.,name),@function; \
227 GLUE(.,name):
228 
229 #define _STATIC(name) \
230 	.section ".text"; \
231 	.align 2 ; \
232 	.section ".opd","aw"; \
233 name: \
234 	.quad GLUE(.,name); \
235 	.quad .TOC.@tocbase; \
236 	.quad 0; \
237 	.previous; \
238 	.type GLUE(.,name),@function; \
239 GLUE(.,name):
240 
241 #define _INIT_STATIC(name) \
242 	__REF; \
243 	.align 2 ; \
244 	.section ".opd","aw"; \
245 name: \
246 	.quad GLUE(.,name); \
247 	.quad .TOC.@tocbase; \
248 	.quad 0; \
249 	.previous; \
250 	.type GLUE(.,name),@function; \
251 GLUE(.,name):
252 
253 #else /* 32-bit */
254 
255 #define _ENTRY(n)	\
256 	.globl n;	\
257 n:
258 
259 #define _GLOBAL(n)	\
260 	.text;		\
261 	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
262 	.globl n;	\
263 n:
264 
265 #define _KPROBE(n)	\
266 	.section ".kprobes.text","a";	\
267 	.globl	n;	\
268 n:
269 
270 #endif
271 
272 /*
273  * LOAD_REG_IMMEDIATE(rn, expr)
274  *   Loads the value of the constant expression 'expr' into register 'rn'
275  *   using immediate instructions only.  Use this when it's important not
276  *   to reference other data (i.e. on ppc64 when the TOC pointer is not
277  *   valid) and when 'expr' is a constant or absolute address.
278  *
279  * LOAD_REG_ADDR(rn, name)
280  *   Loads the address of label 'name' into register 'rn'.  Use this when
281  *   you don't particularly need immediate instructions only, but you need
282  *   the whole address in one register (e.g. it's a structure address and
283  *   you want to access various offsets within it).  On ppc32 this is
284  *   identical to LOAD_REG_IMMEDIATE.
285  *
286  * LOAD_REG_ADDRBASE(rn, name)
287  * ADDROFF(name)
288  *   LOAD_REG_ADDRBASE loads part of the address of label 'name' into
289  *   register 'rn'.  ADDROFF(name) returns the remainder of the address as
290  *   a constant expression.  ADDROFF(name) is a signed expression < 16 bits
291  *   in size, so is suitable for use directly as an offset in load and store
292  *   instructions.  Use this when loading/storing a single word or less as:
293  *      LOAD_REG_ADDRBASE(rX, name)
294  *      ld	rY,ADDROFF(name)(rX)
295  */
296 #ifdef __powerpc64__
297 #ifdef HAVE_AS_ATHIGH
298 #define __AS_ATHIGH high
299 #else
300 #define __AS_ATHIGH h
301 #endif
302 #define LOAD_REG_IMMEDIATE(reg,expr)		\
303 	lis     (reg),(expr)@highest;		\
304 	ori     (reg),(reg),(expr)@higher;	\
305 	rldicr  (reg),(reg),32,31;		\
306 	oris    (reg),(reg),(expr)@__AS_ATHIGH;	\
307 	ori     (reg),(reg),(expr)@l;
308 
309 #define LOAD_REG_ADDR(reg,name)			\
310 	ld	(reg),name@got(r2)
311 
312 #define LOAD_REG_ADDRBASE(reg,name)	LOAD_REG_ADDR(reg,name)
313 #define ADDROFF(name)			0
314 
315 /* offsets for stack frame layout */
316 #define LRSAVE	16
317 
318 #else /* 32-bit */
319 
320 #define LOAD_REG_IMMEDIATE(reg,expr)		\
321 	lis	(reg),(expr)@ha;		\
322 	addi	(reg),(reg),(expr)@l;
323 
324 #define LOAD_REG_ADDR(reg,name)		LOAD_REG_IMMEDIATE(reg, name)
325 
326 #define LOAD_REG_ADDRBASE(reg, name)	lis	(reg),name@ha
327 #define ADDROFF(name)			name@l
328 
329 /* offsets for stack frame layout */
330 #define LRSAVE	4
331 
332 #endif
333 
334 /* various errata or part fixups */
335 #ifdef CONFIG_PPC601_SYNC_FIX
336 #define SYNC				\
337 BEGIN_FTR_SECTION			\
338 	sync;				\
339 	isync;				\
340 END_FTR_SECTION_IFSET(CPU_FTR_601)
341 #define SYNC_601			\
342 BEGIN_FTR_SECTION			\
343 	sync;				\
344 END_FTR_SECTION_IFSET(CPU_FTR_601)
345 #define ISYNC_601			\
346 BEGIN_FTR_SECTION			\
347 	isync;				\
348 END_FTR_SECTION_IFSET(CPU_FTR_601)
349 #else
350 #define	SYNC
351 #define SYNC_601
352 #define ISYNC_601
353 #endif
354 
355 #ifdef CONFIG_PPC_CELL
356 #define MFTB(dest)			\
357 90:	mftb  dest;			\
358 BEGIN_FTR_SECTION_NESTED(96);		\
359 	cmpwi dest,0;			\
360 	beq-  90b;			\
361 END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
362 #else
363 #define MFTB(dest)			mftb dest
364 #endif
365 
366 #ifndef CONFIG_SMP
367 #define TLBSYNC
368 #else /* CONFIG_SMP */
369 /* tlbsync is not implemented on 601 */
370 #define TLBSYNC				\
371 BEGIN_FTR_SECTION			\
372 	tlbsync;			\
373 	sync;				\
374 END_FTR_SECTION_IFCLR(CPU_FTR_601)
375 #endif
376 
377 
378 /*
379  * This instruction is not implemented on the PPC 603 or 601; however, on
380  * the 403GCX and 405GP tlbia IS defined and tlbie is not.
381  * All of these instructions exist in the 8xx, they have magical powers,
382  * and they must be used.
383  */
384 
385 #if !defined(CONFIG_4xx) && !defined(CONFIG_8xx)
386 #define tlbia					\
387 	li	r4,1024;			\
388 	mtctr	r4;				\
389 	lis	r4,KERNELBASE@h;		\
390 0:	tlbie	r4;				\
391 	addi	r4,r4,0x1000;			\
392 	bdnz	0b
393 #endif
394 
395 
396 #ifdef CONFIG_IBM440EP_ERR42
397 #define PPC440EP_ERR42 isync
398 #else
399 #define PPC440EP_ERR42
400 #endif
401 
402 /*
403  * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
404  * keep the address intact to be compatible with code shared with
405  * 32-bit classic.
406  *
407  * On the other hand, I find it useful to have them behave as expected
408  * by their name (ie always do the addition) on 64-bit BookE
409  */
410 #if defined(CONFIG_BOOKE) && !defined(CONFIG_PPC64)
411 #define toreal(rd)
412 #define fromreal(rd)
413 
414 /*
415  * We use addis to ensure compatibility with the "classic" ppc versions of
416  * these macros, which use rs = 0 to get the tophys offset in rd, rather than
417  * converting the address in r0, and so this version has to do that too
418  * (i.e. set register rd to 0 when rs == 0).
419  */
420 #define tophys(rd,rs)				\
421 	addis	rd,rs,0
422 
423 #define tovirt(rd,rs)				\
424 	addis	rd,rs,0
425 
426 #elif defined(CONFIG_PPC64)
427 #define toreal(rd)		/* we can access c000... in real mode */
428 #define fromreal(rd)
429 
430 #define tophys(rd,rs)                           \
431 	clrldi	rd,rs,2
432 
433 #define tovirt(rd,rs)                           \
434 	rotldi	rd,rs,16;			\
435 	ori	rd,rd,((KERNELBASE>>48)&0xFFFF);\
436 	rotldi	rd,rd,48
437 #else
438 /*
439  * On APUS (Amiga PowerPC cpu upgrade board), we don't know the
440  * physical base address of RAM at compile time.
441  */
442 #define toreal(rd)	tophys(rd,rd)
443 #define fromreal(rd)	tovirt(rd,rd)
444 
445 #define tophys(rd,rs)				\
446 0:	addis	rd,rs,-PAGE_OFFSET@h;		\
447 	.section ".vtop_fixup","aw";		\
448 	.align  1;				\
449 	.long   0b;				\
450 	.previous
451 
452 #define tovirt(rd,rs)				\
453 0:	addis	rd,rs,PAGE_OFFSET@h;		\
454 	.section ".ptov_fixup","aw";		\
455 	.align  1;				\
456 	.long   0b;				\
457 	.previous
458 #endif
459 
460 #ifdef CONFIG_PPC_BOOK3S_64
461 #define RFI		rfid
462 #define MTMSRD(r)	mtmsrd	r
463 #else
464 #define FIX_SRR1(ra, rb)
465 #ifndef CONFIG_40x
466 #define	RFI		rfi
467 #else
468 #define RFI		rfi; b .	/* Prevent prefetch past rfi */
469 #endif
470 #define MTMSRD(r)	mtmsr	r
471 #define CLR_TOP32(r)
472 #endif
473 
474 #endif /* __KERNEL__ */
475 
476 /* The boring bits... */
477 
478 /* Condition Register Bit Fields */
479 
480 #define	cr0	0
481 #define	cr1	1
482 #define	cr2	2
483 #define	cr3	3
484 #define	cr4	4
485 #define	cr5	5
486 #define	cr6	6
487 #define	cr7	7
488 
489 
490 /* General Purpose Registers (GPRs) */
491 
492 #define	r0	0
493 #define	r1	1
494 #define	r2	2
495 #define	r3	3
496 #define	r4	4
497 #define	r5	5
498 #define	r6	6
499 #define	r7	7
500 #define	r8	8
501 #define	r9	9
502 #define	r10	10
503 #define	r11	11
504 #define	r12	12
505 #define	r13	13
506 #define	r14	14
507 #define	r15	15
508 #define	r16	16
509 #define	r17	17
510 #define	r18	18
511 #define	r19	19
512 #define	r20	20
513 #define	r21	21
514 #define	r22	22
515 #define	r23	23
516 #define	r24	24
517 #define	r25	25
518 #define	r26	26
519 #define	r27	27
520 #define	r28	28
521 #define	r29	29
522 #define	r30	30
523 #define	r31	31
524 
525 
526 /* Floating Point Registers (FPRs) */
527 
528 #define	fr0	0
529 #define	fr1	1
530 #define	fr2	2
531 #define	fr3	3
532 #define	fr4	4
533 #define	fr5	5
534 #define	fr6	6
535 #define	fr7	7
536 #define	fr8	8
537 #define	fr9	9
538 #define	fr10	10
539 #define	fr11	11
540 #define	fr12	12
541 #define	fr13	13
542 #define	fr14	14
543 #define	fr15	15
544 #define	fr16	16
545 #define	fr17	17
546 #define	fr18	18
547 #define	fr19	19
548 #define	fr20	20
549 #define	fr21	21
550 #define	fr22	22
551 #define	fr23	23
552 #define	fr24	24
553 #define	fr25	25
554 #define	fr26	26
555 #define	fr27	27
556 #define	fr28	28
557 #define	fr29	29
558 #define	fr30	30
559 #define	fr31	31
560 
561 /* AltiVec Registers (VPRs) */
562 
563 #define	vr0	0
564 #define	vr1	1
565 #define	vr2	2
566 #define	vr3	3
567 #define	vr4	4
568 #define	vr5	5
569 #define	vr6	6
570 #define	vr7	7
571 #define	vr8	8
572 #define	vr9	9
573 #define	vr10	10
574 #define	vr11	11
575 #define	vr12	12
576 #define	vr13	13
577 #define	vr14	14
578 #define	vr15	15
579 #define	vr16	16
580 #define	vr17	17
581 #define	vr18	18
582 #define	vr19	19
583 #define	vr20	20
584 #define	vr21	21
585 #define	vr22	22
586 #define	vr23	23
587 #define	vr24	24
588 #define	vr25	25
589 #define	vr26	26
590 #define	vr27	27
591 #define	vr28	28
592 #define	vr29	29
593 #define	vr30	30
594 #define	vr31	31
595 
596 /* VSX Registers (VSRs) */
597 
598 #define	vsr0	0
599 #define	vsr1	1
600 #define	vsr2	2
601 #define	vsr3	3
602 #define	vsr4	4
603 #define	vsr5	5
604 #define	vsr6	6
605 #define	vsr7	7
606 #define	vsr8	8
607 #define	vsr9	9
608 #define	vsr10	10
609 #define	vsr11	11
610 #define	vsr12	12
611 #define	vsr13	13
612 #define	vsr14	14
613 #define	vsr15	15
614 #define	vsr16	16
615 #define	vsr17	17
616 #define	vsr18	18
617 #define	vsr19	19
618 #define	vsr20	20
619 #define	vsr21	21
620 #define	vsr22	22
621 #define	vsr23	23
622 #define	vsr24	24
623 #define	vsr25	25
624 #define	vsr26	26
625 #define	vsr27	27
626 #define	vsr28	28
627 #define	vsr29	29
628 #define	vsr30	30
629 #define	vsr31	31
630 #define	vsr32	32
631 #define	vsr33	33
632 #define	vsr34	34
633 #define	vsr35	35
634 #define	vsr36	36
635 #define	vsr37	37
636 #define	vsr38	38
637 #define	vsr39	39
638 #define	vsr40	40
639 #define	vsr41	41
640 #define	vsr42	42
641 #define	vsr43	43
642 #define	vsr44	44
643 #define	vsr45	45
644 #define	vsr46	46
645 #define	vsr47	47
646 #define	vsr48	48
647 #define	vsr49	49
648 #define	vsr50	50
649 #define	vsr51	51
650 #define	vsr52	52
651 #define	vsr53	53
652 #define	vsr54	54
653 #define	vsr55	55
654 #define	vsr56	56
655 #define	vsr57	57
656 #define	vsr58	58
657 #define	vsr59	59
658 #define	vsr60	60
659 #define	vsr61	61
660 #define	vsr62	62
661 #define	vsr63	63
662 
663 /* SPE Registers (EVPRs) */
664 
665 #define	evr0	0
666 #define	evr1	1
667 #define	evr2	2
668 #define	evr3	3
669 #define	evr4	4
670 #define	evr5	5
671 #define	evr6	6
672 #define	evr7	7
673 #define	evr8	8
674 #define	evr9	9
675 #define	evr10	10
676 #define	evr11	11
677 #define	evr12	12
678 #define	evr13	13
679 #define	evr14	14
680 #define	evr15	15
681 #define	evr16	16
682 #define	evr17	17
683 #define	evr18	18
684 #define	evr19	19
685 #define	evr20	20
686 #define	evr21	21
687 #define	evr22	22
688 #define	evr23	23
689 #define	evr24	24
690 #define	evr25	25
691 #define	evr26	26
692 #define	evr27	27
693 #define	evr28	28
694 #define	evr29	29
695 #define	evr30	30
696 #define	evr31	31
697 
698 /* some stab codes */
699 #define N_FUN	36
700 #define N_RSYM	64
701 #define N_SLINE	68
702 #define N_SO	100
703 
704 #endif /*  __ASSEMBLY__ */
705 
706 #endif /* _ASM_POWERPC_PPC_ASM_H */
707