From 98ebb25e56d0f452f1cfd5d33770eeaedca698fd Mon Sep 17 00:00:00 2001 From: cognet Date: Tue, 9 Nov 2004 16:49:14 +0000 Subject: Use the RET macro. For setjmp() and longjmp(), put the signal mask where it's supposed to be, instead of in the space reserved for fp regs. --- lib/libc/arm/SYS.h | 4 ++-- lib/libc/arm/gen/_setjmp.S | 5 +++-- lib/libc/arm/gen/alloca.S | 2 +- lib/libc/arm/gen/divsi3.S | 8 ++++---- lib/libc/arm/gen/setjmp.S | 10 ++++------ lib/libc/arm/string/ffs.S | 4 ++-- lib/libc/arm/string/memcmp.S | 30 +++++++++++++++--------------- lib/libc/arm/string/memmove.S | 8 ++++---- lib/libc/arm/string/memset.S | 16 ++++++++-------- lib/libc/arm/string/strcmp.S | 2 +- lib/libc/arm/string/strncmp.S | 2 +- lib/libc/arm/sys/brk.S | 2 +- lib/libc/arm/sys/cerror.S | 2 +- lib/libc/arm/sys/fork.S | 2 +- lib/libc/arm/sys/pipe.S | 3 ++- lib/libc/arm/sys/ptrace.S | 2 +- lib/libc/arm/sys/sbrk.S | 2 +- 17 files changed, 52 insertions(+), 52 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/arm/SYS.h b/lib/libc/arm/SYS.h index c8bf2fe..b9bc742 100644 --- a/lib/libc/arm/SYS.h +++ b/lib/libc/arm/SYS.h @@ -74,11 +74,11 @@ #define PSEUDO_NOERROR(x) \ _SYSCALL_NOERROR(x); \ - mov r15, r14 + RET #define PSEUDO(x) \ _SYSCALL(x); \ - mov r15, r14 + RET #define RSYSCALL_NOERROR(x) \ diff --git a/lib/libc/arm/gen/_setjmp.S b/lib/libc/arm/gen/_setjmp.S index 91f5c66..b938405 100644 --- a/lib/libc/arm/gen/_setjmp.S +++ b/lib/libc/arm/gen/_setjmp.S @@ -64,11 +64,12 @@ ENTRY(_setjmp) stmia r0, {r4-r14} mov r0, #0x00000000 - mov r15, r14 + RET .L_setjmp_magic: .word _JB_MAGIC__SETJMP +WEAK_ALIAS(___longjmp, _longjmp) ENTRY(_longjmp) ldr r2, .L_setjmp_magic ldr r3, [r0], #4 @@ -96,7 +97,7 @@ ENTRY(_longjmp) mov r0, r1 teq r0, #0x00000000 moveq r0, #0x00000001 - mov r15, r14 + RET /* validation failed, die die die. */ botch: diff --git a/lib/libc/arm/gen/alloca.S b/lib/libc/arm/gen/alloca.S index 4694d3c..9569d86 100644 --- a/lib/libc/arm/gen/alloca.S +++ b/lib/libc/arm/gen/alloca.S @@ -42,4 +42,4 @@ ENTRY(alloca) bic r0, r0, #0x00000007 sub sp, sp, r0 /* Adjust the stack pointer */ mov r0, sp /* r0 = base of new space */ - mov r15, r14 /* return */ + RET diff --git a/lib/libc/arm/gen/divsi3.S b/lib/libc/arm/gen/divsi3.S index baab96b..104a958 100644 --- a/lib/libc/arm/gen/divsi3.S +++ b/lib/libc/arm/gen/divsi3.S @@ -47,7 +47,7 @@ ENTRY(__modsi3) /* XXX should cause a fatal error */ mvn r0, #0 #endif - mov pc, lr + RET ENTRY(__udivsi3) .L_udivide: /* r0 = r0 / r1; r1 = r0 % r1 */ @@ -69,7 +69,7 @@ ENTRY(__udivsi3) .L_divide_l0: /* r0 == 1 */ mov r0, r1 mov r1, #0 - mov pc, lr + RET ENTRY(__divsi3) .L_divide: /* r0 = r0 / r1; r1 = r0 % r1 */ @@ -373,7 +373,7 @@ ENTRY(__divsi3) movs ip, ip, lsl #1 bicmi r0, r0, #0x80000000 /* Fix incase we divided 0x80000000 */ rsbmi r0, r0, #0 - mov pc, lr + RET .L_udivide_l1: tst ip, #0x10000000 @@ -384,4 +384,4 @@ ENTRY(__divsi3) subhs r1, r1, r0 addhs r3, r3, r2 mov r0, r3 - mov pc, lr + RET diff --git a/lib/libc/arm/gen/setjmp.S b/lib/libc/arm/gen/setjmp.S index 53959e7..f0e9cfa 100644 --- a/lib/libc/arm/gen/setjmp.S +++ b/lib/libc/arm/gen/setjmp.S @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); ENTRY(setjmp) /* Block all signals and retrieve the old signal mask */ stmfd sp!, {r0, r14} - add r2, r0, #4 /* oset */ + add r2, r0, #(25 * 4) /* oset */ mov r0, #0x00000001 /* SIG_BLOCK */ mov r1, #0 /* set */ @@ -70,7 +70,7 @@ ENTRY(setjmp) /* Store integer registers */ stmia r0, {r4-r14} mov r0, #0x00000000 - mov r15, r14 + RET .Lsetjmp_magic: .word _JB_MAGIC_SETJMP @@ -84,14 +84,12 @@ ENTRY(__longjmp) teq r2, r3 bne botch - /* Fetch signal mask */ - add r2, r0, #4 /* Set signal mask */ stmfd sp!, {r0, r1, r14} sub sp, sp, #4 /* align the stack */ - mov r1, r2 + add r1, r0, #(25 * 4) /* Signal mask */ mov r0, #3 /* SIG_SETMASK */ mov r2, #0 bl PIC_SYM(_C_LABEL(sigprocmask), PLT) @@ -122,7 +120,7 @@ ENTRY(__longjmp) mov r0, r1 teq r0, #0x00000000 moveq r0, #0x00000001 - mov r15, r14 + RET /* validation failed, die die die. */ botch: diff --git a/lib/libc/arm/string/ffs.S b/lib/libc/arm/string/ffs.S index e91b3bb..223d55d 100644 --- a/lib/libc/arm/string/ffs.S +++ b/lib/libc/arm/string/ffs.S @@ -62,7 +62,7 @@ ENTRY(ffs) /* now lookup in table indexed on top 6 bits of r0 */ ldrneb r0, [ r2, r0, lsr #26 ] - mov pc, lr + RET .text; .type .L_ffs_table, _ASM_TYPE_OBJECT; .L_ffs_table: @@ -78,5 +78,5 @@ ENTRY(ffs) #else clzne r0, r0 rsbne r0, r0, #32 - mov pc, lr + RET #endif diff --git a/lib/libc/arm/string/memcmp.S b/lib/libc/arm/string/memcmp.S index 5b1a0a5..a81c960 100644 --- a/lib/libc/arm/string/memcmp.S +++ b/lib/libc/arm/string/memcmp.S @@ -77,7 +77,7 @@ ENTRY(memcmp) /* Are both addresses aligned the same way? */ cmp r2, #0x00 eornes r3, ip, r1 - moveq pc, lr /* len == 0, or same addresses! */ + RETeq /* len == 0, or same addresses! */ tst r3, #0x03 subne r2, r2, #0x01 bne .Lmemcmp_bytewise2 /* Badly aligned. Do it the slow way */ @@ -93,25 +93,25 @@ ENTRY(memcmp) ldrb r0, [ip], #0x01 ldrb r3, [r1], #0x01 subs r0, r0, r3 - movne pc, lr + RETne subs r2, r2, #0x01 - moveq pc, lr + RETeq /* Compare up to 2 bytes */ ldrb r0, [ip], #0x01 ldrb r3, [r1], #0x01 subs r0, r0, r3 - movne pc, lr + RETne subs r2, r2, #0x01 - moveq pc, lr + RETeq /* Compare 1 byte */ ldrb r0, [ip], #0x01 ldrb r3, [r1], #0x01 subs r0, r0, r3 - movne pc, lr + RETne subs r2, r2, #0x01 - moveq pc, lr + RETeq /* Compare 4 bytes at a time, if possible */ subs r2, r2, #0x04 @@ -127,7 +127,7 @@ ENTRY(memcmp) /* Correct for extra subtraction, and check if done */ adds r2, r2, #0x04 cmpeq r0, #0x00 /* If done, did all bytes match? */ - moveq pc, lr /* Yup. Just return */ + RETeq /* Yup. Just return */ /* Re-do the final word byte-wise */ sub ip, ip, #0x04 @@ -142,7 +142,7 @@ ENTRY(memcmp) cmpcs r0, r3 beq .Lmemcmp_bytewise2 sub r0, r0, r3 - mov pc, lr + RET #if defined(_KERNEL) && !defined(_STANDALONE) /* @@ -158,23 +158,23 @@ ENTRY(memcmp) ldrb r2, [r1, #0x01] /* r2 = b2#1 */ subs r0, r0, r3 /* r0 = b1#0 - b2#0 */ ldreqb r3, [ip, #0x01] /* r3 = b1#1 */ - movne pc, lr /* Return if mismatch on #0 */ + RETne /* Return if mismatch on #0 */ subs r0, r3, r2 /* r0 = b1#1 - b2#1 */ ldreqb r3, [r1, #0x02] /* r3 = b2#2 */ ldreqb r0, [ip, #0x02] /* r0 = b1#2 */ - movne pc, lr /* Return if mismatch on #1 */ + RETne /* Return if mismatch on #1 */ ldrb r2, [r1, #0x03] /* r2 = b2#3 */ subs r0, r0, r3 /* r0 = b1#2 - b2#2 */ ldreqb r3, [ip, #0x03] /* r3 = b1#3 */ - movne pc, lr /* Return if mismatch on #2 */ + RETne /* Return if mismatch on #2 */ subs r0, r3, r2 /* r0 = b1#3 - b2#3 */ ldreqb r3, [r1, #0x04] /* r3 = b2#4 */ ldreqb r0, [ip, #0x04] /* r0 = b1#4 */ - movne pc, lr /* Return if mismatch on #3 */ + RETne /* Return if mismatch on #3 */ ldrb r2, [r1, #0x05] /* r2 = b2#5 */ subs r0, r0, r3 /* r0 = b1#4 - b2#4 */ ldreqb r3, [ip, #0x05] /* r3 = b1#5 */ - movne pc, lr /* Return if mismatch on #4 */ + RETne /* Return if mismatch on #4 */ sub r0, r3, r2 /* r0 = b1#5 - b2#5 */ - mov pc, lr + RET #endif diff --git a/lib/libc/arm/string/memmove.S b/lib/libc/arm/string/memmove.S index fff9618..f65a254 100644 --- a/lib/libc/arm/string/memmove.S +++ b/lib/libc/arm/string/memmove.S @@ -53,7 +53,7 @@ ENTRY(bcopy) #endif /* Do the buffers overlap? */ cmp r0, r1 - moveq pc, lr /* Bail now if src/dst are the same */ + RETeq /* Bail now if src/dst are the same */ subcc r3, r0, r1 /* if (dst > src) r3 = dst - src */ subcs r3, r1, r0 /* if (src > dsr) r3 = src - dst */ cmp r3, r2 /* if (r3 < len) we have an overlap */ @@ -64,7 +64,7 @@ ENTRY(bcopy) bcc .Lmemmove_backwards moveq r0, #0 /* Quick abort for len=0 */ - moveq pc, lr + RETeq stmdb sp!, {r0, lr} /* memmove() returns dest addr */ subs r2, r2, #4 @@ -382,7 +382,7 @@ ENTRY(bcopy) .Lmemmove_bl4: /* less than 4 bytes to go */ adds r2, r2, #4 - moveq pc, lr /* done */ + RETeq /* done */ /* copy the crud byte at a time */ cmp r2, #2 @@ -392,7 +392,7 @@ ENTRY(bcopy) strgeb r3, [r0, #-1]! ldrgtb r3, [r1, #-1]! strgtb r3, [r0, #-1]! - mov pc, lr + RET /* erg - unaligned destination */ .Lmemmove_bdestul: diff --git a/lib/libc/arm/string/memset.S b/lib/libc/arm/string/memset.S index fbe8581..1e97846 100644 --- a/lib/libc/arm/string/memset.S +++ b/lib/libc/arm/string/memset.S @@ -160,7 +160,7 @@ ENTRY(memset) stmgeia ip!, {r2-r3} #endif bgt .Lmemset_loop128 - moveq pc, lr /* Zero length so just exit */ + RETeq /* Zero length so just exit */ add r1, r1, #0x80 /* Adjust for extra sub */ @@ -179,7 +179,7 @@ ENTRY(memset) stmgeia ip!, {r2-r3} #endif bgt .Lmemset_loop32 - moveq pc, lr /* Zero length so just exit */ + RETeq /* Zero length so just exit */ adds r1, r1, #0x10 /* Partially adjust for extra sub */ @@ -191,7 +191,7 @@ ENTRY(memset) stmgeia ip!, {r2-r3} stmgeia ip!, {r2-r3} #endif - moveq pc, lr /* Zero length so just exit */ + RETeq /* Zero length so just exit */ addlt r1, r1, #0x10 /* Possibly adjust for extra sub */ @@ -200,12 +200,12 @@ ENTRY(memset) subs r1, r1, #0x04 strge r3, [ip], #0x04 bgt .Lmemset_loop4 - moveq pc, lr /* Zero length so just exit */ + RETeq /* Zero length so just exit */ #ifdef __XSCALE__ /* Compensate for 64-bit alignment check */ adds r1, r1, #0x04 - moveq pc, lr + RETeq cmp r1, #2 #else cmp r1, #-2 @@ -214,7 +214,7 @@ ENTRY(memset) strb r3, [ip], #0x01 /* Set 1 byte */ strgeb r3, [ip], #0x01 /* Set another byte */ strgtb r3, [ip] /* and a third */ - mov pc, lr /* Exit */ + RET /* Exit */ .Lmemset_wordunaligned: rsb r2, r2, #0x004 @@ -228,9 +228,9 @@ ENTRY(memset) .Lmemset_lessthanfour: cmp r1, #0x00 - moveq pc, lr /* Zero length so exit */ + RETeq /* Zero length so exit */ strb r3, [ip], #0x01 /* Set 1 byte */ cmp r1, #0x02 strgeb r3, [ip], #0x01 /* Set another byte */ strgtb r3, [ip] /* and a third */ - mov pc, lr /* Exit */ + RET /* Exit */ diff --git a/lib/libc/arm/string/strcmp.S b/lib/libc/arm/string/strcmp.S index 3debd75..e5cba7d 100644 --- a/lib/libc/arm/string/strcmp.S +++ b/lib/libc/arm/string/strcmp.S @@ -40,4 +40,4 @@ ENTRY(strcmp) cmpcs r2, r3 beq 1b sub r0, r2, r3 - mov pc, lr + RET diff --git a/lib/libc/arm/string/strncmp.S b/lib/libc/arm/string/strncmp.S index 33396f6..d172264 100644 --- a/lib/libc/arm/string/strncmp.S +++ b/lib/libc/arm/string/strncmp.S @@ -48,4 +48,4 @@ ENTRY(strncmp) cmpcs r2, r3 beq 1b sub r0, r2, r3 - mov pc, lr + RET diff --git a/lib/libc/arm/sys/brk.S b/lib/libc/arm/sys/brk.S index 8112e91..9141cf0 100644 --- a/lib/libc/arm/sys/brk.S +++ b/lib/libc/arm/sys/brk.S @@ -87,7 +87,7 @@ ENTRY(_brk) /* Return 0 for success */ mov r0, #0x00000000 - mov r15, r14 + RET .align 2 #ifdef PIC diff --git a/lib/libc/arm/sys/cerror.S b/lib/libc/arm/sys/cerror.S index b0f04a6..e657248 100644 --- a/lib/libc/arm/sys/cerror.S +++ b/lib/libc/arm/sys/cerror.S @@ -61,7 +61,7 @@ ASENTRY(CERROR) str r0, [r1] mvn r0, #0x00000000 mvn r1, #0x00000000 - mov pc, lr + RET #if 0 .align 0 diff --git a/lib/libc/arm/sys/fork.S b/lib/libc/arm/sys/fork.S index fb07c87..a5ae1f0 100644 --- a/lib/libc/arm/sys/fork.S +++ b/lib/libc/arm/sys/fork.S @@ -46,4 +46,4 @@ __FBSDID("$FreeBSD$"); _SYSCALL(fork) sub r1, r1, #1 /* r1 == 0xffffffff if parent, 0 if child */ and r0, r0, r1 /* r0 == 0 if child, else unchanged */ - mov r15, r14 + RET diff --git a/lib/libc/arm/sys/pipe.S b/lib/libc/arm/sys/pipe.S index 59ddd88..83518fc2 100644 --- a/lib/libc/arm/sys/pipe.S +++ b/lib/libc/arm/sys/pipe.S @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #ifdef WEAK_ALIAS WEAK_ALIAS(pipe, _pipe) +WEAK_ALIAS(__sys_pipe, _pipe) #endif ENTRY(_pipe) @@ -46,4 +47,4 @@ ENTRY(_pipe) str r0, [r2, #0x0000] str r1, [r2, #0x0004] mov r0, #0x00000000 - mov r15, r14 + RET diff --git a/lib/libc/arm/sys/ptrace.S b/lib/libc/arm/sys/ptrace.S index 0aa1122..46b31bc 100644 --- a/lib/libc/arm/sys/ptrace.S +++ b/lib/libc/arm/sys/ptrace.S @@ -63,7 +63,7 @@ ENTRY(ptrace) SYSTRAP(ptrace) bcs PIC_SYM(CERROR, PLT) - mov pc, lr + RET #ifndef _REENTRANT #ifdef PIC diff --git a/lib/libc/arm/sys/sbrk.S b/lib/libc/arm/sys/sbrk.S index cca380d..20821fe 100644 --- a/lib/libc/arm/sys/sbrk.S +++ b/lib/libc/arm/sys/sbrk.S @@ -77,7 +77,7 @@ ENTRY(_sbrk) str r1, [r2] /* Return old curbrk value */ - mov r15, r14 + RET .align 0 #ifdef PIC -- cgit v1.1