added kout to vault

main
Simon 5 months ago
parent 83e18391b7
commit 893fc4bad9

@ -9,9 +9,8 @@ extern TextStream kout;
namespace Epilogues { namespace Epilogues {
void keyboard(Vault& g) { void keyboard(Vault& g) {
DBG << "keyboard epi" << endl << flush;
(void)g; (void)g;
kout << kout_key.ascii() << endl << flush ; g.kout << kout_key.ascii() << endl << flush ;
} }
void timer(Vault& g) { (void)g; } void timer(Vault& g) { (void)g; }

@ -18,7 +18,8 @@ static BBuffer<Epilogue, 32> epilogue_queue[Core::MAX] = {};
constinit Ticketlock global_lock; constinit Ticketlock global_lock;
constinit bool epi_flag[Core::MAX] = {false}; constinit bool epi_flag[Core::MAX] = {false};
Vault::Vault() {} Vault::Vault() {
}
Guarded::~Guarded() { Guard::leave(); } Guarded::~Guarded() { Guard::leave(); }

@ -12,8 +12,9 @@
//! \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();
TextStream kout = TextStream(0, 80, 0, 10, true);
// no copy // no copy
//TextStream kout;
Vault(const Vault&) = delete; Vault(const Vault&) = delete;
Vault& operator=(const Vault&) = delete; Vault& operator=(const Vault&) = delete;
}; };

@ -78,7 +78,6 @@ extern Ticketlock koutlock;
extern Vault keyboard_vault; extern Vault keyboard_vault;
void handle_keyboard() { void handle_keyboard() {
DBG << "keyboard pro" << endl << flush;
//Key key = Key(); //Key key = Key();
if (PS2Controller::fetch(kout_key)) { if (PS2Controller::fetch(kout_key)) {
Guard::relay(Epilogues::keyboard); Guard::relay(Epilogues::keyboard);

@ -16,7 +16,7 @@
#include "sync/ticketlock.h" #include "sync/ticketlock.h"
#include "interrupt/guard.h" #include "interrupt/guard.h"
TextStream kout = TextStream(0, 80, 0, 10, true); ///TextStream kout = TextStream(0, 80, 0, 10, true);
Ticketlock koutlock; Ticketlock koutlock;
//TextStream dout[8] = { //TextStream dout[8] = {
@ -71,23 +71,6 @@ extern "C" int main() {
CGA::setCursor(0, 0); CGA::setCursor(0, 0);
unsigned int numCPUs = Core::count(); unsigned int numCPUs = Core::count();
DBG_VERBOSE << "Number of CPUs: " << numCPUs << endl;
kout << "Test <stream result> -> <expected>" << endl;
kout << "bool: " << true << " -> true" << endl;
kout << "zero: " << 0 << " -> 0" << endl;
kout << "binary: " << bin << 42 << dec << " -> 0b101010" << endl;
kout << "octal: " << oct << 42 << dec << " -> 052" << endl;
kout << "hex: " << hex << 42 << dec << " -> 0x2a" << endl;
kout << "uint64_t max: " << ~((uint64_t)0) << " -> 18446744073709551615" << endl;
kout << "int64_t max: " << ~(1ll<<63) << " -> 9223372036854775807" << endl;
kout << "int64_t min: " << (1ll<<63) << " -> -9223372036854775808" << endl;
kout << "some int64_t: " << (-1234567890123456789) << " -> -1234567890123456789" << endl;
kout << "some int64_t: " << (1234567890123456789) << " -> 1234567890123456789" << endl;
kout << "pointer: " << reinterpret_cast<void*>(1994473406541717165ull)
<< " -> 0x1badcafefee1dead" << endl;
kout << "smiley: " << static_cast<char>(1) << endl;
/* Start application processors /* Start application processors
* To avoid unexpected behaviour, make sure that interrupts are not * To avoid unexpected behaviour, make sure that interrupts are not
* enabled before the APs are booted. Otherwise it might interfere with the * enabled before the APs are booted. Otherwise it might interfere with the

@ -37,15 +37,16 @@ void Application::action() { // NOLINT
uint16_t cnt = 0; uint16_t cnt = 0;
while (1) { while (1) {
//koutlock.lock(); //koutlock.lock();
{
Guarded g = Guard::enter(); Guarded g = Guard::enter();
//g.vault(); //g.vault();
while(text[cnt++] != '\n'){ while(text[cnt++] != '\n'){
kout << text[cnt-1]; g.vault().kout << text[cnt-1];
} }
kout << endl << flush; g.vault().kout << endl << flush;
//Guard::leave(); //Guard::leave();
//koutlock.unlock(); //koutlock.unlock();
}
activeWaitDelay(1000000000); activeWaitDelay(1000000000);
if(cnt >= sizeof(text)-1) if(cnt >= sizeof(text)-1)
cnt=0; cnt=0;

Loading…
Cancel
Save