more or less works (with kill)
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
#include "epilogues.h"
|
||||
|
||||
#include "../debug/output.h"
|
||||
#include "../arch/core.h"
|
||||
#include "../arch/lapic.h"
|
||||
#include "guard.h"
|
||||
#include "../thread/scheduler.h"
|
||||
|
||||
extern Key kout_key;
|
||||
|
||||
#include "../user/app1/appl.h"
|
||||
extern Application application1;
|
||||
namespace Epilogues {
|
||||
|
||||
void keyboard(Vault& v) {
|
||||
v.kout.setPos(0,0);
|
||||
v.kout << kout_key.ascii() << flush ;
|
||||
|
||||
if(kout_key.scancode == Key::KEY_K)
|
||||
v.sch.kill(v.sch.dispatcher.lifePointer[3]);
|
||||
}
|
||||
|
||||
void timer(Vault& v) {
|
||||
@@ -23,11 +29,13 @@ void timer(Vault& v) {
|
||||
v.kout << counter++ << flush;
|
||||
v.kout.setPos(x, y);
|
||||
}
|
||||
DBG << "timer C:" << dec << Core::getID() << " L:" << LAPIC::getID() << "\n" << flush;
|
||||
|
||||
v.sch.resume(true);
|
||||
}
|
||||
|
||||
void assassin(Vault& v) {
|
||||
DBG << "assassin epilog\n"<< endl;
|
||||
if (v.sch.active()->kill_flag) {
|
||||
v.sch.exit();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void Guard::relay(Epilogue handler) {
|
||||
|
||||
Core::Interrupt::enable(); // goto level 0.5
|
||||
if(epi_flag FOR_CURRENT_CORE){
|
||||
epilogue_queue->produce(handler);
|
||||
epilogue_queue FOR_CURRENT_CORE.produce(handler);
|
||||
}
|
||||
else{
|
||||
epi_flag FOR_CURRENT_CORE = true;
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
#include "../device/ps2controller.h"
|
||||
|
||||
#include "../sync/ticketlock.h"
|
||||
#include "../arch/core_interrupt.h"
|
||||
#include "epilogues.h"
|
||||
#include "guard.h"
|
||||
|
||||
|
||||
Key kout_key = Key();
|
||||
|
||||
void printContext(const InterruptContext *context) {
|
||||
@@ -77,6 +79,7 @@ void handle_keyboard() {
|
||||
LAPIC::endOfInterrupt();
|
||||
if (kout_key.ctrl() && kout_key.alt() && kout_key.scancode == Key::KEY_DEL)
|
||||
System::reboot();
|
||||
|
||||
Guard::relay(Epilogues::keyboard);
|
||||
}
|
||||
else
|
||||
@@ -98,6 +101,7 @@ void handle_keyboard() {
|
||||
[[gnu::interrupt]] void handle_assassin(InterruptContext *context) {
|
||||
(void)context;
|
||||
LAPIC::endOfInterrupt();
|
||||
DBG << "assassin handler\n"<< endl;
|
||||
Guard::relay(Epilogues::assassin);
|
||||
}
|
||||
[[gnu::interrupt]] void handle_wakeup(InterruptContext *context) {
|
||||
@@ -126,6 +130,8 @@ void initInterruptHandlers() {
|
||||
IDT::InterruptDescriptor::Returning(handle_keyboard_asm));
|
||||
IDT::set(Core::Interrupt::Vector::TIMER,
|
||||
IDT::InterruptDescriptor::Returning(handle_timer));
|
||||
IDT::set(Core::Interrupt::Vector::ASSASSIN,
|
||||
IDT::InterruptDescriptor::Returning(handle_assassin));
|
||||
// Load the idt pointer
|
||||
IDT::load();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user