x86_64: Invoke the scheduler every millisecond
This commit is contained in:
parent
13f5d09cfd
commit
c907e16311
@ -48,12 +48,7 @@ load_tr:
|
||||
ltr ax
|
||||
ret
|
||||
|
||||
global switch_task
|
||||
switch_task:
|
||||
cli
|
||||
.loop:
|
||||
hlt
|
||||
jmp .loop
|
||||
extern switch_task
|
||||
|
||||
global kernel_yield
|
||||
kernel_yield:
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "arch/Timer.h"
|
||||
#include "arch/x86_64/CPU.h"
|
||||
#include "arch/x86_64/IO.h"
|
||||
#include "thread/Scheduler.h"
|
||||
#include <cpuid.h>
|
||||
#include <luna/Check.h>
|
||||
#include <luna/Result.h>
|
||||
@ -336,6 +337,7 @@ extern "C" void arch_interrupt_entry(Registers* regs)
|
||||
else if (regs->isr == 32)
|
||||
{
|
||||
Timer::tick();
|
||||
if (should_invoke_scheduler()) Scheduler::invoke(regs);
|
||||
pic_eoi(regs);
|
||||
}
|
||||
else
|
||||
@ -442,4 +444,10 @@ namespace CPU
|
||||
{
|
||||
task_state_segment.rsp[0] = top;
|
||||
}
|
||||
}
|
||||
|
||||
// called by kernel_yield
|
||||
extern "C" void switch_task(Registers* regs)
|
||||
{
|
||||
Scheduler::switch_task(regs);
|
||||
}
|
Loading…
Reference in New Issue
Block a user