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/mips64 | |
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/mips64')
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index 5fa9c7ef830..c4751488c23 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.170 2023/12/13 15:57:22 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.171 2024/01/11 19:16:26 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -400,11 +400,8 @@ fault_common_no_miss: unsigned int code; register_t tpc; uint32_t branch = 0; - int error, numarg; - struct args { - register_t i[8]; - } args; - register_t rval[2]; + int error; + register_t *args, rval[2]; atomic_inc_int(&uvmexp.syscalls); @@ -428,17 +425,10 @@ fault_common_no_miss: if (code > 0 && code < SYS_MAXSYSCALL) callp += code; - numarg = callp->sy_narg; - args.i[0] = locr0->a0; - args.i[1] = locr0->a1; - args.i[2] = locr0->a2; - args.i[3] = locr0->a3; - if (numarg > 4) { - args.i[4] = locr0->a4; - args.i[5] = locr0->a5; - args.i[6] = locr0->a6; - args.i[7] = locr0->a7; - } + /* + * This relies upon a0-a5 being contiguous in struct trapframe. + */ + args = &locr0->a0; rval[0] = 0; rval[1] = 0; @@ -448,7 +438,7 @@ fault_common_no_miss: TRAPSIZE : trppos[ci->ci_cpuid]) - 1].code = code; #endif - error = mi_syscall(p, code, callp, args.i, rval); + error = mi_syscall(p, code, callp, args, rval); switch (error) { case 0: |