diff --git a/kernel/ps4_libkernel.pas b/kernel/ps4_libkernel.pas index 62bfcd5a..1d6e2b58 100644 --- a/kernel/ps4_libkernel.pas +++ b/kernel/ps4_libkernel.pas @@ -559,7 +559,7 @@ begin Exit(SCE_KERNEL_ERROR_EINVAL); end; - info^:=Default(t_get_authinfo); + info^:=Default(t_authinfo); _set_errno(0); Result:=0; diff --git a/rtl/mqueue.pas b/rtl/mqueue.pas index 1649d8ef..0e89477b 100644 --- a/rtl/mqueue.pas +++ b/rtl/mqueue.pas @@ -23,13 +23,16 @@ type le_prev:PPointer; end; -procedure TAILQ_INIT (head:Pointer); inline; -function TAILQ_EMPTY (head:Pointer):Boolean; inline; -function TAILQ_FIRST (head:Pointer):Pointer; inline; -function TAILQ_NEXT (elm,field:Pointer):Pointer; inline; -procedure TAILQ_INSERT_HEAD(head,elm,field:Pointer); inline; -procedure TAILQ_INSERT_TAIL(head,elm,field:Pointer); inline; -procedure TAILQ_REMOVE (head,elm,field:Pointer); inline; +procedure TAILQ_INIT (head:Pointer); inline; +function TAILQ_EMPTY (head:Pointer):Boolean; inline; +function TAILQ_FIRST (head:Pointer):Pointer; inline; +function TAILQ_NEXT (elm,field:Pointer):Pointer; inline; +function TAILQ_PREV (elm,headname,field:Pointer):Pointer; inline; +procedure TAILQ_INSERT_HEAD (head,elm,field:Pointer); inline; +procedure TAILQ_INSERT_TAIL (head,elm,field:Pointer); inline; +procedure TAILQ_INSERT_AFTER (head,listelm,elm,field:Pointer); inline; +procedure TAILQ_INSERT_BEFORE(listelm,elm,field:Pointer); inline; +procedure TAILQ_REMOVE (head,elm,field:Pointer); inline; procedure LIST_INIT (head:Pointer); inline; function LIST_EMPTY (head:Pointer):Boolean; inline; @@ -61,6 +64,11 @@ begin Result:=P_TAILQ_ENTRY(field)^.tqe_next; end; +function TAILQ_PREV(elm,headname,field:Pointer):Pointer; inline; +begin + Result:=P_TAILQ_HEAD(P_TAILQ_ENTRY(field)^.tqe_prev+ptruint(headname))^.tqh_last; +end; + procedure TAILQ_INSERT_HEAD(head,elm,field:Pointer); inline; var offset:ptruint; @@ -86,6 +94,34 @@ begin P_TAILQ_HEAD(head)^.tqh_last:=@P_TAILQ_ENTRY(field)^.tqe_next; end; +procedure TAILQ_INSERT_AFTER(head,listelm,elm,field:Pointer); inline; +var + offset:ptruint; +begin + offset:=ptruint(field-elm); + P_TAILQ_ENTRY(field)^.tqe_next:=P_TAILQ_ENTRY(listelm+offset)^.tqe_next; + if (P_TAILQ_ENTRY(field)^.tqe_next<>nil) then + begin + P_TAILQ_ENTRY(P_TAILQ_ENTRY(field)^.tqe_next+offset)^.tqe_prev:=@P_TAILQ_ENTRY(field)^.tqe_next; + end else + begin + P_TAILQ_HEAD(head)^.tqh_last:=@P_TAILQ_ENTRY(field)^.tqe_next; + end; + P_TAILQ_ENTRY(listelm+offset)^.tqe_next:=(elm); + P_TAILQ_ENTRY(field)^.tqe_prev:=@P_TAILQ_ENTRY(listelm+offset)^.tqe_next; +end; + +procedure TAILQ_INSERT_BEFORE(listelm,elm,field:Pointer); inline; +var + offset:ptruint; +begin + offset:=ptruint(field-elm); + P_TAILQ_ENTRY(field)^.tqe_prev:=P_TAILQ_ENTRY(listelm+offset)^.tqe_prev; + P_TAILQ_ENTRY(field)^.tqe_next:=listelm; + P_TAILQ_ENTRY(listelm+offset)^.tqe_prev^:=elm; + P_TAILQ_ENTRY(listelm+offset)^.tqe_prev:=@P_TAILQ_ENTRY(field)^.tqe_next; +end; + procedure TAILQ_REMOVE(head,elm,field:Pointer); inline; var offset:ptruint; diff --git a/rtl/ntapi.pas b/rtl/ntapi.pas index a6cedaec..5b37c1b6 100644 --- a/rtl/ntapi.pas +++ b/rtl/ntapi.pas @@ -90,6 +90,8 @@ const ViewShare=1; ViewUnmap=2; + SECTION_MAP_EXECUTE=$8; + type PIO_STATUS_BLOCK=^IO_STATUS_BLOCK; IO_STATUS_BLOCK=packed record diff --git a/sys/kern/kern_mtx.pas b/sys/kern/kern_mtx.pas index bb26543e..a2ed11fa 100644 --- a/sys/kern/kern_mtx.pas +++ b/sys/kern/kern_mtx.pas @@ -9,10 +9,13 @@ type p_mtx=^mtx; mtx=TRTLCriticalSection; -procedure mtx_init(var m:mtx); +procedure mtx_init (var m:mtx); procedure mtx_destroy(var m:mtx); -procedure mtx_lock(var m:mtx); -procedure mtx_unlock(var m:mtx); +procedure mtx_lock (var m:mtx); +function mtx_trylock(var m:mtx):Boolean; +procedure mtx_unlock (var m:mtx); +function mtx_owned (var m:mtx):Boolean; +procedure mtx_assert (var m:mtx); implementation @@ -31,11 +34,25 @@ begin EnterCriticalSection(m); end; +function mtx_trylock(var m:mtx):Boolean; inline; +begin + Result:=TryEnterCriticalSection(m)<>0; +end; + procedure mtx_unlock(var m:mtx); inline; begin LeaveCriticalSection(m); end; +function mtx_owned(var m:mtx):Boolean; inline; +begin + Result:=m.OwningThread=GetCurrentThreadId; +end; + +procedure mtx_assert(var m:mtx); inline; +begin + Assert(mtx_owned(m)); +end; end.