|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
// vim: set noet ts=4 sw=4:
|
|
|
|
|
|
|
|
|
|
#include "thread.h"
|
|
|
|
|
#include "../debug/output.h"
|
|
|
|
|
#include "../arch/context.h"
|
|
|
|
|
|
|
|
|
|
// Alias to simplify stuff
|
|
|
|
|
@ -14,8 +15,16 @@ Thread::Thread(void* tos) {
|
|
|
|
|
prepareContext(tos, context, (void(*)(void*)) &(kickoff), this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include "../thread/scheduler.h"
|
|
|
|
|
extern Scheduler sch;
|
|
|
|
|
void Thread::resume(Thread* next) {
|
|
|
|
|
context_switch(&next->context, &context);
|
|
|
|
|
Context *from = &sch.active()->context;
|
|
|
|
|
Context *to = &next->context;
|
|
|
|
|
|
|
|
|
|
sch.dispatcher.lifePointer[Core::getID()] = next;
|
|
|
|
|
DBG << "from: " << hex << from << endl;
|
|
|
|
|
DBG << "to : " << hex << to << endl << flush;
|
|
|
|
|
context_switch(to, from);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Thread::go() {
|
|
|
|
|
|