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: cpio.1,v 1.36 2020/01/16 16:46:46 schwarze Exp $
.\" $OpenBSD: cpio.1,v 1.37 2023/12/09 23:00:11 jca Exp $
.\"
.\" Copyright (c) 1997 SigmaSoft, Th. Lockert
.\" All rights reserved.
@ -23,7 +23,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: January 16 2020 $
.Dd $Mdocdate: December 9 2023 $
.Dt CPIO 1
.Os
.Sh NAME
@ -98,6 +98,8 @@ format.
Old octal character
.Nm
format.
.It Ar pax
POSIX pax format.
.It Ar sv4cpio
SVR4 hex
.Nm
@ -173,6 +175,8 @@ format.
Old octal character
.Nm
format.
.It Ar pax
POSIX pax format.
.It Ar sv4cpio
SVR4 hex
.Nm
@ -298,6 +302,8 @@ be used for larger files.
.It bcpio Ta "4 Gigabytes"
.It sv4cpio Ta "4 Gigabytes"
.It cpio Ta "8 Gigabytes"
.\" XXX should be "unlimited"
.It pax Ta "8 Gigabytes"
.It tar Ta "8 Gigabytes"
.It ustar Ta "8 Gigabytes"
.El

View File

@ -1,4 +1,4 @@
/* $OpenBSD: extern.h,v 1.61 2023/11/26 16:04:17 espie Exp $ */
/* $OpenBSD: extern.h,v 1.62 2023/12/09 23:00:11 jca Exp $ */
/* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */
/*-
@ -284,6 +284,7 @@ int tar_wr(ARCHD *);
int ustar_id(char *, int);
int ustar_rd(ARCHD *, char *);
int ustar_wr(ARCHD *);
int pax_wr(ARCHD *);
/*
* tty_subs.c

View File

@ -1,4 +1,4 @@
/* $OpenBSD: options.c,v 1.106 2023/11/26 16:04:17 espie Exp $ */
/* $OpenBSD: options.c,v 1.107 2023/12/09 23:00:11 jca Exp $ */
/* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */
/*-
@ -216,6 +216,8 @@ FSUB fsub[] = {
{ },
/* 9: gzip, to detect failure to use -z */
{ },
/* 10: POSIX PAX */
{ },
#else
/* 6: compress, to detect failure to use -Z */
{NULL, 0, 4, 0, 0, 0, 0, compress_id},
@ -225,6 +227,10 @@ FSUB fsub[] = {
{NULL, 0, 4, 0, 0, 0, 0, bzip2_id},
/* 9: gzip, to detect failure to use -z */
{NULL, 0, 4, 0, 0, 0, 0, gzip_id},
/* 10: POSIX PAX */
{"pax", 5120, BLKMULT, 0, 1, BLKMULT, 0, ustar_id, no_op,
ustar_rd, tar_endrd, no_op, pax_wr, tar_endwr, tar_trail,
tar_opt},
#endif
};
#define F_OCPIO 0 /* format when called as cpio -6 */

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: pax.1,v 1.76 2022/03/31 17:27:14 naddy Exp $
.\" $OpenBSD: pax.1,v 1.77 2023/12/09 23:00:11 jca Exp $
.\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
.\"
.\" Copyright (c) 1992 Keith Muller.
@ -34,7 +34,7 @@
.\"
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
.\"
.Dd $Mdocdate: March 31 2022 $
.Dd $Mdocdate: December 9 2023 $
.Dt PAX 1
.Os
.Sh NAME
@ -868,6 +868,11 @@ standard.
The default blocksize for this format is 10240 bytes.
Filenames stored by this format must be 100 characters or less in length;
the total pathname must be 256 characters or less.
.It Cm pax
The pax interchange format specified in the
.St -p1003.1-2001
standard.
The default blocksize for this format is 5120 bytes.
.El
.Pp
.Nm
@ -1081,9 +1086,10 @@ utility is compliant with the
specification,
except that the
.Cm pax
archive format and the
archive format is only partially supported,
and the
.Cm listopt
keyword are unsupported.
keyword is unsupported.
.Pp
The flags
.Op Fl 0BDEGjOPTUYZz ,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: tar.c,v 1.73 2023/09/04 17:05:34 jca Exp $ */
/* $OpenBSD: tar.c,v 1.74 2023/12/09 23:00:11 jca Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*-
@ -35,10 +35,12 @@
*/
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <grp.h>
#include <libgen.h>
#include <limits.h>
#include <pwd.h>
#include <stdio.h>
@ -50,6 +52,19 @@
#include "extern.h"
#include "tar.h"
SLIST_HEAD(xheader, xheader_record);
struct xheader_record {
SLIST_ENTRY(xheader_record) entry;
size_t reclen;
char *record;
};
/* shortest possible extended record: "5 a=\n" */
#define MINXHDRSZ 5
/* longest record we'll accept */
#define MAXXHDRSZ BLKMULT
/*
* Routines for reading, writing and header identify of various versions of tar
*/
@ -60,6 +75,9 @@ static char *name_split(char *, int);
static int ul_oct(u_long, char *, int, int);
static int ull_oct(unsigned long long, char *, int, int);
static int rd_xheader(ARCHD *arcn, int, off_t);
#ifndef SMALL
static int wr_xheader(ARCHD *, struct xheader *);
#endif
static uid_t uid_nobody;
static uid_t uid_warn;
@ -891,24 +909,121 @@ reset:
return(0);
}
/*
* ustar_wr()
* write a ustar header for the file specified in the ARCHD to the archive
* Have to check for file types that cannot be stored and file names that
* are too long. Be careful of the term (last arg) to ul_oct, we only use
* '\0' for the termination character (this is different than picky tar)
* ASSUMED: space after header in header block is zero filled
* Return:
* 0 if file has data to be written after the header, 1 if file has NO
* data to write after the header, -1 if archive write failed
*/
#ifndef SMALL
static int
xheader_add(struct xheader *xhdr, const char *keyword,
const char *value)
{
struct xheader_record *rec;
int reclen, tmplen;
char *s;
int
ustar_wr(ARCHD *arcn)
tmplen = MINXHDRSZ;
do {
reclen = tmplen;
tmplen = snprintf(NULL, 0, "%d %s=%s\n", reclen, keyword,
value);
} while (tmplen >= 0 && tmplen != reclen);
if (tmplen < 0)
return -1;
rec = calloc(1, sizeof(*rec));
if (rec == NULL)
return -1;
rec->reclen = reclen;
if (asprintf(&s, "%d %s=%s\n", reclen, keyword, value) < 0) {
free(rec);
return -1;
}
rec->record = s;
SLIST_INSERT_HEAD(xhdr, rec, entry);
return 0;
}
static void
xheader_free(struct xheader *xhdr)
{
struct xheader_record *rec;
while (!SLIST_EMPTY(xhdr)) {
rec = SLIST_FIRST(xhdr);
SLIST_REMOVE_HEAD(xhdr, entry);
free(rec->record);
free(rec);
}
}
static int
wr_xheader(ARCHD *arcn, struct xheader *xhdr)
{
char hdblk[sizeof(HD_USTAR)];
HD_USTAR *hd;
char buf[sizeof(hd->name) + 1];
struct xheader_record *rec;
size_t size;
size = 0;
SLIST_FOREACH(rec, xhdr, entry)
size += rec->reclen;
memset(hdblk, 0, sizeof(hdblk));
hd = (HD_USTAR *)hdblk;
hd->typeflag = XHDRTYPE;
strncpy(hd->magic, TMAGIC, TMAGLEN);
strncpy(hd->version, TVERSION, TVERSLEN);
if (ul_oct(size, hd->size, sizeof(hd->size), 3))
return -1;
/*
* Best effort attempt at providing a useful file name for
* implementations that don't support pax format. Don't bother
* with truncation if the resulting file name doesn't fit.
* XXX dirname/basename portability (check return value?)
*/
(void)snprintf(buf, sizeof(buf), "%s/PaxHeaders.%ld/%s",
dirname(arcn->name), (long)getpid(), basename(arcn->name));
fieldcpy(hd->name, sizeof(hd->name), buf, sizeof(buf));
if (ul_oct(arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 0) ||
ull_oct(arcn->sb.st_mtime < 0 ? 0 : arcn->sb.st_mtime, hd->mtime,
sizeof(hd->mtime), 1) ||
ul_oct(arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 0) ||
ul_oct(arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 0))
return -1;
if (ul_oct(tar_chksm(hdblk, sizeof(HD_USTAR)), hd->chksum,
sizeof(hd->chksum), 3))
return -1;
/* write out extended header */
if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0)
return -1;
if (wr_skip(BLKMULT - sizeof(HD_USTAR)) < 0)
return -1;
/* write out extended header records */
SLIST_FOREACH(rec, xhdr, entry)
if (wr_rdbuf(rec->record, rec->reclen) < 0)
return -1;
if (wr_skip(TAR_PAD(size)) < 0)
return -1;
return 0;
}
#endif
static int
wr_ustar_or_pax(ARCHD *arcn, int ustar)
{
HD_USTAR *hd;
const char *name;
char *pt, hdblk[sizeof(HD_USTAR)];
#ifndef SMALL
struct xheader xhdr = SLIST_HEAD_INITIALIZER(xhdr);
#endif
/*
* check for those file system types ustar cannot store
@ -929,8 +1044,19 @@ ustar_wr(ARCHD *arcn)
*/
if (PAX_IS_LINK(arcn->type) &&
((size_t)arcn->ln_nlen > sizeof(hd->linkname))) {
paxwarn(1, "Link name too long for ustar %s", arcn->ln_name);
return(1);
if (ustar) {
paxwarn(1, "Link name too long for ustar %s",
arcn->ln_name);
return(1);
}
#ifndef SMALL
else if (xheader_add(&xhdr, "linkpath", arcn->name) == -1) {
paxwarn(1, "Link name too long for pax %s",
arcn->ln_name);
xheader_free(&xhdr);
return(1);
}
#endif
}
/*
@ -938,8 +1064,21 @@ ustar_wr(ARCHD *arcn)
* pt != arcn->name, the name has to be split
*/
if ((pt = name_split(arcn->name, arcn->nlen)) == NULL) {
paxwarn(1, "File name too long for ustar %s", arcn->name);
return(1);
if (ustar) {
paxwarn(1, "File name too long for ustar %s",
arcn->name);
return(1);
}
#ifndef SMALL
else if (xheader_add(&xhdr, "path", arcn->name) == -1) {
paxwarn(1, "File name too long for pax %s",
arcn->ln_name);
xheader_free(&xhdr);
return(1);
}
/* PAX format, we don't need to split the path */
pt = arcn->name;
#endif
}
/*
@ -1074,6 +1213,18 @@ ustar_wr(ARCHD *arcn)
strncpy(hd->gname, name, sizeof(hd->gname));
}
#ifndef SMALL
/* write out a pax extended header if needed */
if (!SLIST_EMPTY(&xhdr)) {
int ret;
ret = wr_xheader(arcn, &xhdr);
xheader_free(&xhdr);
if (ret == -1)
return(-1);
}
#endif
/*
* calculate and store the checksum write the header to the archive
* return 0 tells the caller to now write the file data, 1 says no data
@ -1091,6 +1242,9 @@ ustar_wr(ARCHD *arcn)
return(1);
out:
#ifndef SMALL
xheader_free(&xhdr);
#endif
/*
* header field is out of range
*/
@ -1098,6 +1252,42 @@ ustar_wr(ARCHD *arcn)
return(1);
}
/*
* ustar_wr()
* Write out a ustar format archive.
* Have to check for file types that cannot be stored and file names that
* are too long. Be careful of the term (last arg) to ul_oct, we only use
* '\0' for the termination character (this is different than picky tar).
* ASSUMED: space after header in header block is zero filled
* Return:
* 0 if file has data to be written after the header, 1 if file has NO
* data to write after the header, -1 if archive write failed
*/
int
ustar_wr(ARCHD *arcn)
{
return wr_ustar_or_pax(arcn, 1);
}
/*
* pax_wr()
* Write out a pax format archive.
* Have to check for file types that cannot be stored. Be careful of the
* term (last arg) to ul_oct, we only use '\0' for the termination
* character (this is different than picky tar).
* ASSUMED: space after header in header block is zero filled
* Return:
* 0 if file has data to be written after the header, 1 if file has NO
* data to write after the header, -1 if archive write failed
*/
#ifndef SMALL
int
pax_wr(ARCHD *arcn)
{
return wr_ustar_or_pax(arcn, 0);
}
#endif
/*
* name_split()
* see if the name has to be split for storage in a ustar header. We try
@ -1184,12 +1374,6 @@ expandname(char *buf, size_t len, char **gnu_name, const char *name,
return(nlen);
}
/* shortest possible extended record: "5 a=\n" */
#define MINXHDRSZ 5
/* longest record we'll accept */
#define MAXXHDRSZ BLKMULT
static int
rd_time(struct timespec *ts, const char *keyword, char *p)
{

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:

View File

@ -1,4 +1,4 @@
/* $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
@ -29,18 +29,25 @@
#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

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -39,11 +40,20 @@ SECTIONS
{
*(.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 = .;

View File

@ -1,4 +1,4 @@
/* $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
@ -61,10 +61,17 @@
* 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: \

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -39,6 +40,10 @@ SECTIONS
{
*(.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

View File

@ -1,4 +1,4 @@
/* $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
@ -30,19 +30,26 @@
#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

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -43,6 +44,11 @@ SECTIONS
.got : { *(.got.plt) *(.got) } :data :relro
. = DATA_SEGMENT_RELRO_END (0, .);
.openbsd.syscalls :
{
*(.openbsd.syscalls .openbsd.syscalls.*)
} :syscalls
/* BOOTDATA */
. = ALIGN(0x1000);
boot_data_start = .;

View File

@ -1,4 +1,4 @@
/* $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
@ -29,18 +29,25 @@
#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:

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -40,6 +41,11 @@ SECTIONS
{
*(.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

View File

@ -1,4 +1,4 @@
/* $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
@ -33,17 +33,24 @@
#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))

View File

@ -6,6 +6,7 @@ PHDRS
pltgot PT_LOAD;
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
syscalls PT_OPENBSD_SYSCALLS;
relro PT_GNU_RELRO;
dynamic PT_DYNAMIC;
note PT_NOTE;
@ -45,6 +46,10 @@ SECTIONS
{
*(.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, .);

View File

@ -1,4 +1,4 @@
/* $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
@ -30,6 +30,12 @@
#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 ;\
@ -37,7 +43,8 @@
.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

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -38,6 +39,11 @@ SECTIONS
{
*(.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

View File

@ -1,4 +1,4 @@
/* $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.
@ -44,22 +44,29 @@
#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)

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -36,6 +37,9 @@ SECTIONS
. = 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

View File

@ -1,4 +1,4 @@
/* $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.
@ -29,14 +29,21 @@
#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)

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -39,6 +40,11 @@ SECTIONS
{
*(.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;

View File

@ -1,4 +1,4 @@
/* $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
@ -29,14 +29,21 @@
#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

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -39,6 +40,11 @@ SECTIONS
{
*(.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

View File

@ -1,4 +1,4 @@
/* $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
@ -29,14 +29,21 @@
#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

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -38,6 +39,11 @@ SECTIONS
{
*(.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

View File

@ -1,4 +1,4 @@
/* $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>
@ -29,19 +29,26 @@
#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

View File

@ -5,6 +5,7 @@ PHDRS
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;
@ -39,6 +40,11 @@ SECTIONS
{
*(.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

Some files were not shown because too many files have changed in this diff Show More