wip: IPC and Runtime

This commit is contained in:
karina
2026-05-03 21:57:20 +04:00
parent 5f343c991b
commit 39b2af7626
25 changed files with 371 additions and 66 deletions
+28
View File
@@ -69,6 +69,7 @@ OSTask* SchedulerSpawn(void(*entryPoint)(), OSProcess* owner, Boolean isUser, Ad
task->waitingForProcessId = -1;
task->next = gOSSchedulerCurrentTask->next;
task->senderWaiting = nullptr;
gOSSchedulerCurrentTask->next = task;
return task;
@@ -126,3 +127,30 @@ void SchedulerYield(UInt64 ticks) {
UInt64 SchedulerGetNextProcessID() {
return gOSSchedulerNextProcessID++;
}
void SchedulerBlockCurrentTask(UInt32 newState) {
gOSSchedulerCurrentTask->state = newState;
CPUException(kOSSchedulerExceptionNumber);
}
OSTask* SchedulerGetCurrentTask() {
return gOSSchedulerCurrentTask;
}
Int32 SchedulerProcessAllocateHandle(OSProcess* process, OSHandleType type, Pointer object) {
for (Int32 i = 1; i < kOSMaxHandlesPerProcess; i++) {
if (process->handles[i].type == kOSHandleTypeNone) {
process->handles[i].type = type;
process->handles[i].object = object;
return i;
}
}
return -1;
}
Pointer SchedulerProcessGetHandle(OSProcess* process, UInt32 handleId, OSHandleType expectedType) {
if (handleId == 0 || handleId >= kOSMaxHandlesPerProcess) return nullptr;
OSHandle* handle = &process->handles[handleId];
if (handle->type != expectedType) return nullptr;
return handle->object;
}