diff --git a/device/ps2controller.cc b/device/ps2controller.cc index 8bed30a..e2c493d 100644 --- a/device/ps2controller.cc +++ b/device/ps2controller.cc @@ -122,10 +122,7 @@ bool fetch(Key &pressed) { pressed = key_decoder.decode(out_buffer); - if (pressed.alt() || pressed.ctrl() || !pressed.valid()) - return false; - else - return true; + return true; } void setRepeatRate(Speed speed, Delay delay) { diff --git a/device/textstream.h b/device/textstream.h index 561f9b3..b8e853e 100644 --- a/device/textstream.h +++ b/device/textstream.h @@ -20,7 +20,7 @@ * \ref TextWindow and only implements the method \ref TextStream::flush(). * Further formatting or special effects are implemented in \ref TextWindow. */ -class TextStream: public OutputStream, protected TextWindow { +class TextStream: public OutputStream, public TextWindow { // Prevent copies and assignments TextStream(const TextStream&) = delete; TextStream& operator=(const TextStream&) = delete; diff --git a/interrupt/epilogues.cc b/interrupt/epilogues.cc index a993ed6..4572b75 100644 --- a/interrupt/epilogues.cc +++ b/interrupt/epilogues.cc @@ -8,7 +8,9 @@ extern Key kout_key; namespace Epilogues { void keyboard(Vault& g) { + g.kout.setPos(0,0); g.kout << kout_key.ascii() << flush ; + } void timer(Vault& g) { (void)g; } diff --git a/interrupt/guard.cc b/interrupt/guard.cc index c172143..13b1d3b 100644 --- a/interrupt/guard.cc +++ b/interrupt/guard.cc @@ -25,7 +25,7 @@ Guarded::~Guarded() { Guard::leave(); } Guarded Guard::enter() { epi_flag FOR_CURRENT_CORE = true; - Core::Interrupt::enable(); + //Core::Interrupt::enable(); global_lock.lock(); return Guarded(global_vault); } @@ -34,16 +34,17 @@ void Guard::leave() { bool istate = Core::Interrupt::disable(); Epilogue next; + global_lock.unlock(); while(epilogue_queue FOR_CURRENT_CORE.consume(next)){ Core::Interrupt::enable(); + global_lock.lock(); next(global_vault); + global_lock.unlock(); Core::Interrupt::disable(); } epi_flag FOR_CURRENT_CORE = false; - global_lock.unlock(); Core::Interrupt::restore(istate); } - void Guard::relay(Epilogue handler) { //if(!epilogue_queue FOR_CURRENT_CORE.produce(handler)) // return; // enqueue, but dont execute @@ -62,9 +63,9 @@ void Guard::relay(Epilogue handler) { epi_flag FOR_CURRENT_CORE = true; global_lock.lock(); handler(global_vault); - global_lock.unlock(); + leave(); } - epilogue_queue->consume(handler); + //epilogue_queue->consume(handler); } diff --git a/interrupt/handlers.cc b/interrupt/handlers.cc index 4e0e87d..9adcb99 100644 --- a/interrupt/handlers.cc +++ b/interrupt/handlers.cc @@ -79,15 +79,16 @@ extern Vault keyboard_vault; void handle_keyboard() { //Key key = Key(); if (PS2Controller::fetch(kout_key)) { - Guard::relay(Epilogues::keyboard); + LAPIC::endOfInterrupt(); + 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 if (kout_key.ctrl() && kout_key.alt() && kout_key.scancode == Key::KEY_DEL) - System::reboot(); - - LAPIC::endOfInterrupt(); + else + LAPIC::endOfInterrupt(); } [[gnu::interrupt]] void handle_panic(InterruptContext *context) { diff --git a/user/app1/appl.cc b/user/app1/appl.cc index 97dfe82..8216a72 100644 --- a/user/app1/appl.cc +++ b/user/app1/appl.cc @@ -39,15 +39,16 @@ void Application::action() { // NOLINT { Guarded g = Guard::enter(); //g.vault(); - while(text[cnt++] != '\n'){ - DBG << cnt; - } + g.vault().kout.setPos((unsigned)0,(unsigned)Core::getID()*2+1); + + g.vault().kout << cnt++ << flush; + //g.vault().kout << endl << flush; //Guard::leave(); //koutlock.unlock(); } Core::pause(); - activeWaitDelay(100000000); + //activeWaitDelay(1000000000); if(cnt >= sizeof(text)-1) cnt=0;