mirror of https://github.com/red-prig/fpPS4.git
pthread_attr_getschedparam and etc
This commit is contained in:
parent
036110d9df
commit
6299a733da
|
@ -1204,28 +1204,38 @@ begin
|
|||
lib^.set_proc($B46FBCD396F53639,@ps4_pthread_set_defaultstacksize_np);
|
||||
lib^.set_proc($A1567EFCA819246A,@ps4_scePthreadSetDefaultstacksize);
|
||||
|
||||
lib^.set_proc($9EC628351CB0C0D8,@ps4_scePthreadAttrInit);
|
||||
lib^.set_proc($EB6282C04326CDC3,@ps4_scePthreadAttrDestroy);
|
||||
lib^.set_proc($C2D92DFED791D6CA,@ps4_pthread_attr_init);
|
||||
lib^.set_proc($CC772163C7EDE699,@ps4_pthread_attr_destroy);
|
||||
lib^.set_proc($5135F325B5A18531,@ps4_scePthreadAttrSetstacksize);
|
||||
|
||||
lib^.set_proc($9EC628351CB0C0D8,@ps4_scePthreadAttrInit);
|
||||
lib^.set_proc($EB6282C04326CDC3,@ps4_scePthreadAttrDestroy);
|
||||
|
||||
lib^.set_proc($D90D33EAB9C1AD31,@ps4_pthread_attr_setstacksize);
|
||||
lib^.set_proc($FD6ADEA6BB6ED10B,@ps4_scePthreadAttrSetdetachstate);
|
||||
lib^.set_proc($5135F325B5A18531,@ps4_scePthreadAttrSetstacksize);
|
||||
|
||||
lib^.set_proc($13EB72A37969E4BC,@ps4_pthread_attr_setdetachstate);
|
||||
lib^.set_proc($FD6ADEA6BB6ED10B,@ps4_scePthreadAttrSetdetachstate);
|
||||
|
||||
lib^.set_proc($25AACC232F242846,@ps4_pthread_attr_setschedpolicy);
|
||||
lib^.set_proc($E3E87D133C0A1782,@ps4_scePthreadAttrSetschedpolicy);
|
||||
lib^.set_proc($0F3112F61405E1FE,@ps4_scePthreadAttrSetschedparam);
|
||||
lib^.set_proc($1573D61CD93C39FD,@ps4_scePthreadAttrGetschedparam);
|
||||
|
||||
lib^.set_proc($7AE291826D159F63,@ps4_pthread_attr_setschedparam);
|
||||
lib^.set_proc($0F3112F61405E1FE,@ps4_scePthreadAttrSetschedparam);
|
||||
|
||||
lib^.set_proc($AA593DA522EC5263,@ps4_pthread_attr_getschedparam);
|
||||
lib^.set_proc($1573D61CD93C39FD,@ps4_scePthreadAttrGetschedparam);
|
||||
|
||||
lib^.set_proc($DEAC603387B31130,@ps4_scePthreadAttrSetaffinity);
|
||||
lib^.set_proc($F3EB39073663C528,@ps4_scePthreadAttrGetaffinity);
|
||||
lib^.set_proc($F3EB39073663C528,@ps4_scePthreadAttrGetaffinity)
|
||||
;
|
||||
lib^.set_proc($7976D44A911A4EC0,@ps4_scePthreadAttrSetinheritsched);
|
||||
lib^.set_proc($B711ED9E027E7B27,@ps4_scePthreadAttrGetguardsize);
|
||||
lib^.set_proc($46EDFA7E24ED2730,@ps4_scePthreadAttrGetstackaddr);
|
||||
lib^.set_proc($FDF03EED99460D0B,@ps4_scePthreadAttrGetstacksize);
|
||||
lib^.set_proc($FEAB8F6B8484254C,@ps4_scePthreadAttrGetstack);
|
||||
lib^.set_proc($25A44CCBE41CA5E5,@ps4_scePthreadAttrGetdetachstate);
|
||||
|
||||
lib^.set_proc($5544F5652AC74F42,@ps4_pthread_attr_getdetachstate);
|
||||
lib^.set_proc($25A44CCBE41CA5E5,@ps4_scePthreadAttrGetdetachstate);
|
||||
|
||||
lib^.set_proc($C755FBE9AAD83315,@ps4_scePthreadAttrGet);
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ end;
|
|||
|
||||
function ps4_pthread_create_name_np(pthread:p_pthread;pAttr:p_pthread_attr_t;entry:Pointer;arg:Pointer;name:Pchar):Integer; SysV_ABI_CDecl;
|
||||
Var
|
||||
attr:pthread_attr_t;
|
||||
data:pthread;
|
||||
Handle,ThreadId:TThreadID;
|
||||
sa:Pointer;
|
||||
|
@ -285,65 +286,56 @@ begin
|
|||
|
||||
ReadWriteBarrier;
|
||||
|
||||
if (pAttr<>nil) and (pAttr^<>nil) then
|
||||
attr:=nil;
|
||||
if (pAttr<>nil) then
|
||||
begin
|
||||
data^.Attr:=pAttr^^;
|
||||
data^.detachstate:=pAttr^^.flags;
|
||||
ReadWriteBarrier;
|
||||
|
||||
creationFlags:=0;
|
||||
sa:=pAttr^^.stackaddr_attr;
|
||||
ss:=pAttr^^.stacksize_attr;
|
||||
|
||||
if (ss<PTHREAD_STACK_MIN) then
|
||||
begin
|
||||
ss:=PTHREAD_STACK_MIN;
|
||||
data^.Attr.stacksize_attr:=ss;
|
||||
end;
|
||||
|
||||
ThreadId:=0;
|
||||
_sig_lock;
|
||||
|
||||
Handle:=SysBeginThread(sa,ss,@on_ps4_run_thread,data,creationFlags,ThreadId);
|
||||
|
||||
_sig_unlock;
|
||||
if (Handle=0) then
|
||||
begin
|
||||
SwFreeMem(data);
|
||||
Exit(EAGAIN);
|
||||
end;
|
||||
|
||||
if (pAttr^^.cpuset<>0) then
|
||||
begin
|
||||
_sig_lock;
|
||||
SetThreadAffinityMask(Handle,pAttr^^.cpuset);
|
||||
_sig_unlock;
|
||||
end;
|
||||
|
||||
end else
|
||||
attr:=pAttr^;
|
||||
end;
|
||||
if (attr=nil) then
|
||||
begin
|
||||
ThreadId:=0;
|
||||
_sig_lock;
|
||||
|
||||
ss:=PTHREAD_STACK_MIN;
|
||||
data^.Attr.stacksize_attr:=ss;
|
||||
|
||||
Handle:=SysBeginThread(nil,ss,@on_ps4_run_thread,data,0,ThreadId);
|
||||
|
||||
_sig_unlock;
|
||||
if (Handle=0) then
|
||||
begin
|
||||
SwFreeMem(data);
|
||||
Exit(SCE_KERNEL_ERROR_EAGAIN);
|
||||
end;
|
||||
attr:=@_pthread_attr_default;
|
||||
end;
|
||||
|
||||
XCHG(data^.ThreadId,ThreadId);
|
||||
XCHG(data^.handle,Handle);
|
||||
data^.Attr:=attr^;
|
||||
data^.detachstate:=attr^.flags;
|
||||
ReadWriteBarrier;
|
||||
|
||||
creationFlags:=0;
|
||||
sa:=attr^.stackaddr_attr;
|
||||
ss:=attr^.stacksize_attr;
|
||||
|
||||
if (ss<PTHREAD_STACK_MIN) then
|
||||
begin
|
||||
ss:=PTHREAD_STACK_MIN;
|
||||
data^.Attr.stacksize_attr:=ss;
|
||||
end;
|
||||
|
||||
ThreadId:=0;
|
||||
_sig_lock;
|
||||
|
||||
Handle:=SysBeginThread(sa,ss,@on_ps4_run_thread,data,creationFlags,ThreadId);
|
||||
|
||||
_sig_unlock;
|
||||
if (Handle=0) then
|
||||
begin
|
||||
SwFreeMem(data);
|
||||
Exit(EAGAIN);
|
||||
end;
|
||||
|
||||
if (attr^.cpuset<>0) then
|
||||
begin
|
||||
_sig_lock;
|
||||
SetThreadAffinityMask(Handle,attr^.cpuset);
|
||||
_sig_unlock;
|
||||
end;
|
||||
|
||||
pthread^:=data;
|
||||
end;
|
||||
|
||||
XCHG(data^.ThreadId,ThreadId);
|
||||
XCHG(data^.handle,Handle);
|
||||
|
||||
pthread^:=data;
|
||||
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ var
|
|||
sched_inherit :PTHREAD_INHERIT_SCHED;
|
||||
prio :0;
|
||||
suspend :THR_CREATE_RUNNING;
|
||||
flags :PTHREAD_SCOPE_SYSTEM;
|
||||
flags :0{PTHREAD_SCOPE_SYSTEM};
|
||||
stackaddr_attr:nil;
|
||||
stacksize_attr:$10000;
|
||||
guardsize_attr:0;
|
||||
|
@ -42,6 +42,7 @@ function ps4_scePthreadAttrSetstacksize(pAttr:p_pthread_attr_t;size:size_t):Int
|
|||
function ps4_pthread_attr_setdetachstate(pAttr:p_pthread_attr_t;detachstate:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrSetdetachstate(pAttr:p_pthread_attr_t;detachstate:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_pthread_attr_setschedpolicy(pAttr:p_pthread_attr_t;policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrSetschedpolicy(pAttr:p_pthread_attr_t;policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_pthread_attr_setschedparam(pAttr:p_pthread_attr_t;param:PInteger):Integer; SysV_ABI_CDecl;
|
||||
|
@ -144,15 +145,20 @@ begin
|
|||
Result:=px2sce(ps4_pthread_attr_setdetachstate(pAttr,detachstate));
|
||||
end;
|
||||
|
||||
function ps4_scePthreadAttrSetschedpolicy(pAttr:p_pthread_attr_t;policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_pthread_attr_setschedpolicy(pAttr:p_pthread_attr_t;policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=SCE_KERNEL_ERROR_EINVAL;
|
||||
Result:=EINVAL;
|
||||
if (pAttr=nil) then Exit;
|
||||
if (pAttr^=nil) then Exit;
|
||||
pAttr^^.sched_policy:=policy;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_scePthreadAttrSetschedpolicy(pAttr:p_pthread_attr_t;policy:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=px2sce(ps4_pthread_attr_setschedpolicy(pAttr,policy));
|
||||
end;
|
||||
|
||||
function ps4_pthread_attr_setschedparam(pAttr:p_pthread_attr_t;param:PInteger):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=EINVAL;
|
||||
|
|
|
@ -67,10 +67,20 @@ const
|
|||
SCE_KERNEL_CPUMASK_7CPU_ALL =$7f;
|
||||
SCE_KERNEL_CPUMASK_USER_ALL =$3f; // obsolete
|
||||
|
||||
//Thread creation state attributes.
|
||||
THR_CREATE_RUNNING =0;
|
||||
THR_CREATE_SUSPENDED=1;
|
||||
|
||||
//Miscellaneous definitions.
|
||||
THR_STACK_DEFAULT=(2 * 1024 * 1024);
|
||||
THR_STACK_INITIAL=(THR_STACK_DEFAULT * 2);
|
||||
|
||||
THR_STACK_USER=$100; // 0xFF reserved for <pthread.h>
|
||||
|
||||
type
|
||||
p_pthread_attr_t=^pthread_attr_t;
|
||||
pthread_attr_t=^tthread_attr_t;
|
||||
tthread_attr_t=packed record
|
||||
pthread_attr_t=^pthread_attr;
|
||||
pthread_attr=packed record
|
||||
sched_policy :Integer;
|
||||
sched_inherit:Integer;
|
||||
prio :Integer;
|
||||
|
@ -79,27 +89,11 @@ type
|
|||
stackaddr_attr:Pointer;
|
||||
stacksize_attr:QWORD;
|
||||
guardsize_attr:QWORD;
|
||||
cpuset:DWORD;
|
||||
cpuset:QWORD;
|
||||
//cpuset_t *cpuset;
|
||||
//size_t cpusetsize;
|
||||
end;
|
||||
|
||||
//struct pthread_attr {
|
||||
//#define pthread_attr_start_copy sched_policy
|
||||
// int sched_policy;
|
||||
// int sched_inherit;
|
||||
// int prio;
|
||||
// int suspend;
|
||||
//#define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */
|
||||
// int flags; //((*attr)->flags & PTHREAD_DETACHED)
|
||||
// void *stackaddr_attr;
|
||||
// size_t stacksize_attr;
|
||||
// size_t guardsize_attr;
|
||||
//#define pthread_attr_end_copy cpuset
|
||||
// cpuset_t *cpuset;
|
||||
// size_t cpusetsize;
|
||||
//};
|
||||
|
||||
p_pthread_once_t=^pthread_once_t;
|
||||
pthread_once_t=packed record
|
||||
state:Integer;
|
||||
|
@ -146,7 +140,7 @@ type
|
|||
handle:TThreadID;
|
||||
ThreadId:TThreadID;
|
||||
detachstate:Integer;
|
||||
Attr:tthread_attr_t;
|
||||
Attr:pthread_attr;
|
||||
name:array[0..31] of AnsiChar;
|
||||
//
|
||||
errno:QWORD;
|
||||
|
|
Loading…
Reference in New Issue