summaryrefslogtreecommitdiff
path: root/src/sys/os
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-17 21:20:29 -0400
committerIan Moffett <ian@osmora.org>2025-09-17 21:27:49 -0400
commit79822e485edb7b447ab8cb17fdc0f572b598d829 (patch)
treeee142dcadb3488b7e64766d933826520a11ed43d /src/sys/os
parent8e268df60bde6b5548b849cc9b83a224a74b3e43 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'src/sys/os')
-rw-r--r--src/sys/os/os_proc.c19
-rw-r--r--src/sys/os/os_syscall.c9
2 files changed, 22 insertions, 6 deletions
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 <sys/types.h>
#include <sys/param.h>
#include <sys/proc.h>
+#define _NEED_UNIX_SCTAB
+#include <compat/unix/syscall.h>
-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);