mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
The scheduler now keeps track of the initial process.
This commit is contained in:
parent
f9e10ab265
commit
884ce30c07
3 changed files with 12 additions and 3 deletions
|
@ -283,6 +283,7 @@ namespace Sortix
|
||||||
if ( !initstart ) { Panic("could not construct ELF image for init process"); }
|
if ( !initstart ) { Panic("could not construct ELF image for init process"); }
|
||||||
Thread* initthread = CreateThread(initstart);
|
Thread* initthread = CreateThread(initstart);
|
||||||
if ( !initthread ) { Panic("could not create thread for the init process"); }
|
if ( !initthread ) { Panic("could not create thread for the init process"); }
|
||||||
|
Scheduler::SetInitProcess(init);
|
||||||
|
|
||||||
// Lastly set up the timer driver and we are ready to run the OS.
|
// Lastly set up the timer driver and we are ready to run the OS.
|
||||||
Time::Init();
|
Time::Init();
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace Sortix
|
||||||
Thread* idlethread;
|
Thread* idlethread;
|
||||||
Thread* firstrunnablethread;
|
Thread* firstrunnablethread;
|
||||||
Thread* firstsleepingthread;
|
Thread* firstsleepingthread;
|
||||||
|
Process* initprocess;
|
||||||
bool hacksigintpending = false;
|
bool hacksigintpending = false;
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
@ -89,9 +90,14 @@ namespace Sortix
|
||||||
dummythread->process = process;
|
dummythread->process = process;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetInitialProcess(Process* init)
|
void SetInitProcess(Process* init)
|
||||||
{
|
{
|
||||||
dummythread->process = init;
|
initprocess = init;
|
||||||
|
}
|
||||||
|
|
||||||
|
Process* GetInitProcess()
|
||||||
|
{
|
||||||
|
return initprocess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainLoop()
|
void MainLoop()
|
||||||
|
|
|
@ -35,7 +35,9 @@ namespace Sortix
|
||||||
void MainLoop() SORTIX_NORETURN;
|
void MainLoop() SORTIX_NORETURN;
|
||||||
void Switch(CPU::InterruptRegisters* regs);
|
void Switch(CPU::InterruptRegisters* regs);
|
||||||
void SetIdleThread(Thread* thread);
|
void SetIdleThread(Thread* thread);
|
||||||
void SetDummyThreadOwner(Process* init);
|
void SetDummyThreadOwner(Process* process);
|
||||||
|
void SetInitProcess(Process* init);
|
||||||
|
Process* GetInitProcess();
|
||||||
|
|
||||||
void SetThreadState(Thread* thread, Thread::State state);
|
void SetThreadState(Thread* thread, Thread::State state);
|
||||||
Thread::State GetThreadState(Thread* thread);
|
Thread::State GetThreadState(Thread* thread);
|
||||||
|
|
Loading…
Add table
Reference in a new issue