diff options
author | 2015-09-10 13:29:09 +0000 | |
---|---|---|
committer | 2015-09-10 13:29:09 +0000 | |
commit | 3f373d4115327011c7af514e278a1fc5ced933e6 (patch) | |
tree | 947cf988ffff0c8d6ad01c4c60f1930a94839125 /lib/libc | |
parent | Replace TLS_{READ,WRITE}_AGAIN with TLS_WANT_POLL{IN,OUT} and correctly (diff) | |
download | wireguard-openbsd-3f373d4115327011c7af514e278a1fc5ced933e6.tar.xz wireguard-openbsd-3f373d4115327011c7af514e278a1fc5ced933e6.zip |
Adds hidden _libc_FOO aliases for the system call stubs.
Stop generating _brk and _sbrk symbols: they've already been hidden.
Set the ELF symbol size on the syscall stubs.
Give the __{min,cur}brk symbols a size and type, and hide more jump labels.
alpha, arm, m88k, sh, sparc, and vax assistance miod@
hppa assistance kettenis@
ok deraadt@ miod@
Diffstat (limited to 'lib/libc')
50 files changed, 278 insertions, 163 deletions
diff --git a/lib/libc/arch/alpha/SYS.h b/lib/libc/arch/alpha/SYS.h index e05715cca4b..41b3cee56d3 100644 --- a/lib/libc/arch/alpha/SYS.h +++ b/lib/libc/arch/alpha/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.11 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.12 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */ /* @@ -46,12 +46,18 @@ .type _HIDDEN(x),@function /* + * END() uses the alpha .end pseudo-op which requires a matching .ent, + * so here's a short hand for just doing .size + */ +#define _END(x) .size x, . - x + +/* * For functions implemented in ASM that aren't syscalls. * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names */ #define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); \ - .size _HIDDEN(x), . - _HIDDEN(x) + _END(_HIDDEN(x)) #define END_WEAK(x) END_STRONG(x); .weak x @@ -67,7 +73,9 @@ LLABEL(name,1): #define __LEAF(p,n,e) \ LEAF(___CONCAT(p,n),e) #define __END(p,n) \ - END(___CONCAT(p,n)) + END(___CONCAT(p,n)); \ + _HIDDEN_FALIAS(n,___CONCAT(p,n)); \ + _END(_HIDDEN(n)) #define __SYSCALL(p,name) \ __LEAF(p,name,0); /* XXX # of args? */ \ @@ -112,14 +120,19 @@ __END(p,label); # define SYSCALL_NOERROR(x) ALIAS(_thread_sys_,x) \ __SYSCALL_NOERROR(_thread_sys_,x) # define RSYSCALL(x) ALIAS(_thread_sys_,x) \ - __RSYSCALL(_thread_sys_,x) + __RSYSCALL(_thread_sys_,x); \ + _END(x) # define RSYSCALL_HIDDEN(x) __RSYSCALL(_thread_sys_,x) # define RSYSCALL_NOERROR(x) ALIAS(_thread_sys_,x) \ - __RSYSCALL_NOERROR(_thread_sys_,x) + __RSYSCALL_NOERROR(_thread_sys_,x); \ + _END(x) # define PSEUDO(x,y) ALIAS(_thread_sys_,x) \ - __PSEUDO(_thread_sys_,x,y) + __PSEUDO(_thread_sys_,x,y); \ + _END(x) # define PSEUDO_NOERROR(x,y) ALIAS(_thread_sys_,x) \ - __PSEUDO_NOERROR(_thread_sys_,x,y) + __PSEUDO_NOERROR(_thread_sys_,x,y); \ + _END(x) # define SYSLEAF(x,e) ALIAS(_thread_sys_,x) \ __LEAF(_thread_sys_,x,e) -# define SYSEND(x) __END(_thread_sys_,x) +# define SYSEND(x) __END(_thread_sys_,x); \ + _END(x) diff --git a/lib/libc/arch/alpha/sys/brk.S b/lib/libc/arch/alpha/sys/brk.S index dbdccd1240f..f7b64657f89 100644 --- a/lib/libc/arch/alpha/sys/brk.S +++ b/lib/libc/arch/alpha/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.7 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.8 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: brk.S,v 1.4 1996/10/17 03:08:15 cgd Exp $ */ /* @@ -36,11 +36,12 @@ IMPORT(__curbrk, 8) .data __minbrk: .quad _end - -WEAK_ALIAS(brk, _brk) + .size __minbrk, . - __minbrk + .type __minbrk,@object .text -LEAF(_brk, 1) + .weak brk +LEAF(brk, 1) br pv, L1 /* XXX profiling */ L1: LDGP(pv) ldq v0, __minbrk @@ -50,4 +51,4 @@ L1: LDGP(pv) stq a0, __curbrk mov zero, v0 RET -END(_brk) +END(brk) diff --git a/lib/libc/arch/alpha/sys/sbrk.S b/lib/libc/arch/alpha/sys/sbrk.S index f64b2f7772e..d56e1dec17b 100644 --- a/lib/libc/arch/alpha/sys/sbrk.S +++ b/lib/libc/arch/alpha/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.7 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.8 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sbrk.S,v 1.4 1996/10/17 03:08:20 cgd Exp $ */ /* @@ -35,11 +35,12 @@ .data EXPORT(__curbrk) .quad _end - -WEAK_ALIAS(sbrk, _sbrk) + .size __curbrk, . - __curbrk + .type __curbrk,@object .text -LEAF(_sbrk, 1) + .weak sbrk +LEAF(sbrk, 1) br pv, L1 /* XXX profiling */ L1: LDGP(pv) ldq a1, __curbrk @@ -48,4 +49,4 @@ L1: LDGP(pv) stq a0, __curbrk mov a1, v0 RET -END(_sbrk) +END(sbrk) diff --git a/lib/libc/arch/arm/SYS.h b/lib/libc/arch/arm/SYS.h index 5fb3fe67ca8..94824881eb2 100644 --- a/lib/libc/arch/arm/SYS.h +++ b/lib/libc/arch/arm/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.12 2015/08/31 06:48:24 deraadt Exp $ */ +/* $OpenBSD: SYS.h,v 1.13 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */ /*- @@ -68,6 +68,12 @@ ENTRY(_thread_sys_ ## x) #define SYSENTRY_HIDDEN(x) \ ENTRY(_thread_sys_ ## x) +#define __END_HIDDEN(x) \ + END(_thread_sys_ ## x); \ + _HIDDEN_FALIAS(x, _thread_sys_ ## x); \ + END(_HIDDEN(x)) +#define __END(x) \ + __END_HIDDEN(x); END(x) #define SYSTRAP(x) \ ldr r12, =SYS_ ## x; \ @@ -99,14 +105,17 @@ #define PSEUDO_NOERROR(x,y) \ _SYSCALL_NOERROR(x,y); \ - mov r15, r14 + mov r15, r14; \ + __END(x) #define PSEUDO(x,y) \ _SYSCALL(x,y); \ - mov r15, r14 + mov r15, r14; \ + __END(x) #define PSEUDO_HIDDEN(x,y) \ _SYSCALL_HIDDEN(x,y); \ - mov r15, r14 + mov r15, r14; \ + __END_HIDDEN(x) #define RSYSCALL_NOERROR(x) \ @@ -116,5 +125,7 @@ PSEUDO(x,x) #define RSYSCALL_HIDDEN(x) \ PSEUDO_HIDDEN(x,x) +#define SYSCALL_END(x) \ + __END(x) .globl CERROR diff --git a/lib/libc/arch/arm/sys/Ovfork.S b/lib/libc/arch/arm/sys/Ovfork.S index a015a9082a5..10d3ef3ec51 100644 --- a/lib/libc/arch/arm/sys/Ovfork.S +++ b/lib/libc/arch/arm/sys/Ovfork.S @@ -1,4 +1,4 @@ -/* $OpenBSD: Ovfork.S,v 1.4 2015/03/31 04:32:01 guenther Exp $ */ +/* $OpenBSD: Ovfork.S,v 1.5 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: Ovfork.S,v 1.6 2003/08/07 16:42:03 agc Exp $ */ /*- @@ -42,3 +42,4 @@ SYSENTRY(vfork) SYSTRAP(vfork) bcs PIC_SYM(CERROR, PLT) mov r15, r2 +SYSCALL_END(vfork) diff --git a/lib/libc/arch/arm/sys/brk.S b/lib/libc/arch/arm/sys/brk.S index e348be27e0f..05b8831a97c 100644 --- a/lib/libc/arch/arm/sys/brk.S +++ b/lib/libc/arch/arm/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.7 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: brk.S,v 1.7 2003/12/26 11:23:44 martin Exp $ */ /*- @@ -37,18 +37,19 @@ .globl _C_LABEL(end) .globl __curbrk -WEAK_ALIAS(brk, _brk) - .data .align 0 .type __minbrk,#object __minbrk: .word _C_LABEL(end) + END(__minbrk) + + .weak brk /* * Change the data segment size */ -ENTRY(_brk) +ENTRY(brk) #ifdef __PIC__ /* Setup the GOT */ ldr r3, .Lgot @@ -94,3 +95,4 @@ ENTRY(_brk) .word PIC_SYM(__minbrk, GOT) .Lcurbrk: .word PIC_SYM(__curbrk, GOT) +END(brk) diff --git a/lib/libc/arch/arm/sys/cerror.S b/lib/libc/arch/arm/sys/cerror.S index 4481a0918f8..d595caa8f36 100644 --- a/lib/libc/arch/arm/sys/cerror.S +++ b/lib/libc/arch/arm/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.6 2013/12/31 23:31:13 kettenis Exp $ */ +/* $OpenBSD: cerror.S,v 1.7 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: cerror.S,v 1.5 2003/08/07 16:42:04 agc Exp $ */ /*- @@ -62,3 +62,4 @@ ASENTRY(_CERROR) .Lerrno: .word PIC_SYM(_C_LABEL(errno), GOT) +END(_CERROR) diff --git a/lib/libc/arch/arm/sys/sbrk.S b/lib/libc/arch/arm/sys/sbrk.S index cb594713e92..ff38e508730 100644 --- a/lib/libc/arch/arm/sys/sbrk.S +++ b/lib/libc/arch/arm/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.7 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sbrk.S,v 1.7 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -36,8 +36,6 @@ .globl _C_LABEL(end) -WEAK_ALIAS(sbrk, _sbrk) - .data .align 0 .globl __curbrk @@ -45,11 +43,13 @@ WEAK_ALIAS(sbrk, _sbrk) .hidden __curbrk __curbrk: .word _C_LABEL(end) + END(__curbrk) + .weak sbrk /* * Change the data segment size */ -SYSENTRY(_sbrk) +ENTRY(sbrk) #ifdef __PIC__ /* Setup the GOT */ ldr r3, .Lgot @@ -84,3 +84,4 @@ SYSENTRY(_sbrk) #endif .Lcurbrk: .word PIC_SYM(__curbrk, GOT) +END(sbrk) diff --git a/lib/libc/arch/arm/sys/sigpending.S b/lib/libc/arch/arm/sys/sigpending.S index 67b46f6084a..7f324fd62e2 100644 --- a/lib/libc/arch/arm/sys/sigpending.S +++ b/lib/libc/arch/arm/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.3 2012/07/01 19:32:28 guenther Exp $ */ +/* $OpenBSD: sigpending.S,v 1.4 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sigpending.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -41,3 +41,4 @@ SYSENTRY(sigpending) str r0, [r2] mov r0, #0x00000000 mov r15, r14 +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/arm/sys/sigprocmask.S b/lib/libc/arch/arm/sys/sigprocmask.S index 0dbf65879d2..aab0d86434c 100644 --- a/lib/libc/arch/arm/sys/sigprocmask.S +++ b/lib/libc/arch/arm/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.3 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sigprocmask.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -45,3 +45,4 @@ SYSENTRY(sigprocmask) strne r0, [r2] mov r0, #0x00000000 mov r15, r14 +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/arm/sys/sigsuspend.S b/lib/libc/arch/arm/sys/sigsuspend.S index 74eea8b8b76..b1d695e2f20 100644 --- a/lib/libc/arch/arm/sys/sigsuspend.S +++ b/lib/libc/arch/arm/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.3 2004/02/16 16:49:58 drahn Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.4 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sigsuspend.S,v 1.6 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -40,3 +40,4 @@ SYSENTRY(sigsuspend) bcs PIC_SYM(CERROR, PLT) mov r0, #0x00000000 mov r15, r14 +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/arm/sys/tfork_thread.S b/lib/libc/arch/arm/sys/tfork_thread.S index 4115477f28d..a24ef6758ef 100644 --- a/lib/libc/arch/arm/sys/tfork_thread.S +++ b/lib/libc/arch/arm/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.2 2012/06/21 00:56:59 guenther Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.3 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -39,3 +39,4 @@ ENTRY(__tfork_thread) SYSTRAP(__threxit) 1: b PIC_SYM(CERROR, PLT) +END(__tfork_thread) diff --git a/lib/libc/arch/hppa/SYS.h b/lib/libc/arch/hppa/SYS.h index 4a957a2a310..7f891b4f899 100644 --- a/lib/libc/arch/hppa/SYS.h +++ b/lib/libc/arch/hppa/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.20 2015/08/31 04:58:47 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.21 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -71,7 +71,12 @@ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\ #define SYSENTRY_HIDDEN(x) !\ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) #define SYSEXIT(x) !\ -EXIT(__CONCAT(_thread_sys_,x)) + SYSEXIT_HIDDEN(x) !\ + .size x, . - x +#define SYSEXIT_HIDDEN(x) !\ + EXIT(__CONCAT(_thread_sys_,x)) !\ + _HIDDEN_FALIAS(x,_thread_sys_##x) !\ + .size _HIDDEN(x), . - _HIDDEN(x) #define SYSCALL(x) !\ stw rp, HPPA_FRAME_ERP(sr0,sp) !\ @@ -93,7 +98,7 @@ SYSENTRY_HIDDEN(x) !\ SYSCALL(y) !\ bv r0(rp) !\ nop !\ -SYSEXIT(x) +SYSEXIT_HIDDEN(x) #define PSEUDO_NOERROR(x,y) !\ SYSENTRY(x) !\ diff --git a/lib/libc/arch/hppa/sys/brk.S b/lib/libc/arch/hppa/sys/brk.S index 0dae523c592..9b6b3a02d26 100644 --- a/lib/libc/arch/hppa/sys/brk.S +++ b/lib/libc/arch/hppa/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.16 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.17 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -36,9 +36,9 @@ __minbrk .long end -WEAK_ALIAS(brk, _brk) + .weak brk -LEAF_ENTRY(_brk) +LEAF_ENTRY(brk) #ifdef __PIC__ addil LT%__minbrk, r19 ldw RT%__minbrk(r1), t1 @@ -64,7 +64,7 @@ LEAF_ENTRY(_brk) bv r0(rp) stw arg0, R%__curbrk(t1) #endif -EXIT(_brk) +EXIT(brk) .end diff --git a/lib/libc/arch/hppa/sys/sbrk.S b/lib/libc/arch/hppa/sys/sbrk.S index a164e48931a..2479efb874f 100644 --- a/lib/libc/arch/hppa/sys/sbrk.S +++ b/lib/libc/arch/hppa/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.15 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.16 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -35,9 +35,9 @@ __curbrk .long end -WEAK_ALIAS(sbrk, _sbrk) + .weak sbrk -LEAF_ENTRY(_sbrk) +LEAF_ENTRY(sbrk) #ifdef __PIC__ addil LT%__curbrk, r19 ldw RT%__curbrk(r1), t1 @@ -63,7 +63,7 @@ LEAF_ENTRY(_sbrk) bv r0(rp) stw arg0, 0(t1) -EXIT(_sbrk) +EXIT(sbrk) .end diff --git a/lib/libc/arch/hppa64/SYS.h b/lib/libc/arch/hppa64/SYS.h index 7332feb154b..f8afd9b22b8 100644 --- a/lib/libc/arch/hppa64/SYS.h +++ b/lib/libc/arch/hppa64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.9 2015/08/31 04:58:48 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -71,7 +71,12 @@ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\ #define SYSENTRY_HIDDEN(x) !\ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) #define SYSEXIT(x) !\ -EXIT(__CONCAT(_thread_sys_,x)) + SYSEXIT_HIDDEN(x) !\ + .size x, . - x +#define SYSEXIT_HIDDEN(x) !\ + EXIT(__CONCAT(_thread_sys_,x)) + _HIDDEN_FALIAS(x,_thread_sys_##x) !\ + .size _HIDDEN(x), . - _HIDDEN(x) #define SYSCALL(x) !\ std %rp, HPPA_FRAME_RP(%sr0,%sp) !\ @@ -95,7 +100,7 @@ SYSENTRY_HIDDEN(x) !\ SYSCALL(y) !\ bv %r0(%rp) !\ nop !\ -SYSEXIT(x) +SYSEXIT_HIDDEN(x) #define PSEUDO_NOERROR(x,y) !\ SYSENTRY(x) !\ diff --git a/lib/libc/arch/hppa64/sys/brk.S b/lib/libc/arch/hppa64/sys/brk.S index 9ba588e11ab..644e5ad759c 100644 --- a/lib/libc/arch/hppa64/sys/brk.S +++ b/lib/libc/arch/hppa64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.7 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -36,9 +36,9 @@ __minbrk .long end -WEAK_ALIAS(brk, _brk) + .weak brk -LEAF_ENTRY(_brk) +LEAF_ENTRY(brk) #ifdef __PIC__ addil LT%__minbrk, %r19 ldd RT%__minbrk(%r1), arg4 @@ -64,7 +64,7 @@ LEAF_ENTRY(_brk) bv %r0(%rp) std %arg0, R%__curbrk(arg4) #endif -EXIT(_brk) +EXIT(brk) .end diff --git a/lib/libc/arch/hppa64/sys/sbrk.S b/lib/libc/arch/hppa64/sys/sbrk.S index 5a8c68c226f..65d7f3ccf2f 100644 --- a/lib/libc/arch/hppa64/sys/sbrk.S +++ b/lib/libc/arch/hppa64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.7 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -35,9 +35,9 @@ __curbrk .long end -WEAK_ALIAS(sbrk, _sbrk) + .weak sbrk -LEAF_ENTRY(_sbrk) +LEAF_ENTRY(sbrk) #ifdef __PIC__ addil LT%__curbrk, %r19 ldd RT%__curbrk(%r1), %arg3 @@ -63,7 +63,7 @@ LEAF_ENTRY(_sbrk) bv %r0(%rp) std %arg0, 0(%arg3) -EXIT(_sbrk) +EXIT(sbrk) .end diff --git a/lib/libc/arch/m88k/SYS.h b/lib/libc/arch/m88k/SYS.h index 0c48e6cedeb..5cf59fa3021 100644 --- a/lib/libc/arch/m88k/SYS.h +++ b/lib/libc/arch/m88k/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.20 2015/08/31 02:53:56 guenther Exp $*/ +/* $OpenBSD: SYS.h,v 1.21 2015/09/10 13:29:09 guenther Exp $*/ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -62,7 +62,9 @@ #define __CONCAT(p,x) p##x #define __ENTRY(p,x) ENTRY(__CONCAT(p,x)) -#define __END(p,x) END(__CONCAT(p,x)) +#define __END(p,x) END(__CONCAT(p,x)); \ + _HIDDEN_ALIAS(x,__CONCAT(p,x)); \ + END(_HIDDEN(x)) #define __SYSCALLNAME(p,x) __CONCAT(p,x) #define __ALIAS(prefix,name) WEAK_ALIAS(name,__CONCAT(prefix,name)) @@ -120,12 +122,12 @@ #define __PSEUDO_NOERROR(p,x,y) \ __SYSCALL__NOERROR(p,x,y); \ jmp %r1; \ - __END(p,x) + __END(p,x); END(x) #define __PSEUDO(p,x,y) \ __SYSCALL(p,x,y); \ jmp %r1; \ - __END(p,x) + __END(p,x); END(x) #define __PSEUDO_HIDDEN(p,x,y) \ __SYSCALL_HIDDEN(p,x,y); \ jmp %r1; \ @@ -143,6 +145,7 @@ #define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y) #define SYSENTRY(x) __ENTRY(_thread_sys_,x); \ __ALIAS(_thread_sys_,x) +#define SYSCALL_END(x) __END(_thread_sys_,x); END(x) #define ASMSTR .asciz diff --git a/lib/libc/arch/m88k/sys/brk.S b/lib/libc/arch/m88k/sys/brk.S index c073dbc185e..f1aecbf6804 100644 --- a/lib/libc/arch/m88k/sys/brk.S +++ b/lib/libc/arch/m88k/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.13 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.14 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -42,10 +42,12 @@ .align 8 __minbrk: .long _end + END(__minbrk) + .type __minbrk,@object -WEAK_ALIAS(brk,_brk) + .weak brk -ENTRY(_brk) +ENTRY(brk) #ifdef __PIC__ PIC_SAVE(%r9) PIC_SETUP @@ -88,4 +90,4 @@ ENTRY(_brk) br.n CERROR PIC_RESTORE(%r9) #endif -END(_brk) +END(brk) diff --git a/lib/libc/arch/m88k/sys/sbrk.S b/lib/libc/arch/m88k/sys/sbrk.S index 962799d77c7..a35804a9e85 100644 --- a/lib/libc/arch/m88k/sys/sbrk.S +++ b/lib/libc/arch/m88k/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.13 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.14 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -42,11 +42,14 @@ .align 8 __curbrk: .long _end + END(__curbrk) + .type __curbrk,@object + .text -WEAK_ALIAS(sbrk,_sbrk) + .weak sbrk -ENTRY(_sbrk) +ENTRY(sbrk) #ifdef __PIC__ PIC_SAVE(%r9) PIC_SETUP @@ -92,4 +95,4 @@ ENTRY(_sbrk) br.n CERROR PIC_RESTORE(%r9) #endif -END(_sbrk) +END(sbrk) diff --git a/lib/libc/arch/m88k/sys/sigpending.S b/lib/libc/arch/m88k/sys/sigpending.S index 19240aa5341..d3f41f116a3 100644 --- a/lib/libc/arch/m88k/sys/sigpending.S +++ b/lib/libc/arch/m88k/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.9 2013/01/23 18:59:32 miod Exp $ */ +/* $OpenBSD: sigpending.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -35,7 +35,7 @@ #include "SYS.h" -ENTRY(sigpending) +SYSENTRY(sigpending) or %r4,%r2,0 /* save r2 */ or %r13,%r0,SYS_sigpending tb0 0,%r0,450 @@ -43,4 +43,4 @@ ENTRY(sigpending) st %r2,%r4,0 jmp.n %r1 or %r2,%r0,0 -END(sigpending) +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/m88k/sys/sigprocmask.S b/lib/libc/arch/m88k/sys/sigprocmask.S index 307786a38dd..b7a8e32ba3f 100644 --- a/lib/libc/arch/m88k/sys/sigprocmask.S +++ b/lib/libc/arch/m88k/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.10 2013/01/23 18:59:32 miod Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.11 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -50,4 +50,4 @@ SYSENTRY(sigprocmask) 3: jmp.n %r1 or %r2,%r0,0 -END(sigprocmask) +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/m88k/sys/sigsuspend.S b/lib/libc/arch/m88k/sys/sigsuspend.S index af6b45c5ae5..7ba0e873353 100644 --- a/lib/libc/arch/m88k/sys/sigsuspend.S +++ b/lib/libc/arch/m88k/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.11 2013/01/23 18:59:32 miod Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.12 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -49,4 +49,4 @@ SYSENTRY(sigsuspend) br CERROR jmp.n %r1 or %r2,%r0,0 -END(sigsuspend) +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/m88k/sys/syscall.S b/lib/libc/arch/m88k/sys/syscall.S index ec3d79ec46f..7440f80bfc2 100644 --- a/lib/libc/arch/m88k/sys/syscall.S +++ b/lib/libc/arch/m88k/sys/syscall.S @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.S,v 1.13 2013/01/23 18:59:32 miod Exp $ */ +/* $OpenBSD: syscall.S,v 1.14 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -40,4 +40,4 @@ SYSENTRY(syscall) tb0 0,%r0,450 br CERROR jmp %r1 -END(syscall) +SYSCALL_END(syscall) diff --git a/lib/libc/arch/sh/SYS.h b/lib/libc/arch/sh/SYS.h index ac7991f7cd3..ea6ad7b7b01 100644 --- a/lib/libc/arch/sh/SYS.h +++ b/lib/libc/arch/sh/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.8 2015/09/10 13:29:09 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -68,6 +68,13 @@ #define SYSENTRY_HIDDEN(x) \ ENTRY(_thread_sys_ ## x) +#define __END_HIDDEN(x) \ + SET_ENTRY_SIZE(_thread_sys_ ## x); \ + _HIDDEN_FALIAS(x,_thread_sys_ ## x); \ + SET_ENTRY_SIZE(_HIDDEN(x)) +#define __END(x) \ + __END_HIDDEN(x); SET_ENTRY_SIZE(x) + #define SYSTRAP(x) \ mov.l 903f, r0; \ .word 0xc380; /* trapa #0x80; */ \ @@ -133,20 +140,24 @@ #define PSEUDO_NOERROR(x,y) \ _SYSCALL_NOERROR(x,y); \ rts; \ - nop + nop; \ + __END(x) #define PSEUDO(x,y) \ _SYSCALL(x,y); \ rts; \ - nop + nop; \ + __END(x) #define PSEUDO_HIDDEN(x,y) \ _SYSCALL_HIDDEN(x,y); \ rts; \ - nop + nop; \ + __END_HIDDEN(x) #define RSYSCALL_NOERROR(x) PSEUDO_NOERROR(x,x) #define RSYSCALL(x) PSEUDO(x,x) #define RSYSCALL_HIDDEN(x) PSEUDO_HIDDEN(x,x) +#define SYSCALL_END(x) __END(x) .globl CERROR diff --git a/lib/libc/arch/sh/sys/brk.S b/lib/libc/arch/sh/sys/brk.S index 30d76ceedf6..c8a23faa3ff 100644 --- a/lib/libc/arch/sh/sys/brk.S +++ b/lib/libc/arch/sh/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.3 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.4 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: brk.S,v 1.10 2006/01/06 03:58:31 uwe Exp $ */ /*- @@ -37,16 +37,18 @@ #include "SYS.h" -WEAK_ALIAS(brk,_brk) + .weak brk .data .align 2 __minbrk: .long _C_LABEL(end) + .size __minbrk, . - __minbrk + .type __minbrk,@object .text -ENTRY(_brk) +ENTRY(brk) #ifdef __PIC__ mova L_GOT, r0 mov.l L_GOT, r2 @@ -64,7 +66,7 @@ ENTRY(_brk) 1: mov.l LSYS_break, r0 trapa #0x80 - bf err + bf 2f #ifdef __PIC__ mov.l Lcurbrk, r0 mov.l @(r0, r2), r1 @@ -75,7 +77,7 @@ ENTRY(_brk) #endif rts mov.l r4, @r1 -err: +2: JUMP_CERROR .align 2 @@ -88,4 +90,4 @@ Lcurbrk: .long __curbrk@GOT Lminbrk: .long __minbrk Lcurbrk: .long __curbrk #endif - SET_ENTRY_SIZE(_brk) + SET_ENTRY_SIZE(brk) diff --git a/lib/libc/arch/sh/sys/cerror.S b/lib/libc/arch/sh/sys/cerror.S index 3df872707ef..0740e7bb558 100644 --- a/lib/libc/arch/sh/sys/cerror.S +++ b/lib/libc/arch/sh/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.4 2013/12/31 23:31:13 kettenis Exp $ */ +/* $OpenBSD: cerror.S,v 1.5 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: cerror.S,v 1.10 2006/01/06 05:14:39 uwe Exp $ */ /*- @@ -62,3 +62,4 @@ L_errno: .long _C_LABEL(errno)@GOT #else L_errno: .long _C_LABEL(errno) #endif + SET_ENTRY_SIZE(_CERROR) diff --git a/lib/libc/arch/sh/sys/sbrk.S b/lib/libc/arch/sh/sys/sbrk.S index e73423abc36..0b52074e35c 100644 --- a/lib/libc/arch/sh/sys/sbrk.S +++ b/lib/libc/arch/sh/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.3 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.4 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sbrk.S,v 1.9 2006/01/06 03:58:31 uwe Exp $ */ /*- @@ -41,14 +41,17 @@ .globl __curbrk .hidden __curbrk -WEAK_ALIAS(sbrk,_sbrk) + .weak sbrk .data __curbrk: .long _C_LABEL(end) + .size __curbrk, . - __curbrk + .type __curbrk,@object + .text -ENTRY(_sbrk) +ENTRY(sbrk) mov r4, r2 #ifdef __PIC__ mova L_GOT, r0 @@ -63,7 +66,7 @@ ENTRY(_sbrk) add r0, r4 mov.l LSYS_break, r0 trapa #0x80 - bf err + bf 1f #ifdef __PIC__ mov.l Lcurbrk, r0 mov.l @(r0, r3), r1 @@ -74,7 +77,7 @@ ENTRY(_sbrk) add r0, r2 rts mov.l r2, @r1 -err: +1: JUMP_CERROR .align 2 @@ -85,4 +88,4 @@ Lcurbrk: .long __curbrk@GOT #else Lcurbrk: .long __curbrk #endif - SET_ENTRY_SIZE(_sbrk) + SET_ENTRY_SIZE(sbrk) diff --git a/lib/libc/arch/sh/sys/sigpending.S b/lib/libc/arch/sh/sys/sigpending.S index 18b61b2e15a..0f16c928fb6 100644 --- a/lib/libc/arch/sh/sys/sigpending.S +++ b/lib/libc/arch/sh/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.2 2012/07/03 13:17:45 jsg Exp $ */ +/* $OpenBSD: sigpending.S,v 1.3 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sigpending.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -38,4 +38,4 @@ SYSCALL(sigpending) mov.l r0, @r4 /* store returned mask */ rts mov #0, r0 - +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/sh/sys/sigprocmask.S b/lib/libc/arch/sh/sys/sigprocmask.S index 88efac381f0..381050fd82d 100644 --- a/lib/libc/arch/sh/sys/sigprocmask.S +++ b/lib/libc/arch/sh/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.2 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sigprocmask.S,v 1.6 2003/08/07 16:42:21 agc Exp $ */ /*- @@ -48,18 +48,19 @@ SYSENTRY(sigprocmask) mov r2, r5 /* to new mask arg */ 2: mov.l LSYS_sigprocmask, r0 trapa #0x80 - bf err + bf 4f mov r6, r2 /* fetch old mask requested */ tst r2, r2 /* test if old mask requested */ - bt out + bt 3f mov.l r0, @r2 /* store old mask */ -out: +3: xor r0, r0 rts nop -err: +4: JUMP_CERROR .align 2 LSYS_sigprocmask: .long SYS_sigprocmask +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/sh/sys/sigsuspend.S b/lib/libc/arch/sh/sys/sigsuspend.S index 24a4e1ebbe7..2b1401bbcb2 100644 --- a/lib/libc/arch/sh/sys/sigsuspend.S +++ b/lib/libc/arch/sh/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.2 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: sigsuspend.S,v 1.5 2003/08/07 16:42:21 agc Exp $ */ /*- @@ -43,13 +43,14 @@ SYSENTRY(sigsuspend) mov r0, r4 mov.l LSYS_sigsuspend, r0 trapa #0x80 - bf err + bf 1f xor r0, r0 /* shouldn t happen */ rts nop -err: +1: JUMP_CERROR .align 2 LSYS_sigsuspend: .long SYS_sigsuspend +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/sparc/SYS.h b/lib/libc/arch/sparc/SYS.h index be262c8abfd..68227774a9f 100644 --- a/lib/libc/arch/sparc/SYS.h +++ b/lib/libc/arch/sparc/SYS.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:57 guenther Exp $ + * $OpenBSD: SYS.h,v 1.19 2015/09/10 13:29:09 guenther Exp $ */ #include "DEFS.h" @@ -42,6 +42,11 @@ #define __ENTRY(p,x) ENTRY(_CAT(p,x)) ; .weak x ; x = _CAT(p,x) #define __ENTRY_HIDDEN(p,x) ENTRY(_CAT(p,x)) +#define __END_HIDDEN(p,x) END(_CAT(p,x)); \ + _HIDDEN_FALIAS(x, _CAT(p,x)); \ + END(_HIDDEN(x)) +#define __END(p,x) __END_HIDDEN(p,x); END(x) + /* * ERROR branches to cerror. */ @@ -82,21 +87,21 @@ */ #define __RSYSCALL(p,x) \ __ENTRY(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL; ERROR() + t ST_SYSCALL; ERROR(); __END(p,x) /* * PSEUDO(x,y) is like RSYSCALL(y) except that the name is x. */ #define __PSEUDO(p,x,y) \ __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL; ERROR() + t ST_SYSCALL; ERROR(); __END(p,x) /* * PSEUDO_NOERROR(x,y) is like PSEUDO(x,y) except that errno is not set. */ #define __PSEUDO_NOERROR(p,x,y) \ __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL + t ST_SYSCALL; __END(p,x) # define SYSCALL(x) __SYSCALL(_thread_sys_,x) # define RSYSCALL(x) __RSYSCALL(_thread_sys_,x) @@ -104,5 +109,6 @@ # define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y) # define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y) # define SYSENTRY(x) __ENTRY(_thread_sys_,x) +# define SYSCALL_END(x) __END(_thread_sys_,x) .globl _C_LABEL(__cerror) diff --git a/lib/libc/arch/sparc/sys/brk.S b/lib/libc/arch/sparc/sys/brk.S index 9dbefa99952..f3aa5c9a8e5 100644 --- a/lib/libc/arch/sparc/sys/brk.S +++ b/lib/libc/arch/sparc/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.9 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -39,12 +39,15 @@ .data __minbrk: .long _end ! lower brk limit; also for gmon code + END(__minbrk) + .type __minbrk,@object + .text -WEAK_ALIAS(brk, _brk) + .weak brk #ifdef __PIC__ -ENTRY(_brk) +ENTRY(brk) PIC_PROLOGUE(%o5,%o4) #if __PIC__ == 1 ld [%o5 + __minbrk], %o4 @@ -73,8 +76,9 @@ ENTRY(_brk) 1: retl ! success, return 0 & record new break st %o2, [%o4] +END(brk) #else -ENTRY(_brk) +ENTRY(brk) sethi %hi(__minbrk), %o1 ! %o1 = minbrk ld [%o1 + %lo(__minbrk)], %o1 cmp %o1, %o0 ! if (minbrk > %o0) @@ -90,4 +94,5 @@ ENTRY(_brk) 1: retl ! success, return 0 & record new break st %o2, [%g1 + %lo(__curbrk)] +END(brk) #endif diff --git a/lib/libc/arch/sparc/sys/sbrk.S b/lib/libc/arch/sparc/sys/sbrk.S index 61e3ce3ac2e..b0d3497976c 100644 --- a/lib/libc/arch/sparc/sys/sbrk.S +++ b/lib/libc/arch/sparc/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.8 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.9 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -40,11 +40,14 @@ .data __curbrk: .long _end + END(__curbrk) + .type __curbrk,@object + .text -WEAK_ALIAS(sbrk, _sbrk) + .weak sbrk -ENTRY(_sbrk) +ENTRY(sbrk) #ifdef __PIC__ PIC_PROLOGUE(%o5,%o4) #if __PIC__ == 1 @@ -79,3 +82,4 @@ ENTRY(_sbrk) retl ! and update curbrk st %o4, [%o2 + %lo(__curbrk)] #endif +END(sbrk) diff --git a/lib/libc/arch/sparc/sys/sigpending.S b/lib/libc/arch/sparc/sys/sigpending.S index f5839366b06..cfc6ab51a75 100644 --- a/lib/libc/arch/sparc/sys/sigpending.S +++ b/lib/libc/arch/sparc/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: sigpending.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -44,3 +44,4 @@ SYSENTRY(sigpending) 1: retl ! and return 0 clr %o0 +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/sparc/sys/sigprocmask.S b/lib/libc/arch/sparc/sys/sigprocmask.S index 59a93d2675c..5e0e9233b52 100644 --- a/lib/libc/arch/sparc/sys/sigprocmask.S +++ b/lib/libc/arch/sparc/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -55,3 +55,4 @@ SYSENTRY(sigprocmask) 3: retl ! in any case, return 0 clr %o0 +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/sparc/sys/sigreturn.S b/lib/libc/arch/sparc/sys/sigreturn.S index 6dcfb2d45b4..ed14c93ddad 100644 --- a/lib/libc/arch/sparc/sys/sigreturn.S +++ b/lib/libc/arch/sparc/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigreturn.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: sigreturn.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -38,3 +38,4 @@ SYSENTRY(sigreturn) mov SYS_sigreturn, %g1 t ST_SYSCALL ERROR() +SYSCALL_END(sigreturn) diff --git a/lib/libc/arch/sparc/sys/sigsuspend.S b/lib/libc/arch/sparc/sys/sigsuspend.S index dae2cb23716..ee728bd4f9f 100644 --- a/lib/libc/arch/sparc/sys/sigsuspend.S +++ b/lib/libc/arch/sparc/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -39,3 +39,4 @@ SYSENTRY(sigsuspend) mov SYS_sigsuspend, %g1 t ST_SYSCALL ERROR() ! always terminates with EINTR +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/vax/SYS.h b/lib/libc/arch/vax/SYS.h index cba02a0678a..763345190d6 100644 --- a/lib/libc/arch/vax/SYS.h +++ b/lib/libc/arch/vax/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.19 2015/09/10 13:29:09 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.4 1997/05/02 18:15:32 kleink Exp $ */ /* @@ -37,23 +37,27 @@ #define __ENTRY(p,x) ENTRY(p##x,0) #define __DO_SYSCALL(x) chmk $ SYS_ ## x +#define __END(p,x) END(p##x); _HIDDEN_FALIAS(x, p##x); END(_HIDDEN(x)) + #define __SYSCALL(p,x,y) \ - err: jmp _C_LABEL(__cerror); \ + 99: jmp _C_LABEL(__cerror); \ __ENTRY(p,x); \ __DO_SYSCALL(y); \ - jcs err + jcs 99b #define __PSEUDO(p,x,y) \ - err: jmp _C_LABEL(__cerror); \ __ENTRY(p,x); \ __DO_SYSCALL(y); \ - jcs err; \ - ret + jcs 1f; \ + ret; \ + 1: jmp _C_LABEL(__cerror); \ + __END(p,x) #define __PSEUDO_NOERROR(p,x,y) \ __ENTRY(p,x); \ __DO_SYSCALL(y); \ - ret + ret; \ + __END(p,x) #define __ALIAS(prefix,name) \ WEAK_ALIAS(name,prefix##name); @@ -64,13 +68,17 @@ */ #define SYSCALL(x) __ALIAS(_thread_sys_,x) \ __SYSCALL(_thread_sys_,x,x) +#define SYSCALL_END(x) __END(_thread_sys_,x); END(x) #define RSYSCALL(x) __ALIAS(_thread_sys_,x) \ - __PSEUDO(_thread_sys_,x,x) + __PSEUDO(_thread_sys_,x,x); \ + END(x) #define RSYSCALL_HIDDEN(x) __PSEUDO(_thread_sys_,x,x) #define PSEUDO(x,y) __ALIAS(_thread_sys_,x) \ - __PSEUDO(_thread_sys_,x,y) + __PSEUDO(_thread_sys_,x,y); \ + END(x) #define PSEUDO_NOERROR(x,y) __ALIAS(_thread_sys_,x) \ - __PSEUDO_NOERROR(_thread_sys_,x,y) + __PSEUDO_NOERROR(_thread_sys_,x,y); \ + END(x) #define SYSENTRY(x) __ALIAS(_thread_sys_,x) \ __ENTRY(_thread_sys_,x) #define SYSNAME(x) _CAT(__thread_sys_,x) diff --git a/lib/libc/arch/vax/sys/Ovfork.S b/lib/libc/arch/vax/sys/Ovfork.S index 0a619255047..8e16bfe73b2 100644 --- a/lib/libc/arch/vax/sys/Ovfork.S +++ b/lib/libc/arch/vax/sys/Ovfork.S @@ -1,4 +1,4 @@ -/* $OpenBSD: Ovfork.S,v 1.9 2015/03/31 04:32:02 guenther Exp $ */ +/* $OpenBSD: Ovfork.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -43,14 +43,15 @@ SYSENTRY(vfork) movl 16(%fp),%r2 # save return address before we smash it - movab here,16(%fp) + movab 1f,16(%fp) ret -here: +1: chmk $ SYS_vfork - bcs err # if failed, set errno and return -1 + bcs 2f # if failed, set errno and return -1 jmp (%r2) -err: +2: movl %r0,_C_LABEL(errno) mnegl $1,%r0 jmp (%r2) +SYSCALL_END(vfork) diff --git a/lib/libc/arch/vax/sys/brk.S b/lib/libc/arch/vax/sys/brk.S index 49023595209..7ce66b64c2b 100644 --- a/lib/libc/arch/vax/sys/brk.S +++ b/lib/libc/arch/vax/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.10 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.11 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -33,21 +33,25 @@ .data __minbrk: .long _end + END(__minbrk) + .type __minbrk,@object + .text .globl __curbrk -WEAK_ALIAS(brk,_brk) + .weak brk -ENTRY(_brk, 0) +ENTRY(brk, 0) cmpl __minbrk,4(%ap) - blequ ok + blequ 1f movl __minbrk,4(%ap) -ok: +1: chmk $ SYS_break - jcs err + jcs 2f movl 4(%ap),__curbrk clrl %r0 ret -err: +2: jmp _C_LABEL(__cerror) +END(brk) diff --git a/lib/libc/arch/vax/sys/cerror.S b/lib/libc/arch/vax/sys/cerror.S index d56f787afc1..e2c2ec867c4 100644 --- a/lib/libc/arch/vax/sys/cerror.S +++ b/lib/libc/arch/vax/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.11 2015/05/12 04:22:01 miod Exp $ */ +/* $OpenBSD: cerror.S,v 1.12 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -39,3 +39,4 @@ _C_LABEL(___cerror): mnegl $1,%r0 mnegl $1,%r1 ret +END(___cerror) diff --git a/lib/libc/arch/vax/sys/sbrk.S b/lib/libc/arch/vax/sys/sbrk.S index d24feb74933..fea5c520903 100644 --- a/lib/libc/arch/vax/sys/sbrk.S +++ b/lib/libc/arch/vax/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.10 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.11 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -37,19 +37,23 @@ .data __curbrk: .long _end + END(__curbrk) + .type __curbrk,@object + .text -WEAK_ALIAS(sbrk,_sbrk) + .weak sbrk -ENTRY(_sbrk, R3) +ENTRY(sbrk, R3) addl3 __curbrk,4(%ap),-(%sp) pushl $1 movl %ap,%r3 movl %sp,%ap chmk $ SYS_break - jcs err + jcs 1f movl __curbrk,%r0 addl2 4(%r3),__curbrk ret -err: +1: jmp _C_LABEL(__cerror) +END(sbrk) diff --git a/lib/libc/arch/vax/sys/sigpending.S b/lib/libc/arch/vax/sys/sigpending.S index b066d0918a7..174acbf519d 100644 --- a/lib/libc/arch/vax/sys/sigpending.S +++ b/lib/libc/arch/vax/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.5 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: sigpending.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -34,3 +34,4 @@ SYSCALL(sigpending) movl %r0,*4(%ap) # store old mask clrl %r0 ret +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/vax/sys/sigprocmask.S b/lib/libc/arch/vax/sys/sigprocmask.S index 40a6827cf6b..be39d69a021 100644 --- a/lib/libc/arch/vax/sys/sigprocmask.S +++ b/lib/libc/arch/vax/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.9 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -30,8 +30,6 @@ #include "SYS.h" -err: - jmp _C_LABEL(__cerror) SYSENTRY(sigprocmask) tstl 8(%ap) # check new sigset pointer @@ -41,10 +39,13 @@ SYSENTRY(sigprocmask) jbr 2f 1: movl *8(%ap),8(%ap) # indirect to new mask arg 2: chmk $ SYS_sigprocmask - jcs err + jcs 4f tstl 12(%ap) # test if old mask requested - beql out + beql 3f movl %r0,*12(%ap) # store old mask -out: +3: clrl %r0 ret +4: + jmp _C_LABEL(__cerror) +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/vax/sys/sigreturn.S b/lib/libc/arch/vax/sys/sigreturn.S index 1402dec07c7..e554d55f9d4 100644 --- a/lib/libc/arch/vax/sys/sigreturn.S +++ b/lib/libc/arch/vax/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigreturn.S,v 1.7 2008/05/21 20:38:10 miod Exp $ */ +/* $OpenBSD: sigreturn.S,v 1.8 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -44,3 +44,4 @@ SYSCALL(sigreturn) ret +SYSCALL_END(sigreturn) diff --git a/lib/libc/arch/vax/sys/sigsuspend.S b/lib/libc/arch/vax/sys/sigsuspend.S index 9ebd1c76e54..5ef2bdf5ef3 100644 --- a/lib/libc/arch/vax/sys/sigsuspend.S +++ b/lib/libc/arch/vax/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.9 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -30,12 +30,13 @@ #include "SYS.h" -err: - jmp _C_LABEL(__cerror) SYSENTRY(sigsuspend) movl *4(%ap),4(%ap) # indirect to mask arg chmk $ SYS_sigsuspend - jcs err + jcs 1f clrl %r0 # shouldnt happen ret +1: + jmp _C_LABEL(__cerror) +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/vax/sys/syscall.S b/lib/libc/arch/vax/sys/syscall.S index 94859f0e39c..7887aa38962 100644 --- a/lib/libc/arch/vax/sys/syscall.S +++ b/lib/libc/arch/vax/sys/syscall.S @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.S,v 1.9 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: syscall.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -43,3 +43,4 @@ SYSENTRY(syscall) ret 1: jmp _C_LABEL(__cerror) +SYSCALL_END(syscall) diff --git a/lib/libc/arch/vax/sys/tfork_thread.S b/lib/libc/arch/vax/sys/tfork_thread.S index d14fd84cfc6..eec4720e32b 100644 --- a/lib/libc/arch/vax/sys/tfork_thread.S +++ b/lib/libc/arch/vax/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.3 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.4 2015/09/10 13:29:09 guenther Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -65,3 +65,4 @@ ENTRY(__tfork_thread, R2|R3) * system call failed. */ jmp _C_LABEL(__cerror) +END(__tfork_thread) |