|
|
|
|
@ -12,6 +12,7 @@
|
|
|
|
|
#include "device/textstream.h"
|
|
|
|
|
#include "device/ps2controller.h"
|
|
|
|
|
#include "arch/ioapic.h"
|
|
|
|
|
#include "thread/scheduler.h"
|
|
|
|
|
#include "user/app1/appl.h"
|
|
|
|
|
#include "sync/ticketlock.h"
|
|
|
|
|
#include "interrupt/guard.h"
|
|
|
|
|
@ -71,32 +72,32 @@ 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){
|
|
|
|
|
{
|
|
|
|
|
Guarded g = Guard::enter();
|
|
|
|
|
g.vault().kout << "test 1\n" << flush;
|
|
|
|
|
}
|
|
|
|
|
context_switch(&test2, &test1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void test_func2(){
|
|
|
|
|
while(1){
|
|
|
|
|
{
|
|
|
|
|
Guarded g = Guard::enter();
|
|
|
|
|
g.vault().kout << "test 2\n" << flush;
|
|
|
|
|
}
|
|
|
|
|
context_switch(&test1, &test2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//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){
|
|
|
|
|
// {
|
|
|
|
|
// Guarded g = Guard::enter();
|
|
|
|
|
// g.vault().kout << "test 1\n" << flush;
|
|
|
|
|
// }
|
|
|
|
|
// context_switch(&test2, &test1);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//void test_func2(){
|
|
|
|
|
// while(1){
|
|
|
|
|
// {
|
|
|
|
|
// Guarded g = Guard::enter();
|
|
|
|
|
// g.vault().kout << "test 2\n" << flush;
|
|
|
|
|
// }
|
|
|
|
|
// context_switch(&test1, &test2);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -126,7 +127,10 @@ extern "C" int main() {
|
|
|
|
|
|
|
|
|
|
DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
|
|
|
|
|
|
|
|
|
|
test1_thread.go();
|
|
|
|
|
Scheduler sch;
|
|
|
|
|
sch.ready(&application);
|
|
|
|
|
sch.schedule();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Application{}.action();
|
|
|
|
|
while (true){
|
|
|
|
|
|