feat(scheduler): working scheduler
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
#include <Arch/Timer.h>
|
||||
#include <Arch/GIC.h>
|
||||
#include <OS/Scheduler.h>
|
||||
#include <Arch/Exceptions.h>
|
||||
|
||||
static volatile UInt64 sTimerCounter = 0;
|
||||
|
||||
void TimerInitialize() {
|
||||
GICEnableInterrupt(kTimerIRQ);
|
||||
@@ -12,3 +16,13 @@ void TimerReset(UInt64 interval) {
|
||||
__asm__ volatile ("msr cntv_tval_el0, %0" :: "r"(frequency /interval));
|
||||
__asm__ volatile ("msr cntv_ctl_el0, %0" :: "r"((UInt64)1));
|
||||
}
|
||||
|
||||
Address TimerHandler(ExceptionsContext* frame) {
|
||||
sTimerCounter++;
|
||||
TimerReset(kTimerFrequency);
|
||||
return SchedulerNext((Address)frame);
|
||||
}
|
||||
|
||||
UInt64 TimerGetCounter() {
|
||||
return sTimerCounter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user