fix stack usage and readylist

main
Eggert Jung 4 months ago
parent 94249eda37
commit da34f7cada

@ -22,6 +22,7 @@
///TextStream kout = TextStream(0, 80, 0, 10, true); ///TextStream kout = TextStream(0, 80, 0, 10, true);
Ticketlock koutlock; Ticketlock koutlock;
Scheduler sch;
//TextStream dout[8] = { //TextStream dout[8] = {
// TextStream(0 ,20,12,25,false), // TextStream(0 ,20,12,25,false),
@ -71,9 +72,9 @@ OutputStream* copyout[Core::MAX]{
unsigned int testx, testy; unsigned int testx, testy;
Context test1; Context test1;
uint8_t test1_stack[256]; uint8_t test1_stack[1024];
//Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]); //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; //Context test2;
//uint8_t test2_stack[256]; //uint8_t test2_stack[256];
@ -126,7 +127,6 @@ extern "C" int main() {
DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush; DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
Scheduler sch;
sch.ready(&application); sch.ready(&application);
sch.schedule(); sch.schedule();

@ -22,9 +22,11 @@ bool Dispatcher::isActive(const Thread *thread, unsigned *cpu) {
} }
void Dispatcher::go(Thread *first) { void Dispatcher::go(Thread *first) {
lifePointer[Core::getID()] = first;
first->go(); first->go();
} }
void Dispatcher::dispatch(Thread *next) { void Dispatcher::dispatch(Thread *next) {
lifePointer[Core::getID()] = next;
lifePointer[Core::getID()]->resume(next); lifePointer[Core::getID()]->resume(next);
} }

@ -9,6 +9,10 @@
#include "../../interrupt/guard.h" #include "../../interrupt/guard.h"
#include "../../debug/output.h" #include "../../debug/output.h"
#include "../../arch/context.h" #include "../../arch/context.h"
#include "../../thread/scheduler.h"
extern Scheduler sch;
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\
@ -49,8 +53,11 @@ void Application::action() { // NOLINT
//Guard::leave(); //Guard::leave();
//koutlock.unlock(); //koutlock.unlock();
} }
Core::pause(); //Core::pause();
activeWaitDelay(10000000); //activeWaitDelay(10000000);
sch.resume(true);
if(cnt >= sizeof(text)-1) if(cnt >= sizeof(text)-1)
cnt=0; cnt=0;
//context_switch(test2,test1); //context_switch(test2,test1);

Loading…
Cancel
Save