refactor: keep in mind the stack layout is crucial. Move context switching & signal...
[lunaix-os.git] / lunaix-os / kernel / sched.c
index 026fb515a8dbfbc34410e868de18ccad40b7b308..0a7250caa6c8818f12a5b3e66fba4f3291c5a9eb 100644 (file)
@@ -49,22 +49,10 @@ run(struct proc_info* proc)
 
     // FIXME: 这里还是得再考虑一下。
     // tss_update_esp(__current->intr_ctx.esp);
-
-    if (__current->page_table != proc->page_table) {
-        __current = proc;
-        cpu_lcr3(__current->page_table);
-        // from now on, the we are in the kstack of another process
-    } else {
-        __current = proc;
-    }
-
     apic_done_servicing();
 
-    signal_dispatch();
-
-    asm volatile("movl %0, %%eax\n"
-                 "jmp soft_iret\n" ::"r"(&__current->intr_ctx)
-                 : "eax", "memory");
+    asm volatile("pushl %0\n"
+                 "jmp switch_to\n" ::"r"(proc)); // kernel/asm/x86/interrupt.S
 }
 
 void