summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2024-01-11 19:16:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2024-01-11 19:16:28 +0000
commitc936d21ceee5b01f5dbfec8ddf338ec38ce8077c (patch)
tree6d5db37081183ab50596ba2d8c91f48a8583c307 /sys/arch/alpha
parented471b32aaab139bce13d84ff87af6b3a00c2a5c (diff)
Since no system call takes more than 6 arguments, and no more than one
off_t argument, there is no need to process more than 6 arguments on 64-bit platforms and 8 on 32-bit platforms. Make the syscall argument gathering code simpler by removing never-used code to fetch more arguments from the stack, and local argument arrays when pointing to the trap frame does the job. ok guenther@ jsing@
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/alpha/trap.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index c5d57de02ab..899b3edccf2 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.110 2023/12/13 15:57:22 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.111 2024/01/11 19:16:26 miod Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -501,10 +501,10 @@ syscall(u_int64_t code, struct trapframe *framep)
{
const struct sysent *callp = sysent;
struct proc *p;
- int error;
+ int error = ENOSYS;
u_int64_t opc;
u_long rval[2];
- u_long args[10]; /* XXX */
+ u_long args[6];
u_int nargs;
atomic_add_int(&uvmexp.syscalls, 1);
@@ -513,18 +513,13 @@ syscall(u_int64_t code, struct trapframe *framep)
framep->tf_regs[FRAME_SP] = alpha_pal_rdusp();
opc = framep->tf_regs[FRAME_PC] - 4;
- // XXX out of range stays on syscall0, which we assume is enosys
- if (code > 0 && code < SYS_MAXSYSCALL)
- callp += code;
+ if (code <= 0 || code >= SYS_MAXSYSCALL)
+ goto bad;
+
+ callp += code;
nargs = callp->sy_narg;
switch (nargs) {
- default:
- if (nargs > 10) /* XXX */
- panic("syscall: too many args (%d)", nargs);
- if ((error = copyin((caddr_t)(framep->tf_regs[FRAME_SP]), &args[6],
- (nargs - 6) * sizeof(u_long))))
- goto bad;
case 6:
args[5] = framep->tf_regs[FRAME_A5];
case 5: