wip: IPC and Runtime
This commit is contained in:
@@ -4,12 +4,31 @@
|
||||
#pragma once
|
||||
#include <Types.h>
|
||||
|
||||
typedef enum {
|
||||
kOSHandleTypeNone = 0,
|
||||
kOSHandleTypeTask
|
||||
} OSHandleType;
|
||||
|
||||
typedef struct {
|
||||
OSHandleType type;
|
||||
Pointer object;
|
||||
} OSHandle;
|
||||
|
||||
enum {
|
||||
kOSSchedulerTaskStackSize = 16 * 1024,
|
||||
kOSSchedulerExceptionNumber = 0xF0F0,
|
||||
kOSMaxHandlesPerProcess = 256,
|
||||
};
|
||||
|
||||
typedef enum OSTaskState {
|
||||
OSTaskStateDead,
|
||||
OSTaskStateRunning,
|
||||
OSTaskStateReady,
|
||||
OSTaskStateBlocked,
|
||||
OSTaskStateSleeping,
|
||||
|
||||
OSTaskStateBlockedReceive,
|
||||
OSTaskStateBlockedSend,
|
||||
} OSTaskState;
|
||||
|
||||
typedef struct OSProcess {
|
||||
@@ -20,11 +39,12 @@ typedef struct OSProcess {
|
||||
Address heapCurrent;
|
||||
struct OSProcess* parent;
|
||||
ASCII name[32];
|
||||
|
||||
OSHandle handles[kOSMaxHandlesPerProcess];
|
||||
} OSProcess;
|
||||
|
||||
typedef struct OSTask {
|
||||
Address stackPointer;
|
||||
struct OSTask* next;
|
||||
UInt32 id;
|
||||
UInt32 sleepTicks;
|
||||
OSTaskState state;
|
||||
@@ -32,12 +52,10 @@ typedef struct OSTask {
|
||||
Pointer kernelStackBase;
|
||||
OSProcess* process;
|
||||
Int32 waitingForProcessId;
|
||||
} OSTask;
|
||||
|
||||
enum {
|
||||
kOSSchedulerTaskStackSize = 16 * 1024,
|
||||
kOSSchedulerExceptionNumber = 0xF0F0
|
||||
};
|
||||
struct OSTask* next;
|
||||
struct OSTask* senderWaiting;
|
||||
} OSTask;
|
||||
|
||||
extern UInt32 gOSSchedulerNextProcessID;
|
||||
|
||||
@@ -46,3 +64,7 @@ OSTask* SchedulerSpawn(void(*entryPoint)(), OSProcess* owner, Boolean isUser, Ad
|
||||
Address SchedulerNext(Address stackPointer);
|
||||
void SchedulerYield(UInt64 ticks);
|
||||
UInt64 SchedulerGetNextProcessID();
|
||||
void SchedulerBlockCurrentTask(UInt32 newState);
|
||||
OSTask* SchedulerGetCurrentTask();
|
||||
Int32 SchedulerProcessAllocateHandle(OSProcess* process, OSHandleType type, Pointer object);
|
||||
Pointer SchedulerProcessGetHandle(OSProcess* process, UInt32 handleId, OSHandleType expectedType);
|
||||
|
||||
Reference in New Issue
Block a user