with {uint offset, uint syscall#} entries in libc & ld.so.
In libc a few syscall# entries (break, sigprocmask, _tfork, _threxit)
are duplicated because additional or inline uses occur (that situation
is handled elsewhere)
ok kettenis
-/* $OpenBSD: DEFS.h,v 1.1 2022/01/01 23:47:14 guenther Exp $ */
+/* $OpenBSD: DEFS.h,v 1.2 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2015,2018,2021 Philip Guenther <guenther@openbsd.org>
*
#endif
#define _END(x) .size x, . - x
+
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
-/* $OpenBSD: SYS.h,v 1.6 2022/12/08 01:25:43 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.7 2023/12/10 16:45:50 deraadt Exp $ */
/* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */
/*-
#define SYSTRAP(x) \
ldr x8, =SYS_ ## x; \
- svc 0; \
+97: svc 0; \
+ PINSYSCALL(SYS_ ## x, 97b); \
dsb nsh; \
isb
-/* $OpenBSD: SYS.h,v 1.16 2023/12/06 06:15:33 miod Exp $ */
+/* $OpenBSD: SYS.h,v 1.17 2023/12/10 16:45:50 deraadt Exp $ */
/* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */
/*
*/
#define _END(x) .size x, . - x
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
+
/*
* For functions implemented in ASM that aren't syscalls.
* END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names
#define CALLSYS_NOERROR(name) \
ldiq v0, ___CONCAT(SYS_,name); \
- call_pal PAL_OSF1_callsys
+97: call_pal PAL_OSF1_callsys; \
+ PINSYSCALL(___CONCAT(SYS_,name), 97b)
#define CALLSYS_ERROR(name) \
CALLSYS_NOERROR(name); \
-/* $OpenBSD: SYS.h,v 1.21 2023/01/11 01:55:17 mortimer Exp $ */
+/* $OpenBSD: SYS.h,v 1.22 2023/12/10 16:45:50 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */
#define TCB_OFFSET_ERRNO 32
-#define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall
+#define SYSTRAP(x) \
+ movl $(SYS_ ## x),%eax; \
+ movq %rcx, %r10; \
+97: syscall; \
+ PINSYSCALL(SYS_ ## x, 97b)
#define SYSENTRY(x) \
SYSENTRY_HIDDEN(x); \
-/* $OpenBSD: setjmp.S,v 1.9 2020/10/21 17:22:59 kettenis Exp $ */
+/* $OpenBSD: setjmp.S,v 1.10 2023/12/10 16:45:51 deraadt Exp $ */
/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
movl $1,%edi /* how = SIG_BLOCK */
xorl %esi,%esi /* set = empty */
movl $SYS_sigprocmask,%eax
- syscall
+99: syscall
+ PINSYSCALL(SYS_sigprocmask, 99b)
movq %r8,%rdi /* restore jmpbuf addr */
movq %rax,(_JB_SIGMASK * 8)(%rdi)
movq (_JB_SIGMASK * 8)(%rdi),%rsi /* get set from sc_mask */
movl $3,%edi /* how = SIG_SETMASK */
movl $SYS_sigprocmask,%eax
- syscall
+98: syscall
+ PINSYSCALL(SYS_sigprocmask, 98b)
movl %r8d,%eax
leaq __jmpxor(%rip),%rcx
-/* $OpenBSD: sigsetjmp.S,v 1.9 2020/10/21 17:22:59 kettenis Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.10 2023/12/10 16:45:51 deraadt Exp $ */
/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
movl $1,%edi /* how = SIG_BLOCK */
xorl %esi,%esi /* set = empty */
movl $SYS_sigprocmask,%eax
- syscall
+99: syscall
+ PINSYSCALL(SYS_sigprocmask, 99b)
movq %r8,%rdi /* restore jmpbuf addr */
movq %rax,(_JB_SIGMASK * 8)(%rdi)
movq (_JB_SIGMASK * 8)(%rdi),%rsi /* get set from sc_mask */
movl $3,%edi /* how = SIG_SETMASK */
movl $SYS_sigprocmask,%eax
- syscall
+98: syscall
+ PINSYSCALL(SYS_sigprocmask, 98b)
2: movl %r8d,%eax
leaq __jmpxor(%rip),%rcx
-/* $OpenBSD: tfork_thread.S,v 1.11 2023/01/11 01:55:17 mortimer Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.12 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
* Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
*/
movl $SYS___tfork, %eax
.cfi_endproc
- syscall
+99: syscall
+ PINSYSCALL(SYS___tfork, 99b)
jb 2f
/*
*/
movl $SYS___threxit, %eax
xorl %edi, %edi
- syscall
+98: syscall
+ PINSYSCALL(SYS___threxit, 98b)
int3
/*
-/* $OpenBSD: SYS.h,v 1.19 2022/12/08 01:25:43 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.20 2023/12/10 16:45:51 deraadt Exp $ */
/* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */
/*-
#define SYSTRAP(x) \
ldr r12, =SYS_ ## x; \
- swi 0; \
+97: swi 0; \
+ PINSYSCALL(SYS_ ## x, 97b); \
dsb nsh; \
isb
-/* $OpenBSD: SYS.h,v 1.23 2023/02/11 06:10:39 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.24 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1998-2002 Michael Shalayeff
#define EXIT_WEAK(x) EXIT_STRONG(x) !\
.weak x
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits !\
+ .long label !\
+ .long sysno !\
+ .popsection
#define SYSENTRY(x) !\
LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\
#define SYSCALL(x) !\
stw rp, HPPA_FRAME_ERP(sr0,sp) !\
ldil L%SYSCALLGATE, r1 !\
- ble 4(sr7, r1) !\
- ldi __CONCAT(SYS_,x), t1 !\
+97: ble 4(sr7, r1) !\
+ PINSYSCALL(__CONCAT(SYS_,x), 97b) !\
+ ldi __CONCAT(SYS_,x), t1 !\
comb,= 0, t1, 1f !\
ldw HPPA_FRAME_ERP(sr0,sp), rp !\
/* set errno */ \
SYSENTRY(x) !\
stw rp, HPPA_FRAME_ERP(sr0,sp) !\
ldil L%SYSCALLGATE, r1 !\
- ble 4(sr7, r1) !\
- ldi __CONCAT(SYS_,y), t1 !\
+97: ble 4(sr7, r1) !\
+ PINSYSCALL(__CONCAT(SYS_,x), 97b) !\
+ ldi __CONCAT(SYS_,x), t1 !\
ldw HPPA_FRAME_ERP(sr0,sp), rp !\
bv r0(rp) !\
nop !\
-/* $OpenBSD: setjmp.S,v 1.11 2016/05/29 07:59:36 guenther Exp $ */
+/* $OpenBSD: setjmp.S,v 1.12 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
copy %r0, %arg1 ; set = empty
stw %rp, HPPA_FRAME_ERP(%sr0,%sp)
ldil L%SYSCALLGATE, %r1
- ble 4(%sr7, %r1)
+99: ble 4(%sr7, %r1)
+ PINSYSCALL(SYS_sigprocmask, 99b)
ldi SYS_sigprocmask, %t1
ldw HPPA_FRAME_ERP(%sr0,%sp), %rp
ldi 3, %arg0 ; how = SIG_SETMASK
stw %rp, HPPA_FRAME_ERP(%sr0,%sp)
ldil L%SYSCALLGATE, %r1
- ble 4(%sr7, %r1)
+98: ble 4(%sr7, %r1)
+ PINSYSCALL(SYS_sigprocmask, 98b)
ldi SYS_sigprocmask, %t1
ldw HPPA_FRAME_ERP(%sr0,%sp), %rp
-/* $OpenBSD: Ovfork.S,v 1.15 2016/05/07 19:05:21 guenther Exp $ */
+/* $OpenBSD: Ovfork.S,v 1.16 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1999,2002 Michael Shalayeff
.import errno, data
copy rp, t4
ldil L%SYSCALLGATE, r1
- ble 4(sr7, r1)
- ldi __CONCAT(SYS_,vfork), t1
+99: ble 4(sr7, r1)
+ PINSYSCALL(__CONCAT(SYS_,vfork), 99b)
+ ldi __CONCAT(SYS_,vfork), t1
comb,= r0, t1, 1f
copy t4, rp
/* set errno */
-/* $OpenBSD: DEFS.h,v 1.3 2017/11/29 05:13:57 guenther Exp $ */
+/* $OpenBSD: DEFS.h,v 1.4 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 2017 Philip Guenther <guenther@openbsd.org>
*
#else
#define END_BUILTIN(x) END_STRONG(x)
#endif
+
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.27 2017/11/29 05:13:57 guenther Exp $
+ * $OpenBSD: SYS.h,v 1.28 2023/12/10 16:45:51 deraadt Exp $
*/
#include "DEFS.h"
#define __DO_SYSCALL(x) \
movl $(SYS_ ## x),%eax; \
- int $0x80
+ 97: int $0x80; \
+ PINSYSCALL(SYS_ ## x, 97b)
+
#define SET_ERRNO() \
movl %eax,%gs:(TCB_OFFSET_ERRNO); \
-/* $OpenBSD: setjmp.S,v 1.14 2020/12/13 21:21:32 bluhm Exp $ */
+/* $OpenBSD: setjmp.S,v 1.15 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
pushl $1 /* how = SIG_BLOCK */
call 1f
1: movl $(SYS_sigprocmask),%eax
- int $0x80 /* leave oset in %eax */
+99: int $0x80 /* leave oset in %eax */
+ PINSYSCALL(SYS_sigprocmask, 99b)
popl %edx
addl $8,%esp
addl $__jmpxor-1b,%edx # load cookie address
pushl $3 /* how = SIG_SETMASK */
call 1f /* get our eip */
1: movl $(SYS_sigprocmask),%eax
- int $0x80
+98: int $0x80
+ PINSYSCALL(SYS_sigprocmask, 98b)
popl %ecx
addl $8,%esp
addl $__jmpxor-1b,%ecx # load cookie address
-/* $OpenBSD: sigsetjmp.S,v 1.13 2020/12/13 21:21:32 bluhm Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.14 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
pushl $1 /* how = SIG_BLOCK */
subl $4,%esp
movl $(SYS_sigprocmask),%eax
- int $0x80 /* leave oset in %eax */
+99: int $0x80 /* leave oset in %eax */
+ PINSYSCALL(SYS_sigprocmask, 99b)
addl $12,%esp
movl %eax,(_JB_SIGMASK * 4)(%ecx)
pushl $3 /* how = SIG_SETMASK */
subl $4,%esp
movl $(SYS_sigprocmask),%eax
- int $0x80
+98: int $0x80
+ PINSYSCALL(SYS_sigprocmask, 98b)
addl $12,%esp
1: call 2f
-/* $OpenBSD: Ovfork.S,v 1.10 2016/05/07 19:05:21 guenther Exp $ */
+/* $OpenBSD: Ovfork.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
SYSENTRY_HIDDEN(vfork)
popl %ecx /* my rta into ecx */
movl $(SYS_vfork),%eax
- int $0x80
+99: int $0x80
+ PINSYSCALL(SYS_vfork, 99b)
HANDLE_ERRNO()
jmp *%ecx
SYSCALL_END_HIDDEN(vfork)
-/* $OpenBSD: brk.S,v 1.15 2022/12/04 08:22:13 tb Exp $ */
+/* $OpenBSD: brk.S,v 1.16 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
movl %ecx,4(%esp)
1:
movl $(SYS_break),%eax
- int $0x80
+99: int $0x80
+ PINSYSCALL(SYS_break, 99b)
jc 2f
PIC_PROLOGUE
movl PIC_GOT(__curbrk),%edx # set up GOT addressing
movl %ecx,4(%esp)
1:
movl $(SYS_break),%eax
- int $0x80
+98: int $0x80
+ PINSYSCALL(SYS_break, 98b)
jc 2f
xorl %eax,%eax
movl %ecx,__curbrk
-/* $OpenBSD: sbrk.S,v 1.15 2022/12/04 08:22:13 tb Exp $ */
+/* $OpenBSD: sbrk.S,v 1.16 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
movl (%edx),%eax
addl %eax,4(%esp)
movl $(SYS_break),%eax
- int $0x80
+99: int $0x80
+ PINSYSCALL(SYS_break, 99b)
jc 2f
PIC_PROLOGUE
movl PIC_GOT(__curbrk),%edx
movl __curbrk,%eax
addl %eax,4(%esp)
movl $(SYS_break),%eax
- int $0x80
+98: int $0x80
+ PINSYSCALL(SYS_break, 98b)
jc 2f
movl __curbrk,%eax
addl %ecx,__curbrk
-/* $OpenBSD: sigprocmask.S,v 1.12 2016/05/07 19:05:21 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.13 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
1: movl (%ecx),%ecx # fetch indirect ...
movl %ecx,8(%esp) # to new mask arg
2: movl $(SYS_sigprocmask),%eax
- int $0x80
+99: int $0x80
+ PINSYSCALL(SYS_sigprocmask, 99b)
jc 1f
movl 12(%esp),%ecx # fetch old mask requested
testl %ecx,%ecx # test if old mask requested
-/* $OpenBSD: sigsuspend.S,v 1.10 2016/05/07 19:05:21 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
movl (%eax),%eax # indirect to mask arg
movl %eax,4(%esp)
movl $(SYS_sigsuspend),%eax
- int $0x80
+99: int $0x80
+ PINSYSCALL(SYS_sigsuspend, 99b)
SET_ERRNO()
ret
SYSCALL_END_HIDDEN(sigsuspend)
-/* $OpenBSD: tfork_thread.S,v 1.10 2020/10/18 14:28:17 deraadt Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
* All rights reserved.
pushl 8(%ebp) # push param
pushl $0 # slot for return address, ignored by kernel
movl $SYS___tfork, %eax
- int $0x80
+99: int $0x80
+ PINSYSCALL(SYS___tfork, 99b)
jb 2f
/*
pushl $0 # NULL pointer argument to __threxit
pushl $0 # slot for return address, ignored by kernel
movl $SYS___threxit, %eax
- int $0x80
+98: int $0x80
+ PINSYSCALL(SYS___threxit, 98b)
int3
/*
-/* $OpenBSD: DEFS.h,v 1.3 2016/09/22 18:19:59 guenther Exp $ */
+/* $OpenBSD: DEFS.h,v 1.4 2023/12/10 16:45:51 deraadt Exp $ */
#include <machine/asm.h>
*/
#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x))
#define END_WEAK(x) END_STRONG(x); .weak x
+
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
-/* $OpenBSD: SYS.h,v 1.25 2018/06/16 16:06:03 guenther Exp $*/
+/* $OpenBSD: SYS.h,v 1.26 2023/12/10 16:45:51 deraadt Exp $*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
#define __DO_SYSCALL(x) \
or %r13, %r0, __SYSCALLNAME(SYS_,x); \
- tb0 0, %r0, 450
+97: tb0 0, %r0, 450; \
+ PINSYSCALL(__SYSCALLNAME(SYS_,x), 97b)
#define __SYSCALL__NOERROR(p,x,y) \
__ENTRY(p,x); \
-/* $OpenBSD: brk.S,v 1.14 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: brk.S,v 1.15 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
1:
or %r4,%r2,0
or %r13,%r0,__SYSCALLNAME(SYS_,break)
- tb0 0,%r0,450
+99: tb0 0,%r0,450
+ PINSYSCALL(SYS_break, 99b)
#ifdef __PIC__
br 9f
#else
-/* $OpenBSD: sbrk.S,v 1.14 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sbrk.S,v 1.15 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
add %r2,%r2,%r5
or %r4,%r2,0
or %r13,%r0,SYS_break
- tb0 0,%r0,450
+99: tb0 0,%r0,450
+ PINSYSCALL(SYS_break, 99b)
#ifdef __PIC__
br 9f
#else
-/* $OpenBSD: sigpending.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigpending.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
SYSENTRY(sigpending)
or %r4,%r2,0 /* save r2 */
or %r13,%r0,SYS_sigpending
- tb0 0,%r0,450
+99: tb0 0,%r0,450
+ PINSYSCALL(SYS_sigpending, 99b)
br CERROR
st %r2,%r4,0
jmp.n %r1
-/* $OpenBSD: sigprocmask.S,v 1.12 2015/10/23 04:39:24 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.13 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
ld %r3,%r3,0 /* else load set from *set and do it */
2:
or %r13,%r0,SYS_sigprocmask
- tb0 0,%r0,450
+99: tb0 0,%r0,450
+ PINSYSCALL(SYS_sigprocmask, 99b)
br CERROR
bcnd eq0,%r4,3f /* if old mask not requested, done */
st %r2,%r4,0 /* otherwise, set it */
-/* $OpenBSD: sigsuspend.S,v 1.13 2016/05/07 19:05:21 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.14 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
SYSENTRY_HIDDEN(sigsuspend)
ld %r2,%r2,0 /* dereference the pointer mask */
or %r13,%r0,SYS_sigsuspend
- tb0 0,%r0,450
+99: tb0 0,%r0,450
+ PINSYSCALL(SYS_sigsuspend, 99b)
br CERROR
jmp.n %r1
or %r2,%r0,0
-/* $OpenBSD: tfork_thread.S,v 1.7 2020/11/07 02:52:08 aoyama Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.8 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
*/
ENTRY(__tfork_thread)
or %r13, %r0, __SYSCALLNAME(SYS_,__tfork)
- tb0 0, %r0, 450 /* corrupts r2 and r3 in the child */
+99: tb0 0, %r0, 450 /* corrupts r2 and r3 in the child */
+ PINSYSCALL(SYS___tfork, 99b)
br CERROR
bcnd eq0, %r2, 1f
or %r2, %r5, %r0 /* arg */
or %r13, %r0, __SYSCALLNAME(SYS_,__threxit)
- tb0 0, %r0, 450
+98: tb0 0, %r0, 450
+ PINSYSCALL(SYS___threxit, 98b)
NOP
tb0 0, %r0, 130 /* breakpoint */
END(__tfork_thread)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.12 2016/05/07 19:05:22 guenther Exp $
+ * $OpenBSD: SYS.h,v 1.13 2023/12/10 16:45:51 deraadt Exp $
*/
#include <sys/syscall.h>
.size _HIDDEN(x), . - _HIDDEN(x)
#define END_WEAK(x) END_STRONG(x); .weak x
-
#define CERROR __cerror
.hidden CERROR
# define __ENTRY(p,x) ENTRY(p ## x)
-# define __DO_SYSCALL(x) \
- li v0,SYS_ ## x; \
- syscall
+# define __DO_SYSCALL(x) \
+ li v0,SYS_ ## x; \
+ 97: syscall; \
+ PINSYSCALL(SYS_ ## x, 97b) \
+
# define __LEAF2(p,x,sz) LEAF(p ## x, sz) \
WEAK_ALIAS(x, p ## x);
#define SYSCALL_END(x) __END2(_thread_sys_,x)
#define SYSCALL_END_HIDDEN(x) __END2_HIDDEN(_thread_sys_,x)
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
-/* $OpenBSD: setjmp.S,v 1.12 2018/01/08 16:44:32 visa Exp $ */
+/* $OpenBSD: setjmp.S,v 1.13 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
li a0, 1 # how = SIG_BLOCK
move a1, zero # get current signal mask
li v0, SYS_sigprocmask
- syscall # mask in v0
+99: syscall # mask in v0
+ PINSYSCALL(SYS_sigprocmask, 99b)
bne a3, zero, botch
REG_S v0, _JB_MASK(a2) # save sc_mask
REG_L a1, _JB_MASK(a2) # load sc_mask
li a0, 3 # how = SIG_SETMASK
li v0, SYS_sigprocmask
- syscall
+98: syscall
+ PINSYSCALL(SYS_sigprocmask, 98b)
bne a3, zero, botch
REG_L v0, _JB_REGS+ZERO*REGSZ(a2)
-/* $OpenBSD: brk.S,v 1.10 2022/12/08 01:25:43 guenther Exp $ */
+/* $OpenBSD: brk.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
move a0, v0 # dont allow break < minbrk
1:
li v0, SYS_break
- syscall
+99: syscall
+ PINSYSCALL(SYS_break, 99b)
bne a3, zero, 2f
PTR_S a0, __curbrk
move v0, zero
-/* $OpenBSD: sbrk.S,v 1.10 2022/12/08 01:25:43 guenther Exp $ */
+/* $OpenBSD: sbrk.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
PTR_L v1, __curbrk
li v0, SYS_break
PTR_ADDU a0, a0, v1 # compute current break
- syscall
+99: syscall
+ PINSYSCALL(SYS_break, 99b)
bne a3, zero, 1f
move v0, v1 # return old val of curbrk from above
-/* $OpenBSD: sigpending.S,v 1.7 2015/10/23 04:39:24 guenther Exp $ */
+/* $OpenBSD: sigpending.S,v 1.8 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
SETUP_GP64(GPOFF, _HIDDEN(sigpending))
.set reorder
li v0, SYS_sigpending
- syscall
+99: syscall
+ PINSYSCALL(SYS_sigpending, 99b)
bne a3, zero, 1f
sw v0, 0(a0)
move v0, zero
-/* $OpenBSD: sigprocmask.S,v 1.7 2015/10/23 04:39:24 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.8 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
lw a1, 0(a1) # indirect to new mask arg
.Ldoit:
li v0, SYS_sigprocmask
- syscall
+99: syscall
+ PINSYSCALL(SYS_sigprocmask, 99b)
bne a3, zero, .Lerr
beq a2, zero, .Lout # test if old mask requested
sw v0, 0(a2) # store old mask
-/* $OpenBSD: sigsuspend.S,v 1.7 2016/05/07 19:05:22 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.8 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
.set reorder
lw a0, 0(a0) # indirect to mask arg
li v0, SYS_sigsuspend
- syscall
+99: syscall
+ PINSYSCALL(SYS_sigsuspend, 99b)
bne a3, zero, 1f
move v0, zero # should not happen
RESTORE_GP64
-/* $OpenBSD: SYS.h,v 1.27 2023/02/11 06:10:39 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.28 2023/12/10 16:45:51 deraadt Exp $ */
/*-
* Copyright (c) 1994
* Andrew Cagney. All rights reserved.
#define PSEUDO_NOERROR(x,y) SYSENTRY(x) \
RETGUARD_SETUP(x, %r11, %r12); \
li %r0, SYS_ ## y ; \
- sc; \
+ 97: sc; \
+ PINSYSCALL(SYS_ ## y, 97b); \
RETGUARD_CHECK(x, %r11, %r12); \
blr; \
__END(x)
#define PSEUDO_HIDDEN(x,y) SYSENTRY_HIDDEN(x) \
RETGUARD_SETUP(x, %r11, %r12); \
li %r0, SYS_ ## y; \
- sc; \
+ 97: sc; \
+ PINSYSCALL(SYS_ ## y, 97b); \
cmpwi %r0, 0; \
beq+ .L_ret; \
stw %r0, R2_OFFSET_ERRNO(2); \
-/* $OpenBSD: setjmp.S,v 1.14 2022/06/10 01:56:02 guenther Exp $ */
+/* $OpenBSD: setjmp.S,v 1.15 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn. All rights reserved.
*
li 3, 1 /* how = SIG_BLOCK */
li 4, 0 /* oset = empty */
li 0, SYS_sigprocmask
- sc
+99: sc
+ PINSYSCALL(SYS_sigprocmask, 99b)
+
stw 3, JMP_sig(5)
mr 3, 5
ENTRY(_setjmp)
li 3, 3 /* how = SIG_SETMASK */
lwz 4, JMP_sig(5) /* oset from the jmpbuf */
li 0, SYS_sigprocmask
- sc
+98: sc
+ PINSYSCALL(SYS_sigprocmask, 98b)
mr 3, 5 /* restore jmpbuf and val to r3,r4 */
mr 4, 6
-/* $OpenBSD: sigsetjmp.S,v 1.8 2022/06/10 01:56:02 guenther Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.9 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn. All rights reserved.
*
li 3, 1 /* how = SIG_BLOCK */
li 4, 0 /* oset = empty */
li 0, SYS_sigprocmask
- sc
+99: sc
+ PINSYSCALL(SYS_sigprocmask, 99b)
stw 3, JMP_sigmask(5)
1: mflr 6
bcl 20, 31, 2f
li 3, 3 /* how = SIG_SETMASK */
lwz 4, JMP_sigmask(5) /* oset from the jmpbuf */
li 0, SYS_sigprocmask
- sc
+98: sc
+ PINSYSCALL(SYS_sigprocmask, 98b)
1: bcl 20, 31, 2f
2: mflr 9
-/* $OpenBSD: brk.S,v 1.18 2022/12/08 01:25:43 guenther Exp $ */
+/* $OpenBSD: brk.S,v 1.19 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
#endif
li 0, SYS_break
- sc
+99: sc
+ PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi 0, 0
-/* $OpenBSD: sbrk.S,v 1.17 2022/12/08 01:25:43 guenther Exp $ */
+/* $OpenBSD: sbrk.S,v 1.18 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
mr 7, 3
li 0, SYS_break
- sc
+99: sc
+ PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi 0, 0
-/* $OpenBSD: sigpending.S,v 1.8 2020/11/28 19:49:30 gkoehler Exp $ */
+/* $OpenBSD: sigpending.S,v 1.9 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
*
RETGUARD_SETUP(sigpending, %r11, %r12)
mr %r5, %r3
li %r0, SYS_sigpending
- sc
+99: sc
+ PINSYSCALL(SYS_sigpending, 99b)
stw %r3, 0(%r5)
li %r3, 0
RETGUARD_CHECK(sigpending, %r11, %r12)
-/* $OpenBSD: sigprocmask.S,v 1.14 2020/11/28 19:49:30 gkoehler Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.15 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
.L_do_call:
li 0, SYS_sigprocmask
- sc
-
+99: sc
+ PINSYSCALL(SYS_sigprocmask, 99b)
+
/* didnt work? */
cmpwi 0, 0
beq+ .L_sigprocmask_ok
-/* $OpenBSD: sigsuspend.S,v 1.7 2020/11/28 19:49:30 gkoehler Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.8 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
li %r0, SYS_sigsuspend
lwz %r3, 0(%r3) /* load the mask */
- sc
+99: sc
+ PINSYSCALL(SYS_sigsuspend, 99b)
cmpwi %r0, 0
beq+ .L_ret
-/* $OpenBSD: tfork_thread.S,v 1.10 2020/11/28 19:49:30 gkoehler Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.11 2023/12/10 16:45:51 deraadt Exp $ */
/*
* Copyright (c) 2005 Tim Wiess <tim@nop.cx>
RETGUARD_SETUP(__tfork_thread, %r11, %r12)
/* call __tfork */
li %r0, SYS___tfork
- sc
+99: sc
+ PINSYSCALL(SYS___tfork, 99b)
cmpwi %r0, 0
bne 1f
/* child returned, call __threxit */
li %r0, SYS___threxit
- sc
+98: sc
+ PINSYSCALL(SYS___threxit, 98b)
.long 0 /* illegal */
1:
-/* $OpenBSD: DEFS.h,v 1.1 2020/06/25 01:59:27 drahn Exp $ */
+/* $OpenBSD: DEFS.h,v 1.2 2023/12/10 16:45:52 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
#else
#define END_BUILTIN(x) END_STRONG(x)
#endif
+
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
-/* $OpenBSD: SYS.h,v 1.5 2022/12/07 23:25:59 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.6 2023/12/10 16:45:52 deraadt Exp $ */
/*-
* Copyright (c) 1994
* Andrew Cagney. All rights reserved.
ENTRY(_thread_sys_ ## x) \
RETGUARD_SETUP(_thread_sys_ ## x, %r11); \
li %r0, SYS_ ## y ; \
- sc ; \
+ 97: sc ; \
+ PINSYSCALL(SYS_ ## y, 97b); \
RETGUARD_CHECK(_thread_sys_ ## x, %r11); \
blr; \
__END(_thread_sys_,x)
#define PSEUDO_HIDDEN(x,y) ENTRY(_thread_sys_ ## x) \
RETGUARD_SETUP(_thread_sys_ ## x, %r11); \
li %r0, SYS_ ## y ; \
- sc ; \
+ 97: sc ; \
+ PINSYSCALL(SYS_ ## y, 97b); \
cmpwi %r0, 0 ; \
beq .L_ret ; \
stw %r0, R13_OFFSET_ERRNO(%r13); \
-/* $OpenBSD: setjmp.S,v 1.4 2020/10/18 17:51:39 mortimer Exp $ */
+/* $OpenBSD: setjmp.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2020 Dale Rahn. All rights reserved.
*
li %r3, 1 /* how = SIG_BLOCK */
li %r4, 0 /* oset = empty */
li %r0, SYS_sigprocmask
- sc
+99: sc
+ PINSYSCALL(SYS_sigprocmask, 99b)
std %r3, JMP_sig(%r5)
b 1f
nop
li %r3, 3 /* how = SIG_SETMASK */
ld %r4, JMP_sig(%r5) /* oset from the jmpbuf */
li %r0, SYS_sigprocmask
- sc
+98: sc
+ PINSYSCALL(SYS_sigprocmask, 98b)
nop
b 1f
nop
-/* $OpenBSD: sigsetjmp.S,v 1.3 2020/10/19 23:24:17 mortimer Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.4 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2020 Dale Rahn. All rights reserved.
*
li %r3, 1 /* how = SIG_BLOCK */
li %r4, 0 /* oset = empty */
li %r0, SYS_sigprocmask
- sc
+99: sc
+ PINSYSCALL(SYS_sigprocmask, 99b)
nop
std %r3, JMP_sigmask(5)
1:
li %r3, 3 /* how = SIG_SETMASK */
ld %r4, JMP_sigmask(%r5) /* oset from the jmpbuf */
li %r0, SYS_sigprocmask
- sc
+98: sc
+ PINSYSCALL(SYS_sigprocmask, 98b)
1:
addis %r9, %r2, __jmpxor@toc@ha
addi %r9, %r9, __jmpxor@toc@l
-/* $OpenBSD: brk.S,v 1.5 2022/12/07 23:25:59 guenther Exp $ */
+/* $OpenBSD: brk.S,v 1.6 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
addi %r6, %r6, __curbrk@toc@l /* # %r6 = &__curbrk */
li %r0, SYS_break
- sc
+99: sc
+ PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi %r0, 0
-/* $OpenBSD: sbrk.S,v 1.4 2020/10/16 23:42:16 deraadt Exp $ */
+/* $OpenBSD: sbrk.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
mr %r7, %r3
li %r0, SYS_break
- sc
+99: sc
+ PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi %r0, 0
-/* $OpenBSD: sigpending.S,v 1.2 2020/10/16 23:42:16 deraadt Exp $ */
+/* $OpenBSD: sigpending.S,v 1.3 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
*
li %r0, SYS_sigpending
mr %r5, %r3
- sc
+99: sc
+ PINSYSCALL(SYS_sigpending, 99b)
stw %r3, 0(%r5)
li %r3, 0
RETGUARD_CHECK(sigpending, %r11)
-/* $OpenBSD: sigprocmask.S,v 1.4 2020/10/16 23:42:16 deraadt Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
lwz %r4, 0(%r4) /* get new mask */
.L_do_call:
- sc
+99: sc
+ PINSYSCALL(SYS_sigprocmask, 99b)
/* didnt work? */
cmpwi %r0, 0
-/* $OpenBSD: sigsuspend.S,v 1.3 2020/10/16 23:42:16 deraadt Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.4 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1996 Dale Rahn <drahn@openbsd.org>
li %r0, SYS_sigsuspend
lwz %r3, 0(%r3) /* load the mask */
- sc
+99: sc
+ PINSYSCALL(SYS_sigsuspend, 99b)
cmpwi %r0, 0
beq .L_ret
-/* $OpenBSD: tfork_thread.S,v 1.4 2020/10/19 14:15:29 deraadt Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2005 Tim Wiess <tim@nop.cx>
RETGUARD_SETUP(__tfork_thread, %r11)
li %r0, SYS___tfork
- sc
+99: sc
+ PINSYSCALL(SYS___tfork, 99b)
cmpwi %r0, 0
bne 1f
/* child returned, call __threxit */
li %r0, SYS___threxit
- sc
+98: sc
+ PINSYSCALL(SYS___threxit, 98b)
.long 0 /* illegal */
1:
stw %r0, R13_OFFSET_ERRNO(%r13)
-/* $OpenBSD: DEFS.h,v 1.1 2021/04/29 18:39:53 drahn Exp $ */
+/* $OpenBSD: DEFS.h,v 1.2 2023/12/10 16:45:52 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x))
#define END_WEAK(x) END_STRONG(x); .weak x
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
-/* $OpenBSD: SYS.h,v 1.4 2022/12/02 12:27:08 jca Exp $ */
+/* $OpenBSD: SYS.h,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*-
* Copyright (c) 2020 Brian Bamsch <bbamsch@google.com>
* Copyright (c) 1990 The Regents of the University of California.
#define __END(x) \
__END_HIDDEN(x); END(x)
-#define SYSTRAP(x) \
- li t0, SYS_ ## x; \
- ecall
+#define SYSTRAP(x) \
+ li t0, SYS_ ## x; \
+97: ecall; \
+ PINSYSCALL(SYS_ ## x, 97b)
#define HANDLE_ERROR() \
beqz t0, 200f; \
-/* $OpenBSD: brk.S,v 1.4 2022/12/03 15:02:30 jca Exp $ */
+/* $OpenBSD: brk.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2021 Dale Rahn <drahn@openbsd.org>
*
lla t1, __curbrk
li t0, SYS_break
- ecall
+99: ecall
+ PINSYSCALL(SYS_break, 99b)
/* check for error */
beqz t0, .L_brk_ok
-/* $OpenBSD: SYS.h,v 1.13 2023/02/11 06:10:39 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.14 2023/12/10 16:45:52 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
#define __END(x) \
__END_HIDDEN(x); SET_ENTRY_SIZE(x)
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits; \
+ .long label; \
+ .long sysno; \
+ .popsection;
+
#ifdef __ASSEMBLER__
/*
* If the system call number fits in a 8-bit signed value (i.e. fits in 7 bits),
.macro systrap num
.iflt \num - 128
mov # \num, r0
- trapa #0x80
+97: trapa #0x80
+ PINSYSCALL(\num, 97b)
.else
mov.l 903f, r0
- trapa #0x80
+97: trapa #0x80
+ PINSYSCALL(\num, 97b)
bra 904f
nop
.align 2
-/* $OpenBSD: brk.S,v 1.8 2022/12/08 02:11:27 guenther Exp $ */
+/* $OpenBSD: brk.S,v 1.9 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: brk.S,v 1.10 2006/01/06 03:58:31 uwe Exp $ */
/*-
#else
mov #SYS_break, r0
#endif
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(SYS_break, 99b)
bf 2f
#ifdef __PIC__
mov.l Lcurbrk, r0
-/* $OpenBSD: sbrk.S,v 1.8 2022/12/08 02:11:27 guenther Exp $ */
+/* $OpenBSD: sbrk.S,v 1.9 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: sbrk.S,v 1.9 2006/01/06 03:58:31 uwe Exp $ */
/*-
#else
mov #SYS_break, r0
#endif
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(SYS_break, 99b)
bf 1f
#ifdef __PIC__
mov.l Lcurbrk, r0
-/* $OpenBSD: sigprocmask.S,v 1.6 2022/09/02 06:19:04 miod Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.7 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: sigprocmask.S,v 1.6 2003/08/07 16:42:21 agc Exp $ */
/*-
#else
mov #SYS_sigprocmask, r0
#endif
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(SYS_sigprocmask, 99b)
bf 4f
mov r6, r2 /* fetch old mask requested */
tst r2, r2 /* test if old mask requested */
-/* $OpenBSD: sigsuspend.S,v 1.5 2022/09/02 06:19:04 miod Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.6 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: sigsuspend.S,v 1.5 2003/08/07 16:42:21 agc Exp $ */
/*-
#else
mov #SYS_sigsuspend, r0
#endif
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(SYS_sigsuspend, 99b)
SET_ERRNO_AND_RETURN
.align 2
-/* $OpenBSD: tfork_thread.S,v 1.4 2022/09/02 06:19:04 miod Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
#else
mov #SYS___tfork, r0
#endif
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(SYS___tfork, 99b)
bf 9f
tst r0, r0
#else
mov #SYS___threxit, r0
#endif
- trapa #0x80
+98: trapa #0x80
+ PINSYSCALL(SYS___threxit, 98b)
9:
/*
-/* $OpenBSD: SYS.h,v 1.17 2022/01/01 23:47:14 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.18 2023/12/10 16:45:52 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
#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)); \
+#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)
* Note that it adds a `nop' over what we could do, if we only knew what
* came at label 1....
*/
-#define _SYSCALL(p,x,y) \
- __ENTRY(p,x); mov _CAT(SYS_,y),%g1; t ST_SYSCALL; bcc 1f; nop; ERROR(); 1:
-#define _SYSCALL_HIDDEN(p,x,y) \
- __ENTRY_HIDDEN(p,x); mov _CAT(SYS_,y),%g1; t ST_SYSCALL; bcc 1f; nop; ERROR(); 1:
+#define _SYSCALL(p,x,y) \
+ __ENTRY(p,x); \
+ mov _CAT(SYS_,y),%g1; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,y), 97b); \
+ bcc 1f; \
+ nop; \
+ ERROR(); \
+1:
-#define __SYSCALL(p,x) \
+#define _SYSCALL_HIDDEN(p,x,y) \
+ __ENTRY_HIDDEN(p,x); \
+ mov _CAT(SYS_,y),%g1; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,y), 97b); \
+ bcc 1f; \
+ nop; \
+ ERROR(); \
+1:
+
+#define __SYSCALL(p,x) \
_SYSCALL(p,x,x)
-#define __SYSCALL_HIDDEN(p,x) \
+#define __SYSCALL_HIDDEN(p,x) \
_SYSCALL_HIDDEN(p,x,x)
/*
* we use the SYSCALL_G2RFLAG to put the `success' return address in %g2
* and avoid a branch.
*/
-#define __RSYSCALL(p,x) \
- __ENTRY(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \
- add %o7,8,%g2; t ST_SYSCALL; ERROR(); __END(p,x)
-#define __RSYSCALL_HIDDEN(p,x) \
- __ENTRY_HIDDEN(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \
- add %o7,8,%g2; t ST_SYSCALL; ERROR(); __END_HIDDEN(p,x)
+#define __RSYSCALL(p,x) \
+ __ENTRY(p,x); \
+ mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \
+ add %o7,8,%g2; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,x), 97b); \
+ ERROR(); \
+ __END(p,x)
+#define __RSYSCALL_HIDDEN(p,x) \
+ __ENTRY_HIDDEN(p,x); \
+ mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \
+ add %o7,8,%g2; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,x), 97b); \
+ ERROR(); \
+ __END_HIDDEN(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(); __END(p,x)
+#define __PSEUDO(p,x,y) \
+ __ENTRY(p,x); \
+ mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; \
+ add %o7,8,%g2; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,y), 97b); \
+ ERROR(); \
+ __END(p,x)
/*
* SYSCALL_NOERROR is like SYSCALL, except it's used for syscalls
*
* XXX - This should be optimized.
*/
-#define __SYSCALL_NOERROR(p,x) \
- __ENTRY(p,x); mov _CAT(SYS_,x),%g1; t ST_SYSCALL
+#define __SYSCALL_NOERROR(p,x) \
+ __ENTRY(p,x); \
+ mov _CAT(SYS_,x),%g1; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,x), 97b)
/*
* RSYSCALL_NOERROR is like RSYSCALL, except it's used for syscalls
*
* XXX - This should be optimized.
*/
-#define __RSYSCALL_NOERROR(p,x) \
- __ENTRY(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \
- t ST_SYSCALL; __END(p,x)
+#define __RSYSCALL_NOERROR(p,x) \
+ __ENTRY(p,x); \
+ mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \
+ add %o7,8,%g2; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,x), 97b); \
+ __END(p,x)
/*
* PSEUDO_NOERROR(x,y) is like RSYSCALL_NOERROR(y) except that the name is x.
*/
-#define __PSEUDO_NOERROR(p,x,y) \
- __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \
- t ST_SYSCALL; __END(p,x)
+#define __PSEUDO_NOERROR(p,x,y) \
+ __ENTRY(p,x); \
+ mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; \
+ add %o7,8,%g2; \
+97: t ST_SYSCALL; \
+ PINSYSCALL(_CAT(SYS_,y), 97b); \
+ __END(p,x)
/*
* SYSENTRY is for functions that pretend to be syscalls.
-/* $OpenBSD: setjmp.S,v 1.6 2016/04/28 12:53:47 kettenis Exp $ */
+/* $OpenBSD: setjmp.S,v 1.7 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: setjmp.S,v 1.4 2000/08/28 00:45:59 eeh Exp $ */
/*
mov 1, %o0 /* SIG_BLOCK */
mov SYS_sigprocmask, %g1
clr %o1 /* sigprocmask(SIG_BLOCK, 0) */
- t ST_SYSCALL
+99: t ST_SYSCALL
+ PINSYSCALL(SYS_sigprocmask, 99b)
stx %o0, [%o3 + 0x10]
stx %sp, [%o3 + 0x00] /* store caller's stack pointer */
mov 3, %o0 /* SIG_SETMASK */
ldx [%i0 + 0x10], %o1
mov SYS_sigprocmask, %g1
- t ST_SYSCALL
+98: t ST_SYSCALL
+ PINSYSCALL(SYS_sigprocmask, 98b)
ldx [%i0 + 0x00], %fp
ldx [%i0 + 0x08], %i7
-/* $OpenBSD: sigsetjmp.S,v 1.4 2016/05/08 18:29:34 guenther Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: sigsetjmp.S,v 1.5 2000/08/28 00:45:59 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
mov 1, %o0 /* SIG_BLOCK */
mov SYS_sigprocmask, %g1
clr %o1 /* sigprocmask(SIG_BLOCK, 0) */
- t ST_SYSCALL
+99: t ST_SYSCALL
+ PINSYSCALL(SYS_sigprocmask, 99b)
stx %o0, [%o3 + 0x10]
1: stx %sp, [%o3 + 0x00] /* store caller's stack pointer */
mov 3, %o0 /* SIG_SETMASK */
ldx [%i0 + 0x10], %o1
mov SYS_sigprocmask, %g1
- t ST_SYSCALL
+98: t ST_SYSCALL
+ PINSYSCALL(SYS_sigprocmask, 98b)
1: ldx [%i0 + 0x00], %fp
ldx [%i0 + 0x08], %i7
-/* $OpenBSD: brk.S,v 1.11 2023/01/13 17:52:08 miod Exp $ */
+/* $OpenBSD: brk.S,v 1.12 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: brk.S,v 1.9 2000/07/25 20:15:40 mycroft Exp $ */
/*
movgu %xcc, %o1, %o0 /* %o0 = minbrk */
mov %o0, %o2 /* save argument to syscall */
mov SYS_break, %g1
- t ST_SYSCALL
+99: t ST_SYSCALL
+ PINSYSCALL(SYS_break, 99b)
set __curbrk, %o3
bcc,a,pt %icc, 1f
ldx [%o5 + %o3], %o4
movgu %xcc, %o1, %o0 /* %o0 = minbrk */
mov %o0, %o2 /* save argument to syscall */
mov SYS_break, %g1
- t ST_SYSCALL
+98: t ST_SYSCALL
+ PINSYSCALL(SYS_break, 98b)
bcc,a,pt %icc,1f
sethi %hi(__curbrk), %g1
ERROR()
-/* $OpenBSD: sbrk.S,v 1.9 2023/01/13 17:52:08 miod Exp $ */
+/* $OpenBSD: sbrk.S,v 1.10 2023/12/10 16:45:52 deraadt Exp $ */
/* $NetBSD: sbrk.S,v 1.7 2000/07/25 15:14:46 mycroft Exp $ */
/*
add %o3, %o0, %o4 /* %o4 = new break */
mov %o4, %o0 /* copy for syscall */
mov SYS_break, %g1
- t ST_SYSCALL /* break(new_break) */
+99: t ST_SYSCALL /* break(new_break) */
+ PINSYSCALL(SYS_break, 99b)
bcc,a 1f /* if success, */
mov %o3, %o0 /* set return value */
ERROR()
add %o3, %o0, %o4 /* %o4 = new break */
mov %o4, %o0 /* copy for syscall */
mov SYS_break, %g1
- t ST_SYSCALL /* break(new_break) */
+98: t ST_SYSCALL /* break(new_break) */
+ PINSYSCALL(SYS_break, 98b)
bcc,a 1f /* if success, */
mov %o3, %o0 /* set return value */
ERROR()
-/* $OpenBSD: sigpending.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: sigpending.S,v 1.4 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
SYSENTRY(sigpending)
mov %o0, %o2 /* save pointer */
mov SYS_sigpending, %g1
- t ST_SYSCALL /* sigpending() */
+99: t ST_SYSCALL /* sigpending() */
+ PINSYSCALL(SYS_sigpending, 99b)
bcc,a 1f /* if success, */
st %o0, [%o2] /* store return value */
ERROR()
-/* $OpenBSD: sigprocmask.S,v 1.4 2015/10/23 04:39:25 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
mov 1, %o0 /* ... using sigprocmask(SIG_BLOCK) */
1:
mov SYS_sigprocmask, %g1
- t ST_SYSCALL
+99: t ST_SYSCALL
+ PINSYSCALL(SYS_sigprocmask, 99b)
bcc 2f /* if success, */
tst %o2 /* check to see if oset requested */
ERROR()
-/* $OpenBSD: sigsuspend.S,v 1.4 2016/05/07 19:05:22 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
SYSENTRY_HIDDEN(sigsuspend)
ld [%o0], %o0 /* indirect to mask argument */
mov SYS_sigsuspend, %g1
- t ST_SYSCALL
+99: t ST_SYSCALL
+ PINSYSCALL(SYS_sigsuspend, 99b)
ERROR() /* always terminates with EINTR */
SYSCALL_END_HIDDEN(sigsuspend)
-/* $OpenBSD: tfork_thread.S,v 1.4 2020/10/18 14:28:18 deraadt Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
* different return paths.
*/
mov SYS___tfork, %g1
- t ST_SYSCALL
+99: t ST_SYSCALL
+ PINSYSCALL(SYS___tfork, 99b)
bcs 9f
nop
mov SYS___threxit, %g1
clr %o0
- t ST_SYSCALL /* will not return */
+98: t ST_SYSCALL /* will not return */
+ PINSYSCALL(SYS___threxit, 98b)
unimp
9:
-/* $OpenBSD: SYS.h,v 1.5 2020/02/18 12:19:11 kettenis Exp $ */
+/* $OpenBSD: SYS.h,v 1.6 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2016 Dale Rahn
#include <machine/asm.h>
#include <sys/syscall.h>
-#define SYSTRAP(x) \
- ldr x8, =SYS_ ## x ;\
- svc 0 ;\
- dsb nsh ;\
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
+#define SYSTRAP(x) \
+ ldr x8, =SYS_ ## x ;\
+99: svc 0 ;\
+ PINSYSCALL(SYS_ ## x, 99b) ;\
+ dsb nsh ;\
isb
-#define DL_SYSCALL(n) \
- .global __CONCAT(_dl_,n) ;\
- .type __CONCAT(_dl_,n)%function ;\
-__CONCAT(_dl_,n): ;\
- RETGUARD_SETUP(__CONCAT(_dl_,n), x15) ;\
- SYSTRAP(n) ;\
- cneg x0, x0, cs /* r0 = -errno */ ;\
- RETGUARD_CHECK(__CONCAT(_dl_,n), x15) ;\
+#define DL_SYSCALL(n) \
+ .global __CONCAT(_dl_,n) ;\
+ .type __CONCAT(_dl_,n)%function ;\
+__CONCAT(_dl_,n): ;\
+ RETGUARD_SETUP(__CONCAT(_dl_,n), x15) ;\
+ SYSTRAP(n) ;\
+ cneg x0, x0, cs /* r0 = -errno */ ;\
+ RETGUARD_CHECK(__CONCAT(_dl_,n), x15) ;\
ret
btext PT_LOAD FLAGS (0x08000001);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
. = DATA_SEGMENT_RELRO_END (0, .);
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
/* BOOTDATA */
. = ALIGN(0x1000);
boot_data_start = .;
-/* $OpenBSD: SYS.h,v 1.3 2023/12/06 06:15:33 miod Exp $ */
+/* $OpenBSD: SYS.h,v 1.4 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
* further register saving.
*/
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
#define DL_SYSCALL(c) \
LEAF_NOPROFILE(_dl_##c, irrelevant); \
ldiq v0, SYS_##c; \
- call_pal PAL_OSF1_callsys; \
+99: call_pal PAL_OSF1_callsys; \
+ PINSYSCALL(SYS_##c, 99b); \
beq a3, 1f; \
subq zero, v0, v0; /* return -errno */ \
1: \
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.3 2023/04/25 04:11:10 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.4 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
#include <sys/syscall.h>
#include <machine/asm.h>
-#define DL_SYSCALL(n) \
- .global __CONCAT(_dl_,n) ;\
- .type __CONCAT(_dl_,n), @function ;\
- .align 16,0xcc ;\
-__CONCAT(_dl_,n): ;\
- endbr64 ;\
- RETGUARD_SETUP(_dl_##n, r11) ;\
- RETGUARD_PUSH(r11) ;\
- movl $(__CONCAT(SYS_,n)), %eax ;\
- movq %rcx, %r10 ;\
- syscall ;\
- jnc 1f ;\
- neg %rax ;\
-1: RETGUARD_POP(r11) ;\
- RETGUARD_CHECK(_dl_##n, r11) ;\
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
+#define DL_SYSCALL(n) \
+ .global __CONCAT(_dl_,n) ;\
+ .type __CONCAT(_dl_,n), @function ;\
+ .align 16,0xcc ;\
+__CONCAT(_dl_,n): ;\
+ endbr64 ;\
+ RETGUARD_SETUP(_dl_##n, r11) ;\
+ RETGUARD_PUSH(r11) ;\
+ movl $(__CONCAT(SYS_,n)), %eax ;\
+ movq %rcx, %r10 ;\
+99: syscall ;\
+ PINSYSCALL(__CONCAT(SYS_,n), 99b) ;\
+ jnc 1f ;\
+ neg %rax ;\
+1: RETGUARD_POP(r11) ;\
+ RETGUARD_CHECK(_dl_##n, r11) ;\
ret
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
.got : { *(.got.plt) *(.got) } :data :relro
. = DATA_SEGMENT_RELRO_END (0, .);
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
/* BOOTDATA */
. = ALIGN(0x1000);
boot_data_start = .;
-/* $OpenBSD: SYS.h,v 1.3 2020/03/13 09:31:26 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.4 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
#include <machine/asm.h>
#include <sys/syscall.h>
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
#define SYSTRAP(x) \
- ldr r12, =SYS_ ## x; \
- swi 0; \
- dsb nsh; \
+ ldr r12, =SYS_ ## x ;\
+99: swi 0 ;\
+ PINSYSCALL(SYS_ ## x, 99b) ;\
+ dsb nsh ;\
isb
-#define DL_SYSCALL(n) \
- .global __CONCAT(_dl_,n) ;\
- .type __CONCAT(_dl_,n)%function ;\
-__CONCAT(_dl_,n): ;\
- SYSTRAP(n) ;\
- bcs .L_cerr ;\
+#define DL_SYSCALL(n) \
+ .global __CONCAT(_dl_,n) ;\
+ .type __CONCAT(_dl_,n)%function ;\
+__CONCAT(_dl_,n): ;\
+ SYSTRAP(n) ;\
+ bcs .L_cerr ;\
mov pc, lr
.L_cerr:
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.1 2017/08/27 21:59:52 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.2 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
#include <machine/vmparam.h>
#undef _LOCORE
-#define DL_SYSCALL(x) \
-ENTRY(__CONCAT(_dl_,x),0) !\
- stw rp, HPPA_FRAME_ERP(sr0,sp) !\
- ldil L%SYSCALLGATE, r1 !\
- ble 4(sr7, r1) !\
- ldi __CONCAT(SYS_,x), t1 !\
- comb,<> r0, t1, _dl_sysexit !\
- ldw HPPA_FRAME_ERP(sr0,sp), rp !\
- bv r0(rp) !\
- nop !\
-_dl_sysexit !\
- bv r0(rp) !\
- sub r0, ret0, ret0 !\
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits !\
+ .long label !\
+ .long sysno !\
+ .popsection
+
+#define DL_SYSCALL(x) \
+ENTRY(__CONCAT(_dl_,x),0) !\
+ stw rp, HPPA_FRAME_ERP(sr0,sp) !\
+ ldil L%SYSCALLGATE, r1 !\
+99: ble 4(sr7, r1) !\
+ PINSYSCALL(__CONCAT(SYS_,x), 99b) !\
+ ldi __CONCAT(SYS_,x), t1 !\
+ comb,<> r0, t1, _dl_sysexit !\
+ ldw HPPA_FRAME_ERP(sr0,sp), rp !\
+ bv r0(rp) !\
+ nop !\
+_dl_sysexit !\
+ bv r0(rp) !\
+ sub r0, ret0, ret0 !\
EXIT(__CONCAT(_dl_,x))
pltgot PT_LOAD;
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
. = DATA_SEGMENT_RELRO_END (0, .);
-/* $OpenBSD: SYS.h,v 1.1 2017/08/27 21:59:52 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.2 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
#include <sys/syscall.h>
#include <machine/asm.h>
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
#define DL_SYSCALL(n) \
.section ".text" ;\
.align 16,0xcc ;\
.type __CONCAT(_dl_,n),@function ;\
__CONCAT(_dl_,n): ;\
movl $__CONCAT(SYS_, n),%eax; ;\
- int $0x80 ;\
+99: int $0x80 ;\
+ PINSYSCALL(__CONCAT(SYS_, n), 99b) ;\
jb .L_cerr ;\
ret
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.4 2019/10/23 19:55:09 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.5 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
#include <machine/asm.h>
#include <sys/syscall.h>
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
#define __CONCAT(p,x) p##x
#define __ENTRY(p,x) ENTRY(__CONCAT(p,x))
#define __SYSCALLNAME(p,x) __CONCAT(p,x)
-#define __DO_SYSCALL(x) \
- or %r13, %r0, __SYSCALLNAME(SYS_,x); \
- tb0 0, %r0, 450
+#define __DO_SYSCALL(x) \
+ or %r13, %r0, __SYSCALLNAME(SYS_,x) ;\
+99: tb0 0, %r0, 450 ;\
+ PINSYSCALL(__SYSCALLNAME(SYS_,x), 99b)
/*
* m88k syscall return ABI requires the same amount of ASM
* whether or not the syscall can possibly fail, so there's
* no benefit to a DL_SYSCALL_NOERR() macro.
*/
-#define DL_SYSCALL(n) \
- __ENTRY(_dl_,n); \
- __DO_SYSCALL(n); \
- subu %r2, %r0, %r2; /* return -errno; */ \
- jmp %r1; \
+#define DL_SYSCALL(n) \
+ __ENTRY(_dl_,n) ;\
+ __DO_SYSCALL(n) ;\
+ subu %r2, %r0, %r2 /* return -errno; */ ;\
+ jmp %r1 ;\
END(_dl_##n)
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ scalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
. = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
.openbsd.randomdata : { *(.openbsd.randomdata .openbsd.randomdata.*) }
:data :relro :random
+ .openbsd.syscalls : { *(.openbsd.syscalls .openbsd.syscalls.*) }
+ :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.1 2017/08/27 21:59:52 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.2 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
#include <sys/syscall.h>
#include <machine/asm.h>
-#define DL_SYSCALL(c) \
-NLEAF(_dl_##c,0) \
- li v0,SYS_##c; \
- syscall; \
- bnez a3, 1f; \
- j ra; \
-1: ; \
- subu v0, zero, v0; \
- j ra ; \
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
+#define DL_SYSCALL(c) \
+NLEAF(_dl_##c,0) \
+ li v0,SYS_##c; \
+99: syscall; \
+ PINSYSCALL(SYS_##c, 99b); \
+ bnez a3, 1f; \
+ j ra; \
+1: ; \
+ subu v0, zero, v0; \
+ j ra; \
END(_dl_##c)
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
_gp = ALIGN(16) + 0x7ff0;
-/* $OpenBSD: SYS.h,v 1.4 2020/11/28 19:49:30 gkoehler Exp $ */
+/* $OpenBSD: SYS.h,v 1.5 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
#include <sys/syscall.h>
#include <machine/asm.h>
-#define DL_SYSCALL(n) \
-ENTRY(_dl_##n) \
- RETGUARD_SETUP(_dl_##n, %r11, %r12) ;\
- li 0, SYS_##n ;\
- sc ;\
- cmpwi 0, 0 ;\
- beq+ .L_end##n ;\
- neg 3, 3 ;\
-.L_end##n: ;\
- RETGUARD_CHECK(_dl_##n, %r11, %r12) ;\
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
+#define DL_SYSCALL(n) \
+ENTRY(_dl_##n) \
+ RETGUARD_SETUP(_dl_##n, %r11, %r12) ;\
+ li 0, SYS_##n ;\
+99: sc ;\
+ PINSYSCALL(SYS_##n, 99b) ;\
+ cmpwi 0, 0 ;\
+ beq+ .L_end##n ;\
+ neg 3, 3 ;\
+.L_end##n: ;\
+ RETGUARD_CHECK(_dl_##n, %r11, %r12) ;\
blr
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.2 2020/10/16 23:42:53 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.3 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
#include <sys/syscall.h>
#include <machine/asm.h>
-#define DL_SYSCALL(n) \
-ENTRY(_dl_##n) \
- RETGUARD_SETUP(_dl_##n, %r11) ;\
- li %r0, SYS_##n ;\
- sc ;\
- cmpdi %r0, 0 ;\
- beq .L_end##n ;\
- neg %r3, %r3 ;\
-.L_end##n: ;\
- RETGUARD_CHECK(_dl_##n, %r11) ;\
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
+#define DL_SYSCALL(n) \
+ENTRY(_dl_##n) \
+ RETGUARD_SETUP(_dl_##n, %r11) ;\
+ li %r0, SYS_##n ;\
+99: sc ;\
+ PINSYSCALL(SYS_##n, 99b) ;\
+ cmpdi %r0, 0 ;\
+ beq .L_end##n ;\
+ neg %r3, %r3 ;\
+.L_end##n: ;\
+ RETGUARD_CHECK(_dl_##n, %r11) ;\
blr
text PT_LOAD FLAGS (1);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.1 2021/04/28 15:16:26 drahn Exp $ */
+/* $OpenBSD: SYS.h,v 1.2 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@openbsd.org>
#include <machine/asm.h>
#include <sys/syscall.h>
-#define SYSTRAP(x) \
- li t0, SYS_ ## x ;\
- ecall ;\
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
+#define SYSTRAP(x) \
+ li t0, SYS_ ## x ;\
+99: ecall ;\
+ PINSYSCALL(SYS_ ## x, 99b)
/* XXX fence */
-#define DL_SYSCALL(n) \
- .global __CONCAT(_dl_,n) ;\
- .type __CONCAT(_dl_,n)%function ;\
-__CONCAT(_dl_,n): ;\
- RETGUARD_SETUP(__CONCAT(_dl_,n), x15) ;\
- SYSTRAP(n) ;\
- beqz t0, 1f ;\
- sub a0, zero, a0 /* r0 = -errno */ ;\
-1: ;\
- RETGUARD_CHECK(__CONCAT(_dl_,n), x15) ;\
+#define DL_SYSCALL(n) \
+ .global __CONCAT(_dl_,n) ;\
+ .type __CONCAT(_dl_,n)%function ;\
+__CONCAT(_dl_,n): ;\
+ RETGUARD_SETUP(__CONCAT(_dl_,n), x15) ;\
+ SYSTRAP(n) ;\
+ beqz t0, 1f ;\
+ sub a0, zero, a0 /* r0 = -errno */ ;\
+1: ;\
+ RETGUARD_CHECK(__CONCAT(_dl_,n), x15) ;\
ret
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
+
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.2 2022/09/02 06:19:05 miod Exp $ */
+/* $OpenBSD: SYS.h,v 1.3 2023/12/10 16:45:50 deraadt Exp $ */
/*
* Copyright (c) 2006 Dale Rahn
#include <machine/asm.h>
#include <sys/syscall.h>
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
#ifdef __ASSEMBLER__
/*
* If the system call number fits in a 8-bit signed value (i.e. fits in 7 bits),
.macro systrap num
.iflt \num - 128
mov # \num, r0
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(\num, 99b)
.else
mov.l 903f, r0
- trapa #0x80
+99: trapa #0x80
+ PINSYSCALL(\num, 99b)
bra 904f
nop
.align 2
.endm
#endif
-#define SYSTRAP(x) \
- systrap SYS_ ## x
+#define SYSTRAP(x) \
+ systrap SYS_ ## x
-#define DL_SYSCALL(n) \
- .global __CONCAT(_dl_,n) ;\
- .type __CONCAT(_dl_,n)%function ;\
-__CONCAT(_dl_,n): ;\
- SYSTRAP(n) ;\
- bf .L_cerr ;\
- nop ;\
- rts ;\
+#define DL_SYSCALL(n) \
+ .global __CONCAT(_dl_,n) ;\
+ .type __CONCAT(_dl_,n)%function ;\
+__CONCAT(_dl_,n): ;\
+ SYSTRAP(n) ;\
+ bf .L_cerr ;\
+ nop ;\
+ rts ;\
nop
.L_cerr:
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
. = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
.openbsd.randomdata : { *(.openbsd.randomdata .openbsd.randomdata.*) }
:data :relro :random
+ .openbsd.syscalls : { *(.openbsd.syscalls .openbsd.syscalls.*) } :syscalls
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro
-/* $OpenBSD: SYS.h,v 1.4 2021/12/14 07:20:16 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.5 2023/12/10 16:45:50 deraadt Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
#include <machine/trap.h>
#include <machine/asm.h>
+#define PINSYSCALL(sysno, label) \
+ .pushsection .openbsd.syscalls,"",@progbits ;\
+ .long label ;\
+ .long sysno ;\
+ .popsection
+
#define __CONCAT(x,y) x##y
-#define DL_SYSCALL(n) \
-_ENTRY(__CONCAT(_dl_,n)) \
- mov __CONCAT(SYS_,n) | SYSCALL_G2RFLAG, %g1 ;\
- add %o7, 8, %g2 ;\
- t ST_SYSCALL ;\
- retl ;\
+#define DL_SYSCALL(n) \
+_ENTRY(__CONCAT(_dl_,n)) \
+ mov __CONCAT(SYS_,n) | SYSCALL_G2RFLAG, %g1 ;\
+ add %o7, 8, %g2 ;\
+99: t ST_SYSCALL ;\
+ PINSYSCALL(__CONCAT(SYS_,n), 99b) ;\
+ retl ;\
sub %g0, %o0, %o0
btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
+ syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
{
*(.openbsd.randomdata .openbsd.randomdata.*)
} :data :relro :random
+ .openbsd.syscalls :
+ {
+ *(.openbsd.syscalls .openbsd.syscalls.*)
+ } :syscalls
.data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro
.dynamic : { *(.dynamic) } :data :relro :dynamic
.got : { *(.got.plt) *(.got) } :data :relro