diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2024-01-11 19:16:28 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2024-01-11 19:16:28 +0000 |
commit | c936d21ceee5b01f5dbfec8ddf338ec38ce8077c (patch) | |
tree | 6d5db37081183ab50596ba2d8c91f48a8583c307 /sys/arch/arm64 | |
parent | ed471b32aaab139bce13d84ff87af6b3a00c2a5c (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/arm64')
-rw-r--r-- | sys/arch/arm64/arm64/syscall.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/sys/arch/arm64/arm64/syscall.c b/sys/arch/arm64/arm64/syscall.c index 675423d1cc2..21a77a019a6 100644 --- a/sys/arch/arm64/arm64/syscall.c +++ b/sys/arch/arm64/arm64/syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.c,v 1.17 2023/12/13 15:57:22 miod Exp $ */ +/* $OpenBSD: syscall.c,v 1.18 2024/01/11 19:16:26 miod Exp $ */ /* * Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com> * @@ -26,16 +26,14 @@ #include <uvm/uvm_extern.h> -#define MAXARGS 8 - void svc_handler(trapframe_t *frame) { struct proc *p = curproc; const struct sysent *callp; int code, error = ENOSYS; - u_int nap = 8, nargs; - register_t *ap, *args, copyargs[MAXARGS], rval[2]; + u_int nargs; + register_t *args, rval[2]; uvmexp.syscalls++; @@ -47,24 +45,12 @@ svc_handler(trapframe_t *frame) frame->tf_elr += 8; code = frame->tf_x[8]; - - ap = &frame->tf_x[0]; - if (code <= 0 || code >= SYS_MAXSYSCALL) goto bad; callp = sysent + code; - nargs = callp->sy_argsize / sizeof(register_t); - if (nargs <= nap) { - args = ap; - } else { - KASSERT(nargs <= MAXARGS); - memcpy(copyargs, ap, nap * sizeof(register_t)); - if ((error = copyin((void *)frame->tf_sp, copyargs + nap, - (nargs - nap) * sizeof(register_t)))) - goto bad; - args = copyargs; - } + nargs = callp->sy_narg; + args = &frame->tf_x[0]; rval[0] = 0; rval[1] = 0; |