ptos: ps+hal: Add thread control block init
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user