Schedule on PIC timer raise.
This causes a page fault because we don't properly handle the sleep case.
This commit is contained in:
parent
496dfeaef9
commit
656687b183
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "common/port.h"
|
||||
#include "debug/debug.h"
|
||||
#include "scheduler/scheduler.h"
|
||||
|
||||
#define IDT_INTERRUPT_GATE 0x8E
|
||||
|
||||
|
@ -122,6 +123,7 @@ extern "C" void interrupt_timer(InterruptFrame*) {
|
|||
dbgln("timer: %us", cnt * 50 / 1000);
|
||||
}
|
||||
outb(PIC1_COMMAND, PIC_EOI);
|
||||
sched::Yield();
|
||||
}
|
||||
|
||||
void EnablePic() {
|
||||
|
|
|
@ -12,22 +12,31 @@
|
|||
#include "syscall/syscall.h"
|
||||
|
||||
extern "C" void zion() {
|
||||
dbgln("[boot] Init GDT & IDT.");
|
||||
InitGdt();
|
||||
InitIdt();
|
||||
|
||||
dbgln("[boot] Init Paging.");
|
||||
InitPaging();
|
||||
|
||||
dbgln("[boot] Init Physical Memory Manager.");
|
||||
phys_mem::InitBootstrapPageAllocation();
|
||||
KernelHeap heap(0xFFFFFFFF'40000000, 0xFFFFFFFF'80000000);
|
||||
phys_mem::InitPhysicalMemoryManager();
|
||||
|
||||
dbgln("[boot] Init syscalls.");
|
||||
InitSyscall();
|
||||
|
||||
dbgln("[boot] Init scheduler.");
|
||||
// Schedule every 50ms.
|
||||
SetFrequency(/* hertz= */ 20);
|
||||
sched::InitScheduler();
|
||||
sched::EnableScheduler();
|
||||
|
||||
dbgln("[boot] Loading sys init program.");
|
||||
LoadInitProgram();
|
||||
|
||||
dbgln("[boot] Init finished, yielding.");
|
||||
sched::EnableScheduler();
|
||||
sched::Yield();
|
||||
|
||||
dbgln("Sleeping!");
|
||||
|
|
Loading…
Reference in New Issue