diff --git a/main.cc b/main.cc index 1691948..e49f722 100644 --- a/main.cc +++ b/main.cc @@ -22,6 +22,7 @@ ///TextStream kout = TextStream(0, 80, 0, 10, true); Ticketlock koutlock; +Scheduler sch; //TextStream dout[8] = { // TextStream(0 ,20,12,25,false), @@ -71,9 +72,9 @@ OutputStream* copyout[Core::MAX]{ unsigned int testx, testy; Context test1; -uint8_t test1_stack[256]; +uint8_t test1_stack[1024]; //Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]); -Application application = Application(test1_stack); +Application application = Application(&test1_stack[sizeof(test1_stack)-1]); //Context test2; //uint8_t test2_stack[256]; @@ -126,7 +127,6 @@ extern "C" int main() { DBG << "Main CPU " << static_cast(LAPIC::getID()) << endl << flush; - Scheduler sch; sch.ready(&application); sch.schedule(); diff --git a/thread/dispatcher.cc b/thread/dispatcher.cc index 1420f33..7ed5862 100644 --- a/thread/dispatcher.cc +++ b/thread/dispatcher.cc @@ -22,9 +22,11 @@ bool Dispatcher::isActive(const Thread *thread, unsigned *cpu) { } void Dispatcher::go(Thread *first) { + lifePointer[Core::getID()] = first; first->go(); } void Dispatcher::dispatch(Thread *next) { + lifePointer[Core::getID()] = next; lifePointer[Core::getID()]->resume(next); } diff --git a/user/app1/appl.cc b/user/app1/appl.cc index 2ea95c1..d3065e2 100644 --- a/user/app1/appl.cc +++ b/user/app1/appl.cc @@ -9,6 +9,10 @@ #include "../../interrupt/guard.h" #include "../../debug/output.h" #include "../../arch/context.h" +#include "../../thread/scheduler.h" + +extern Scheduler sch; + char text[] = "Ich mag\n\ Saftige Pflaumen voller Aroma\n\ Ich knuddel jede Oma ins Koma\n\ @@ -49,8 +53,11 @@ void Application::action() { // NOLINT //Guard::leave(); //koutlock.unlock(); } - Core::pause(); - activeWaitDelay(10000000); + //Core::pause(); + //activeWaitDelay(10000000); + + sch.resume(true); + if(cnt >= sizeof(text)-1) cnt=0; //context_switch(test2,test1);