diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-15 00:15:11 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-15 00:15:11 +0000 |
commit | ced779cec940e9a6ce249c7d4f02e15e8f474e76 (patch) | |
tree | bf4f5ed8c1638349a508516b349c26094ab003dd /lib/libc/arch/powerpc | |
parent | 1125da851d322ce096fad8322d337929f2e37d8a (diff) |
TIB conversion is complete, so set errno in the syscall stub and eliminate
__cerror
ok ketternis@
Diffstat (limited to 'lib/libc/arch/powerpc')
-rw-r--r-- | lib/libc/arch/powerpc/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/SYS.h | 18 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/brk.S | 6 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/sbrk.S | 6 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/sigprocmask.S | 6 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/sys/tfork_thread.S | 15 |
6 files changed, 33 insertions, 21 deletions
diff --git a/lib/libc/arch/powerpc/Makefile.inc b/lib/libc/arch/powerpc/Makefile.inc index 74ee41bf416..baa5c74e723 100644 --- a/lib/libc/arch/powerpc/Makefile.inc +++ b/lib/libc/arch/powerpc/Makefile.inc @@ -1,2 +1 @@ -# $OpenBSD: Makefile.inc,v 1.5 2016/05/07 19:05:22 guenther Exp $ -CERROR= cerror.S +# $OpenBSD: Makefile.inc,v 1.6 2016/05/15 00:15:10 guenther Exp $ diff --git a/lib/libc/arch/powerpc/SYS.h b/lib/libc/arch/powerpc/SYS.h index 05fe72401fa..0fbe6d54614 100644 --- a/lib/libc/arch/powerpc/SYS.h +++ b/lib/libc/arch/powerpc/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.21 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.22 2016/05/15 00:15:10 guenther Exp $ */ /*- * Copyright (c) 1994 * Andrew Cagney. All rights reserved. @@ -44,6 +44,15 @@ #include "machine/asm.h" + +/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */ +#define TCB_OFFSET_ERRNO (-8) +/* from <powerpc/tcb.h>: TCB address == %r2 - TCB_OFFSET */ +#define TCB_OFFSET 0x7000 + +/* offset of errno from %r2 */ +#define R2_OFFSET_ERRNO (-TCB_OFFSET + TCB_OFFSET_ERRNO) + /* * We define a hidden alias with the prefix "_libc_" for each global symbol * that may be used internally. By referencing _libc_x instead of x, other @@ -68,13 +77,16 @@ #define _CONCAT(x,y) x##y -#define PSEUDO_PREFIX(p,x,y) .extern _ASM_LABEL(__cerror) ; \ +#define PSEUDO_PREFIX(p,x,y) \ ENTRY(p##x) \ li 0, SYS_##y ; \ /* sc */ #define PSEUDO_SUFFIX cmpwi 0, 0 ; \ beqlr+ ; \ - b _ASM_LABEL(__cerror) + stw 0, R2_OFFSET_ERRNO(2); \ + li 3, -1; \ + li 4, -1; /* for __syscall(lseek) */ \ + blr #define PSEUDO_NOERROR_SUFFIX blr diff --git a/lib/libc/arch/powerpc/sys/brk.S b/lib/libc/arch/powerpc/sys/brk.S index 77ea58769a0..b88ee26fd49 100644 --- a/lib/libc/arch/powerpc/sys/brk.S +++ b/lib/libc/arch/powerpc/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.12 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.13 2016/05/15 00:15:10 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -66,7 +66,9 @@ PSEUDO_PREFIX(,brk,break) /* check for error */ cmpwi 0, 0 beq+ .L_brk_ok /* OK so this is stupid but I haven't read b */ - b _ASM_LABEL(__cerror) + stw 0, R2_OFFSET_ERRNO(2) + li 3, -1 + blr /* update, __curbrk and return */ .L_brk_ok: diff --git a/lib/libc/arch/powerpc/sys/sbrk.S b/lib/libc/arch/powerpc/sys/sbrk.S index 36016f63055..5c4d7e9e22f 100644 --- a/lib/libc/arch/powerpc/sys/sbrk.S +++ b/lib/libc/arch/powerpc/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.11 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.12 2016/05/15 00:15:10 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -63,7 +63,9 @@ PSEUDO_PREFIX(,sbrk,break) /* check for error */ cmpwi 0, 0 beq+ .L_sbrk_ok - b _ASM_LABEL(__cerror) + stw 0, R2_OFFSET_ERRNO(2) + li 3, -1 + blr /* update, __curbrk and return */ .L_sbrk_ok: diff --git a/lib/libc/arch/powerpc/sys/sigprocmask.S b/lib/libc/arch/powerpc/sys/sigprocmask.S index 373685891f4..6b10a5c6063 100644 --- a/lib/libc/arch/powerpc/sys/sigprocmask.S +++ b/lib/libc/arch/powerpc/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.11 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.12 2016/05/15 00:15:10 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -49,7 +49,9 @@ PREFIX_HIDDEN(sigprocmask) /* didnt work? */ cmpwi 0, 0 beq+ .L_sigprocmask_ok - b _ASM_LABEL(__cerror) + stw 0, R2_OFFSET_ERRNO(2) + li 3, -1 + blr .L_sigprocmask_ok: lwz 5, 12(1) diff --git a/lib/libc/arch/powerpc/sys/tfork_thread.S b/lib/libc/arch/powerpc/sys/tfork_thread.S index a59d22051c8..7ec35c34cef 100644 --- a/lib/libc/arch/powerpc/sys/tfork_thread.S +++ b/lib/libc/arch/powerpc/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.6 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.7 2016/05/15 00:15:10 guenther Exp $ */ /* * Copyright (c) 2005 Tim Wiess <tim@nop.cx> @@ -16,19 +16,14 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <sys/syscall.h> -#include <machine/asm.h> +#include "SYS.h" ENTRY(__tfork_thread) - /* sanity check */ - cmpwi %r5, 0 - beq 1f - /* call __tfork */ li %r0, SYS___tfork sc cmpwi %r0, 0 - bne 2f + bne 1f /* check if we are parent or child */ cmpwi %r3, 0 @@ -44,7 +39,7 @@ ENTRY(__tfork_thread) li %r0, SYS___threxit sc 1: + stw 0, R2_OFFSET_ERRNO(%r2) li %r3, -1 -2: - b _C_LABEL(__cerror) + blr END(__tfork_thread) |