rum
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "epilogues.h"
|
#include "epilogues.h"
|
||||||
|
|
||||||
|
#include "../debug/output.h"
|
||||||
#include "guard.h"
|
#include "guard.h"
|
||||||
|
|
||||||
extern Key kout_key;
|
extern Key kout_key;
|
||||||
@@ -8,6 +9,7 @@ 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 ;
|
kout << kout_key.ascii() << endl << flush ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,22 +44,23 @@ void Guard::leave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Guard::relay(Epilogue handler) {
|
void Guard::relay(Epilogue handler) {
|
||||||
if(!epilogue_queue FOR_CURRENT_CORE.consume(handler))
|
//if(!epilogue_queue FOR_CURRENT_CORE.produce(handler))
|
||||||
return; // enqueue, but dont execute
|
// return; // enqueue, but dont execute
|
||||||
if(epi_flag FOR_CURRENT_CORE){
|
//if(!epi_flag FOR_CURRENT_CORE){
|
||||||
enter();
|
// enter();
|
||||||
Core::Interrupt::disable();
|
// Core::Interrupt::enable();
|
||||||
leave();
|
|
||||||
}
|
|
||||||
//Core::Interrupt::enable(); // goto level 0.5
|
|
||||||
//if(epi_flag FOR_CURRENT_CORE){
|
|
||||||
// epilogue_queue->produce(handler);
|
|
||||||
//}
|
|
||||||
//else{
|
|
||||||
// epi_flag FOR_CURRENT_CORE = true;
|
|
||||||
// handler(global_vault);
|
// handler(global_vault);
|
||||||
// leave(); // maybe not needed since destructor also calls leave
|
// leave();
|
||||||
//}
|
//}
|
||||||
|
Core::Interrupt::enable(); // goto level 0.5
|
||||||
|
if(epi_flag FOR_CURRENT_CORE){
|
||||||
|
epilogue_queue->produce(handler);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
epi_flag FOR_CURRENT_CORE = true;
|
||||||
|
handler(global_vault);
|
||||||
|
leave(); // maybe not needed since destructor also calls leave
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vault &Guard::unsafeConstAccess() { return global_vault; }
|
const Vault &Guard::unsafeConstAccess() { return global_vault; }
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ 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);
|
||||||
|
|||||||
6
main.cc
6
main.cc
@@ -31,7 +31,7 @@ Ticketlock koutlock;
|
|||||||
//};
|
//};
|
||||||
|
|
||||||
TextStream dout[Core::MAX] = {
|
TextStream dout[Core::MAX] = {
|
||||||
{0, 40, 10, 14},
|
{0, 40, 10, 20},
|
||||||
{40, 80, 10, 14},
|
{40, 80, 10, 14},
|
||||||
{0, 40, 14, 18},
|
{0, 40, 14, 18},
|
||||||
{40, 80, 14, 18},
|
{40, 80, 14, 18},
|
||||||
@@ -110,8 +110,8 @@ extern "C" int main() {
|
|||||||
|
|
||||||
Application{}.action();
|
Application{}.action();
|
||||||
while (true){
|
while (true){
|
||||||
DBG << "pos: " << testx << ", " << testy << endl << flush;
|
//DBG << "pos: " << testx << ", " << testy << endl << flush;
|
||||||
Core::pause();
|
//Core::pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "sync/ticketlock.h"
|
#include "sync/ticketlock.h"
|
||||||
|
#include "debug/output.h"
|
||||||
|
|
||||||
void Ticketlock::lock() {
|
void Ticketlock::lock() {
|
||||||
uint64_t ticket = __atomic_fetch_add(&ticket_count, 1, __ATOMIC_RELAXED);
|
uint64_t ticket = __atomic_fetch_add(&ticket_count, 1, __ATOMIC_RELAXED);
|
||||||
@@ -8,5 +9,7 @@ void Ticketlock::lock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Ticketlock::unlock() {
|
void Ticketlock::unlock() {
|
||||||
__atomic_fetch_add(&ticket_current, 1, __ATOMIC_RELEASE);
|
if(ticket_current != ticket_count){
|
||||||
|
__atomic_fetch_add(&ticket_current, 1, __ATOMIC_RELEASE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void Application::action() { // NOLINT
|
|||||||
kout << text[cnt-1];
|
kout << text[cnt-1];
|
||||||
}
|
}
|
||||||
kout << endl << flush;
|
kout << endl << flush;
|
||||||
Guard::leave();
|
//Guard::leave();
|
||||||
//koutlock.unlock();
|
//koutlock.unlock();
|
||||||
|
|
||||||
activeWaitDelay(1000000000);
|
activeWaitDelay(1000000000);
|
||||||
|
|||||||
Reference in New Issue
Block a user