mirror of
https://github.com/red-prig/fpPS4.git
synced 2024-11-23 06:19:57 +00:00
+
This commit is contained in:
parent
6c9d2fa02d
commit
73c4b37a8b
@ -166,6 +166,13 @@ type
|
||||
OnCreateBlockCb:TBlockCb;
|
||||
OnFreeBlockCb :TBlockCb;
|
||||
|
||||
stat:record
|
||||
flex:QWORD;
|
||||
direct:QWORD;
|
||||
cpu:QWORD;
|
||||
gpu:QWORD;
|
||||
end;
|
||||
|
||||
Function check_fixed(Offset:Pointer;Size:QWORD;flags:Byte;fd:Integer):Integer;
|
||||
Function mmap(Offset:Pointer;Size,Align:QWORD;prot,flags:Byte;fd:Integer;addr:QWORD;var AdrOut:Pointer):Integer;
|
||||
|
||||
@ -561,12 +568,59 @@ begin
|
||||
begin
|
||||
FFreeSet.Insert(key);
|
||||
end;
|
||||
end else
|
||||
if (key.block<>nil) then //not system
|
||||
begin
|
||||
if (key.F.direct=0) then //is flex
|
||||
begin
|
||||
Inc(stat.flex,key.Size);
|
||||
end else //is direct
|
||||
begin
|
||||
Inc(stat.direct,key.Size);
|
||||
end;
|
||||
|
||||
if _isgpu(key.F.prot) then
|
||||
begin
|
||||
Inc(stat.gpu,key.Size);
|
||||
end else
|
||||
begin
|
||||
Inc(stat.cpu,key.Size);
|
||||
end;
|
||||
end;
|
||||
FAllcSet.Insert(key);
|
||||
end;
|
||||
|
||||
procedure TVirtualManager._Delete(const key:TVirtualAdrNode);
|
||||
var
|
||||
It:TAllcPoolNodeSet.Iterator;
|
||||
rkey:TVirtualAdrNode;
|
||||
begin
|
||||
It:=FAllcSet.find(key);
|
||||
if (It.Item<>nil) then
|
||||
begin
|
||||
rkey:=It.Item^;
|
||||
|
||||
if not rkey.IsFree then
|
||||
if (rkey.block<>nil) then //not system
|
||||
begin
|
||||
if (rkey.F.direct=0) then //is flex
|
||||
begin
|
||||
Dec(stat.flex,rkey.Size);
|
||||
end else //is direct
|
||||
begin
|
||||
Dec(stat.direct,rkey.Size);
|
||||
end;
|
||||
|
||||
if _isgpu(rkey.F.prot) then
|
||||
begin
|
||||
Dec(stat.gpu,rkey.Size);
|
||||
end else
|
||||
begin
|
||||
Dec(stat.cpu,rkey.Size);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
FAllcSet.delete(key);
|
||||
FFreeSet.delete(key);
|
||||
end;
|
||||
|
@ -954,6 +954,11 @@ begin
|
||||
lib^.set_proc($5E15879FA3F947B5,@ps4_pthread_rwlock_trywrlock);
|
||||
lib^.set_proc($12098BA3A11682CA,@ps4_pthread_rwlock_unlock);
|
||||
|
||||
lib^.set_proc($C8E7C683F2356482,@ps4_scePthreadRwlockattrInit);
|
||||
lib^.set_proc($8B689F6777D2D9FA,@ps4_scePthreadRwlockattrDestroy);
|
||||
lib^.set_proc($2B296CD42845CAB7,@ps4_scePthreadRwlockattrGettype);
|
||||
lib^.set_proc($87F3A27E2A2E05DF,@ps4_scePthreadRwlockattrSettype);
|
||||
|
||||
lib^.set_proc($E942C06B47EAE230,@ps4_scePthreadRwlockInit);
|
||||
lib^.set_proc($041FA46F4F1397D0,@ps4_scePthreadRwlockDestroy);
|
||||
lib^.set_proc($3B1F62D1CECBE70D,@ps4_scePthreadRwlockRdlock);
|
||||
@ -1113,6 +1118,7 @@ begin
|
||||
|
||||
lib^.set_proc($93E017AAEDBF7817,@ps4_getpagesize);
|
||||
lib^.set_proc($A4EF7A4F0CCE9B91,@ps4_sceKernelGetDirectMemorySize);
|
||||
lib^.set_proc($68DCF5D5F9E7CE2E,@ps4_sceKernelAvailableFlexibleMemorySize);
|
||||
|
||||
lib^.set_proc($AD35F0EB9C662C80,@ps4_sceKernelAllocateDirectMemory);
|
||||
lib^.set_proc($07EBDCD803B666B7,@ps4_sceKernelAllocateMainDirectMemory);
|
||||
|
@ -86,6 +86,7 @@ type
|
||||
|
||||
function ps4_sceKernelGetDirectMemorySize:Int64; SysV_ABI_CDecl;
|
||||
function ps4_getpagesize:Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelAvailableFlexibleMemorySize(sizeOut:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
|
||||
//direct
|
||||
|
||||
@ -350,6 +351,32 @@ begin
|
||||
Result:=PHYSICAL_PAGE_SIZE;
|
||||
end;
|
||||
|
||||
function ps4_sceKernelAvailableFlexibleMemorySize(sizeOut:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
var
|
||||
flex:QWORD;
|
||||
begin
|
||||
Result:=0;
|
||||
if (sizeOut=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
_sig_lock;
|
||||
rwlock_rdlock(MMLock); //r
|
||||
|
||||
flex:=VirtualManager.stat.flex;
|
||||
|
||||
rwlock_unlock(MMLock);
|
||||
_sig_unlock;
|
||||
|
||||
if (flex<SceKernelFlexibleMemorySize) then
|
||||
begin
|
||||
flex:=SceKernelFlexibleMemorySize-flex;
|
||||
end else
|
||||
begin
|
||||
flex:=0;
|
||||
end;
|
||||
|
||||
sizeOut^:=flex;
|
||||
end;
|
||||
|
||||
function _test_mtype(mtype:Integer):Boolean; inline;
|
||||
begin
|
||||
Case mtype of
|
||||
|
@ -1406,7 +1406,7 @@ var
|
||||
begin
|
||||
if (gpuAddr=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
if (gpuAddrSizeInBytes<$FF) then Exit(SCE_GNM_ERROR_SUBMISSION_NOT_ENOUGH_RESOURCES);
|
||||
if (gpuAddrSizeInBytes<=$FF) then Exit(SCE_GNM_ERROR_SUBMISSION_NOT_ENOUGH_RESOURCES);
|
||||
|
||||
PQWORD(gpuAddr)^:=$68750777c03e1000; //prepare flip?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user