summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2021-12-09 00:26:12 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2021-12-09 00:26:12 +0000
commit7e6e414e2c08159131c872247dcdcf8ef812a294 (patch)
treeca5f0e06b96c8fcbbcc7167df41d831d6f3302d3 /sys/arch
parentb6288ade839f9de0cd569d091510068f0e78bb51 (diff)
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and
SYS_syscall as the nosys() function into the MD syscall entry routines and the SYSCALL_DEBUG support. Adjust alpha's syscall check to match the other archs. Also, make sysent const to get it into .rodata. With that, 'struct emul' is unused: delete it and all its references ok millert@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/trap.c16
-rw-r--r--sys/arch/amd64/amd64/trap.c10
-rw-r--r--sys/arch/arm/arm/syscall.c12
-rw-r--r--sys/arch/arm64/arm64/syscall.c12
-rw-r--r--sys/arch/hppa/hppa/trap.c17
-rw-r--r--sys/arch/i386/i386/trap.c17
-rw-r--r--sys/arch/m88k/m88k/trap.c30
-rw-r--r--sys/arch/mips64/mips64/trap.c17
-rw-r--r--sys/arch/powerpc/powerpc/trap.c17
-rw-r--r--sys/arch/powerpc64/powerpc64/syscall.c11
-rw-r--r--sys/arch/riscv64/riscv64/syscall.c11
-rw-r--r--sys/arch/sh/sh/trap.c17
-rw-r--r--sys/arch/sparc64/sparc64/trap.c12
13 files changed, 85 insertions, 114 deletions
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 2fd696df0a5..f5a8ca8f70c 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.99 2020/11/07 16:12:20 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.100 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -525,9 +525,9 @@ syscall(code, framep)
u_int64_t code;
struct trapframe *framep;
{
- struct sysent *callp;
+ const struct sysent *callp;
struct proc *p;
- int error, numsys;
+ int error;
u_int64_t opc;
u_long rval[2];
u_long args[10]; /* XXX */
@@ -539,9 +539,6 @@ syscall(code, framep)
framep->tf_regs[FRAME_SP] = alpha_pal_rdusp();
opc = framep->tf_regs[FRAME_PC] - 4;
- callp = p->p_p->ps_emul->e_sysent;
- numsys = p->p_p->ps_emul->e_nsysent;
-
switch(code) {
case SYS_syscall:
case SYS___syscall:
@@ -557,10 +554,11 @@ syscall(code, framep)
}
error = 0;
- if (code < numsys)
- callp += code;
+ callp = sysent;
+ if (code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
- callp += p->p_p->ps_emul->e_nosys;
+ callp += code;
nargs = callp->sy_narg + hidden;
switch (nargs) {
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 87e65841638..334502b2e3f 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.89 2021/06/02 00:39:26 cheloha Exp $ */
+/* $OpenBSD: trap.c,v 1.90 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@@ -521,7 +521,6 @@ syscall(struct trapframe *frame)
const struct sysent *callp;
struct proc *p;
int error;
- int nsys;
size_t argsize, argoff;
register_t code, args[9], rval[2], *argp;
@@ -530,8 +529,6 @@ syscall(struct trapframe *frame)
p = curproc;
code = frame->tf_rax;
- callp = p->p_p->ps_emul->e_sysent;
- nsys = p->p_p->ps_emul->e_nsysent;
argp = &args[0];
argoff = 0;
@@ -549,8 +546,9 @@ syscall(struct trapframe *frame)
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
diff --git a/sys/arch/arm/arm/syscall.c b/sys/arch/arm/arm/syscall.c
index 1f0f284ee99..d8f97b18104 100644
--- a/sys/arch/arm/arm/syscall.c
+++ b/sys/arch/arm/arm/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.23 2021/05/16 03:39:27 jsg Exp $ */
+/* $OpenBSD: syscall.c,v 1.24 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: syscall.c,v 1.24 2003/11/14 19:03:17 scw Exp $ */
/*-
@@ -115,7 +115,6 @@ swi_handler(trapframe_t *frame)
code = frame->tf_r12;
ap = &frame->tf_r0;
- callp = p->p_p->ps_emul->e_sysent;
switch (code) {
case SYS_syscall:
@@ -129,11 +128,12 @@ swi_handler(trapframe_t *frame)
break;
}
- if (code < 0 || code >= p->p_p->ps_emul->e_nsysent) {
- callp += p->p_p->ps_emul->e_nosys;
- } else {
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
+ else
callp += code;
- }
+
nargs = callp->sy_argsize / sizeof(register_t);
if (nargs <= nap) {
args = ap;
diff --git a/sys/arch/arm64/arm64/syscall.c b/sys/arch/arm64/arm64/syscall.c
index 8412c2b93cc..a222c8410b0 100644
--- a/sys/arch/arm64/arm64/syscall.c
+++ b/sys/arch/arm64/arm64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.8 2021/05/16 03:30:33 jsg Exp $ */
+/* $OpenBSD: syscall.c,v 1.9 2021/12/09 00:26:11 guenther Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
*
@@ -56,7 +56,6 @@ svc_handler(trapframe_t *frame)
code = frame->tf_x[8];
ap = &frame->tf_x[0];
- callp = p->p_p->ps_emul->e_sysent;
switch (code) {
case SYS_syscall:
@@ -69,11 +68,12 @@ svc_handler(trapframe_t *frame)
break;
}
- if (code < 0 || code >= p->p_p->ps_emul->e_nsysent) {
- callp += p->p_p->ps_emul->e_nosys;
- } else {
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
+ else
callp += code;
- }
+
nargs = callp->sy_argsize / sizeof(register_t);
if (nargs <= nap) {
args = ap;
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index 2a90ad3f0ae..2df8bb365ef 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.154 2021/10/07 08:21:22 claudio Exp $ */
+/* $OpenBSD: trap.c,v 1.155 2021/12/09 00:26:11 guenther Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -762,9 +762,9 @@ void syscall(struct trapframe *frame);
void
syscall(struct trapframe *frame)
{
- register struct proc *p = curproc;
- register const struct sysent *callp;
- int retq, nsys, code, argsize, argoff, error;
+ struct proc *p = curproc;
+ const struct sysent *callp;
+ int retq, code, argsize, argoff, error;
register_t args[8], rval[2];
#ifdef DIAGNOSTIC
int oldcpl = curcpu()->ci_cpl;
@@ -776,8 +776,6 @@ syscall(struct trapframe *frame)
panic("syscall");
p->p_md.md_regs = frame;
- nsys = p->p_p->ps_emul->e_nsysent;
- callp = p->p_p->ps_emul->e_sysent;
argoff = 4; retq = 0;
switch (code = frame->tf_t1) {
@@ -789,8 +787,6 @@ syscall(struct trapframe *frame)
argoff = 3;
break;
case SYS___syscall:
- if (callp != sysent)
- break;
/*
* this works, because quads get magically swapped
* due to the args being laid backwards on the stack
@@ -810,8 +806,9 @@ syscall(struct trapframe *frame)
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys; /* bad syscall # */
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 86ca52a1b1b..8af32449dbd 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.155 2021/09/19 10:43:26 mpi Exp $ */
+/* $OpenBSD: trap.c,v 1.156 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -517,9 +517,9 @@ void
syscall(struct trapframe *frame)
{
caddr_t params;
- struct sysent *callp;
+ const struct sysent *callp;
struct proc *p;
- int error, nsys;
+ int error;
register_t code, args[8], rval[2];
#ifdef DIAGNOSTIC
int ocpl = lapic_tpr;
@@ -545,9 +545,6 @@ syscall(struct trapframe *frame)
p->p_md.md_regs = frame;
code = frame->tf_eax;
- nsys = p->p_p->ps_emul->e_nsysent;
- callp = p->p_p->ps_emul->e_sysent;
-
params = (caddr_t)frame->tf_esp + sizeof(int);
switch (code) {
@@ -563,16 +560,16 @@ syscall(struct trapframe *frame)
* Like syscall, but code is a quad, so as to maintain
* quad alignment for the rest of the arguments.
*/
- if (callp != sysent)
- break;
copyin(params + _QUAD_LOWWORD * sizeof(int), &code, sizeof(int));
params += sizeof(quad_t);
break;
default:
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys; /* illegal */
+
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
argsize = callp->sy_argsize;
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index 8ace9507e9b..28cdc6be601 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.119 2020/10/30 17:11:20 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.120 2021/12/09 00:26:11 guenther Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -1141,8 +1141,8 @@ error_fatal(struct trapframe *frame)
void
m88100_syscall(register_t code, struct trapframe *tf)
{
- int i, nsys, nap;
- struct sysent *callp;
+ int i, nap;
+ const struct sysent *callp;
struct proc *p = curproc;
int error;
register_t args[8] __aligned(8);
@@ -1151,9 +1151,6 @@ m88100_syscall(register_t code, struct trapframe *tf)
uvmexp.syscalls++;
- callp = p->p_p->ps_emul->e_sysent;
- nsys = p->p_p->ps_emul->e_nsysent;
-
p->p_md.md_tf = tf;
/*
@@ -1172,16 +1169,15 @@ m88100_syscall(register_t code, struct trapframe *tf)
nap--;
break;
case SYS___syscall:
- if (callp != sysent)
- break;
code = ap[_QUAD_LOWWORD];
ap += 2;
nap -= 2;
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
@@ -1264,8 +1260,8 @@ m88100_syscall(register_t code, struct trapframe *tf)
void
m88110_syscall(register_t code, struct trapframe *tf)
{
- int i, nsys, nap;
- struct sysent *callp;
+ int i, nap;
+ const struct sysent *callp;
struct proc *p = curproc;
int error;
register_t args[8] __aligned(8);
@@ -1274,9 +1270,6 @@ m88110_syscall(register_t code, struct trapframe *tf)
uvmexp.syscalls++;
- callp = p->p_p->ps_emul->e_sysent;
- nsys = p->p_p->ps_emul->e_nsysent;
-
p->p_md.md_tf = tf;
/*
@@ -1295,16 +1288,15 @@ m88110_syscall(register_t code, struct trapframe *tf)
nap--;
break;
case SYS___syscall:
- if (callp != sysent)
- break;
code = ap[_QUAD_LOWWORD];
ap += 2;
nap -= 2;
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 3c359ca6c64..857f9fed7c6 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.155 2021/10/24 15:29:10 visa Exp $ */
+/* $OpenBSD: trap.c,v 1.156 2021/12/09 00:26:11 guenther Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -400,11 +400,11 @@ fault_common_no_miss:
case T_SYSCALL+T_USER:
{
struct trapframe *locr0 = p->p_md.md_regs;
- struct sysent *callp;
+ const struct sysent *callp;
unsigned int code;
register_t tpc;
uint32_t branch = 0;
- int error, numarg, numsys;
+ int error, numarg;
struct args {
register_t i[8];
} args;
@@ -426,8 +426,7 @@ fault_common_no_miss:
trapframe->pc, 0, branch);
} else
locr0->pc += 4;
- callp = p->p_p->ps_emul->e_sysent;
- numsys = p->p_p->ps_emul->e_nsysent;
+ callp = sysent;
code = locr0->v0;
switch (code) {
case SYS_syscall:
@@ -439,8 +438,8 @@ fault_common_no_miss:
* platforms, which doesn't change anything here.
*/
code = locr0->a0;
- if (code >= numsys)
- callp += p->p_p->ps_emul->e_nosys; /* (illegal) */
+ if (code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
numarg = callp->sy_argsize / sizeof(register_t);
@@ -459,8 +458,8 @@ fault_common_no_miss:
}
break;
default:
- if (code >= numsys)
- callp += p->p_p->ps_emul->e_nosys; /* (illegal) */
+ if (code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index eee4b367bb5..5831bc1cf7e 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.122 2021/11/26 14:59:42 jsg Exp $ */
+/* $OpenBSD: trap.c,v 1.123 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -236,11 +236,11 @@ trap(struct trapframe *frame)
struct vm_map *map;
vaddr_t va;
int access_type;
- struct sysent *callp;
+ const struct sysent *callp;
size_t argsize;
register_t code, error;
register_t *params, rval[2], args[10];
- int nsys, n;
+ int n;
if (frame->srr1 & PSL_PR) {
type |= EXC_USER;
@@ -357,9 +357,6 @@ trap(struct trapframe *frame)
case EXC_SC|EXC_USER:
uvmexp.syscalls++;
- nsys = p->p_p->ps_emul->e_nsysent;
- callp = p->p_p->ps_emul->e_sysent;
-
code = frame->fixreg[0];
params = frame->fixreg + FIRSTARG;
@@ -377,16 +374,16 @@ trap(struct trapframe *frame)
* so as to maintain quad alignment
* for the rest of the args.
*/
- if (callp != sysent)
- break;
params++;
code = *params++;
break;
default:
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
+
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
argsize = callp->sy_argsize;
diff --git a/sys/arch/powerpc64/powerpc64/syscall.c b/sys/arch/powerpc64/powerpc64/syscall.c
index b383c7978f3..95fb92b5915 100644
--- a/sys/arch/powerpc64/powerpc64/syscall.c
+++ b/sys/arch/powerpc64/powerpc64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.7 2020/10/09 20:30:18 kettenis Exp $ */
+/* $OpenBSD: syscall.c,v 1.8 2021/12/09 00:26:11 guenther Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
@@ -31,13 +31,11 @@ syscall(struct trapframe *frame)
{
struct proc *p = curproc;
const struct sysent *callp;
- int code, error, nsys;
+ int code, error;
int nap = 8, nargs;
register_t *ap, *args, copyargs[MAXARGS], rval[2];
code = frame->fixreg[0];
- callp = p->p_p->ps_emul->e_sysent;
- nsys = p->p_p->ps_emul->e_nsysent;
ap = &frame->fixreg[3];
switch (code) {
@@ -48,8 +46,9 @@ syscall(struct trapframe *frame)
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
nargs = callp->sy_argsize / sizeof(register_t);
diff --git a/sys/arch/riscv64/riscv64/syscall.c b/sys/arch/riscv64/riscv64/syscall.c
index 615d2c9dfd1..44520a83e33 100644
--- a/sys/arch/riscv64/riscv64/syscall.c
+++ b/sys/arch/riscv64/riscv64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.10 2021/06/21 14:39:30 deraadt Exp $ */
+/* $OpenBSD: syscall.c,v 1.11 2021/12/09 00:26:11 guenther Exp $ */
/*
* Copyright (c) 2020 Brian Bamsch <bbamsch@google.com>
@@ -54,7 +54,6 @@ svc_handler(trapframe_t *frame)
ap = &frame->tf_a[0];
code = frame->tf_t[0];
- callp = p->p_p->ps_emul->e_sysent;
switch (code) {
case SYS_syscall:
@@ -67,11 +66,11 @@ svc_handler(trapframe_t *frame)
break;
}
- if (code < 0 || code >= p->p_p->ps_emul->e_nsysent) {
- callp += p->p_p->ps_emul->e_nosys;
- } else {
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
+ else
callp += code;
- }
nargs = callp->sy_argsize / sizeof(register_t);
if (nargs <= nap) {
args = ap;
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index b75d7582038..64e969df7be 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.48 2021/03/11 11:17:00 jsg Exp $ */
+/* $OpenBSD: trap.c,v 1.49 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@@ -512,7 +512,7 @@ syscall(struct proc *p, struct trapframe *tf)
{
caddr_t params;
const struct sysent *callp;
- int error, opc, nsys;
+ int error, opc;
size_t argsize;
register_t code, args[8], rval[2], ocode;
@@ -521,9 +521,6 @@ syscall(struct proc *p, struct trapframe *tf)
opc = tf->tf_spc;
ocode = code = tf->tf_r0;
- nsys = p->p_p->ps_emul->e_nsysent;
- callp = p->p_p->ps_emul->e_sysent;
-
params = (caddr_t)tf->tf_r15;
switch (code) {
@@ -538,8 +535,6 @@ syscall(struct proc *p, struct trapframe *tf)
* Like syscall, but code is a quad, so as to maintain
* quad alignment for the rest of the arguments.
*/
- if (callp != sysent)
- break;
#if _BYTE_ORDER == BIG_ENDIAN
code = tf->tf_r5;
#else
@@ -549,14 +544,16 @@ syscall(struct proc *p, struct trapframe *tf)
default:
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys; /* illegal */
+
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else
callp += code;
argsize = callp->sy_argsize;
#ifdef DIAGNOSTIC
if (argsize > sizeof args) {
- callp += p->p_p->ps_emul->e_nosys - code;
+ callp += SYS_syscall - code;
argsize = callp->sy_argsize;
}
#endif
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 1d7165d172f..0f996f913bf 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.109 2021/05/05 07:29:01 mpi Exp $ */
+/* $OpenBSD: trap.c,v 1.110 2021/12/09 00:26:11 guenther Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -1102,7 +1102,7 @@ out:
void
syscall(struct trapframe64 *tf, register_t code, register_t pc)
{
- int i, nsys, nap;
+ int i, nap;
int64_t *ap;
const struct sysent *callp;
struct proc *p = curproc;
@@ -1126,9 +1126,6 @@ syscall(struct trapframe64 *tf, register_t code, register_t pc)
new = code & SYSCALL_G2RFLAG;
code &= ~SYSCALL_G2RFLAG;
- callp = p->p_p->ps_emul->e_sysent;
- nsys = p->p_p->ps_emul->e_nsysent;
-
/*
* The first six system call arguments are in the six %o registers.
* Any arguments beyond that are in the `argument extension' area
@@ -1151,8 +1148,9 @@ syscall(struct trapframe64 *tf, register_t code, register_t pc)
break;
}
- if (code < 0 || code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
+ callp = sysent;
+ if (code < 0 || code >= SYS_MAXSYSCALL)
+ callp += SYS_syscall;
else {
register_t *argp;