mirror of https://github.com/red-prig/fpPS4.git
sceKernelMlock and etc
This commit is contained in:
parent
ab085657cb
commit
fb1d06cf73
|
@ -1112,6 +1112,11 @@ begin
|
|||
lib^.set_proc($2FF4372C48C86E00,@ps4_sceKernelMapDirectMemory);
|
||||
lib^.set_proc($35C6965317CC3484,@ps4_sceKernelMapNamedDirectMemory);
|
||||
|
||||
lib^.set_proc($9930597C46A5D81C,@ps4_mlock);
|
||||
lib^.set_proc($386E11B03C0B82EA,@ps4_munlock);
|
||||
lib^.set_proc($DE4EA4C7FCCE3924,@ps4_sceKernelMlock);
|
||||
lib^.set_proc($C502087C9F3AD2C9,@ps4_sceKernelMunlock);
|
||||
|
||||
lib^.set_proc($B59638F9264D1610,@ps4_msync);
|
||||
lib^.set_proc($0E435E6F1989C952,@ps4_sceKernelMsync);
|
||||
|
||||
|
|
|
@ -207,6 +207,11 @@ function ps4_sceKernelMapNamedDirectMemory(
|
|||
alignment:QWORD;
|
||||
name:Pchar):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_mlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
function ps4_munlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelMlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelMunlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
|
||||
//
|
||||
|
||||
function ps4_msync(addr:Pointer;len:size_t;flags:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
@ -1603,6 +1608,70 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
//
|
||||
|
||||
function _sys_mlock(addr:Pointer;len:qword):Integer;
|
||||
var
|
||||
tmp:Pointer;
|
||||
begin
|
||||
tmp:=AlignDw(addr,PHYSICAL_PAGE_SIZE);
|
||||
len:=len+(addr-tmp);
|
||||
|
||||
addr:=tmp;
|
||||
len:=AlignUp(len,PHYSICAL_PAGE_SIZE);
|
||||
|
||||
if VirtualLock(addr,len) then
|
||||
begin
|
||||
Result:=0;
|
||||
end else
|
||||
begin
|
||||
Result:=ENOMEM;
|
||||
end;
|
||||
end;
|
||||
|
||||
function _sys_munlock(addr:Pointer;len:qword):Integer;
|
||||
var
|
||||
tmp:Pointer;
|
||||
begin
|
||||
tmp:=AlignDw(addr,PHYSICAL_PAGE_SIZE);
|
||||
len:=len+(addr-tmp);
|
||||
|
||||
addr:=tmp;
|
||||
len:=AlignUp(len,PHYSICAL_PAGE_SIZE);
|
||||
|
||||
if VirtualUnlock(addr,len) then
|
||||
begin
|
||||
Result:=0;
|
||||
end else
|
||||
begin
|
||||
Result:=ENOMEM;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ps4_mlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=_set_errno(_sys_mlock(addr,len));
|
||||
end;
|
||||
|
||||
function ps4_munlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=_set_errno(_sys_munlock(addr,len));
|
||||
end;
|
||||
|
||||
function ps4_sceKernelMlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=_sys_mlock(addr,len);
|
||||
_set_errno(Result);
|
||||
Result:=px2sce(Result);
|
||||
end;
|
||||
|
||||
function ps4_sceKernelMunlock(addr:Pointer;len:qword):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=_sys_munlock(addr,len);
|
||||
_set_errno(Result);
|
||||
Result:=px2sce(Result);
|
||||
end;
|
||||
|
||||
////
|
||||
////
|
||||
|
||||
|
|
|
@ -3157,8 +3157,8 @@ begin
|
|||
res:=addr;
|
||||
if (g_heap_param.HeapMemoryLock=0) then
|
||||
begin
|
||||
ps4_sceKernelMlock(addr,size); //ignore ret
|
||||
ret:=0;
|
||||
//ret:=sceKernelMlock(addr,size); TODO
|
||||
if (ret=0) then
|
||||
begin
|
||||
_out^:=res;
|
||||
|
|
Loading…
Reference in New Issue