diff options
-rw-r--r-- | .devcontainer/Dockerfile | 2 | ||||
-rw-r--r-- | kernel/main/kmain.c | 6 | ||||
-rw-r--r-- | kernel/proc/sched.c | 8 |
3 files changed, 13 insertions, 3 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 82b877f..9cf7799 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,4 +2,4 @@ FROM --platform=linux/x86_64 mcr.microsoft.com/devcontainers/base:ubuntu-22.04 LABEL authors="sotech117" RUN sudo apt-get update -RUN sudo apt-get install python2 python2-minimal cscope nasm make build-essential grub2-common qemu qemu-system xorriso genisoimage xterm gdb -y
\ No newline at end of file +RUN sudo apt-get install python2 python2-minimal cscope nasm make build-essential grub2-common grub-pc-bin qemu qemu-system xorriso genisoimage xterm gdb -y
\ No newline at end of file diff --git a/kernel/main/kmain.c b/kernel/main/kmain.c index 1d61270..e45299a 100644 --- a/kernel/main/kmain.c +++ b/kernel/main/kmain.c @@ -168,7 +168,7 @@ static void *initproc_run(long arg1, void *arg2) proctest_main(0, NULL); - dbg(DBG_PROC, "%s", "In main thread!"); + dbg(DBG_PROC, "%s", "In main thread!\n"); // see if there are any children to wait for while (do_waitpid(-1, 0, 0) != -ECHILD) @@ -205,7 +205,11 @@ void initproc_start() sched_make_runnable(init_thread); + // update current thread to main thread + curthr = init_thread; + context_make_active(&curcore.kc_ctx); // start the scheduler + // context_make_active(&init_thread->kt_ctx); // TODO: ask about how the core is linked to scheduler } diff --git a/kernel/proc/sched.c b/kernel/proc/sched.c index c4f1d5a..d0e634f 100644 --- a/kernel/proc/sched.c +++ b/kernel/proc/sched.c @@ -270,7 +270,13 @@ void sched_make_runnable(kthread_t *thr) { // NOT_YET_IMPLEMENTED("PROCS: sched_make_runnable"); - dbg(DBG_SCHED, "Making thread with proc pid %d runnable\n", thr->kt_proc->p_pid); + dbg(DBG_SCHED, "Making thread with proc pid %d runnable\n in thread\n", thr->kt_proc->p_pid); + if (curthr == NULL) + { + dbg(DBG_SCHED, "I did this ^^ with a null thread!\n"); + } else { + dbg(DBG_SCHED, "I did this ^^ with thread %d\n", curthr->kt_proc->p_pid); + } KASSERT(thr != curthr); KASSERT(thr->kt_state != KT_RUNNABLE); |