schedule with 4 application

main
Eggert Jung 4 months ago
parent e6d6e7521c
commit 7322a9ed70

@ -73,9 +73,13 @@ unsigned int testx, testy;
uint8_t test1_stack[1024]; uint8_t test1_stack[1024];
uint8_t test2_stack[1024]; uint8_t test2_stack[1024];
uint8_t test3_stack[1024];
uint8_t test4_stack[1024];
//Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]); //Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]);
Application application1 = Application(&test1_stack[sizeof(test1_stack)-1]); Application application1 = Application(&test1_stack[sizeof(test1_stack)-1]);
Application application2 = Application(&test2_stack[sizeof(test2_stack)-1]); Application application2 = Application(&test2_stack[sizeof(test2_stack)-1]);
Application application3 = Application(&test3_stack[sizeof(test3_stack)-1]);
Application application4 = Application(&test4_stack[sizeof(test4_stack)-1]);
//Context test2; //Context test2;
//uint8_t test2_stack[256]; //uint8_t test2_stack[256];
@ -114,6 +118,14 @@ extern "C" int main() {
* Startup IPIs or even block devices like keyboard because of a missing EOI * Startup IPIs or even block devices like keyboard because of a missing EOI
*/ */
{
Guarded g = Guard::enter();
sch.ready(&application1);
sch.ready(&application2);
sch.ready(&application3);
sch.ready(&application4);
}
ApplicationProcessor::boot(); ApplicationProcessor::boot();
PS2Controller::init(); PS2Controller::init();
@ -128,9 +140,12 @@ extern "C" int main() {
DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush; DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
sch.ready(&application1);
sch.ready(&application2);
sch.schedule(); {
Guarded g = Guard::enter();
sch.schedule();
}
//Application{}.action(); //Application{}.action();
@ -150,6 +165,11 @@ extern "C" int main_ap() {
DBG << "App CPU " << static_cast<int>(Core::getID()) << endl << flush; DBG << "App CPU " << static_cast<int>(Core::getID()) << endl << flush;
{
Guarded g = Guard::enter();
sch.schedule();
}
//assert(Core::getID() != 1); //assert(Core::getID() != 1);
//Application{}.action(); //Application{}.action();

@ -8,6 +8,7 @@
typedef void (*kickoff_t)(void*); typedef void (*kickoff_t)(void*);
void Thread::kickoff(Thread* object) { void Thread::kickoff(Thread* object) {
Guard::leave();
object->action(); object->action();
} }

@ -47,7 +47,7 @@ void Application::action() { // NOLINT
{ {
Guarded g = Guard::enter(); Guarded g = Guard::enter();
//g.vault(); //g.vault();
g.vault().kout.setPos((unsigned)10*row,(unsigned)Core::getID()*2+1); g.vault().kout.setPos((unsigned)10*row,(unsigned)/*Core::getID()*2+*/1);
g.vault().kout << cnt++ << flush; g.vault().kout << cnt++ << flush;
//g.vault().kout << endl << flush; //g.vault().kout << endl << flush;
@ -57,7 +57,11 @@ void Application::action() { // NOLINT
//Core::pause(); //Core::pause();
//activeWaitDelay(10000000); //activeWaitDelay(10000000);
sch.resume(true);
{
Guarded g = Guard::enter();
sch.resume(true);
}
if(cnt >= sizeof(text)-1) if(cnt >= sizeof(text)-1)
cnt=0; cnt=0;

Loading…
Cancel
Save