From 79822e485edb7b447ab8cb17fdc0f572b598d829 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 17 Sep 2025 21:20:29 -0400 Subject: kern/amd64: Implement syscall domains and windows A syscall domain in the L5 kernel is a fixed list of "syscall windows", each syscall window represents a specific platform and/or syscall model. A platform latch within each domain determines which window / platform should be visible. Since syscall domains are per-process, these changes are local to their respective processes. Signed-off-by: Ian Moffett --- src/sys/os/os_proc.c | 19 +++++++++++++++++++ src/sys/os/os_syscall.c | 9 +++------ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/sys/os') diff --git a/src/sys/os/os_proc.c b/src/sys/os/os_proc.c index 6880dda..329a3ea 100644 --- a/src/sys/os/os_proc.c +++ b/src/sys/os/os_proc.c @@ -41,13 +41,32 @@ static pid_t next_pid = 0; int proc_init(struct proc *procp, int flags) { + struct syscall_domain *scdp; + struct syscall_win *winp; int error; if (procp == NULL) { return -EINVAL; } + /* Put the process in a known state */ + scdp = &procp->scdom; memset(procp, 0, sizeof(*procp)); + + /* + * Initialize each platform latch + */ + for (platch_t p = 0; p < __SC_PLATCH_MAX; ++p) { + winp = &scdp->slots[p]; + switch (p) { + case SC_PLATCH_UNIX: + winp->p = 1; + winp->sctab = &g_unix_sctab[0]; + winp->nimpl = UNIX_SCTAB_LEN; + break; + } + } + procp->pid = atomic_inc_int(&next_pid); error = md_proc_init(procp, flags); return error; diff --git a/src/sys/os/os_syscall.c b/src/sys/os/os_syscall.c index 060f774..782bfb4 100644 --- a/src/sys/os/os_syscall.c +++ b/src/sys/os/os_syscall.c @@ -31,10 +31,7 @@ #include #include #include +#define _NEED_UNIX_SCTAB +#include -scret_t(*g_sctab[])(struct syscall_args *) = { - [SYS_none] = NULL, - [SYS_exit] = sys_exit -}; - -const size_t MAX_SYSCALLS = NELEM(g_sctab); +const size_t UNIX_SCTAB_LEN = NELEM(g_unix_sctab); -- cgit v1.2.3