summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2023-02-11 23:07:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2023-02-11 23:07:29 +0000
commit093c867c6043e3af2f4b845860e1e59452286937 (patch)
tree3225d278651946319a6b9686cf843a1f1645c4ef
parent6b3c6d9f392a03c2ed83b3487ed43f174e081efb (diff)
__syscall() is no longer neccessary since the system calls which needed
it are now unpadded ok kettenis guenther
-rw-r--r--lib/libc/Symbols.list2
-rw-r--r--lib/libc/sys/Makefile.inc4
-rw-r--r--lib/libc/sys/syscall.221
-rw-r--r--sys/arch/alpha/alpha/trap.c7
-rw-r--r--sys/arch/amd64/amd64/trap.c3
-rw-r--r--sys/arch/arm/arm/syscall.c8
-rw-r--r--sys/arch/arm64/arm64/syscall.c3
-rw-r--r--sys/arch/hppa/hppa/trap.c15
-rw-r--r--sys/arch/i386/i386/trap.c11
-rw-r--r--sys/arch/m88k/m88k/trap.c21
-rw-r--r--sys/arch/mips64/mips64/trap.c6
-rw-r--r--sys/arch/powerpc/powerpc/trap.c12
-rw-r--r--sys/arch/powerpc64/powerpc64/syscall.c3
-rw-r--r--sys/arch/riscv64/riscv64/syscall.c3
-rw-r--r--sys/arch/sh/sh/trap.c15
-rw-r--r--sys/arch/sparc64/sparc64/trap.c9
-rw-r--r--sys/kern/syscalls.master4
-rw-r--r--sys/sys/syscall_mi.h5
18 files changed, 23 insertions, 129 deletions
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list
index c5b8794362e..0e6bcda055c 100644
--- a/lib/libc/Symbols.list
+++ b/lib/libc/Symbols.list
@@ -25,7 +25,6 @@ __get_tcb
__semctl
__set_tcb
__stack_smash_handler
-__syscall
__tfork_thread
__threxit
__thrsigdivert
@@ -38,7 +37,6 @@ _thread_sys___getcwd
_thread_sys___realpath
_thread_sys___semctl
_thread_sys___set_tcb
-_thread_sys___syscall
_thread_sys___threxit
_thread_sys___thrsigdivert
_thread_sys___thrsleep
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index a405654bca1..f359b3e07b7 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.169 2023/01/08 04:54:50 guenther Exp $
+# $OpenBSD: Makefile.inc,v 1.170 2023/02/11 23:07:28 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -41,7 +41,7 @@ SRCS+= ${CANCEL:%=w_%.c}
# modules with default implementations on all architectures, unless overridden
# below:
-ASM= __semctl.o __syscall.o __thrsigdivert.o \
+ASM= __semctl.o __thrsigdivert.o \
access.o acct.o adjfreq.o adjtime.o \
bind.o chdir.o chflags.o chflagsat.o chmod.o chown.o chroot.o \
clock_getres.o clock_settime.o \
diff --git a/lib/libc/sys/syscall.2 b/lib/libc/sys/syscall.2
index 09f635851de..e80511d6208 100644
--- a/lib/libc/sys/syscall.2
+++ b/lib/libc/sys/syscall.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: syscall.2,v 1.14 2022/08/02 17:37:18 deraadt Exp $
+.\" $OpenBSD: syscall.2,v 1.15 2023/02/11 23:07:28 deraadt Exp $
.\" $NetBSD: syscall.2,v 1.4 1995/02/27 12:38:53 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,19 +30,17 @@
.\"
.\" @(#)syscall.2 8.1 (Berkeley) 6/16/93
.\"
-.Dd $Mdocdate: August 2 2022 $
+.Dd $Mdocdate: February 11 2023 $
.Dt SYSCALL 2
.Os
.Sh NAME
-.Nm syscall ,
-.Nm __syscall
+.Nm syscall
.Nd indirect system call
.Sh SYNOPSIS
.In sys/syscall.h
.In unistd.h
.Ft int
.Fn syscall "int number" "..."
-.Fn __syscall "quad_t number" "..."
.Sh DESCRIPTION
.Fn syscall
performs the system call whose assembly language
@@ -52,19 +50,6 @@ with the specified arguments.
Symbolic constants for system calls can be found in the header file
.In sys/syscall.h .
.Pp
-Since different system calls have different return types, a
-prototype of
-.Nm __syscall
-specifying the correct return type should be declared locally.
-This is especially important for system calls returning
-larger-than-int results.
-.Pp
-The
-.Nm __syscall
-form should be used when one or more of the parameters is a
-64-bit argument to ensure that argument alignment is correct.
-This system call is useful for testing new system calls that
-do not have entries in the C library.
.Sh RETURN VALUES
The return values are defined by the system call being invoked.
In general, for system calls returning
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 6a0c1c481ed..635f2a7d6d3 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.106 2023/01/31 15:18:51 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.107 2023/02/11 23:07:26 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -518,11 +518,6 @@ syscall(code, framep)
switch(code) {
case SYS_syscall:
- case SYS___syscall:
- /*
- * syscall() and __syscall() are handled the same on
- * the alpha, as everything is 64-bit aligned, anyway.
- */
indirect = code;
code = framep->tf_regs[FRAME_A0];
hidden = 1;
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 33f73911ff8..272d84b27d0 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.96 2023/01/20 16:01:04 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.97 2023/02/11 23:07:26 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@@ -574,7 +574,6 @@ syscall(struct trapframe *frame)
switch (code) {
case SYS_syscall:
- case SYS___syscall:
/*
* Code is first argument, followed by actual args.
*/
diff --git a/sys/arch/arm/arm/syscall.c b/sys/arch/arm/arm/syscall.c
index eabf879dead..c23dcc32f2a 100644
--- a/sys/arch/arm/arm/syscall.c
+++ b/sys/arch/arm/arm/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.25 2023/01/16 05:32:04 deraadt Exp $ */
+/* $OpenBSD: syscall.c,v 1.26 2023/02/11 23:07:26 deraadt Exp $ */
/* $NetBSD: syscall.c,v 1.24 2003/11/14 19:03:17 scw Exp $ */
/*-
@@ -122,12 +122,6 @@ swi_handler(trapframe_t *frame)
code = *ap++;
nap--;
break;
- case SYS___syscall:
- indirect = code;
- code = ap[_QUAD_LOWWORD];
- ap += 2;
- nap -= 2;
- break;
}
callp = sysent;
diff --git a/sys/arch/arm64/arm64/syscall.c b/sys/arch/arm64/arm64/syscall.c
index 343231259df..fab269d49d6 100644
--- a/sys/arch/arm64/arm64/syscall.c
+++ b/sys/arch/arm64/arm64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.12 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: syscall.c,v 1.13 2023/02/11 23:07:26 deraadt Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
*
@@ -54,7 +54,6 @@ svc_handler(trapframe_t *frame)
switch (code) {
case SYS_syscall:
- case SYS___syscall:
indirect = code;
code = *ap++;
nap--;
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index d8600482f1a..bebd3c072ba 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.160 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.161 2023/02/11 23:07:26 deraadt Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -788,19 +788,6 @@ syscall(struct trapframe *frame)
args[2] = frame->tf_arg3;
argoff = 3;
break;
- case SYS___syscall:
- /*
- * this works, because quads get magically swapped
- * due to the args being laid backwards on the stack
- * and then copied in words
- */
- indirect = code;
- code = frame->tf_arg0;
- args[0] = frame->tf_arg2;
- args[1] = frame->tf_arg3;
- argoff = 2;
- retq = 1;
- break;
default:
args[0] = frame->tf_arg0;
args[1] = frame->tf_arg1;
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 9751eb9e8ef..c936dc35070 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.159 2023/01/30 10:49:05 jsg Exp $ */
+/* $OpenBSD: trap.c,v 1.160 2023/02/11 23:07:27 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -556,15 +556,6 @@ syscall(struct trapframe *frame)
copyin(params, &code, sizeof(int));
params += sizeof(int);
break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- indirect = code;
- copyin(params + _QUAD_LOWWORD * sizeof(int), &code, sizeof(int));
- params += sizeof(quad_t);
- break;
default:
break;
}
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index 0af00c0a7c8..7f4d31149e4 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.126 2023/01/31 15:18:54 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.127 2023/02/11 23:07:27 deraadt Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -1167,9 +1167,7 @@ m88100_syscall(register_t code, struct trapframe *tf)
/*
* For 88k, all the arguments are passed in the registers (r2-r9),
* and further arguments (if any) on stack.
- * For syscall (and __syscall), r2 (and r3) has the actual code.
- * __syscall takes a quad syscall number, so that other
- * arguments are at their natural alignments.
+ * For syscall, r2 has the actual code.
*/
ap = &tf->tf_r[2];
nap = 8; /* r2-r9 */
@@ -1180,12 +1178,6 @@ m88100_syscall(register_t code, struct trapframe *tf)
code = *ap++;
nap--;
break;
- case SYS___syscall:
- indirect = code;
- code = ap[_QUAD_LOWWORD];
- ap += 2;
- nap -= 2;
- break;
}
callp = sysent;
@@ -1288,9 +1280,7 @@ m88110_syscall(register_t code, struct trapframe *tf)
/*
* For 88k, all the arguments are passed in the registers (r2-r9),
* and further arguments (if any) on stack.
- * For syscall (and __syscall), r2 (and r3) has the actual code.
- * __syscall takes a quad syscall number, so that other
- * arguments are at their natural alignments.
+ * For syscall, r2 has the actual code.
*/
ap = &tf->tf_r[2];
nap = 8; /* r2-r9 */
@@ -1300,11 +1290,6 @@ m88110_syscall(register_t code, struct trapframe *tf)
code = *ap++;
nap--;
break;
- case SYS___syscall:
- code = ap[_QUAD_LOWWORD];
- ap += 2;
- nap -= 2;
- break;
}
callp = sysent;
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 79f3558dcb1..ba018dd9f48 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.165 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.166 2023/02/11 23:07:27 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -426,12 +426,8 @@ fault_common_no_miss:
code = locr0->v0;
switch (code) {
case SYS_syscall:
- case SYS___syscall:
/*
* Code is first argument, followed by actual args.
- * __syscall provides the code as a quad to maintain
- * proper alignment of 64-bit arguments on 32-bit
- * platforms, which doesn't change anything here.
*/
indirect = code;
code = locr0->a0;
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 5002becf570..94ec7ccf281 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.130 2023/01/31 01:27:58 gkoehler Exp $ */
+/* $OpenBSD: trap.c,v 1.131 2023/02/11 23:07:27 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -372,16 +372,6 @@ trap(struct trapframe *frame)
indirect = code;
code = *params++;
break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad,
- * so as to maintain quad alignment
- * for the rest of the args.
- */
- params++;
- indirect = code;
- code = *params++;
- break;
default:
break;
}
diff --git a/sys/arch/powerpc64/powerpc64/syscall.c b/sys/arch/powerpc64/powerpc64/syscall.c
index 87b2da61fd8..04fcc332728 100644
--- a/sys/arch/powerpc64/powerpc64/syscall.c
+++ b/sys/arch/powerpc64/powerpc64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.10 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: syscall.c,v 1.11 2023/02/11 23:07:27 deraadt Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
@@ -40,7 +40,6 @@ syscall(struct trapframe *frame)
switch (code) {
case SYS_syscall:
- case SYS___syscall:
indirect = code;
code = *ap++;
nap--;
diff --git a/sys/arch/riscv64/riscv64/syscall.c b/sys/arch/riscv64/riscv64/syscall.c
index 77944c44d19..a918bb02601 100644
--- a/sys/arch/riscv64/riscv64/syscall.c
+++ b/sys/arch/riscv64/riscv64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.14 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: syscall.c,v 1.15 2023/02/11 23:07:27 deraadt Exp $ */
/*
* Copyright (c) 2020 Brian Bamsch <bbamsch@google.com>
@@ -57,7 +57,6 @@ svc_handler(trapframe_t *frame)
switch (code) {
case SYS_syscall:
- case SYS___syscall:
indirect = code;
code = *ap++;
nap--;
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index 491a239bd21..72421959d63 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.53 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.54 2023/02/11 23:07:27 deraadt Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@@ -536,19 +536,6 @@ syscall(struct proc *p, struct trapframe *tf)
code = tf->tf_r4;
argoff = 1;
break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- indirect = code;
-#if _BYTE_ORDER == BIG_ENDIAN
- code = tf->tf_r5;
-#else
- code = tf->tf_r4;
-#endif
- argoff = 2;
- break;
default:
argoff = 0;
break;
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 7321a66f9d1..09723a695ee 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.114 2023/01/24 07:26:34 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.115 2023/02/11 23:07:28 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -1133,19 +1133,12 @@ syscall(struct trapframe *tf, register_t code, register_t pc)
* The first six system call arguments are in the six %o registers.
* Any arguments beyond that are in the `argument extension' area
* of the user's stack frame (see <machine/frame.h>).
- *
- * Check for ``special'' codes that alter this, namely syscall and
- * __syscall. These both pass a syscall number in the first argument
- * register, so the other arguments are just shifted down, possibly
- * pushing one off the end into the extension area. This happens
- * with mmap() and mquery() used via __syscall().
*/
ap = &tf->tf_out[0];
nap = 6;
switch (code) {
case SYS_syscall:
- case SYS___syscall:
indirect = code;
code = *ap++;
nap--;
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 029d06a2b3b..4bb0a8c905b 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.239 2023/01/07 05:24:58 guenther Exp $
+; $OpenBSD: syscalls.master,v 1.240 2023/02/11 23:07:25 deraadt Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -360,7 +360,7 @@
196 OBSOL ogetdirentries48
197 STD { void *sys_pad_mmap(void *addr, size_t len, int prot, \
int flags, int fd, long pad, off_t pos); }
-198 INDIR { quad_t sys___syscall(quad_t num, ...); }
+198 OBSOL __syscall
199 STD NOLOCK { off_t sys_pad_lseek(int fd, int pad, off_t offset, \
int whence); }
200 STD { int sys_pad_truncate(const char *path, int pad, \
diff --git a/sys/sys/syscall_mi.h b/sys/sys/syscall_mi.h
index 07c2c9bab9f..7f88ce78ef9 100644
--- a/sys/sys/syscall_mi.h
+++ b/sys/sys/syscall_mi.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall_mi.h,v 1.27 2023/01/16 05:32:05 deraadt Exp $ */
+/* $OpenBSD: syscall_mi.h,v 1.28 2023/02/11 23:07:23 deraadt Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -77,9 +77,6 @@ mi_syscall(struct proc *p, register_t code, int indirect,
case SYS_syscall:
indirect = KTRC_CODE_SYSCALL;
break;
- case SYS___syscall:
- indirect = KTRC_CODE__SYSCALL;
- break;
default:
indirect = 0;
}