|
|
|
|
@ -33,10 +33,6 @@ Ticketlock koutlock;
|
|
|
|
|
// TextStream(0 ,0 ,0, 0,false),
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
Context test1;
|
|
|
|
|
uint8_t test1_stack[256];
|
|
|
|
|
Application application = Application(test1_stack);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TextStream dout[Core::MAX] = {
|
|
|
|
|
@ -74,17 +70,32 @@ OutputStream* copyout[Core::MAX]{
|
|
|
|
|
|
|
|
|
|
unsigned int testx, testy;
|
|
|
|
|
|
|
|
|
|
Context test1;
|
|
|
|
|
uint8_t test1_stack[256];
|
|
|
|
|
Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]);
|
|
|
|
|
//Application application = Application(test1_stack);
|
|
|
|
|
|
|
|
|
|
Context test2;
|
|
|
|
|
uint8_t test2_stack[256];
|
|
|
|
|
Thread test2_thread = Thread(&test2_stack[sizeof(test2_stack)-1]);
|
|
|
|
|
|
|
|
|
|
void test_func1(){
|
|
|
|
|
while(1){
|
|
|
|
|
DBG << "test 1\n";
|
|
|
|
|
//context_switch(Context *next, Context *current);
|
|
|
|
|
{
|
|
|
|
|
Guarded g = Guard::enter();
|
|
|
|
|
g.vault().kout << "test 1\n" << flush;
|
|
|
|
|
}
|
|
|
|
|
context_switch(&test2, &test1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void test_func2(){
|
|
|
|
|
while(1){
|
|
|
|
|
DBG << "test 2\n";
|
|
|
|
|
//context_switch(Context *next, Context *current);
|
|
|
|
|
{
|
|
|
|
|
Guarded g = Guard::enter();
|
|
|
|
|
g.vault().kout << "test 2\n" << flush;
|
|
|
|
|
}
|
|
|
|
|
context_switch(&test1, &test2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -115,7 +126,9 @@ extern "C" int main() {
|
|
|
|
|
PS2Controller::drainBuffer();
|
|
|
|
|
|
|
|
|
|
DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
|
|
|
|
|
prepareContext(&test1_stack[sizeof(test1_stack)-1], test1, (void(*)(void*)) &(Application::kickoff),(Thread*)&application);
|
|
|
|
|
|
|
|
|
|
prepareContext(&test1_stack[sizeof(test1_stack)-1], test1, (void(*)(void*)) &(test_func1));
|
|
|
|
|
prepareContext(&test2_stack[sizeof(test2_stack)-1], test2, (void(*)(void*)) &(test_func2));
|
|
|
|
|
|
|
|
|
|
context_launch(&test1);
|
|
|
|
|
|
|
|
|
|
|