[Kernel] Start implementing address arbiters

This commit is contained in:
wheremyfoodat 2022-09-20 00:53:39 +03:00
parent f100601caf
commit 8bfa29568a
7 changed files with 58 additions and 13 deletions

View file

@ -21,11 +21,12 @@ class Kernel {
Handle currentThread;
Handle mainThread;
Handle srvHandle; // Handle for the special service manager port "srv:"
u32 arbiterCount;
u32 threadCount;
ServiceManager serviceManager;
// Get pointer to the object with the specified handle
KernelObject* getObject(u32 handle) {
KernelObject* getObject(Handle handle) {
// Accessing an object that has not been created
if (handle >= objects.size()) [[unlikely]] {
return nullptr;
@ -35,7 +36,7 @@ class Kernel {
}
// Get pointer to the object with the specified handle and type
KernelObject* getObject(u32 handle, KernelObjectType type) {
KernelObject* getObject(Handle handle, KernelObjectType type) {
if (handle >= objects.size() || objects[handle].type != type) [[unlikely]] {
return nullptr;
}
@ -53,6 +54,7 @@ class Kernel {
return handleCounter++;
}
Handle makeArbiter();
Handle makeEvent(ResetType resetType);
Handle makeProcess();
Handle makePort(const char* name);
@ -71,6 +73,7 @@ class Kernel {
const char* resetTypeToString(u32 type);
// SVC implementations
void arbitrateAddress();
void createAddressArbiter();
void createEvent();
void createThread();

View file

@ -88,7 +88,13 @@ struct Session {
};
struct Thread {
u32 initialSP; // Initial r13 value
u32 entrypoint; // Initial r15 value
u32 priority;
u32 processorID;
Thread(u32 initialSP, u32 entrypoint, u32 priority, u32 processorID) : initialSP(initialSP), entrypoint(entrypoint),
priority(priority), processorID(processorID) {}
};
static const char* kernelObjectTypeToString(KernelObjectType t) {