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