sync with OpenBSD -current

This commit is contained in:
purplerain 2023-12-10 13:25:40 +00:00
parent 4c73aa256c
commit 086d8cf2c2
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
118 changed files with 975 additions and 393 deletions

View file

@ -1,4 +1,4 @@
/* $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>
*
@ -67,3 +67,9 @@
#endif
#define _END(x) .size x, . - x
#define PINSYSCALL(sysno, label) \
.pushsection .openbsd.syscalls,"",@progbits; \
.long label; \
.long sysno; \
.popsection;

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -53,7 +53,8 @@
#define SYSTRAP(x) \
ldr x8, =SYS_ ## x; \
svc 0; \
97: svc 0; \
PINSYSCALL(SYS_ ## x, 97b); \
dsb nsh; \
isb

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -56,6 +56,12 @@
*/
#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
@ -67,7 +73,8 @@
#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); \

View file

@ -1,4 +1,4 @@
/* $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.
@ -41,7 +41,11 @@
/* 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); \

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -64,7 +64,8 @@ ENTRY(setjmp)
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)
@ -100,7 +101,8 @@ ENTRY(longjmp)
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

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -62,7 +62,8 @@ ENTRY(sigsetjmp)
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)
@ -100,7 +101,8 @@ ENTRY(siglongjmp)
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

View file

@ -1,4 +1,4 @@
/* $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>
@ -56,7 +56,8 @@ ENTRY(__tfork_thread)
*/
movl $SYS___tfork, %eax
.cfi_endproc
syscall
99: syscall
PINSYSCALL(SYS___tfork, 99b)
jb 2f
/*
@ -90,7 +91,8 @@ ENTRY(__tfork_thread)
*/
movl $SYS___threxit, %eax
xorl %edi, %edi
syscall
98: syscall
PINSYSCALL(SYS___threxit, 98b)
int3
/*

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -54,7 +54,8 @@
#define SYSTRAP(x) \
ldr r12, =SYS_ ## x; \
swi 0; \
97: swi 0; \
PINSYSCALL(SYS_ ## x, 97b); \
dsb nsh; \
isb

View file

@ -1,4 +1,4 @@
/* $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
@ -67,6 +67,11 @@
#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)) !\
@ -84,8 +89,9 @@ 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 */ \
@ -113,8 +119,9 @@ SYSEXIT_HIDDEN(x)
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 !\

View file

@ -1,4 +1,4 @@
/* $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.
@ -63,7 +63,8 @@ ALTENTRY(setjmp)
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
@ -129,7 +130,8 @@ ALTENTRY(longjmp)
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

View file

@ -1,4 +1,4 @@
/* $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
@ -32,8 +32,9 @@ SYSENTRY_HIDDEN(vfork)
.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 */

View file

@ -1,4 +1,4 @@
/* $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>
*
@ -47,3 +47,9 @@
#else
#define END_BUILTIN(x) END_STRONG(x)
#endif
#define PINSYSCALL(sysno, label) \
.pushsection .openbsd.syscalls,"",@progbits; \
.long label; \
.long sysno; \
.popsection;

View file

@ -29,7 +29,7 @@
* 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"
@ -59,7 +59,9 @@
#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); \

View file

@ -1,4 +1,4 @@
/* $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.
@ -59,7 +59,8 @@ ENTRY(setjmp)
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
@ -89,7 +90,8 @@ ENTRY(longjmp)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -47,7 +47,8 @@ ENTRY(sigsetjmp)
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)
@ -81,7 +82,8 @@ ENTRY(siglongjmp)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -36,7 +36,8 @@
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)

View file

@ -1,4 +1,4 @@
/* $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.
@ -54,7 +54,8 @@ ENTRY_NB(brk)
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
@ -71,7 +72,8 @@ ENTRY_NB(brk)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -51,7 +51,8 @@ ENTRY_NB(sbrk)
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
@ -65,7 +66,8 @@ ENTRY_NB(sbrk)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -43,7 +43,8 @@ SYSENTRY_HIDDEN(sigprocmask)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -38,7 +38,8 @@ SYSENTRY_HIDDEN(sigsuspend)
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)

View file

@ -1,4 +1,4 @@
/* $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.
@ -62,7 +62,8 @@ ENTRY(__tfork_thread)
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
/*
@ -98,7 +99,8 @@ ENTRY(__tfork_thread)
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
/*

View file

@ -1,4 +1,4 @@
/* $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>
@ -23,3 +23,9 @@
*/
#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;

View file

@ -1,4 +1,4 @@
/* $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.
@ -80,7 +80,8 @@
#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); \

View file

@ -1,4 +1,4 @@
/* $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.
@ -65,7 +65,8 @@ ENTRY(brk)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -64,7 +64,8 @@ ENTRY(sbrk)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -38,7 +38,8 @@
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -43,7 +43,8 @@ SYSENTRY_HIDDEN(sigprocmask)
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 */

View file

@ -1,4 +1,4 @@
/* $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.
@ -45,7 +45,8 @@
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

View file

@ -1,4 +1,4 @@
/* $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
@ -34,7 +34,8 @@
*/
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
@ -52,7 +53,8 @@ ENTRY(__tfork_thread)
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)

View file

@ -29,7 +29,7 @@
* 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>
@ -59,15 +59,16 @@
.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);
@ -124,3 +125,8 @@
#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;

View file

@ -1,4 +1,4 @@
/* $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)
@ -60,7 +60,8 @@ LEAF(setjmp, FRAMESZ)
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
@ -132,7 +133,8 @@ LEAF(longjmp, FRAMESZ)
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)

View file

@ -1,4 +1,4 @@
/* $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.
@ -55,7 +55,8 @@ LEAF(brk, FRAMESZ)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -52,7 +52,8 @@ LEAF(sbrk, FRAMESZ)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -41,7 +41,8 @@ SYSLEAF(sigpending, FRAMESZ)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -47,7 +47,8 @@ SYSLEAF_HIDDEN(sigprocmask, FRAMESZ)
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

View file

@ -1,4 +1,4 @@
/* $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.
@ -42,7 +42,8 @@ SYSLEAF_HIDDEN(sigsuspend, FRAMESZ)
.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

View file

@ -1,4 +1,4 @@
/* $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.
@ -64,7 +64,8 @@
#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)
@ -72,7 +73,8 @@
#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); \

View file

@ -1,4 +1,4 @@
/* $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.
*
@ -68,7 +68,9 @@ ENTRY(setjmp)
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)
@ -125,7 +127,8 @@ ENTRY(longjmp)
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

View file

@ -1,4 +1,4 @@
/* $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.
*
@ -63,7 +63,8 @@ ENTRY(sigsetjmp)
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
@ -122,7 +123,8 @@ ENTRY(siglongjmp)
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

View file

@ -1,4 +1,4 @@
/* $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
@ -60,7 +60,8 @@ ENTRY_NB(brk)
#endif
li 0, SYS_break
sc
99: sc
PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi 0, 0

View file

@ -1,4 +1,4 @@
/* $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
@ -57,7 +57,8 @@ ENTRY_NB(sbrk)
mr 7, 3
li 0, SYS_break
sc
99: sc
PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi 0, 0

View file

@ -1,4 +1,4 @@
/* $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
*
@ -24,7 +24,8 @@ SYSENTRY(sigpending)
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)

View file

@ -1,4 +1,4 @@
/* $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
@ -46,8 +46,9 @@ SYSENTRY_HIDDEN(sigprocmask)
.L_do_call:
li 0, SYS_sigprocmask
sc
99: sc
PINSYSCALL(SYS_sigprocmask, 99b)
/* didnt work? */
cmpwi 0, 0
beq+ .L_sigprocmask_ok

View file

@ -1,4 +1,4 @@
/* $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
@ -35,7 +35,8 @@ SYSENTRY_HIDDEN(sigsuspend)
li %r0, SYS_sigsuspend
lwz %r3, 0(%r3) /* load the mask */
sc
99: sc
PINSYSCALL(SYS_sigsuspend, 99b)
cmpwi %r0, 0
beq+ .L_ret

View file

@ -1,4 +1,4 @@
/* $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>
@ -22,7 +22,8 @@ ENTRY(__tfork_thread)
RETGUARD_SETUP(__tfork_thread, %r11, %r12)
/* call __tfork */
li %r0, SYS___tfork
sc
99: sc
PINSYSCALL(SYS___tfork, 99b)
cmpwi %r0, 0
bne 1f
@ -38,7 +39,8 @@ ENTRY(__tfork_thread)
/* child returned, call __threxit */
li %r0, SYS___threxit
sc
98: sc
PINSYSCALL(SYS___threxit, 98b)
.long 0 /* illegal */
1:

View file

@ -1,4 +1,4 @@
/* $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.
@ -67,3 +67,9 @@
#else
#define END_BUILTIN(x) END_STRONG(x)
#endif
#define PINSYSCALL(sysno, label) \
.pushsection .openbsd.syscalls,"",@progbits; \
.long label; \
.long sysno; \
.popsection;

View file

@ -1,4 +1,4 @@
/* $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.
@ -69,7 +69,8 @@
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)
@ -77,7 +78,8 @@
#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); \

View file

@ -1,4 +1,4 @@
/* $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.
*
@ -70,7 +70,8 @@ ENTRY(setjmp)
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
@ -130,7 +131,8 @@ ENTRY(longjmp)
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

View file

@ -1,4 +1,4 @@
/* $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.
*
@ -67,7 +67,8 @@ ENTRY(sigsetjmp)
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:
@ -126,7 +127,8 @@ ENTRY(siglongjmp)
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

View file

@ -1,4 +1,4 @@
/* $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
@ -50,7 +50,8 @@ SYSENTRY(brk)
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

View file

@ -1,4 +1,4 @@
/* $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
@ -51,7 +51,8 @@ SYSENTRY(sbrk)
mr %r7, %r3
li %r0, SYS_break
sc
99: sc
PINSYSCALL(SYS_break, 99b)
/* check for error */
cmpwi %r0, 0

View file

@ -1,4 +1,4 @@
/* $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
*
@ -25,7 +25,8 @@ SYSENTRY(sigpending)
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)

View file

@ -1,4 +1,4 @@
/* $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
@ -47,7 +47,8 @@ SYSENTRY_HIDDEN(sigprocmask)
lwz %r4, 0(%r4) /* get new mask */
.L_do_call:
sc
99: sc
PINSYSCALL(SYS_sigprocmask, 99b)
/* didnt work? */
cmpwi %r0, 0

View file

@ -1,4 +1,4 @@
/* $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>
@ -35,7 +35,8 @@ SYSENTRY(sigsuspend)
li %r0, SYS_sigsuspend
lwz %r3, 0(%r3) /* load the mask */
sc
99: sc
PINSYSCALL(SYS_sigsuspend, 99b)
cmpwi %r0, 0
beq .L_ret

View file

@ -1,4 +1,4 @@
/* $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>
@ -22,7 +22,8 @@ ENTRY(__tfork_thread)
RETGUARD_SETUP(__tfork_thread, %r11)
li %r0, SYS___tfork
sc
99: sc
PINSYSCALL(SYS___tfork, 99b)
cmpwi %r0, 0
bne 1f
@ -39,7 +40,8 @@ ENTRY(__tfork_thread)
/* 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)

View file

@ -1,4 +1,4 @@
/* $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.
@ -58,3 +58,8 @@
#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;

View file

@ -1,4 +1,4 @@
/* $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.
@ -56,9 +56,10 @@
#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; \

View file

@ -1,4 +1,4 @@
/* $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>
*
@ -38,7 +38,8 @@ ENTRY_NB(brk)
lla t1, __curbrk
li t0, SYS_break
ecall
99: ecall
PINSYSCALL(SYS_break, 99b)
/* check for error */
beqz t0, .L_brk_ok

View file

@ -1,4 +1,4 @@
/* $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.
@ -85,6 +85,12 @@
#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),
@ -94,10 +100,12 @@
.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

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -69,7 +69,8 @@ ENTRY(brk)
#else
mov #SYS_break, r0
#endif
trapa #0x80
99: trapa #0x80
PINSYSCALL(SYS_break, 99b)
bf 2f
#ifdef __PIC__
mov.l Lcurbrk, r0

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -69,7 +69,8 @@ ENTRY(sbrk)
#else
mov #SYS_break, r0
#endif
trapa #0x80
99: trapa #0x80
PINSYSCALL(SYS_break, 99b)
bf 1f
#ifdef __PIC__
mov.l Lcurbrk, r0

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -52,7 +52,8 @@ SYSENTRY_HIDDEN(sigprocmask)
#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 */

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -46,7 +46,8 @@ SYSENTRY_HIDDEN(sigsuspend)
#else
mov #SYS_sigsuspend, r0
#endif
trapa #0x80
99: trapa #0x80
PINSYSCALL(SYS_sigsuspend, 99b)
SET_ERRNO_AND_RETURN
.align 2

View file

@ -1,4 +1,4 @@
/* $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.
@ -29,7 +29,8 @@ ENTRY(__tfork_thread)
#else
mov #SYS___tfork, r0
#endif
trapa #0x80
99: trapa #0x80
PINSYSCALL(SYS___tfork, 99b)
bf 9f
tst r0, r0
@ -53,7 +54,8 @@ ENTRY(__tfork_thread)
#else
mov #SYS___threxit, r0
#endif
trapa #0x80
98: trapa #0x80
PINSYSCALL(SYS___threxit, 98b)
9:
/*

View file

@ -1,4 +1,4 @@
/* $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.
@ -49,8 +49,8 @@
#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)
@ -67,15 +67,30 @@
* 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)
/*
@ -83,19 +98,34 @@
* 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
@ -103,8 +133,11 @@
*
* 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
@ -112,16 +145,24 @@
*
* 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.

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -53,7 +53,8 @@ ENTRY(setjmp)
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 */
@ -68,7 +69,8 @@ ENTRY(longjmp)
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

View file

@ -1,4 +1,4 @@
/* $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
@ -43,7 +43,8 @@ ENTRY(sigsetjmp)
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 */
@ -62,7 +63,8 @@ ENTRY(siglongjmp)
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

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -59,7 +59,8 @@ ENTRY_NB(brk)
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
@ -74,7 +75,8 @@ ENTRY_NB(brk)
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()

View file

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -59,7 +59,8 @@ ENTRY_NB(sbrk)
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()
@ -72,7 +73,8 @@ ENTRY_NB(sbrk)
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()

View file

@ -1,4 +1,4 @@
/* $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.
@ -38,7 +38,8 @@
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()

View file

@ -1,4 +1,4 @@
/* $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.
@ -46,7 +46,8 @@ SYSENTRY_HIDDEN(sigprocmask)
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()

View file

@ -1,4 +1,4 @@
/* $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.
@ -39,6 +39,7 @@
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)

View file

@ -1,4 +1,4 @@
/* $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
@ -36,7 +36,8 @@ ENTRY(__tfork_thread)
* different return paths.
*/
mov SYS___tfork, %g1
t ST_SYSCALL
99: t ST_SYSCALL
PINSYSCALL(SYS___tfork, 99b)
bcs 9f
nop
@ -59,7 +60,8 @@ ENTRY(__tfork_thread)
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: