From 0b3d643f9ead9b5141dedbb2d1b06ce15469fc4a Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 28 Jan 2007 14:52:57 +0100 Subject: [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 Signed-off-by: Kyle McMartin --- arch/parisc/lib/fixup.S | 20 +++++++++++--------- arch/parisc/lib/lusercopy.S | 37 ++++++++++++------------------------- arch/parisc/lib/memcpy.c | 38 ++++++++++---------------------------- 3 files changed, 33 insertions(+), 62 deletions(-) (limited to 'arch/parisc/lib') diff --git a/arch/parisc/lib/fixup.S b/arch/parisc/lib/fixup.S index ecce3d35401..d172d4245cd 100644 --- a/arch/parisc/lib/fixup.S +++ b/arch/parisc/lib/fixup.S @@ -22,6 +22,7 @@ #include #include #include +#include #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) + diff --git a/arch/parisc/lib/lusercopy.S b/arch/parisc/lib/lusercopy.S index a0509855c9a..1bd23ccec17 100644 --- a/arch/parisc/lib/lusercopy.S +++ b/arch/parisc/lib/lusercopy.S @@ -37,6 +37,7 @@ #include #include +#include /* * 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 diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c index 5575e41f9d6..2c43ebe99a9 100644 --- a/arch/parisc/lib/memcpy.c +++ b/arch/parisc/lib/memcpy.c @@ -96,30 +96,18 @@ DECLARE_PER_CPU(struct exception_data, exception_data); #define DPRINTF(fmt, args...) #endif -#ifndef __LP64__ -#define EXC_WORD ".word" -#else -#define EXC_WORD ".dword" -#endif - #define def_load_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \ __asm__ __volatile__ ( \ - "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n" \ - "\t.section __ex_table,\"aw\"\n" \ - "\t" EXC_WORD "\t1b\n" \ - "\t" EXC_WORD "\t" #_e "\n" \ - "\t.previous\n" \ + "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n\t" \ + ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \ : _tt(_t), "+r"(_a) \ : \ : "r8") #define def_store_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \ __asm__ __volatile__ ( \ - "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n" \ - "\t.section __ex_table,\"aw\"\n" \ - "\t" EXC_WORD "\t1b\n" \ - "\t" EXC_WORD "\t" #_e "\n" \ - "\t.previous\n" \ + "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n\t" \ + ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \ : "+r"(_a) \ : _tt(_t) \ : "r8") @@ -133,22 +121,16 @@ DECLARE_PER_CPU(struct exception_data, exception_data); #define def_load_insn(_insn,_tt,_s,_o,_a,_t,_e) \ __asm__ __volatile__ ( \ - "1:\t" #_insn " " #_o "(" _s ",%1), %0\n" \ - "\t.section __ex_table,\"aw\"\n" \ - "\t" EXC_WORD "\t1b\n" \ - "\t" EXC_WORD "\t" #_e "\n" \ - "\t.previous\n" \ + "1:\t" #_insn " " #_o "(" _s ",%1), %0\n\t" \ + ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \ : _tt(_t) \ : "r"(_a) \ : "r8") #define def_store_insn(_insn,_tt,_s,_t,_o,_a,_e) \ __asm__ __volatile__ ( \ - "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n" \ - "\t.section __ex_table,\"aw\"\n" \ - "\t" EXC_WORD "\t1b\n" \ - "\t" EXC_WORD "\t" #_e "\n" \ - "\t.previous\n" \ + "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n\t" \ + ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \ : \ : _tt(_t), "r"(_a) \ : "r8") @@ -167,8 +149,8 @@ extern inline void prefetch_dst(const void *addr) __asm__("ldd 0(" d_space ",%0), %%r0" : : "r" (addr)); } #else -#define prefetch_src(addr) -#define prefetch_dst(addr) +#define prefetch_src(addr) do { } while(0) +#define prefetch_dst(addr) do { } while(0) #endif /* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words -- cgit v1.2.3