From c936d21ceee5b01f5dbfec8ddf338ec38ce8077c Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Thu, 11 Jan 2024 19:16:28 +0000 Subject: 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@ --- sys/arch/arm64/arm64/syscall.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'sys/arch/arm64') 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 * @@ -26,16 +26,14 @@ #include -#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; -- cgit v1.2.3