changes
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
-Iarch
|
||||
-xc++
|
||||
-std=gnu++2b
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
|
||||
#include "guard.h"
|
||||
|
||||
extern Key kout_key;
|
||||
extern TextStream kout;
|
||||
|
||||
namespace Epilogues {
|
||||
|
||||
void keyboard(Vault& g) {
|
||||
|
||||
(void)g;
|
||||
kout << kout_key.ascii() << endl << flush ;
|
||||
}
|
||||
|
||||
void timer(Vault& g) { (void)g; }
|
||||
|
||||
@@ -26,6 +26,7 @@ Guarded Guard::enter() {
|
||||
epi_flag FOR_CURRENT_CORE = true;
|
||||
Core::Interrupt::enable();
|
||||
global_lock.lock();
|
||||
return Guarded(global_vault);
|
||||
}
|
||||
|
||||
void Guard::leave() {
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
#include "../object/key.h"
|
||||
#include "../types.h"
|
||||
#include "epilogues.h"
|
||||
#include "../device/textstream.h"
|
||||
|
||||
//! \brief The epilogue vault contains the protected data for the epilogue level
|
||||
struct Vault {
|
||||
Vault();
|
||||
// no copy
|
||||
//TextStream kout;
|
||||
Vault(const Vault&) = delete;
|
||||
Vault& operator=(const Vault&) = delete;
|
||||
};
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "epilogues.h"
|
||||
#include "guard.h"
|
||||
|
||||
Key kout_key = Key();
|
||||
|
||||
void printContext(const InterruptContext *context) {
|
||||
DBG << "ip: " << hex << context->cs << ':' << context->ip
|
||||
<< " sp: " << context->ss << ':' << context->sp << " flags" << bin
|
||||
@@ -74,15 +76,16 @@ enum PAGE_FAULT_ERROR {
|
||||
extern TextStream kout;
|
||||
extern Ticketlock koutlock;
|
||||
extern Vault keyboard_vault;
|
||||
|
||||
void handle_keyboard() {
|
||||
Key key = Key();
|
||||
if (PS2Controller::fetch(key)) {
|
||||
//Key key = Key();
|
||||
if (PS2Controller::fetch(kout_key)) {
|
||||
Guard::relay(Epilogues::keyboard);
|
||||
//koutlock.lock();
|
||||
//kout << key.ascii() << endl << flush ;
|
||||
//koutlock.unlock();
|
||||
}
|
||||
else if (key.ctrl() && key.alt() && key.scancode == Key::KEY_DEL)
|
||||
else if (kout_key.ctrl() && kout_key.alt() && kout_key.scancode == Key::KEY_DEL)
|
||||
System::reboot();
|
||||
|
||||
LAPIC::endOfInterrupt();
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "../../device/textstream.h"
|
||||
#include "../../sync/ticketlock.h"
|
||||
#include "../../arch/core.h"
|
||||
#include "../../interrupt/guard.h"
|
||||
|
||||
char text[] = "Ich mag\n\
|
||||
Saftige Pflaumen voller Aroma\n\
|
||||
Ich knuddel jede Oma ins Koma\n\
|
||||
@@ -34,12 +36,15 @@ void activeWaitDelay(uint64_t cycles) {
|
||||
void Application::action() { // NOLINT
|
||||
uint16_t cnt = 0;
|
||||
while (1) {
|
||||
koutlock.lock();
|
||||
//koutlock.lock();
|
||||
Guarded g = Guard::enter();
|
||||
//g.vault();
|
||||
while(text[cnt++] != '\n'){
|
||||
kout << text[cnt-1];
|
||||
}
|
||||
kout << endl << flush;
|
||||
koutlock.unlock();
|
||||
Guard::leave();
|
||||
//koutlock.unlock();
|
||||
|
||||
activeWaitDelay(1000000000);
|
||||
if(cnt >= sizeof(text)-1)
|
||||
|
||||
Reference in New Issue
Block a user