diff --git a/main.cc b/main.cc index fa66e05..aa405b3 100644 --- a/main.cc +++ b/main.cc @@ -18,7 +18,10 @@ #include "arch/context.h" #include "thread/thread.h" +<<<<<<< HEAD +======= +>>>>>>> 4e7dad9 (fooo) ///TextStream kout = TextStream(0, 80, 0, 10, true); Ticketlock koutlock; @@ -33,6 +36,12 @@ Ticketlock koutlock; // TextStream(0 ,0 ,0, 0,false), //}; +Context test1; +uint8_t test1_stack[256]; +Application application = Application(test1_stack); + + + TextStream dout[Core::MAX] = { {0, 40, 10, 14}, {40, 80, 10, 14}, @@ -82,6 +91,8 @@ void test_func2(){ } } + + // Main function // (the bootstrap processor starts here)} extern "C" int main() { @@ -107,12 +118,8 @@ extern "C" int main() { PS2Controller::drainBuffer(); DBG << "Main CPU " << static_cast(LAPIC::getID()) << endl << flush; + prepareContext(test1_stack, test1, (void(*)(void*)) &(Application::kickoff),(Thread*)&application); - Context test1; - Thread test1_thread; - uint8_t test1_stack[256]; - - prepareContext(&test1_stack[255], test1, (void(*)(void*)) &(Application::kickoff), ); context_launch(&test1); //Application{}.action(); diff --git a/thread/thread.cc b/thread/thread.cc index 12a1dd6..db40208 100644 --- a/thread/thread.cc +++ b/thread/thread.cc @@ -6,10 +6,14 @@ typedef void (*kickoff_t)(void*); void Thread::kickoff(Thread* object) { - Guard::leave(); + //Guard::leave(); object->action(); } -Thread::Thread(void* tos) { (void)tos; } +Thread::Thread(void* tos) { + volatile bool kill_flag; + Context context; + Thread* queue_link; +} void Thread::resume(Thread* next) { (void)next; } diff --git a/thread/thread.h b/thread/thread.h index b731d81..62be4b7 100644 --- a/thread/thread.h +++ b/thread/thread.h @@ -42,7 +42,6 @@ class Thread { public: /*! \brief Marker for a dying thread */ - volatile bool kill_flag; /*! \brief Constructor * Initializes the context using \ref prepareContext with the given stack diff --git a/user/app1/appl.h b/user/app1/appl.h index c391407..40ec369 100644 --- a/user/app1/appl.h +++ b/user/app1/appl.h @@ -24,7 +24,8 @@ class Application:public Thread { * * \todo(14) Implement Constructor */ - + Application(void* tos): Thread(tos){ + } /*! \brief Contains the application code. * * \todo(14) Implement Method