Skip to content

Commit 0b3d643

Browse files
hdellerKyle McMartin
authored andcommitted
[PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro
- this macro unifies the code to add exception table entries - additionally use ENTRY()/ENDPROC() at more places Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
1 parent 8e9e984 commit 0b3d643

9 files changed

Lines changed: 97 additions & 218 deletions

File tree

‎arch/parisc/kernel/pacache.S‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,11 @@
2727
*/
2828

2929
#ifdef CONFIG_64BIT
30-
#define ADDIB addib,*
31-
#define CMPB cmpb,*
32-
#define ANDCM andcm,*
33-
3430
.level 2.0w
3531
#else
36-
#define ADDIB addib,
37-
#define CMPB cmpb,
38-
#define ANDCM andcm
39-
4032
.level 2.0
4133
#endif
4234

43-
4435
#include <asm/psw.h>
4536
#include <asm/assembly.h>
4637
#include <asm/pgtable.h>

‎arch/parisc/kernel/syscall.S‎

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,7 @@
2323
*/
2424
#define KILL_INSN break 0,0
2525

26-
#ifdef CONFIG_64BIT
27-
.level 2.0w
28-
#else
29-
.level 1.1
30-
#endif
31-
32-
/* on 64bit pad to 64bit values */
33-
#ifdef CONFIG_64BIT
34-
#define ULONG_WORD(x) .word 0, x
35-
#else
36-
#define ULONG_WORD(x) .word x
37-
#endif
38-
26+
.level LEVEL
3927

4028
.text
4129

@@ -603,16 +591,10 @@ cas_action:
603591
the other for the store. Either return -EFAULT.
604592
Each of the entries must be relocated. */
605593
.section __ex_table,"aw"
606-
ULONG_WORD(2b - linux_gateway_page)
607-
ULONG_WORD(3b - linux_gateway_page)
608-
.previous
609-
610-
.section __ex_table,"aw"
611-
ULONG_WORD(1b - linux_gateway_page)
612-
ULONG_WORD(3b - linux_gateway_page)
594+
ASM_ULONG_INSN (1b - linux_gateway_page), (3b - linux_gateway_page)
595+
ASM_ULONG_INSN (2b - linux_gateway_page), (3b - linux_gateway_page)
613596
.previous
614597

615-
end_compare_and_swap:
616598

617599
/* Make sure nothing else is placed on this page */
618600
.align ASM_PAGE_SIZE
@@ -622,7 +604,7 @@ ENTRY(end_linux_gateway_page)
622604
/* Relocate symbols assuming linux_gateway_page is mapped
623605
to virtual address 0x0 */
624606

625-
#define LWS_ENTRY(_name_) ULONG_WORD(lws_##_name_ - linux_gateway_page)
607+
#define LWS_ENTRY(_name_) ASM_ULONG_INSN (lws_##_name_ - linux_gateway_page)
626608

627609
.section .rodata,"a"
628610

‎arch/parisc/kernel/unaligned.c‎

Lines changed: 25 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define DPRINTF(fmt, args...)
3636
#endif
3737

38-
#ifdef __LP64__
38+
#ifdef CONFIG_64BIT
3939
#define RFMT "%016lx"
4040
#else
4141
#define RFMT "%08lx"
@@ -150,15 +150,8 @@ static int emulate_ldh(struct pt_regs *regs, int toreg)
150150
"4: ldi -2, %1\n"
151151
FIXUP_BRANCH(3b)
152152
" .previous\n"
153-
" .section __ex_table,\"aw\"\n"
154-
#ifdef __LP64__
155-
" .dword 1b,4b\n"
156-
" .dword 2b,4b\n"
157-
#else
158-
" .word 1b,4b\n"
159-
" .word 2b,4b\n"
160-
#endif
161-
" .previous\n"
153+
ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
154+
ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
162155
: "=r" (val), "=r" (ret)
163156
: "0" (val), "r" (saddr), "r" (regs->isr)
164157
: "r20", FIXUP_BRANCH_CLOBBER );
@@ -195,15 +188,8 @@ static int emulate_ldw(struct pt_regs *regs, int toreg, int flop)
195188
"4: ldi -2, %1\n"
196189
FIXUP_BRANCH(3b)
197190
" .previous\n"
198-
" .section __ex_table,\"aw\"\n"
199-
#ifdef __LP64__
200-
" .dword 1b,4b\n"
201-
" .dword 2b,4b\n"
202-
#else
203-
" .word 1b,4b\n"
204-
" .word 2b,4b\n"
205-
#endif
206-
" .previous\n"
191+
ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
192+
ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
207193
: "=r" (val), "=r" (ret)
208194
: "0" (val), "r" (saddr), "r" (regs->isr)
209195
: "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -227,7 +213,7 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
227213
regs->isr, regs->ior, toreg);
228214
#ifdef CONFIG_PA20
229215

230-
#ifndef __LP64__
216+
#ifndef CONFIG_64BIT
231217
if (!flop)
232218
return -1;
233219
#endif
@@ -246,15 +232,8 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
246232
"4: ldi -2, %1\n"
247233
FIXUP_BRANCH(3b)
248234
" .previous\n"
249-
" .section __ex_table,\"aw\"\n"
250-
#ifdef __LP64__
251-
" .dword 1b,4b\n"
252-
" .dword 2b,4b\n"
253-
#else
254-
" .word 1b,4b\n"
255-
" .word 2b,4b\n"
256-
#endif
257-
" .previous\n"
235+
ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
236+
ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
258237
: "=r" (val), "=r" (ret)
259238
: "0" (val), "r" (saddr), "r" (regs->isr)
260239
: "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -278,17 +257,9 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
278257
"5: ldi -2, %2\n"
279258
FIXUP_BRANCH(4b)
280259
" .previous\n"
281-
" .section __ex_table,\"aw\"\n"
282-
#ifdef __LP64__
283-
" .dword 1b,5b\n"
284-
" .dword 2b,5b\n"
285-
" .dword 3b,5b\n"
286-
#else
287-
" .word 1b,5b\n"
288-
" .word 2b,5b\n"
289-
" .word 3b,5b\n"
290-
#endif
291-
" .previous\n"
260+
ASM_EXCEPTIONTABLE_ENTRY(1b,5b)
261+
ASM_EXCEPTIONTABLE_ENTRY(2b,5b)
262+
ASM_EXCEPTIONTABLE_ENTRY(3b,5b)
292263
: "=r" (valh), "=r" (vall), "=r" (ret)
293264
: "0" (valh), "1" (vall), "r" (saddr), "r" (regs->isr)
294265
: "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -328,15 +299,8 @@ static int emulate_sth(struct pt_regs *regs, int frreg)
328299
"4: ldi -2, %0\n"
329300
FIXUP_BRANCH(3b)
330301
" .previous\n"
331-
" .section __ex_table,\"aw\"\n"
332-
#ifdef __LP64__
333-
" .dword 1b,4b\n"
334-
" .dword 2b,4b\n"
335-
#else
336-
" .word 1b,4b\n"
337-
" .word 2b,4b\n"
338-
#endif
339-
" .previous\n"
302+
ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
303+
ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
340304
: "=r" (ret)
341305
: "r" (val), "r" (regs->ior), "r" (regs->isr)
342306
: "r19", FIXUP_BRANCH_CLOBBER );
@@ -382,15 +346,8 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop)
382346
"4: ldi -2, %0\n"
383347
FIXUP_BRANCH(3b)
384348
" .previous\n"
385-
" .section __ex_table,\"aw\"\n"
386-
#ifdef __LP64__
387-
" .dword 1b,4b\n"
388-
" .dword 2b,4b\n"
389-
#else
390-
" .word 1b,4b\n"
391-
" .word 2b,4b\n"
392-
#endif
393-
" .previous\n"
349+
ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
350+
ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
394351
: "=r" (ret)
395352
: "r" (val), "r" (regs->ior), "r" (regs->isr)
396353
: "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -413,7 +370,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
413370
val, regs->isr, regs->ior);
414371

415372
#ifdef CONFIG_PA20
416-
#ifndef __LP64__
373+
#ifndef CONFIG_64BIT
417374
if (!flop)
418375
return -1;
419376
#endif
@@ -439,19 +396,10 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
439396
"6: ldi -2, %0\n"
440397
FIXUP_BRANCH(5b)
441398
" .previous\n"
442-
" .section __ex_table,\"aw\"\n"
443-
#ifdef __LP64__
444-
" .dword 1b,6b\n"
445-
" .dword 2b,6b\n"
446-
" .dword 3b,6b\n"
447-
" .dword 4b,6b\n"
448-
#else
449-
" .word 1b,6b\n"
450-
" .word 2b,6b\n"
451-
" .word 3b,6b\n"
452-
" .word 4b,6b\n"
453-
#endif
454-
" .previous\n"
399+
ASM_EXCEPTIONTABLE_ENTRY(1b,6b)
400+
ASM_EXCEPTIONTABLE_ENTRY(2b,6b)
401+
ASM_EXCEPTIONTABLE_ENTRY(3b,6b)
402+
ASM_EXCEPTIONTABLE_ENTRY(4b,6b)
455403
: "=r" (ret)
456404
: "r" (val), "r" (regs->ior), "r" (regs->isr)
457405
: "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -482,21 +430,11 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
482430
"7: ldi -2, %0\n"
483431
FIXUP_BRANCH(6b)
484432
" .previous\n"
485-
" .section __ex_table,\"aw\"\n"
486-
#ifdef __LP64__
487-
" .dword 1b,7b\n"
488-
" .dword 2b,7b\n"
489-
" .dword 3b,7b\n"
490-
" .dword 4b,7b\n"
491-
" .dword 5b,7b\n"
492-
#else
493-
" .word 1b,7b\n"
494-
" .word 2b,7b\n"
495-
" .word 3b,7b\n"
496-
" .word 4b,7b\n"
497-
" .word 5b,7b\n"
498-
#endif
499-
" .previous\n"
433+
ASM_EXCEPTIONTABLE_ENTRY(1b,7b)
434+
ASM_EXCEPTIONTABLE_ENTRY(2b,7b)
435+
ASM_EXCEPTIONTABLE_ENTRY(3b,7b)
436+
ASM_EXCEPTIONTABLE_ENTRY(4b,7b)
437+
ASM_EXCEPTIONTABLE_ENTRY(5b,7b)
500438
: "=r" (ret)
501439
: "r" (valh), "r" (vall), "r" (regs->ior), "r" (regs->isr)
502440
: "r19", "r20", "r21", "r1", FIXUP_BRANCH_CLOBBER );

‎arch/parisc/lib/fixup.S‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <asm/asm-offsets.h>
2323
#include <asm/assembly.h>
2424
#include <asm/errno.h>
25+
#include <linux/linkage.h>
2526

2627
#ifdef CONFIG_SMP
2728
.macro get_fault_ip t1 t2
@@ -30,7 +31,7 @@
3031
/* t2 = smp_processor_id() */
3132
mfctl 30,\t2
3233
ldw TI_CPU(\t2),\t2
33-
#ifdef __LP64__
34+
#ifdef CONFIG_64BIT
3435
extrd,u \t2,63,32,\t2
3536
#endif
3637
/* t2 = &__per_cpu_offset[smp_processor_id()]; */
@@ -58,33 +59,34 @@
5859
.section .fixup, "ax"
5960

6061
/* get_user() fixups, store -EFAULT in r8, and 0 in r9 */
61-
.export fixup_get_user_skip_1
62-
fixup_get_user_skip_1:
62+
ENTRY(fixup_get_user_skip_1)
6363
get_fault_ip %r1,%r8
6464
ldo 4(%r1), %r1
6565
ldi -EFAULT, %r8
6666
bv %r0(%r1)
6767
copy %r0, %r9
68+
ENDPROC(fixup_get_user_skip_1)
6869

69-
.export fixup_get_user_skip_2
70-
fixup_get_user_skip_2:
70+
ENTRY(fixup_get_user_skip_2)
7171
get_fault_ip %r1,%r8
7272
ldo 8(%r1), %r1
7373
ldi -EFAULT, %r8
7474
bv %r0(%r1)
7575
copy %r0, %r9
76+
ENDPROC(fixup_get_user_skip_2)
7677

7778
/* put_user() fixups, store -EFAULT in r8 */
78-
.export fixup_put_user_skip_1
79-
fixup_put_user_skip_1:
79+
ENTRY(fixup_put_user_skip_1)
8080
get_fault_ip %r1,%r8
8181
ldo 4(%r1), %r1
8282
bv %r0(%r1)
8383
ldi -EFAULT, %r8
84+
ENDPROC(fixup_put_user_skip_1)
8485

85-
.export fixup_put_user_skip_2
86-
fixup_put_user_skip_2:
86+
ENTRY(fixup_put_user_skip_2)
8787
get_fault_ip %r1,%r8
8888
ldo 8(%r1), %r1
8989
bv %r0(%r1)
9090
ldi -EFAULT, %r8
91+
ENDPROC(fixup_put_user_skip_2)
92+

0 commit comments

Comments
 (0)