diff --git a/main.cc b/main.cc index 35cc9b7..d282d45 100644 --- a/main.cc +++ b/main.cc @@ -110,7 +110,7 @@ extern "C" int main() { Context test1; uint8_t test1_stack[256]; - prepareContext(test1_stack, test1, (void (*)(void *))&test_func1); + prepareContext(test1_stack, test1, (void(*)(void*)) &(Application::kickoff)); context_launch(&test1); //Application{}.action(); @@ -131,7 +131,7 @@ extern "C" int main_ap() { DBG << "App CPU " << static_cast(Core::getID()) << endl << flush; //assert(Core::getID() != 1); - Application{}.action(); + //Application{}.action(); return 0; } diff --git a/thread/thread.cc b/thread/thread.cc index 1fa8f6f..12a1dd6 100644 --- a/thread/thread.cc +++ b/thread/thread.cc @@ -5,7 +5,9 @@ // Alias to simplify stuff typedef void (*kickoff_t)(void*); -void Thread::kickoff(Thread* object) { (void)object; } +void Thread::kickoff(Thread* object) { + Guard::leave(); + object->action(); } Thread::Thread(void* tos) { (void)tos; } diff --git a/thread/thread.h b/thread/thread.h index 5eda83f..b731d81 100644 --- a/thread/thread.h +++ b/thread/thread.h @@ -16,12 +16,12 @@ #include "../arch/context.h" #include "../object/queue.h" #include "../types.h" - +#include "../interrupt/guard.h" /*! \brief The Thread is an object used by the scheduler. * \ingroup thread */ class Thread { - protected: + public: /*! \brief The thread's entry point. * * For the first activation of a thread, we need a "return address" diff --git a/user/app1/appl.h b/user/app1/appl.h index 5c16b6d..c391407 100644 --- a/user/app1/appl.h +++ b/user/app1/appl.h @@ -6,13 +6,13 @@ #pragma once #include "../../types.h" - +#include "../../thread/thread.h" //! \brief Test application //! //! \todo(12) Create a test application //! \todo(14) Application should inherit from \ref Thread //! \todo(16) Make some noise using the \ref PIT::pcspeaker "PC Speaker" -class Application { +class Application:public Thread { // Prevent copies and assignments Application(const Application&) = delete; Application& operator=(const Application&) = delete;