diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/powerpc/sys/brk.S | 38 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/cerror.S | 43 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/exect.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/pipe.S | 15 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/ptrace.S | 3 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/sbrk.S | 28 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/setlogin.S | 16 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/sigprocmask.S | 30 |
8 files changed, 120 insertions, 63 deletions
diff --git a/lib/libc/arch/powerpc/sys/brk.S b/lib/libc/arch/powerpc/sys/brk.S index 4cf2fc548b8..ce1e0a8a00b 100644 --- a/lib/libc/arch/powerpc/sys/brk.S +++ b/lib/libc/arch/powerpc/sys/brk.S @@ -1,29 +1,41 @@ #include "SYS.h" .extern curbrk - .extern _end + .extern _C_LABEL(end) -PSEUDO_PREFIX(brk,break) +PREFIX2(brk,break) /* check >= _end, if not make the call for _end */ - addis 5,0,_end@h - ori 5,5,_end@l /* # 5 = &_end */ - cmpw 3,5 - bge+ .L_brk_call - mr 3, 5 +#ifndef PIC + addis 5,0,_C_LABEL(end)@h + ori 5,5,_C_LABEL(end)@l /* # 5 = &_end */ +#else + mflr 10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr 9 + mtlr 10 + lwz 5,_C_LABEL(end)@got(9) +#endif + cmpw 3,5 + bge+ .L_brk_call + mr 3, 5 .L_brk_call: - mr 7, 3 + mr 7, 3 /* call break(size) */ - addis 6, 0, curbrk@H - ori 6, 6, curbrk@L /* # 6 = &curbrk */ +#ifndef PIC + addis 6, 0, curbrk@H + ori 6, 6, curbrk@L /* # 6 = &curbrk */ +#else + lwz 6,_ASM_LABEL(curbrk)@got(9) +#endif sc /* check for error */ - cmpwi 0, 0 - beq+ .L_brk_ok /* OK so this is stupid but I haven't read b */ - b cerror + cmpwi 0, 0 + beq+ .L_brk_ok /* OK so this is stupid but I haven't read b */ + b PIC_PLT(_ASM_LABEL(cerror)) /* update, curbrk and return */ .L_brk_ok: diff --git a/lib/libc/arch/powerpc/sys/cerror.S b/lib/libc/arch/powerpc/sys/cerror.S index a99db9ddf83..f8f2fa25877 100644 --- a/lib/libc/arch/powerpc/sys/cerror.S +++ b/lib/libc/arch/powerpc/sys/cerror.S @@ -3,20 +3,45 @@ .text ENTRY(cerror) -#if 1 +#if defined(_THREAD_SAFE) || defined (PIC) + stwu 1, -16(1) /* follow the SVR4 ABI */ +#endif +#ifndef PIC +# ifndef _THREAD_SAFE addis 5, 0, errno@H ori 5, 5, errno@L +# else + mr 9, 0 + mflr 10 + bl _C_LABEL(__error) + mr 3, 5 + mtlr 10 + mr 0, 9 +# endif #else - .data - .extern errno -errno_toc: - .long errno - .text - addis 5, 0, errno_toc@H - ori 5, 5, errno_toc@L - lwz 5, 0(5) +# ifndef _THREAD_SAFE + mflr 10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr 4 + mtlr 10 + lwz 5,_C_LABEL(errno)@got(4) +# else + mflr 10 + stw 10, 20(1) + stw 0, 12(1) + + bl PIC_PLT(_C_LABEL(__error)) + mr 5, 3 + lwz 10, 12(1) + mtlr 10 + lwz 0, 20(1) +# endif #endif + stw 0, 0(5) addi 3, 0, -1 addi 4, 0, -1 +#if defined(_THREAD_SAFE) || defined (PIC) + addi 1, 1, 16 /* follow the SVR4 ABI */ +#endif blr diff --git a/lib/libc/arch/powerpc/sys/exect.S b/lib/libc/arch/powerpc/sys/exect.S index 46108f9d7b3..a5676a4c2b4 100644 --- a/lib/libc/arch/powerpc/sys/exect.S +++ b/lib/libc/arch/powerpc/sys/exect.S @@ -3,19 +3,19 @@ */ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: exect.S,v 1.2 1998/08/07 01:44:01 rahnds Exp $" + .asciz "$OpenBSD: exect.S,v 1.3 1999/01/28 05:09:12 rahnds Exp $" #endif /* SYSLIBC_SCCS */ #include "SYS.h" .text -PSEUDO_PREFIX(exect,execve) +PREFIX2(exect,execve) sc /* check for error */ - cmpwi 0, 0 - beq+ exect_ok /* OK so this is stupid but I haven't read b */ - b cerror + cmpwi 0, 0 + beq+ _ASM_LABEL(exect_ok) + b PIC_PLT(_ASM_LABEL(cerror)) /* update, curbrk and return */ exect_ok: diff --git a/lib/libc/arch/powerpc/sys/pipe.S b/lib/libc/arch/powerpc/sys/pipe.S index a80c05e7bf8..539a01c5aff 100644 --- a/lib/libc/arch/powerpc/sys/pipe.S +++ b/lib/libc/arch/powerpc/sys/pipe.S @@ -4,12 +4,13 @@ .text PREFIX(pipe) - mr 5, 3 /* keep buf addr safe */ + mr 5, 3 /* keep buf addr safe */ sc - cmpwi 0, 0 - beq ok - b cerror -ok: stw 3, 0(5) - stw 4, 4(5) - li 3, 0 + cmpwi 0, 0 + beq ok + b PIC_PLT(_ASM_LABEL(cerror)) + +ok: stw 3, 0(5) + stw 4, 4(5) + li 3, 0 blr diff --git a/lib/libc/arch/powerpc/sys/ptrace.S b/lib/libc/arch/powerpc/sys/ptrace.S index 93627bd0f11..e20aa27a65e 100644 --- a/lib/libc/arch/powerpc/sys/ptrace.S +++ b/lib/libc/arch/powerpc/sys/ptrace.S @@ -7,6 +7,7 @@ PREFIX(ptrace) sc cmpwi 0, 0 beq ok - b cerror + b PIC_PLT(_ASM_LABEL(cerror)) + ok: blr diff --git a/lib/libc/arch/powerpc/sys/sbrk.S b/lib/libc/arch/powerpc/sys/sbrk.S index c54fa839e8a..0cf807a5d6a 100644 --- a/lib/libc/arch/powerpc/sys/sbrk.S +++ b/lib/libc/arch/powerpc/sys/sbrk.S @@ -4,16 +4,26 @@ .globl _end .globl curbrk .globl minbrk -curbrk: .long _end -minbrk: .long _end +_ASM_LABEL(curbrk): + .long _C_LABEL(end) +_ASM_LABEL(minbrk): + .long _C_LABEL(end) .text -PSEUDO_PREFIX(sbrk,break) +PREFIX2(sbrk,break) /* call break(curbrk + size) */ - addis 6,0,curbrk@h - ori 6,6,curbrk@l /* # 6 = &curbrk */ +#ifndef PIC + addis 6, 0, curbrk@H + ori 6, 6, curbrk@L /* # 6 = &curbrk */ +#else + mflr 10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr 4 + mtlr 10 + lwz 6,_ASM_LABEL(curbrk)@got(9) +#endif lwz 5, 0(6) /* # 5 = *6 (old_curbrk) */ add 3, 5, 3 /* # 3 = new_curbrk */ mr 7, 3 @@ -21,12 +31,12 @@ PSEUDO_PREFIX(sbrk,break) sc /* check for error */ - cmpwi 0, 0 - beq+ sbrk_ok /* OK so this is stupid but I haven't read b */ - b cerror + cmpwi 0, 0 + beq+ .L_sbrk_ok + b PIC_PLT(_ASM_LABEL(cerror)) /* update, curbrk and return */ -sbrk_ok: +.L_sbrk_ok: stw 7, 0(6) /* # remember, 6=&curbrk, 7=new_curbrk */ mr 3, 5 /* # remember, 5=old_curbrk */ blr diff --git a/lib/libc/arch/powerpc/sys/setlogin.S b/lib/libc/arch/powerpc/sys/setlogin.S index 8f8ea689bc0..7acd76d9c3c 100644 --- a/lib/libc/arch/powerpc/sys/setlogin.S +++ b/lib/libc/arch/powerpc/sys/setlogin.S @@ -1,8 +1,16 @@ #include "SYS.h" - .extern __logname_valid + .extern _C_LABEL(_logname_valid) RSYSCALL(setlogin) - lis 0, __logname_valid@H li 4, 4 - stw 4,__logname_valid@L(0) +#ifndef PIC + lis 0,_C_LABEL(_logname_valid)@H + stw 4,_C_LABEL(_logname_valid)@L(0) +#else + mflr 10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr 9 + mtlr 10 + lwz 5,_C_LABEL(_logname_valid)@got(9) + stw 4,0(5) +#endif blr - diff --git a/lib/libc/arch/powerpc/sys/sigprocmask.S b/lib/libc/arch/powerpc/sys/sigprocmask.S index dd343ddb8f9..6b2cd018874 100644 --- a/lib/libc/arch/powerpc/sys/sigprocmask.S +++ b/lib/libc/arch/powerpc/sys/sigprocmask.S @@ -9,26 +9,26 @@ PREFIX(sigprocmask) /* check set (new mask value) for null, in which case fiddle arguments */ - cmpwi 4, 0 - bne+ load_set - addi 3, 0, 1 /* how = SIG_BLOCK, new mask already 0 */ - b do_call -load_set: - lwz 4, 0(4) /* get new mask */ -do_call: + cmpwi 4, 0 + bne+ .L_load_set + addi 3, 0, 1 /* how = SIG_BLOCK, new mask already 0 */ + b .L_do_call +.L_load_set: + lwz 4, 0(4) /* get new mask */ +.L_do_call: sc /* didnt work? */ - cmpwi 0, 0 - beq+ sigprocmask_ok - b cerror + cmpwi 0, 0 + beq+ .L_sigprocmask_ok + b cerror -sigprocmask_ok: +.L_sigprocmask_ok: lwz 5, 12(1) - cmpwi 5, 0 - beq+ sigprocmask_done - stw 3, 0(5) -sigprocmask_done: + cmpwi 5, 0 + beq+ .L_sigprocmask_done + stw 3, 0(5) +.L_sigprocmask_done: addi 1, 1, 16 blr |