summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/proc/scheduler.c
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-10-09 10:24:41 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-10-09 10:24:41 -0400
commitcc23ea5a4b38807e79aceb23e6f43e965926618f (patch)
tree90142bb44186f4dad7bbd82d3d53655b835c822b /arch/x86_64/proc/scheduler.c
parent434ddcd907832b1febc7d70e4faa52109c7eb3bd (diff)
downloadjove-kernel-cc23ea5a4b38807e79aceb23e6f43e965926618f.tar.gz
jove-kernel-cc23ea5a4b38807e79aceb23e6f43e965926618f.tar.bz2
jove-kernel-cc23ea5a4b38807e79aceb23e6f43e965926618f.zip
add basic scheduler logic. rename init rootdir indexes
Diffstat (limited to 'arch/x86_64/proc/scheduler.c')
-rw-r--r--arch/x86_64/proc/scheduler.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86_64/proc/scheduler.c b/arch/x86_64/proc/scheduler.c
new file mode 100644
index 0000000..23e54af
--- /dev/null
+++ b/arch/x86_64/proc/scheduler.c
@@ -0,0 +1,20 @@
+#include "proc/scheduler.h"
+#include "arch/x86_64/hal/gdt.h"
+#include "process.h"
+#include "../hal/smp.h"
+#include <string.h>
+
+void
+_scheduler_switch_pcb_arch(pcb_t *target)
+{
+ processor_t *proc = processor_current();
+ proc->tss.rsp[0] = (uintptr_t)target->header.ksp;
+
+ if(target->iopb) {
+ proc->tss.iopb = sizeof(struct tss);
+ jove_owned_obj_t *iopb_obj = obj_take(target->iopb);
+ memcpy(proc->iopb, obj_deref(iopb_obj), sizeof(proc->iopb));
+ }else{
+ proc->tss.iopb = 0xff;
+ }
+}