timer/scheduler working
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
#include "../debug/output.h"
|
||||
#include "guard.h"
|
||||
#include "../thread/scheduler.h"
|
||||
|
||||
extern Key kout_key;
|
||||
extern Scheduler sch;
|
||||
|
||||
namespace Epilogues {
|
||||
|
||||
@@ -13,7 +15,22 @@ void keyboard(Vault& g) {
|
||||
|
||||
}
|
||||
|
||||
void timer(Vault& g) { (void)g; }
|
||||
void timer(Vault& g) {
|
||||
static int counter = 0;
|
||||
int x, y;
|
||||
if(Core::getID() == 0) {
|
||||
g.kout.getPos(x, y);
|
||||
g.kout.setPos(65U, 0U);
|
||||
g.kout << counter++ << " " << flush;
|
||||
g.kout.setPos(x, y);
|
||||
}
|
||||
|
||||
void assassin(Vault& g) { (void)g; }
|
||||
sch.resume(true);
|
||||
}
|
||||
|
||||
void assassin(Vault& g) {
|
||||
if (sch.active()->kill_flag) {
|
||||
sch.exit();
|
||||
}
|
||||
}
|
||||
}; // namespace Epilogues
|
||||
|
||||
@@ -71,9 +71,6 @@ enum PAGE_FAULT_ERROR {
|
||||
kernelpanic("Page fault!");
|
||||
}
|
||||
|
||||
extern Ticketlock koutlock;
|
||||
extern Vault keyboard_vault;
|
||||
|
||||
void handle_keyboard() {
|
||||
//Key key = Key();
|
||||
if (PS2Controller::fetch(kout_key)) {
|
||||
@@ -81,9 +78,6 @@ void handle_keyboard() {
|
||||
if (kout_key.ctrl() && kout_key.alt() && kout_key.scancode == Key::KEY_DEL)
|
||||
System::reboot();
|
||||
Guard::relay(Epilogues::keyboard);
|
||||
//koutlock.lock();
|
||||
//kout << key.ascii() << endl << flush ;
|
||||
//koutlock.unlock();
|
||||
}
|
||||
else
|
||||
LAPIC::endOfInterrupt();
|
||||
@@ -97,10 +91,14 @@ void handle_keyboard() {
|
||||
|
||||
[[gnu::interrupt]] void handle_timer(InterruptContext *context) {
|
||||
(void)context;
|
||||
LAPIC::endOfInterrupt();
|
||||
Guard::relay(Epilogues::timer);
|
||||
}
|
||||
|
||||
[[gnu::interrupt]] void handle_assassin(InterruptContext *context) {
|
||||
(void)context;
|
||||
LAPIC::endOfInterrupt();
|
||||
Guard::relay(Epilogues::assassin);
|
||||
}
|
||||
[[gnu::interrupt]] void handle_wakeup(InterruptContext *context) {
|
||||
(void)context;
|
||||
@@ -120,6 +118,9 @@ void initInterruptHandlers() {
|
||||
IDT::set(Core::Interrupt::Vector::PAGE_FAULT,
|
||||
IDT::InterruptDescriptor::ReturningWithError(handle_page_fault));
|
||||
|
||||
IDT::set(Core::Interrupt::Vector::TIMER,
|
||||
IDT::InterruptDescriptor::Returning(handle_timer));
|
||||
|
||||
// TODO: Add more handlers here
|
||||
IDT::set(Core::Interrupt::Vector::KEYBOARD,
|
||||
IDT::InterruptDescriptor::Returning(handle_keyboard_asm));
|
||||
|
||||
Reference in New Issue
Block a user