aboutsummaryrefslogtreecommitdiff
path: root/kernel/main/kmain.c
diff options
context:
space:
mode:
authorMichael Foiani <mfoiani@cs.brown.edu>2024-02-11 04:05:38 -0500
committerMichael Foiani <mfoiani@cs.brown.edu>2024-02-11 04:05:38 -0500
commitc2cebabba05eff0436faf90bbd691c1e36f7013c (patch)
tree395bd6c7513b028c82b9c4cd5ffc1ebf8e1787ca /kernel/main/kmain.c
parent65ece110519f88227039921b09dab60ec4d3d982 (diff)
add debug statements and start some testing
Diffstat (limited to 'kernel/main/kmain.c')
-rw-r--r--kernel/main/kmain.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/main/kmain.c b/kernel/main/kmain.c
index da8e1be..1d61270 100644
--- a/kernel/main/kmain.c
+++ b/kernel/main/kmain.c
@@ -86,6 +86,8 @@ void kmain()
for (size_t i = 0; i < sizeof(init_funcs) / sizeof(init_funcs[0]); i++)
init_funcs[i]();
+ dbg(DBG_PROC, "Starting init process\n");
+
initproc_start();
panic("\nReturned to kmain()\n");
}
@@ -164,7 +166,15 @@ static void *initproc_run(long arg1, void *arg2)
// dbg(DBG_THR, "Thread: %s\n", thread->kt_proc->p_name);
// }
- dbg(DBG_INIT, "%s", "In main thread!");
+ proctest_main(0, NULL);
+
+ dbg(DBG_PROC, "%s", "In main thread!");
+
+ // see if there are any children to wait for
+ while (do_waitpid(-1, 0, 0) != -ECHILD)
+ {
+ // do nothing
+ }
return NULL;
}
@@ -185,6 +195,8 @@ void initproc_start()
{
// NOT_YET_IMPLEMENTED("PROCS: initproc_start");
+ dbg(DBG_PROC, "Setting up the initial process and preparing it to run\n");
+
proc_t *init_proc = proc_create("init");
KASSERT(init_proc != NULL);