summaryrefslogtreecommitdiff
path: root/sys/arch/arm
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2023-12-12 15:30:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2023-12-12 15:30:57 +0000
commit8c7460c9897521d5f816ac3fda78a94555c9b9b8 (patch)
treea76554430df0c1549d7f9a58111ca1376d678b61 /sys/arch/arm
parentd88a737e6a2d8df255f5eb84d88fdb69f559a924 (diff)
remove support for syscall(2) -- the "indirection system call" because
it is a dangerous alternative entry point for all system calls, and thus incompatible with the precision system call entry point scheme we are heading towards. This has been a 3-year mission: First perl needed a code-generated wrapper to fake syscall(2) as a giant switch table, then all the ports were cleaned with relatively minor fixes, except for "go". "go" required two fixes -- 1) a framework issue with old library versions, and 2) like perl, a fake syscall(2) wrapper to handle ioctl(2) and sysctl(2) because "syscall(SYS_ioctl" occurs all over the place in the "go" ecosystem because the "go developers" are plan9-loving unix-hating folk who tried to build an ecosystem without allowing "ioctl". ok kettenis, jsing, afresh1, sthen
Diffstat (limited to 'sys/arch/arm')
-rw-r--r--sys/arch/arm/arm/syscall.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/sys/arch/arm/arm/syscall.c b/sys/arch/arm/arm/syscall.c
index c23dcc32f2a..3879834e2ea 100644
--- a/sys/arch/arm/arm/syscall.c
+++ b/sys/arch/arm/arm/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.26 2023/02/11 23:07:26 deraadt Exp $ */
+/* $OpenBSD: syscall.c,v 1.27 2023/12/12 15:30:55 deraadt Exp $ */
/* $NetBSD: syscall.c,v 1.24 2003/11/14 19:03:17 scw Exp $ */
/*-
@@ -93,8 +93,8 @@ void
swi_handler(trapframe_t *frame)
{
struct proc *p = curproc;
- const struct sysent *callp;
- int code, error, indirect = -1;
+ const struct sysent *callp = sysent;
+ int code, error;
u_int nap = 4, nargs;
register_t *ap, *args, copyargs[MAXARGS], rval[2];
@@ -103,31 +103,18 @@ swi_handler(trapframe_t *frame)
/* Before enabling interrupts, save FPU state */
vfp_save();
- /* Re-enable interrupts if they were enabled previously */
- if (__predict_true((frame->tf_spsr & PSR_I) == 0))
- enable_interrupts(PSR_I);
+ enable_interrupts(PSR_I);
p->p_addr->u_pcb.pcb_tf = frame;
/* Skip over speculation-blocking barrier. */
frame->tf_pc += 8;
- code = frame->tf_r12;
-
ap = &frame->tf_r0;
- switch (code) {
- case SYS_syscall:
- indirect = code;
- code = *ap++;
- nap--;
- break;
- }
-
- callp = sysent;
- if (code < 0 || code >= SYS_MAXSYSCALL)
- callp += SYS_syscall;
- else
+ code = frame->tf_r12;
+ // XXX out of range stays on syscall0, which we assume is enosys
+ if (code >= 0 || code <= SYS_MAXSYSCALL)
callp += code;
nargs = callp->sy_argsize / sizeof(register_t);
@@ -145,27 +132,23 @@ swi_handler(trapframe_t *frame)
rval[0] = 0;
rval[1] = frame->tf_r1;
- error = mi_syscall(p, code, indirect, callp, args, rval);
+ error = mi_syscall(p, code, callp, args, rval);
switch (error) {
case 0:
frame->tf_r0 = rval[0];
frame->tf_r1 = rval[1];
-
frame->tf_spsr &= ~PSR_C; /* carry bit */
break;
-
case ERESTART:
/*
* Reconstruct the pc to point at the swi.
*/
frame->tf_pc -= 12;
break;
-
case EJUSTRETURN:
/* nothing to do */
break;
-
default:
bad:
frame->tf_r0 = error;