aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2016-10-13 01:42:53 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-11-13 19:11:51 -0500
commit24bfa6a9e0d4fe414dfc4ad06c93e10c4c37194e (patch)
tree13368fce0b6bc8558aad558dc275368f2dc44afc
parent997e200182347d2cc7e37bc43eaafe249b4571b9 (diff)
powerpc: EX_TABLE macro for exception tables
This macro is taken from s390, and allows more flexibility in changing exception table format. mpe: Put it in ppc_asm.h and only define one version using stringinfy_in_c(). Add some empty definitions and headers to keep the selftests happy. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/futex.h14
-rw-r--r--arch/powerpc/include/asm/io.h19
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h10
-rw-r--r--arch/powerpc/include/asm/uaccess.h25
-rw-r--r--arch/powerpc/include/asm/word-at-a-time.h6
-rw-r--r--arch/powerpc/lib/checksum_32.S47
-rw-r--r--arch/powerpc/lib/checksum_64.S20
-rw-r--r--arch/powerpc/lib/copy_32.S55
-rw-r--r--arch/powerpc/lib/copyuser_64.S271
-rw-r--r--arch/powerpc/lib/copyuser_power7.S20
-rw-r--r--arch/powerpc/lib/ldstfp.S24
-rw-r--r--arch/powerpc/lib/sstep.c15
-rw-r--r--arch/powerpc/lib/string.S11
-rw-r--r--arch/powerpc/lib/string_64.S16
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c6
-rw-r--r--arch/powerpc/sysdev/tsi108_pci.c6
-rw-r--r--tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h2
-rw-r--r--tools/testing/selftests/powerpc/primitives/asm/firmware.h0
l---------tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h1
-rw-r--r--tools/testing/selftests/powerpc/primitives/asm/processor.h0
-rw-r--r--tools/testing/selftests/powerpc/primitives/linux/stringify.h0
21 files changed, 241 insertions, 327 deletions
diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h
index 2a9cf845473b..eaada6c92344 100644
--- a/arch/powerpc/include/asm/futex.h
+++ b/arch/powerpc/include/asm/futex.h
@@ -23,10 +23,8 @@
23"4: li %1,%3\n" \ 23"4: li %1,%3\n" \
24 "b 3b\n" \ 24 "b 3b\n" \
25 ".previous\n" \ 25 ".previous\n" \
26 ".section __ex_table,\"a\"\n" \ 26 EX_TABLE(1b, 4b) \
27 ".align 3\n" \ 27 EX_TABLE(2b, 4b) \
28 PPC_LONG "1b,4b,2b,4b\n" \
29 ".previous" \
30 : "=&r" (oldval), "=&r" (ret) \ 28 : "=&r" (oldval), "=&r" (ret) \
31 : "b" (uaddr), "i" (-EFAULT), "r" (oparg) \ 29 : "b" (uaddr), "i" (-EFAULT), "r" (oparg) \
32 : "cr0", "memory") 30 : "cr0", "memory")
@@ -104,11 +102,9 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
104"3: .section .fixup,\"ax\"\n\ 102"3: .section .fixup,\"ax\"\n\
1054: li %0,%6\n\ 1034: li %0,%6\n\
106 b 3b\n\ 104 b 3b\n\
107 .previous\n\ 105 .previous\n"
108 .section __ex_table,\"a\"\n\ 106 EX_TABLE(1b, 4b)
109 .align 3\n\ 107 EX_TABLE(2b, 4b)
110 " PPC_LONG "1b,4b,2b,4b\n\
111 .previous" \
112 : "+r" (ret), "=&r" (prev), "+m" (*uaddr) 108 : "+r" (ret), "=&r" (prev), "+m" (*uaddr)
113 : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT) 109 : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT)
114 : "cc", "memory"); 110 : "cc", "memory");
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f6fda8482f60..5ed292431b5b 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -33,6 +33,7 @@ extern struct pci_dev *isa_bridge_pcidev;
33#include <asm/synch.h> 33#include <asm/synch.h>
34#include <asm/delay.h> 34#include <asm/delay.h>
35#include <asm/mmu.h> 35#include <asm/mmu.h>
36#include <asm/ppc_asm.h>
36 37
37#include <asm-generic/iomap.h> 38#include <asm-generic/iomap.h>
38 39
@@ -458,13 +459,10 @@ static inline unsigned int name(unsigned int port) \
458 "5: li %0,-1\n" \ 459 "5: li %0,-1\n" \
459 " b 4b\n" \ 460 " b 4b\n" \
460 ".previous\n" \ 461 ".previous\n" \
461 ".section __ex_table,\"a\"\n" \ 462 EX_TABLE(0b, 5b) \
462 " .align 2\n" \ 463 EX_TABLE(1b, 5b) \
463 " .long 0b,5b\n" \ 464 EX_TABLE(2b, 5b) \
464 " .long 1b,5b\n" \ 465 EX_TABLE(3b, 5b) \
465 " .long 2b,5b\n" \
466 " .long 3b,5b\n" \
467 ".previous" \
468 : "=&r" (x) \ 466 : "=&r" (x) \
469 : "r" (port + _IO_BASE) \ 467 : "r" (port + _IO_BASE) \
470 : "memory"); \ 468 : "memory"); \
@@ -479,11 +477,8 @@ static inline void name(unsigned int val, unsigned int port) \
479 "0:" op " %0,0,%1\n" \ 477 "0:" op " %0,0,%1\n" \
480 "1: sync\n" \ 478 "1: sync\n" \
481 "2:\n" \ 479 "2:\n" \
482 ".section __ex_table,\"a\"\n" \ 480 EX_TABLE(0b, 2b) \
483 " .align 2\n" \ 481 EX_TABLE(1b, 2b) \
484 " .long 0b,2b\n" \
485 " .long 1b,2b\n" \
486 ".previous" \
487 : : "r" (val), "r" (port + _IO_BASE) \ 482 : : "r" (val), "r" (port + _IO_BASE) \
488 : "memory"); \ 483 : "memory"); \
489} 484}
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 28ab87e5b739..6af8852d1f7f 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -780,4 +780,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
780 780
781#endif /* __ASSEMBLY__ */ 781#endif /* __ASSEMBLY__ */
782 782
783/*
784 * Helper macro for exception table entries
785 */
786#define EX_TABLE(_fault, _target) \
787 stringify_in_c(.section __ex_table,"a";)\
788 PPC_LONG_ALIGN stringify_in_c(;) \
789 PPC_LONG stringify_in_c(_fault;) \
790 PPC_LONG stringify_in_c(_target;) \
791 stringify_in_c(.previous)
792
783#endif /* _ASM_POWERPC_PPC_ASM_H */ 793#endif /* _ASM_POWERPC_PPC_ASM_H */
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index c266227fdd5b..e0b724619c4a 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -7,6 +7,7 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <asm/asm-compat.h> 9#include <asm/asm-compat.h>
10#include <asm/ppc_asm.h>
10#include <asm/processor.h> 11#include <asm/processor.h>
11#include <asm/page.h> 12#include <asm/page.h>
12 13
@@ -132,10 +133,7 @@ extern long __put_user_bad(void);
132 "3: li %0,%3\n" \ 133 "3: li %0,%3\n" \
133 " b 2b\n" \ 134 " b 2b\n" \
134 ".previous\n" \ 135 ".previous\n" \
135 ".section __ex_table,\"a\"\n" \ 136 EX_TABLE(1b, 3b) \
136 PPC_LONG_ALIGN "\n" \
137 PPC_LONG "1b,3b\n" \
138 ".previous" \
139 : "=r" (err) \ 137 : "=r" (err) \
140 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err)) 138 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
141 139
@@ -152,11 +150,8 @@ extern long __put_user_bad(void);
152 "4: li %0,%3\n" \ 150 "4: li %0,%3\n" \
153 " b 3b\n" \ 151 " b 3b\n" \
154 ".previous\n" \ 152 ".previous\n" \
155 ".section __ex_table,\"a\"\n" \ 153 EX_TABLE(1b, 4b) \
156 PPC_LONG_ALIGN "\n" \ 154 EX_TABLE(2b, 4b) \
157 PPC_LONG "1b,4b\n" \
158 PPC_LONG "2b,4b\n" \
159 ".previous" \
160 : "=r" (err) \ 155 : "=r" (err) \
161 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err)) 156 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
162#endif /* __powerpc64__ */ 157#endif /* __powerpc64__ */
@@ -215,10 +210,7 @@ extern long __get_user_bad(void);
215 " li %1,0\n" \ 210 " li %1,0\n" \
216 " b 2b\n" \ 211 " b 2b\n" \
217 ".previous\n" \ 212 ".previous\n" \
218 ".section __ex_table,\"a\"\n" \ 213 EX_TABLE(1b, 3b) \
219 PPC_LONG_ALIGN "\n" \
220 PPC_LONG "1b,3b\n" \
221 ".previous" \
222 : "=r" (err), "=r" (x) \ 214 : "=r" (err), "=r" (x) \
223 : "b" (addr), "i" (-EFAULT), "0" (err)) 215 : "b" (addr), "i" (-EFAULT), "0" (err))
224 216
@@ -237,11 +229,8 @@ extern long __get_user_bad(void);
237 " li %1+1,0\n" \ 229 " li %1+1,0\n" \
238 " b 3b\n" \ 230 " b 3b\n" \
239 ".previous\n" \ 231 ".previous\n" \
240 ".section __ex_table,\"a\"\n" \ 232 EX_TABLE(1b, 4b) \
241 PPC_LONG_ALIGN "\n" \ 233 EX_TABLE(2b, 4b) \
242 PPC_LONG "1b,4b\n" \
243 PPC_LONG "2b,4b\n" \
244 ".previous" \
245 : "=r" (err), "=&r" (x) \ 234 : "=r" (err), "=&r" (x) \
246 : "b" (addr), "i" (-EFAULT), "0" (err)) 235 : "b" (addr), "i" (-EFAULT), "0" (err))
247#endif /* __powerpc64__ */ 236#endif /* __powerpc64__ */
diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
index 4afe66aa1400..f3f4710d4ff5 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <asm/asm-compat.h> 9#include <asm/asm-compat.h>
10#include <asm/ppc_asm.h>
10 11
11#ifdef __BIG_ENDIAN__ 12#ifdef __BIG_ENDIAN__
12 13
@@ -193,10 +194,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
193#endif 194#endif
194 "b 2b\n" 195 "b 2b\n"
195 ".previous\n" 196 ".previous\n"
196 ".section __ex_table,\"a\"\n\t" 197 EX_TABLE(1b, 3b)
197 PPC_LONG_ALIGN "\n\t"
198 PPC_LONG "1b,3b\n"
199 ".previous"
200 : [tmp] "=&b" (tmp), [offset] "=&r" (offset), [ret] "=&r" (ret) 198 : [tmp] "=&b" (tmp), [offset] "=&r" (offset), [ret] "=&r" (ret)
201 : [addr] "b" (addr), "m" (*(unsigned long *)addr)); 199 : [addr] "b" (addr), "m" (*(unsigned long *)addr));
202 200
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
index ea29a5d67743..9a671c774b22 100644
--- a/arch/powerpc/lib/checksum_32.S
+++ b/arch/powerpc/lib/checksum_32.S
@@ -103,17 +103,14 @@ EXPORT_SYMBOL(__csum_partial)
103 adde r12,r12,r10 103 adde r12,r12,r10
104 104
105#define CSUM_COPY_16_BYTES_EXCODE(n) \ 105#define CSUM_COPY_16_BYTES_EXCODE(n) \
106.section __ex_table,"a"; \ 106 EX_TABLE(8 ## n ## 0b, src_error); \
107 .align 2; \ 107 EX_TABLE(8 ## n ## 1b, src_error); \
108 .long 8 ## n ## 0b,src_error; \ 108 EX_TABLE(8 ## n ## 2b, src_error); \
109 .long 8 ## n ## 1b,src_error; \ 109 EX_TABLE(8 ## n ## 3b, src_error); \
110 .long 8 ## n ## 2b,src_error; \ 110 EX_TABLE(8 ## n ## 4b, dst_error); \
111 .long 8 ## n ## 3b,src_error; \ 111 EX_TABLE(8 ## n ## 5b, dst_error); \
112 .long 8 ## n ## 4b,dst_error; \ 112 EX_TABLE(8 ## n ## 6b, dst_error); \
113 .long 8 ## n ## 5b,dst_error; \ 113 EX_TABLE(8 ## n ## 7b, dst_error);
114 .long 8 ## n ## 6b,dst_error; \
115 .long 8 ## n ## 7b,dst_error; \
116 .text
117 114
118 .text 115 .text
119 .stabs "arch/powerpc/lib/",N_SO,0,0,0f 116 .stabs "arch/powerpc/lib/",N_SO,0,0,0f
@@ -263,14 +260,11 @@ dst_error:
263 stw r0,0(r8) 260 stw r0,0(r8)
264 blr 261 blr
265 262
266 .section __ex_table,"a" 263 EX_TABLE(70b, src_error);
267 .align 2 264 EX_TABLE(71b, dst_error);
268 .long 70b,src_error 265 EX_TABLE(72b, src_error);
269 .long 71b,dst_error 266 EX_TABLE(73b, dst_error);
270 .long 72b,src_error 267 EX_TABLE(54b, dst_error);
271 .long 73b,dst_error
272 .long 54b,dst_error
273 .text
274 268
275/* 269/*
276 * this stuff handles faults in the cacheline loop and branches to either 270 * this stuff handles faults in the cacheline loop and branches to either
@@ -291,12 +285,11 @@ dst_error:
291#endif 285#endif
292#endif 286#endif
293 287
294 .section __ex_table,"a" 288 EX_TABLE(30b, src_error);
295 .align 2 289 EX_TABLE(31b, dst_error);
296 .long 30b,src_error 290 EX_TABLE(40b, src_error);
297 .long 31b,dst_error 291 EX_TABLE(41b, dst_error);
298 .long 40b,src_error 292 EX_TABLE(50b, src_error);
299 .long 41b,dst_error 293 EX_TABLE(51b, dst_error);
300 .long 50b,src_error 294
301 .long 51b,dst_error
302EXPORT_SYMBOL(csum_partial_copy_generic) 295EXPORT_SYMBOL(csum_partial_copy_generic)
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index fd9176671f9f..d0d311e108ff 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -182,34 +182,22 @@ EXPORT_SYMBOL(__csum_partial)
182 182
183 .macro srcnr 183 .macro srcnr
184100: 184100:
185 .section __ex_table,"a" 185 EX_TABLE(100b,.Lsrc_error_nr)
186 .align 3
187 .llong 100b,.Lsrc_error_nr
188 .previous
189 .endm 186 .endm
190 187
191 .macro source 188 .macro source
192150: 189150:
193 .section __ex_table,"a" 190 EX_TABLE(150b,.Lsrc_error)
194 .align 3
195 .llong 150b,.Lsrc_error
196 .previous
197 .endm 191 .endm
198 192
199 .macro dstnr 193 .macro dstnr
200200: 194200:
201 .section __ex_table,"a" 195 EX_TABLE(200b,.Ldest_error_nr)
202 .align 3
203 .llong 200b,.Ldest_error_nr
204 .previous
205 .endm 196 .endm
206 197
207 .macro dest 198 .macro dest
208250: 199250:
209 .section __ex_table,"a" 200 EX_TABLE(250b,.Ldest_error)
210 .align 3
211 .llong 250b,.Ldest_error
212 .previous
213 .endm 201 .endm
214 202
215/* 203/*
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index 40cce33b08d6..ff0d894d7ff9 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -49,17 +49,14 @@
499 ## n ## 1: \ 499 ## n ## 1: \
50 addi r5,r5,-(16 * n); \ 50 addi r5,r5,-(16 * n); \
51 b 105f; \ 51 b 105f; \
52.section __ex_table,"a"; \ 52 EX_TABLE(8 ## n ## 0b,9 ## n ## 0b); \
53 .align 2; \ 53 EX_TABLE(8 ## n ## 1b,9 ## n ## 0b); \
54 .long 8 ## n ## 0b,9 ## n ## 0b; \ 54 EX_TABLE(8 ## n ## 2b,9 ## n ## 0b); \
55 .long 8 ## n ## 1b,9 ## n ## 0b; \ 55 EX_TABLE(8 ## n ## 3b,9 ## n ## 0b); \
56 .long 8 ## n ## 2b,9 ## n ## 0b; \ 56 EX_TABLE(8 ## n ## 4b,9 ## n ## 1b); \
57 .long 8 ## n ## 3b,9 ## n ## 0b; \ 57 EX_TABLE(8 ## n ## 5b,9 ## n ## 1b); \
58 .long 8 ## n ## 4b,9 ## n ## 1b; \ 58 EX_TABLE(8 ## n ## 6b,9 ## n ## 1b); \
59 .long 8 ## n ## 5b,9 ## n ## 1b; \ 59 EX_TABLE(8 ## n ## 7b,9 ## n ## 1b)
60 .long 8 ## n ## 6b,9 ## n ## 1b; \
61 .long 8 ## n ## 7b,9 ## n ## 1b; \
62 .text
63 60
64 .text 61 .text
65 .stabs "arch/powerpc/lib/",N_SO,0,0,0f 62 .stabs "arch/powerpc/lib/",N_SO,0,0,0f
@@ -323,13 +320,10 @@ _GLOBAL(__copy_tofrom_user)
32373: stwu r9,4(r6) 32073: stwu r9,4(r6)
324 bdnz 72b 321 bdnz 72b
325 322
326 .section __ex_table,"a" 323 EX_TABLE(70b,100f)
327 .align 2 324 EX_TABLE(71b,101f)
328 .long 70b,100f 325 EX_TABLE(72b,102f)
329 .long 71b,101f 326 EX_TABLE(73b,103f)
330 .long 72b,102f
331 .long 73b,103f
332 .text
333 327
33458: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */ 32858: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
335 clrlwi r5,r5,32-LG_CACHELINE_BYTES 329 clrlwi r5,r5,32-LG_CACHELINE_BYTES
@@ -364,10 +358,7 @@ _GLOBAL(__copy_tofrom_user)
364 358
36553: dcbt r3,r4 35953: dcbt r3,r4
36654: dcbz r11,r6 36054: dcbz r11,r6
367 .section __ex_table,"a" 361 EX_TABLE(54b,105f)
368 .align 2
369 .long 54b,105f
370 .text
371/* the main body of the cacheline loop */ 362/* the main body of the cacheline loop */
372 COPY_16_BYTES_WITHEX(0) 363 COPY_16_BYTES_WITHEX(0)
373#if L1_CACHE_BYTES >= 32 364#if L1_CACHE_BYTES >= 32
@@ -500,15 +491,13 @@ _GLOBAL(__copy_tofrom_user)
500 bdnz 114b 491 bdnz 114b
501120: blr 492120: blr
502 493
503 .section __ex_table,"a" 494 EX_TABLE(30b,108b)
504 .align 2 495 EX_TABLE(31b,109b)
505 .long 30b,108b 496 EX_TABLE(40b,110b)
506 .long 31b,109b 497 EX_TABLE(41b,111b)
507 .long 40b,110b 498 EX_TABLE(130b,132b)
508 .long 41b,111b 499 EX_TABLE(131b,120b)
509 .long 130b,132b 500 EX_TABLE(112b,120b)
510 .long 131b,120b 501 EX_TABLE(114b,120b)
511 .long 112b,120b 502
512 .long 114b,120b
513 .text
514EXPORT_SYMBOL(__copy_tofrom_user) 503EXPORT_SYMBOL(__copy_tofrom_user)
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 60386b2c99bb..aee6e24e81ab 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -394,70 +394,66 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
394192: 394192:
395 blr /* #bytes not copied in r3 */ 395 blr /* #bytes not copied in r3 */
396 396
397 .section __ex_table,"a" 397 EX_TABLE(20b,120b)
398 .align 3 398 EX_TABLE(220b,320b)
399 .llong 20b,120b 399 EX_TABLE(21b,121b)
400 .llong 220b,320b 400 EX_TABLE(221b,321b)
401 .llong 21b,121b 401 EX_TABLE(70b,170b)
402 .llong 221b,321b 402 EX_TABLE(270b,370b)
403 .llong 70b,170b 403 EX_TABLE(22b,122b)
404 .llong 270b,370b 404 EX_TABLE(222b,322b)
405 .llong 22b,122b 405 EX_TABLE(71b,171b)
406 .llong 222b,322b 406 EX_TABLE(271b,371b)
407 .llong 71b,171b 407 EX_TABLE(72b,172b)
408 .llong 271b,371b 408 EX_TABLE(272b,372b)
409 .llong 72b,172b 409 EX_TABLE(244b,344b)
410 .llong 272b,372b 410 EX_TABLE(245b,345b)
411 .llong 244b,344b 411 EX_TABLE(23b,123b)
412 .llong 245b,345b 412 EX_TABLE(73b,173b)
413 .llong 23b,123b 413 EX_TABLE(44b,144b)
414 .llong 73b,173b 414 EX_TABLE(74b,174b)
415 .llong 44b,144b 415 EX_TABLE(45b,145b)
416 .llong 74b,174b 416 EX_TABLE(75b,175b)
417 .llong 45b,145b 417 EX_TABLE(24b,124b)
418 .llong 75b,175b 418 EX_TABLE(25b,125b)
419 .llong 24b,124b 419 EX_TABLE(26b,126b)
420 .llong 25b,125b 420 EX_TABLE(27b,127b)
421 .llong 26b,126b 421 EX_TABLE(28b,128b)
422 .llong 27b,127b 422 EX_TABLE(29b,129b)
423 .llong 28b,128b 423 EX_TABLE(30b,130b)
424 .llong 29b,129b 424 EX_TABLE(31b,131b)
425 .llong 30b,130b 425 EX_TABLE(32b,132b)
426 .llong 31b,131b 426 EX_TABLE(76b,176b)
427 .llong 32b,132b 427 EX_TABLE(33b,133b)
428 .llong 76b,176b 428 EX_TABLE(77b,177b)
429 .llong 33b,133b 429 EX_TABLE(78b,178b)
430 .llong 77b,177b 430 EX_TABLE(79b,179b)
431 .llong 78b,178b 431 EX_TABLE(80b,180b)
432 .llong 79b,179b 432 EX_TABLE(34b,134b)
433 .llong 80b,180b 433 EX_TABLE(94b,194b)
434 .llong 34b,134b 434 EX_TABLE(95b,195b)
435 .llong 94b,194b 435 EX_TABLE(96b,196b)
436 .llong 95b,195b 436 EX_TABLE(35b,135b)
437 .llong 96b,196b 437 EX_TABLE(81b,181b)
438 .llong 35b,135b 438 EX_TABLE(36b,136b)
439 .llong 81b,181b 439 EX_TABLE(82b,182b)
440 .llong 36b,136b 440 EX_TABLE(37b,137b)
441 .llong 82b,182b 441 EX_TABLE(83b,183b)
442 .llong 37b,137b 442 EX_TABLE(38b,138b)
443 .llong 83b,183b 443 EX_TABLE(39b,139b)
444 .llong 38b,138b 444 EX_TABLE(84b,184b)
445 .llong 39b,139b 445 EX_TABLE(85b,185b)
446 .llong 84b,184b 446 EX_TABLE(40b,140b)
447 .llong 85b,185b 447 EX_TABLE(86b,186b)
448 .llong 40b,140b 448 EX_TABLE(41b,141b)
449 .llong 86b,186b 449 EX_TABLE(87b,187b)
450 .llong 41b,141b 450 EX_TABLE(42b,142b)
451 .llong 87b,187b 451 EX_TABLE(88b,188b)
452 .llong 42b,142b 452 EX_TABLE(43b,143b)
453 .llong 88b,188b 453 EX_TABLE(89b,189b)
454 .llong 43b,143b 454 EX_TABLE(90b,190b)
455 .llong 89b,189b 455 EX_TABLE(91b,191b)
456 .llong 90b,190b 456 EX_TABLE(92b,192b)
457 .llong 91b,191b
458 .llong 92b,192b
459
460 .text
461 457
462/* 458/*
463 * Routine to copy a whole page of data, optimized for POWER4. 459 * Routine to copy a whole page of data, optimized for POWER4.
@@ -598,78 +594,77 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
598 li r5,4096 594 li r5,4096
599 b .Ldst_aligned 595 b .Ldst_aligned
600 596
601 .section __ex_table,"a" 597 EX_TABLE(20b,100b)
602 .align 3 598 EX_TABLE(21b,100b)
603 .llong 20b,100b 599 EX_TABLE(22b,100b)
604 .llong 21b,100b 600 EX_TABLE(23b,100b)
605 .llong 22b,100b 601 EX_TABLE(24b,100b)
606 .llong 23b,100b 602 EX_TABLE(25b,100b)
607 .llong 24b,100b 603 EX_TABLE(26b,100b)
608 .llong 25b,100b 604 EX_TABLE(27b,100b)
609 .llong 26b,100b 605 EX_TABLE(28b,100b)
610 .llong 27b,100b 606 EX_TABLE(29b,100b)
611 .llong 28b,100b 607 EX_TABLE(30b,100b)
612 .llong 29b,100b 608 EX_TABLE(31b,100b)
613 .llong 30b,100b 609 EX_TABLE(32b,100b)
614 .llong 31b,100b 610 EX_TABLE(33b,100b)
615 .llong 32b,100b 611 EX_TABLE(34b,100b)
616 .llong 33b,100b 612 EX_TABLE(35b,100b)
617 .llong 34b,100b 613 EX_TABLE(36b,100b)
618 .llong 35b,100b 614 EX_TABLE(37b,100b)
619 .llong 36b,100b 615 EX_TABLE(38b,100b)
620 .llong 37b,100b 616 EX_TABLE(39b,100b)
621 .llong 38b,100b 617 EX_TABLE(40b,100b)
622 .llong 39b,100b 618 EX_TABLE(41b,100b)
623 .llong 40b,100b 619 EX_TABLE(42b,100b)
624 .llong 41b,100b 620 EX_TABLE(43b,100b)
625 .llong 42b,100b 621 EX_TABLE(44b,100b)
626 .llong 43b,100b 622 EX_TABLE(45b,100b)
627 .llong 44b,100b 623 EX_TABLE(46b,100b)
628 .llong 45b,100b 624 EX_TABLE(47b,100b)
629 .llong 46b,100b 625 EX_TABLE(48b,100b)
630 .llong 47b,100b 626 EX_TABLE(49b,100b)
631 .llong 48b,100b 627 EX_TABLE(50b,100b)
632 .llong 49b,100b 628 EX_TABLE(51b,100b)
633 .llong 50b,100b 629 EX_TABLE(52b,100b)
634 .llong 51b,100b 630 EX_TABLE(53b,100b)
635 .llong 52b,100b 631 EX_TABLE(54b,100b)
636 .llong 53b,100b 632 EX_TABLE(55b,100b)
637 .llong 54b,100b 633 EX_TABLE(56b,100b)
638 .llong 55b,100b 634 EX_TABLE(57b,100b)
639 .llong 56b,100b 635 EX_TABLE(58b,100b)
640 .llong 57b,100b 636 EX_TABLE(59b,100b)
641 .llong 58b,100b 637 EX_TABLE(60b,100b)
642 .llong 59b,100b 638 EX_TABLE(61b,100b)
643 .llong 60b,100b 639 EX_TABLE(62b,100b)
644 .llong 61b,100b 640 EX_TABLE(63b,100b)
645 .llong 62b,100b 641 EX_TABLE(64b,100b)
646 .llong 63b,100b 642 EX_TABLE(65b,100b)
647 .llong 64b,100b 643 EX_TABLE(66b,100b)
648 .llong 65b,100b 644 EX_TABLE(67b,100b)
649 .llong 66b,100b 645 EX_TABLE(68b,100b)
650 .llong 67b,100b 646 EX_TABLE(69b,100b)
651 .llong 68b,100b 647 EX_TABLE(70b,100b)
652 .llong 69b,100b 648 EX_TABLE(71b,100b)
653 .llong 70b,100b 649 EX_TABLE(72b,100b)
654 .llong 71b,100b 650 EX_TABLE(73b,100b)
655 .llong 72b,100b 651 EX_TABLE(74b,100b)
656 .llong 73b,100b 652 EX_TABLE(75b,100b)
657 .llong 74b,100b 653 EX_TABLE(76b,100b)
658 .llong 75b,100b 654 EX_TABLE(77b,100b)
659 .llong 76b,100b 655 EX_TABLE(78b,100b)
660 .llong 77b,100b 656 EX_TABLE(79b,100b)
661 .llong 78b,100b 657 EX_TABLE(80b,100b)
662 .llong 79b,100b 658 EX_TABLE(81b,100b)
663 .llong 80b,100b 659 EX_TABLE(82b,100b)
664 .llong 81b,100b 660 EX_TABLE(83b,100b)
665 .llong 82b,100b 661 EX_TABLE(84b,100b)
666 .llong 83b,100b 662 EX_TABLE(85b,100b)
667 .llong 84b,100b 663 EX_TABLE(86b,100b)
668 .llong 85b,100b 664 EX_TABLE(87b,100b)
669 .llong 86b,100b 665 EX_TABLE(88b,100b)
670 .llong 87b,100b 666 EX_TABLE(89b,100b)
671 .llong 88b,100b 667 EX_TABLE(90b,100b)
672 .llong 89b,100b 668 EX_TABLE(91b,100b)
673 .llong 90b,100b 669
674 .llong 91b,100b
675EXPORT_SYMBOL(__copy_tofrom_user) 670EXPORT_SYMBOL(__copy_tofrom_user)
diff --git a/arch/powerpc/lib/copyuser_power7.S b/arch/powerpc/lib/copyuser_power7.S
index da0c568d18c4..a24b4039352c 100644
--- a/arch/powerpc/lib/copyuser_power7.S
+++ b/arch/powerpc/lib/copyuser_power7.S
@@ -29,35 +29,23 @@
29 29
30 .macro err1 30 .macro err1
31100: 31100:
32 .section __ex_table,"a" 32 EX_TABLE(100b,.Ldo_err1)
33 .align 3
34 .llong 100b,.Ldo_err1
35 .previous
36 .endm 33 .endm
37 34
38 .macro err2 35 .macro err2
39200: 36200:
40 .section __ex_table,"a" 37 EX_TABLE(200b,.Ldo_err2)
41 .align 3
42 .llong 200b,.Ldo_err2
43 .previous
44 .endm 38 .endm
45 39
46#ifdef CONFIG_ALTIVEC 40#ifdef CONFIG_ALTIVEC
47 .macro err3 41 .macro err3
48300: 42300:
49 .section __ex_table,"a" 43 EX_TABLE(300b,.Ldo_err3)
50 .align 3
51 .llong 300b,.Ldo_err3
52 .previous
53 .endm 44 .endm
54 45
55 .macro err4 46 .macro err4
56400: 47400:
57 .section __ex_table,"a" 48 EX_TABLE(400b,.Ldo_err4)
58 .align 3
59 .llong 400b,.Ldo_err4
60 .previous
61 .endm 49 .endm
62 50
63 51
diff --git a/arch/powerpc/lib/ldstfp.S b/arch/powerpc/lib/ldstfp.S
index 5d0cdbfbe3f2..a58777c1b2cb 100644
--- a/arch/powerpc/lib/ldstfp.S
+++ b/arch/powerpc/lib/ldstfp.S
@@ -21,18 +21,12 @@
21 21
22#define STKFRM (PPC_MIN_STKFRM + 16) 22#define STKFRM (PPC_MIN_STKFRM + 16)
23 23
24 .macro extab instr,handler
25 .section __ex_table,"a"
26 PPC_LONG \instr,\handler
27 .previous
28 .endm
29
30 .macro inst32 op 24 .macro inst32 op
31reg = 0 25reg = 0
32 .rept 32 26 .rept 32
3320: \op reg,0,r4 2720: \op reg,0,r4
34 b 3f 28 b 3f
35 extab 20b,99f 29 EX_TABLE(20b,99f)
36reg = reg + 1 30reg = reg + 1
37 .endr 31 .endr
38 .endm 32 .endm
@@ -100,7 +94,7 @@ _GLOBAL(do_lfs)
100 mr r3,r9 94 mr r3,r9
101 addi r1,r1,STKFRM 95 addi r1,r1,STKFRM
102 blr 96 blr
103 extab 2b,3b 97 EX_TABLE(2b,3b)
104 98
105/* Load FP reg N from double at *p. N is in r3, p in r4. */ 99/* Load FP reg N from double at *p. N is in r3, p in r4. */
106_GLOBAL(do_lfd) 100_GLOBAL(do_lfd)
@@ -127,7 +121,7 @@ _GLOBAL(do_lfd)
127 mr r3,r9 121 mr r3,r9
128 addi r1,r1,STKFRM 122 addi r1,r1,STKFRM
129 blr 123 blr
130 extab 2b,3b 124 EX_TABLE(2b,3b)
131 125
132/* Store FP reg N to float at *p. N is in r3, p in r4. */ 126/* Store FP reg N to float at *p. N is in r3, p in r4. */
133_GLOBAL(do_stfs) 127_GLOBAL(do_stfs)
@@ -154,7 +148,7 @@ _GLOBAL(do_stfs)
154 mr r3,r9 148 mr r3,r9
155 addi r1,r1,STKFRM 149 addi r1,r1,STKFRM
156 blr 150 blr
157 extab 2b,3b 151 EX_TABLE(2b,3b)
158 152
159/* Store FP reg N to double at *p. N is in r3, p in r4. */ 153/* Store FP reg N to double at *p. N is in r3, p in r4. */
160_GLOBAL(do_stfd) 154_GLOBAL(do_stfd)
@@ -181,7 +175,7 @@ _GLOBAL(do_stfd)
181 mr r3,r9 175 mr r3,r9
182 addi r1,r1,STKFRM 176 addi r1,r1,STKFRM
183 blr 177 blr
184 extab 2b,3b 178 EX_TABLE(2b,3b)
185 179
186#ifdef CONFIG_ALTIVEC 180#ifdef CONFIG_ALTIVEC
187/* Get the contents of vrN into v0; N is in r3. */ 181/* Get the contents of vrN into v0; N is in r3. */
@@ -248,7 +242,7 @@ _GLOBAL(do_lvx)
248 mr r3,r9 242 mr r3,r9
249 addi r1,r1,STKFRM 243 addi r1,r1,STKFRM
250 blr 244 blr
251 extab 2b,3b 245 EX_TABLE(2b,3b)
252 246
253/* Store vector reg N to *p. N is in r3, p in r4. */ 247/* Store vector reg N to *p. N is in r3, p in r4. */
254_GLOBAL(do_stvx) 248_GLOBAL(do_stvx)
@@ -276,7 +270,7 @@ _GLOBAL(do_stvx)
276 mr r3,r9 270 mr r3,r9
277 addi r1,r1,STKFRM 271 addi r1,r1,STKFRM
278 blr 272 blr
279 extab 2b,3b 273 EX_TABLE(2b,3b)
280#endif /* CONFIG_ALTIVEC */ 274#endif /* CONFIG_ALTIVEC */
281 275
282#ifdef CONFIG_VSX 276#ifdef CONFIG_VSX
@@ -344,7 +338,7 @@ _GLOBAL(do_lxvd2x)
344 mr r3,r9 338 mr r3,r9
345 addi r1,r1,STKFRM 339 addi r1,r1,STKFRM
346 blr 340 blr
347 extab 2b,3b 341 EX_TABLE(2b,3b)
348 342
349/* Store VSX reg N to vector doubleword *p. N is in r3, p in r4. */ 343/* Store VSX reg N to vector doubleword *p. N is in r3, p in r4. */
350_GLOBAL(do_stxvd2x) 344_GLOBAL(do_stxvd2x)
@@ -372,7 +366,7 @@ _GLOBAL(do_stxvd2x)
372 mr r3,r9 366 mr r3,r9
373 addi r1,r1,STKFRM 367 addi r1,r1,STKFRM
374 blr 368 blr
375 extab 2b,3b 369 EX_TABLE(2b,3b)
376 370
377#endif /* CONFIG_VSX */ 371#endif /* CONFIG_VSX */
378 372
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 3362299b1859..b64287c6793f 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -493,10 +493,7 @@ static int __kprobes do_vsx_store(int rn, int (*func)(int, unsigned long),
493 "3: li %0,%4\n" \ 493 "3: li %0,%4\n" \
494 " b 2b\n" \ 494 " b 2b\n" \
495 ".previous\n" \ 495 ".previous\n" \
496 ".section __ex_table,\"a\"\n" \ 496 EX_TABLE(1b, 3b) \
497 PPC_LONG_ALIGN "\n" \
498 PPC_LONG "1b,3b\n" \
499 ".previous" \
500 : "=r" (err), "=r" (cr) \ 497 : "=r" (err), "=r" (cr) \
501 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err)) 498 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err))
502 499
@@ -508,10 +505,7 @@ static int __kprobes do_vsx_store(int rn, int (*func)(int, unsigned long),
508 "3: li %0,%3\n" \ 505 "3: li %0,%3\n" \
509 " b 2b\n" \ 506 " b 2b\n" \
510 ".previous\n" \ 507 ".previous\n" \
511 ".section __ex_table,\"a\"\n" \ 508 EX_TABLE(1b, 3b) \
512 PPC_LONG_ALIGN "\n" \
513 PPC_LONG "1b,3b\n" \
514 ".previous" \
515 : "=r" (err), "=r" (x) \ 509 : "=r" (err), "=r" (x) \
516 : "r" (addr), "i" (-EFAULT), "0" (err)) 510 : "r" (addr), "i" (-EFAULT), "0" (err))
517 511
@@ -523,10 +517,7 @@ static int __kprobes do_vsx_store(int rn, int (*func)(int, unsigned long),
523 "3: li %0,%3\n" \ 517 "3: li %0,%3\n" \
524 " b 2b\n" \ 518 " b 2b\n" \
525 ".previous\n" \ 519 ".previous\n" \
526 ".section __ex_table,\"a\"\n" \ 520 EX_TABLE(1b, 3b) \
527 PPC_LONG_ALIGN "\n" \
528 PPC_LONG "1b,3b\n" \
529 ".previous" \
530 : "=r" (err) \ 521 : "=r" (err) \
531 : "r" (addr), "i" (-EFAULT), "0" (err)) 522 : "r" (addr), "i" (-EFAULT), "0" (err))
532 523
diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S
index d13e07603519..a787776822d8 100644
--- a/arch/powerpc/lib/string.S
+++ b/arch/powerpc/lib/string.S
@@ -13,8 +13,6 @@
13#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
14#include <asm/export.h> 14#include <asm/export.h>
15 15
16 .section __ex_table,"a"
17 PPC_LONG_ALIGN
18 .text 16 .text
19 17
20/* This clears out any unused part of the destination buffer, 18/* This clears out any unused part of the destination buffer,
@@ -125,10 +123,9 @@ _GLOBAL(__clear_user)
12592: mfctr r3 12392: mfctr r3
126 blr 124 blr
127 125
128 .section __ex_table,"a" 126 EX_TABLE(11b, 90b)
129 PPC_LONG 11b,90b 127 EX_TABLE(1b, 91b)
130 PPC_LONG 1b,91b 128 EX_TABLE(8b, 92b)
131 PPC_LONG 8b,92b 129
132 .text
133EXPORT_SYMBOL(__clear_user) 130EXPORT_SYMBOL(__clear_user)
134#endif 131#endif
diff --git a/arch/powerpc/lib/string_64.S b/arch/powerpc/lib/string_64.S
index 57ace356c949..c100f4d5d5d0 100644
--- a/arch/powerpc/lib/string_64.S
+++ b/arch/powerpc/lib/string_64.S
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <asm/ppc_asm.h> 21#include <asm/ppc_asm.h>
22#include <asm/linkage.h>
22#include <asm/asm-offsets.h> 23#include <asm/asm-offsets.h>
23#include <asm/export.h> 24#include <asm/export.h>
24 25
@@ -41,26 +42,17 @@ PPC64_CACHES:
41 42
42 .macro err1 43 .macro err1
43100: 44100:
44 .section __ex_table,"a" 45 EX_TABLE(100b,.Ldo_err1)
45 .align 3
46 .llong 100b,.Ldo_err1
47 .previous
48 .endm 46 .endm
49 47
50 .macro err2 48 .macro err2
51200: 49200:
52 .section __ex_table,"a" 50 EX_TABLE(200b,.Ldo_err2)
53 .align 3
54 .llong 200b,.Ldo_err2
55 .previous
56 .endm 51 .endm
57 52
58 .macro err3 53 .macro err3
59300: 54300:
60 .section __ex_table,"a" 55 EX_TABLE(300b,.Ldo_err3)
61 .align 3
62 .llong 300b,.Ldo_err3
63 .previous
64 .endm 56 .endm
65 57
66.Ldo_err1: 58.Ldo_err1:
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 3cc7cace194a..87fee0c8eb21 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -80,10 +80,8 @@
80 "3: li %1,-1\n" \ 80 "3: li %1,-1\n" \
81 " li %0,%3\n" \ 81 " li %0,%3\n" \
82 " b 2b\n" \ 82 " b 2b\n" \
83 ".section __ex_table,\"a\"\n" \ 83 ".previous\n" \
84 PPC_LONG_ALIGN "\n" \ 84 EX_TABLE(1b, 3b) \
85 PPC_LONG "1b,3b\n" \
86 ".text" \
87 : "=r" (err), "=r" (x) \ 85 : "=r" (err), "=r" (x) \
88 : "b" (addr), "i" (-EFAULT), "0" (err)) 86 : "b" (addr), "i" (-EFAULT), "0" (err))
89 87
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
index 57c971b7839c..53a16aa4d384 100644
--- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -137,10 +137,8 @@ void tsi108_clear_pci_error(u32 pci_cfg_base)
137 ".section .fixup,\"ax\"\n" \ 137 ".section .fixup,\"ax\"\n" \
138 "3: li %0,-1\n" \ 138 "3: li %0,-1\n" \
139 " b 2b\n" \ 139 " b 2b\n" \
140 ".section __ex_table,\"a\"\n" \ 140 ".previous\n" \
141 " .align 2\n" \ 141 EX_TABLE(1b, 3b) \
142 " .long 1b,3b\n" \
143 ".text" \
144 : "=r"(x) : "r"(addr)) 142 : "=r"(x) : "r"(addr))
145 143
146int 144int
diff --git a/tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h b/tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h
index 50ae7d2091ce..80d34a9ffff4 100644
--- a/tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h
+++ b/tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h
@@ -25,6 +25,8 @@
25 25
26#define PPC_MTOCRF(A, B) mtocrf A, B 26#define PPC_MTOCRF(A, B) mtocrf A, B
27 27
28#define EX_TABLE(x, y)
29
28FUNC_START(enter_vmx_usercopy) 30FUNC_START(enter_vmx_usercopy)
29 li r3,1 31 li r3,1
30 blr 32 blr
diff --git a/tools/testing/selftests/powerpc/primitives/asm/firmware.h b/tools/testing/selftests/powerpc/primitives/asm/firmware.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/tools/testing/selftests/powerpc/primitives/asm/firmware.h
diff --git a/tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h b/tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h
new file mode 120000
index 000000000000..66c8193224e9
--- /dev/null
+++ b/tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h
@@ -0,0 +1 @@
../../../../../../arch/powerpc/include/asm/ppc_asm.h \ No newline at end of file
diff --git a/tools/testing/selftests/powerpc/primitives/asm/processor.h b/tools/testing/selftests/powerpc/primitives/asm/processor.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/tools/testing/selftests/powerpc/primitives/asm/processor.h
diff --git a/tools/testing/selftests/powerpc/primitives/linux/stringify.h b/tools/testing/selftests/powerpc/primitives/linux/stringify.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/tools/testing/selftests/powerpc/primitives/linux/stringify.h