diff options
Diffstat (limited to 'include/asm-powerpc/ppc_asm.h')
-rw-r--r-- | include/asm-powerpc/ppc_asm.h | 92 |
1 files changed, 66 insertions, 26 deletions
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h index 6cd52c130332..e4350e406d2a 100644 --- a/include/asm-powerpc/ppc_asm.h +++ b/include/asm-powerpc/ppc_asm.h | |||
@@ -1,10 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. | 2 | * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. |
3 | */ | 3 | */ |
4 | |||
5 | #ifndef _ASM_POWERPC_PPC_ASM_H | 4 | #ifndef _ASM_POWERPC_PPC_ASM_H |
6 | #define _ASM_POWERPC_PPC_ASM_H | 5 | #define _ASM_POWERPC_PPC_ASM_H |
7 | 6 | ||
7 | #include <linux/stringify.h> | ||
8 | #include <linux/config.h> | ||
9 | |||
8 | #ifdef __ASSEMBLY__ | 10 | #ifdef __ASSEMBLY__ |
9 | 11 | ||
10 | /* | 12 | /* |
@@ -87,6 +89,66 @@ | |||
87 | #define RFDI .long 0x4c00004e /* rfdi instruction */ | 89 | #define RFDI .long 0x4c00004e /* rfdi instruction */ |
88 | #define RFMCI .long 0x4c00004c /* rfmci instruction */ | 90 | #define RFMCI .long 0x4c00004c /* rfmci instruction */ |
89 | 91 | ||
92 | #ifdef CONFIG_PPC64 | ||
93 | |||
94 | #define XGLUE(a,b) a##b | ||
95 | #define GLUE(a,b) XGLUE(a,b) | ||
96 | |||
97 | #define _GLOBAL(name) \ | ||
98 | .section ".text"; \ | ||
99 | .align 2 ; \ | ||
100 | .globl name; \ | ||
101 | .globl GLUE(.,name); \ | ||
102 | .section ".opd","aw"; \ | ||
103 | name: \ | ||
104 | .quad GLUE(.,name); \ | ||
105 | .quad .TOC.@tocbase; \ | ||
106 | .quad 0; \ | ||
107 | .previous; \ | ||
108 | .type GLUE(.,name),@function; \ | ||
109 | GLUE(.,name): | ||
110 | |||
111 | #define _KPROBE(name) \ | ||
112 | .section ".kprobes.text","a"; \ | ||
113 | .align 2 ; \ | ||
114 | .globl name; \ | ||
115 | .globl GLUE(.,name); \ | ||
116 | .section ".opd","aw"; \ | ||
117 | name: \ | ||
118 | .quad GLUE(.,name); \ | ||
119 | .quad .TOC.@tocbase; \ | ||
120 | .quad 0; \ | ||
121 | .previous; \ | ||
122 | .type GLUE(.,name),@function; \ | ||
123 | GLUE(.,name): | ||
124 | |||
125 | #define _STATIC(name) \ | ||
126 | .section ".text"; \ | ||
127 | .align 2 ; \ | ||
128 | .section ".opd","aw"; \ | ||
129 | name: \ | ||
130 | .quad GLUE(.,name); \ | ||
131 | .quad .TOC.@tocbase; \ | ||
132 | .quad 0; \ | ||
133 | .previous; \ | ||
134 | .type GLUE(.,name),@function; \ | ||
135 | GLUE(.,name): | ||
136 | |||
137 | #else /* 32-bit */ | ||
138 | |||
139 | #define _GLOBAL(n) \ | ||
140 | .text; \ | ||
141 | .stabs __stringify(n:F-1),N_FUN,0,0,n;\ | ||
142 | .globl n; \ | ||
143 | n: | ||
144 | |||
145 | #define _KPROBE(n) \ | ||
146 | .section ".kprobes.text","a"; \ | ||
147 | .globl n; \ | ||
148 | n: | ||
149 | |||
150 | #endif | ||
151 | |||
90 | /* | 152 | /* |
91 | * LOADADDR( rn, name ) | 153 | * LOADADDR( rn, name ) |
92 | * loads the address of 'name' into 'rn' | 154 | * loads the address of 'name' into 'rn' |
@@ -251,31 +313,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
251 | .previous | 313 | .previous |
252 | #endif | 314 | #endif |
253 | 315 | ||
254 | /* | 316 | #ifdef CONFIG_PPC64 |
255 | * On 64-bit cpus, we use the rfid instruction instead of rfi, but | 317 | #define RFI rfid |
256 | * we then have to make sure we preserve the top 32 bits except for | 318 | #define MTMSRD(r) mtmsrd r |
257 | * the 64-bit mode bit, which we clear. | ||
258 | */ | ||
259 | #if defined(CONFIG_PPC64BRIDGE) | ||
260 | #define FIX_SRR1(ra, rb) \ | ||
261 | mr rb,ra; \ | ||
262 | mfmsr ra; \ | ||
263 | clrldi ra,ra,1; /* turn off 64-bit mode */ \ | ||
264 | rldimi ra,rb,0,32 | ||
265 | #define RFI .long 0x4c000024 /* rfid instruction */ | ||
266 | #define MTMSRD(r) .long (0x7c000164 + ((r) << 21)) /* mtmsrd */ | ||
267 | #define CLR_TOP32(r) rlwinm (r),(r),0,0,31 /* clear top 32 bits */ | ||
268 | #elif defined(CONFIG_PPC64) | ||
269 | /* Insert the high 32 bits of the MSR into what will be the new | ||
270 | MSR (via SRR1 and rfid) This preserves the MSR.SF and MSR.ISF | ||
271 | bits. */ | ||
272 | |||
273 | #define FIX_SRR1(ra, rb) \ | ||
274 | mr rb,ra; \ | ||
275 | mfmsr ra; \ | ||
276 | rldimi ra,rb,0,32 | ||
277 | |||
278 | #define CLR_TOP32(r) rlwinm (r),(r),0,0,31 /* clear top 32 bits */ | ||
279 | 319 | ||
280 | #else | 320 | #else |
281 | #define FIX_SRR1(ra, rb) | 321 | #define FIX_SRR1(ra, rb) |