commit 23e4afe25408d5450173c76fca5a3d6f16dacdbd
parent 05ecb45ae40f365a64dab6261bdd38bbff1cd8a8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 6 Nov 2024 21:39:35 +0100
os9: Update arm64 code to use seterror()
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/os9/arch/arm64/trap.c b/src/os9/arch/arm64/trap.c
@@ -1,3 +1,4 @@
+#include <errno.h>
#include <setjmp.h>
#include <stdint.h>
@@ -18,20 +19,21 @@ syscall(Context *ctx)
if (nsys < 0 || nsys >= NR_SYSCALLS) {
kprint("trap: %llu: invalid syscall %d number\n",
ctx->r[X29], nsys);
- seterrno(EINVAL);
+ seterror(EINVAL);
return;
}
+ nsys = ctx->r[X0];
arg1 = ctx->r[X1];
arg2 = ctx->r[X2];
arg3 = ctx->r[X3];
arg4 = ctx->r[X4];
- sys = systab[n];
+ sys = &systab[nsys];
if (!sys->fn)
panic("null syscall entry");
- r = (*fn)(sys->narg, arg1, arg2, arg3, arg4);
- setret(r);
+ r = (*sys->fn)(sys->nargs, arg1, arg2, arg3, arg4);
+ seterror(r);
}
void
@@ -39,7 +41,7 @@ trap(Context *ctx)
{
enum ecvals ec;
const char *msg;
- int numsvc, nsyscall;
+ int numsvc;
ec = (ctx->r[ESR] >> 26) & 0x3f;
@@ -57,7 +59,7 @@ trap(Context *ctx)
kprint("trap: %llu: invalid svc %d number\n",
ctx->r[X29], numsvc);
seterror(EINVAL);
- setret(-1);
+ seterror(-1);
}
ctx->r[X0] = proc->ret;