aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/ppc_asm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/ppc_asm.h')
-rw-r--r--include/asm-powerpc/ppc_asm.h79
1 files changed, 43 insertions, 36 deletions
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index c27baa0563fe..ab8688d39024 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -94,6 +94,7 @@
94#define RFDI .long 0x4c00004e /* rfdi instruction */ 94#define RFDI .long 0x4c00004e /* rfdi instruction */
95#define RFMCI .long 0x4c00004c /* rfmci instruction */ 95#define RFMCI .long 0x4c00004c /* rfmci instruction */
96 96
97#ifdef __KERNEL__
97#ifdef CONFIG_PPC64 98#ifdef CONFIG_PPC64
98 99
99#define XGLUE(a,b) a##b 100#define XGLUE(a,b) a##b
@@ -155,52 +156,56 @@ n:
155#endif 156#endif
156 157
157/* 158/*
158 * LOADADDR( rn, name ) 159 * LOAD_REG_IMMEDIATE(rn, expr)
159 * loads the address of 'name' into 'rn' 160 * Loads the value of the constant expression 'expr' into register 'rn'
161 * using immediate instructions only. Use this when it's important not
162 * to reference other data (i.e. on ppc64 when the TOC pointer is not
163 * valid).
160 * 164 *
161 * LOADBASE( rn, name ) 165 * LOAD_REG_ADDR(rn, name)
162 * loads the address (possibly without the low 16 bits) of 'name' into 'rn' 166 * Loads the address of label 'name' into register 'rn'. Use this when
163 * suitable for base+disp addressing 167 * you don't particularly need immediate instructions only, but you need
168 * the whole address in one register (e.g. it's a structure address and
169 * you want to access various offsets within it). On ppc32 this is
170 * identical to LOAD_REG_IMMEDIATE.
171 *
172 * LOAD_REG_ADDRBASE(rn, name)
173 * ADDROFF(name)
174 * LOAD_REG_ADDRBASE loads part of the address of label 'name' into
175 * register 'rn'. ADDROFF(name) returns the remainder of the address as
176 * a constant expression. ADDROFF(name) is a signed expression < 16 bits
177 * in size, so is suitable for use directly as an offset in load and store
178 * instructions. Use this when loading/storing a single word or less as:
179 * LOAD_REG_ADDRBASE(rX, name)
180 * ld rY,ADDROFF(name)(rX)
164 */ 181 */
165#ifdef __powerpc64__ 182#ifdef __powerpc64__
166#define LOADADDR(rn,name) \ 183#define LOAD_REG_IMMEDIATE(reg,expr) \
167 lis rn,name##@highest; \ 184 lis (reg),(expr)@highest; \
168 ori rn,rn,name##@higher; \ 185 ori (reg),(reg),(expr)@higher; \
169 rldicr rn,rn,32,31; \ 186 rldicr (reg),(reg),32,31; \
170 oris rn,rn,name##@h; \ 187 oris (reg),(reg),(expr)@h; \
171 ori rn,rn,name##@l 188 ori (reg),(reg),(expr)@l;
172 189
173#define LOADBASE(rn,name) \ 190#define LOAD_REG_ADDR(reg,name) \
174 ld rn,name@got(r2) 191 ld (reg),name@got(r2)
175 192
176#define OFF(name) 0 193#define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name)
177 194#define ADDROFF(name) 0
178#define SET_REG_TO_CONST(reg, value) \
179 lis reg,(((value)>>48)&0xFFFF); \
180 ori reg,reg,(((value)>>32)&0xFFFF); \
181 rldicr reg,reg,32,31; \
182 oris reg,reg,(((value)>>16)&0xFFFF); \
183 ori reg,reg,((value)&0xFFFF);
184
185#define SET_REG_TO_LABEL(reg, label) \
186 lis reg,(label)@highest; \
187 ori reg,reg,(label)@higher; \
188 rldicr reg,reg,32,31; \
189 oris reg,reg,(label)@h; \
190 ori reg,reg,(label)@l;
191 195
192/* offsets for stack frame layout */ 196/* offsets for stack frame layout */
193#define LRSAVE 16 197#define LRSAVE 16
194 198
195#else /* 32-bit */ 199#else /* 32-bit */
196#define LOADADDR(rn,name) \
197 lis rn,name@ha; \
198 addi rn,rn,name@l
199 200
200#define LOADBASE(rn,name) \ 201#define LOAD_REG_IMMEDIATE(reg,expr) \
201 lis rn,name@ha 202 lis (reg),(expr)@ha; \
203 addi (reg),(reg),(expr)@l;
202 204
203#define OFF(name) name@l 205#define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name)
206
207#define LOAD_REG_ADDRBASE(reg, name) lis (reg),name@ha
208#define ADDROFF(name) name@l
204 209
205/* offsets for stack frame layout */ 210/* offsets for stack frame layout */
206#define LRSAVE 4 211#define LRSAVE 4
@@ -325,6 +330,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
325#define CLR_TOP32(r) 330#define CLR_TOP32(r)
326#endif 331#endif
327 332
333#endif /* __KERNEL__ */
334
328/* The boring bits... */ 335/* The boring bits... */
329 336
330/* Condition Register Bit Fields */ 337/* Condition Register Bit Fields */