aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-07 18:12:55 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-07 18:12:55 +0300
commitfe4c623cb9320226866829317cea8ba0c49e7dbc (patch)
tree7ea3723077c72ff7969747a70ece0b94d88d2219 /src
parentd592abd8ccc4026c51e196777031eb65c4acc4de (diff)
downloadkmi-fe4c623cb9320226866829317cea8ba0c49e7dbc.tar.gz
kmi-fe4c623cb9320226866829317cea8ba0c49e7dbc.zip
make executable entrypoint universal callback
+ Effectively means that all executables can be called into, but if an exe doesn't want to deal with anyone else it should just set a flag like `not_really_a_server` or whatever
Diffstat (limited to 'src')
-rw-r--r--src/proc.c5
-rw-r--r--src/uapi/dispatch.c1
-rw-r--r--src/uapi/ipc.c15
-rw-r--r--src/uapi/proc.c3
4 files changed, 5 insertions, 19 deletions
diff --git a/src/proc.c b/src/proc.c
index eaa25d8..09dcc5f 100644
--- a/src/proc.c
+++ b/src/proc.c
@@ -24,6 +24,7 @@ stat_t prepare_proc(struct tcb *t, vm_t bin, vm_t interp)
if (!entry)
return ERR_INVAL;
+ t->callback = entry;
alloc_stack(t);
set_thread(t);
set_return(t, entry);
@@ -61,10 +62,6 @@ stat_t init_proc(void *fdt, vm_t *proc_fdt, vm_t *proc_initrd)
stat_t ret = prepare_proc(t, get_init_base(fdt), 0);
assert(ret == OK);
- /** In the init process, can the entry be the callback? Is that too
- * unergonomic? */
- t->callback = t->exec;
-
/** \todo start one thread per core, with special handling for init in
* that each thread starts at the entry point of init? */
diff --git a/src/uapi/dispatch.c b/src/uapi/dispatch.c
index b5dbda2..16a17d2 100644
--- a/src/uapi/dispatch.c
+++ b/src/uapi/dispatch.c
@@ -60,7 +60,6 @@ void handle_syscall(sys_arg_t syscall, sys_arg_t a, sys_arg_t b,
break;
case SYS_REQ_REL_TIMER: sys_req_rel_timer(t, a, b, c, d, e); break;
case SYS_REQ_ABS_TIMER: sys_req_abs_timer(t, a, b, c, d, e); break;
- case SYS_IPC_SERVER: sys_ipc_server(t, a, b, c, d, e); break;
case SYS_IPC_REQ: sys_ipc_req(t, a, b, c, d, e); break;
case SYS_IPC_FWD: sys_ipc_fwd(t, a, b, c, d, e); break;
case SYS_IPC_KICK: sys_ipc_kick(t, a, b, c, d, e); break;
diff --git a/src/uapi/ipc.c b/src/uapi/ipc.c
index 613d4a9..3ac4727 100644
--- a/src/uapi/ipc.c
+++ b/src/uapi/ipc.c
@@ -166,7 +166,7 @@ static __noreturn void __run_notify(struct tcb *t, struct tcb *r)
/* signal to whoever is receiving us that we're from the kernel
* ("pid 0"), and we are notifying the current thread */
vm_t s = enter_rpc(t,
- SYS_RET5(0, code, flags, t->eid, t->tid),
+ SYS_RET5(0, t->tid, code, flags, t->eid),
IPC_REQ);
finalize_rpc(t, r, s);
@@ -271,19 +271,6 @@ static void leave_rpc(struct tcb *t, struct sys_ret a)
}
/**
- * IPC server notification syscall handler.
- *
- * @param t Current tcb.
- * @param callback Address of server callback.
- * @return \ref OK and \c 0.
- */
-SYSCALL_DEFINE1(ipc_server)(struct tcb *t, sys_arg_t callback)
-{
- get_cproc(t)->callback = callback;
- return_args1(t, OK);
-}
-
-/**
* Actual IPC syscall handler.
*
* @param t Current tcb.
diff --git a/src/uapi/proc.c b/src/uapi/proc.c
index ff02113..293a01f 100644
--- a/src/uapi/proc.c
+++ b/src/uapi/proc.c
@@ -37,6 +37,9 @@ SYSCALL_DEFINE5(create)(struct tcb *t, sys_arg_t func,
if (!c)
return_args1(t, ERR_OOMEM);
+ /** @todo there's quite a bit of overlap between this and what
+ * core_bringup() is doing, might separate this out into its own
+ * function? */
alloc_stack(c);
set_args5(c, c->tid, d0, d1, d2, d3);