Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b3d643f authored by Helge Deller's avatar Helge Deller Committed by Kyle McMartin
Browse files

[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: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent 8e9e9844
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -27,20 +27,11 @@
 */

#ifdef CONFIG_64BIT
#define ADDIB	addib,*
#define CMPB	cmpb,*
#define ANDCM	andcm,*

	.level	2.0w
#else
#define ADDIB	addib,
#define CMPB	cmpb,
#define ANDCM	andcm

	.level	2.0
#endif


#include <asm/psw.h>
#include <asm/assembly.h>
#include <asm/pgtable.h>
+4 −22
Original line number Diff line number Diff line
@@ -23,19 +23,7 @@
	 */
#define KILL_INSN	break	0,0

#ifdef CONFIG_64BIT
	.level          2.0w
#else
	.level		1.1
#endif

/* on 64bit pad to 64bit values */
#ifdef CONFIG_64BIT
#define ULONG_WORD(x)	.word 0, x
#else
#define ULONG_WORD(x)	.word x
#endif

	.level          LEVEL

	.text

@@ -603,16 +591,10 @@ cas_action:
	   the other for the store. Either return -EFAULT.
	   Each of the entries must be relocated. */
	.section __ex_table,"aw"
	ULONG_WORD(2b - linux_gateway_page)
	ULONG_WORD(3b - linux_gateway_page)
	.previous

	.section __ex_table,"aw"
	ULONG_WORD(1b - linux_gateway_page)
	ULONG_WORD(3b - linux_gateway_page)
	ASM_ULONG_INSN (1b - linux_gateway_page), (3b - linux_gateway_page)
	ASM_ULONG_INSN (2b - linux_gateway_page), (3b - linux_gateway_page)
	.previous

end_compare_and_swap:

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

#define LWS_ENTRY(_name_) ULONG_WORD(lws_##_name_ - linux_gateway_page)
#define LWS_ENTRY(_name_) ASM_ULONG_INSN (lws_##_name_ - linux_gateway_page)

	.section .rodata,"a"

+25 −87
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
#define DPRINTF(fmt, args...)
#endif

#ifdef __LP64__
#ifdef CONFIG_64BIT
#define RFMT "%016lx"
#else
#define RFMT "%08lx"
@@ -150,15 +150,8 @@ static int emulate_ldh(struct pt_regs *regs, int toreg)
"4:	ldi	-2, %1\n"
	FIXUP_BRANCH(3b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,4b\n"
"	.dword  2b,4b\n"
#else
"	.word	1b,4b\n"
"	.word	2b,4b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
	ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
	: "=r" (val), "=r" (ret)
	: "0" (val), "r" (saddr), "r" (regs->isr)
	: "r20", FIXUP_BRANCH_CLOBBER );
@@ -195,15 +188,8 @@ static int emulate_ldw(struct pt_regs *regs, int toreg, int flop)
"4:	ldi	-2, %1\n"
	FIXUP_BRANCH(3b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,4b\n"
"	.dword  2b,4b\n"
#else
"	.word	1b,4b\n"
"	.word	2b,4b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
	ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
	: "=r" (val), "=r" (ret)
	: "0" (val), "r" (saddr), "r" (regs->isr)
	: "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -227,7 +213,7 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
		regs->isr, regs->ior, toreg);
#ifdef CONFIG_PA20

#ifndef __LP64__
#ifndef CONFIG_64BIT
	if (!flop)
		return -1;
#endif
@@ -246,15 +232,8 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
"4:	ldi	-2, %1\n"
	FIXUP_BRANCH(3b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,4b\n"
"	.dword  2b,4b\n"
#else
"	.word	1b,4b\n"
"	.word	2b,4b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
	ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
	: "=r" (val), "=r" (ret)
	: "0" (val), "r" (saddr), "r" (regs->isr)
	: "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -278,17 +257,9 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
"5:	ldi	-2, %2\n"
	FIXUP_BRANCH(4b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,5b\n"
"	.dword  2b,5b\n"
"	.dword	3b,5b\n"
#else
"	.word	1b,5b\n"
"	.word	2b,5b\n"
"	.word	3b,5b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b,5b)
	ASM_EXCEPTIONTABLE_ENTRY(2b,5b)
	ASM_EXCEPTIONTABLE_ENTRY(3b,5b)
	: "=r" (valh), "=r" (vall), "=r" (ret)
	: "0" (valh), "1" (vall), "r" (saddr), "r" (regs->isr)
	: "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -328,15 +299,8 @@ static int emulate_sth(struct pt_regs *regs, int frreg)
"4:	ldi	-2, %0\n"
	FIXUP_BRANCH(3b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,4b\n"
"	.dword  2b,4b\n"
#else
"	.word	1b,4b\n"
"	.word	2b,4b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
	ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
	: "=r" (ret)
	: "r" (val), "r" (regs->ior), "r" (regs->isr)
	: "r19", FIXUP_BRANCH_CLOBBER );
@@ -382,15 +346,8 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop)
"4:	ldi	-2, %0\n"
	FIXUP_BRANCH(3b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,4b\n"
"	.dword  2b,4b\n"
#else
"	.word	1b,4b\n"
"	.word	2b,4b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
	ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
	: "=r" (ret)
	: "r" (val), "r" (regs->ior), "r" (regs->isr)
	: "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -413,7 +370,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
		val,  regs->isr, regs->ior);

#ifdef CONFIG_PA20
#ifndef __LP64__
#ifndef CONFIG_64BIT
	if (!flop)
		return -1;
#endif
@@ -439,19 +396,10 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
"6:	ldi	-2, %0\n"
	FIXUP_BRANCH(5b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,6b\n"
"	.dword  2b,6b\n"
"	.dword	3b,6b\n"
"	.dword  4b,6b\n"
#else
"	.word	1b,6b\n"
"	.word	2b,6b\n"
"	.word	3b,6b\n"
"	.word	4b,6b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b,6b)
	ASM_EXCEPTIONTABLE_ENTRY(2b,6b)
	ASM_EXCEPTIONTABLE_ENTRY(3b,6b)
	ASM_EXCEPTIONTABLE_ENTRY(4b,6b)
	: "=r" (ret)
	: "r" (val), "r" (regs->ior), "r" (regs->isr)
	: "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -482,21 +430,11 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
"7:	ldi	-2, %0\n"
	FIXUP_BRANCH(6b)
"	.previous\n"
"	.section __ex_table,\"aw\"\n"
#ifdef __LP64__
"	.dword	1b,7b\n"
"	.dword  2b,7b\n"
"	.dword	3b,7b\n"
"	.dword  4b,7b\n"
"	.dword  5b,7b\n"
#else
"	.word	1b,7b\n"
"	.word	2b,7b\n"
"	.word	3b,7b\n"
"	.word	4b,7b\n"
"	.word  	5b,7b\n"
#endif
"	.previous\n"
	ASM_EXCEPTIONTABLE_ENTRY(1b,7b)
	ASM_EXCEPTIONTABLE_ENTRY(2b,7b)
	ASM_EXCEPTIONTABLE_ENTRY(3b,7b)
	ASM_EXCEPTIONTABLE_ENTRY(4b,7b)
	ASM_EXCEPTIONTABLE_ENTRY(5b,7b)
	: "=r" (ret)
	: "r" (valh), "r" (vall), "r" (regs->ior), "r" (regs->isr)
	: "r19", "r20", "r21", "r1", FIXUP_BRANCH_CLOBBER );
+11 −9
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <asm/asm-offsets.h>
#include <asm/assembly.h>
#include <asm/errno.h>
#include <linux/linkage.h>

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

	/* get_user() fixups, store -EFAULT in r8, and 0 in r9 */
	.export fixup_get_user_skip_1
fixup_get_user_skip_1:
ENTRY(fixup_get_user_skip_1)
	get_fault_ip %r1,%r8
	ldo 4(%r1), %r1
	ldi -EFAULT, %r8
	bv %r0(%r1)
	copy %r0, %r9
ENDPROC(fixup_get_user_skip_1)

	.export fixup_get_user_skip_2
fixup_get_user_skip_2:
ENTRY(fixup_get_user_skip_2)
	get_fault_ip %r1,%r8
	ldo 8(%r1), %r1
	ldi -EFAULT, %r8
	bv %r0(%r1)
	copy %r0, %r9
ENDPROC(fixup_get_user_skip_2)

	/* put_user() fixups, store -EFAULT in r8 */
	.export fixup_put_user_skip_1
fixup_put_user_skip_1:
ENTRY(fixup_put_user_skip_1)
	get_fault_ip %r1,%r8
	ldo 4(%r1), %r1
	bv %r0(%r1)
	ldi -EFAULT, %r8
ENDPROC(fixup_put_user_skip_1)

	.export fixup_put_user_skip_2
fixup_put_user_skip_2:
ENTRY(fixup_put_user_skip_2)
	get_fault_ip %r1,%r8
	ldo 8(%r1), %r1
	bv %r0(%r1)
	ldi -EFAULT, %r8
ENDPROC(fixup_put_user_skip_2)
+12 −25
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
	
#include <asm/assembly.h>
#include <asm/errno.h>
#include <linux/linkage.h>

	/*
	 * get_sr gets the appropriate space value into
@@ -67,8 +68,7 @@
	 *         otherwise strlen (i.e. excludes zero byte)
	 */

	.export lstrncpy_from_user,code
lstrncpy_from_user:
ENTRY(lstrncpy_from_user)
	.proc
	.callinfo NO_CALLS
	.entry
@@ -87,6 +87,7 @@ $lsfu_exit:
	bv          %r0(%r2)
	nop
	.exit
ENDPROC(lstrncpy_from_user)

	.section .fixup,"ax"
3:      fixup_branch $lsfu_exit
@@ -94,13 +95,8 @@ $lsfu_exit:
	.previous

	.section __ex_table,"aw"
#ifdef __LP64__
	.dword      1b,3b
	.dword      2b,3b
#else
	.word       1b,3b
	.word       2b,3b
#endif
	ASM_ULONG_INSN 1b,3b
	ASM_ULONG_INSN 2b,3b
	.previous

	.procend
@@ -112,8 +108,7 @@ $lsfu_exit:
	 * otherwise, returns number of bytes not transferred.
	 */

	.export lclear_user,code
lclear_user:
ENTRY(lclear_user)
	.proc
	.callinfo NO_CALLS
	.entry
@@ -127,6 +122,7 @@ $lclu_done:
	bv          %r0(%r2)
	copy        %r25,%r28
	.exit
ENDPROC(lclear_user)

	.section .fixup,"ax"
2:      fixup_branch $lclu_done
@@ -134,11 +130,7 @@ $lclu_done:
	.previous

	.section __ex_table,"aw"
#ifdef __LP64__
	.dword      1b,2b
#else
	.word       1b,2b
#endif
	ASM_ULONG_INSN 1b,2b
	.previous

	.procend
@@ -151,8 +143,7 @@ $lclu_done:
	 *         else strlen + 1 (i.e. includes zero byte).
	 */

	.export lstrnlen_user,code
lstrnlen_user:
ENTRY(lstrnlen_user)
	.proc
	.callinfo NO_CALLS
	.entry
@@ -172,6 +163,7 @@ $lslen_done:
$lslen_nzero:
	b           $lslen_done
	ldo         1(%r26),%r26 /* special case for N == 0 */
ENDPROC(lstrnlen_user)

	.section .fixup,"ax"
3:      fixup_branch $lslen_done
@@ -179,13 +171,8 @@ $lslen_nzero:
	.previous

	.section __ex_table,"aw"
#ifdef __LP64__
	.dword      1b,3b
	.dword      2b,3b
#else
	.word       1b,3b
	.word       2b,3b
#endif
	ASM_ULONG_INSN 1b,3b
	ASM_ULONG_INSN 2b,3b
	.previous

	.procend
Loading