ptos: ps+hal: Add thread control block init

Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
2026-07-14 16:14:03 -04:00
parent fe6be93d32
commit fcfe1dfb4a
6 changed files with 168 additions and 2 deletions
+9 -1
View File
@@ -8,6 +8,7 @@
#include <ps/thread.h>
#include <ps/process.h>
#include <hal/thread.h>
#include <ex/pool.h>
#include <atomic.h>
@@ -15,9 +16,10 @@
static UQUAD NextThreadTid = 0;
PT_STATUS
PsCreateThread(struct _PROCESS *Parent, ULONG Flags, THREAD **Result)
PsCreateThread(struct _PROCESS *Parent, ULONG Flags, UPTR Ip, THREAD **Result)
{
THREAD *Thread;
PT_STATUS Status;
if (Parent == NULL || Result == NULL) {
return STATUS_INVALID_PARAM;
@@ -35,6 +37,12 @@ PsCreateThread(struct _PROCESS *Parent, ULONG Flags, THREAD **Result)
Thread->Tid = AtomicIncQuad(&NextThreadTid);
Thread->Parent = Parent;
Status = HalThreadInit(Thread, Flags, Ip);
if (PT_ERROR(Status)) {
ExFreePoolWithTag(Thread, THREAD_POOL_TAG);
return Status;
}
*Result = Thread;
return STATUS_SUCCESS;
}