[Kernel] Fix ArbitrateAddress

This commit is contained in:
wheremyfoodat 2022-09-20 16:50:20 +03:00
parent 919951516a
commit 77078f73b3
5 changed files with 25 additions and 13 deletions

View file

@ -66,6 +66,7 @@ class Kernel {
Handle makeSession(Handle port);
Handle makeThread(u32 entrypoint, u32 initialSP, u32 priority, u32 id, ThreadStatus status = ThreadStatus::Dormant);
void sleepThreadOnArbiter(u32 waitingAddress);
void switchThread(int newThreadIndex);
std::optional<Handle> getPortHandle(const char* name);

View file

@ -88,13 +88,13 @@ struct Session {
};
enum class ThreadStatus {
Running, // Currently running
Ready, // Ready to run
WaitArb, // Waiting on an address arbiter
WaitSleep, // Waiting due to a SleepThread SVC
WaitIPC, // Waiting for the reply from an IPC request
Dormant, // Created but not yet made ready
Dead // Run to completion, or forcefully terminated
Running, // Currently running
Ready, // Ready to run
WaitArbiter, // Waiting on an address arbiter
WaitSleep, // Waiting due to a SleepThread SVC
WaitIPC, // Waiting for the reply from an IPC request
Dormant, // Created but not yet made ready
Dead // Run to completion, or forcefully terminated
};
struct Thread {
@ -104,6 +104,9 @@ struct Thread {
u32 processorID;
ThreadStatus status;
Handle handle; // OS handle for this thread
// The waiting address for threads that are waiting on an AddressArbiter
u32 waitingAddress;
// Thread context used for switching between threads
std::array<u32, 16> gprs;