This commit is contained in:
Pavel 2022-10-05 17:05:17 +03:00
parent 5238e7b729
commit f07cdb2ca6
2 changed files with 181 additions and 11 deletions

View File

@ -123,23 +123,72 @@ end;
// void *memblock
//);
function ps4_sceKernelGetModuleInfoFromAddr(Addr:Pointer;P2:Integer;info:PKernelModuleInfo):Integer; SysV_ABI_CDecl;
type
pSceKernelModuleInfoEx=^SceKernelModuleInfoEx;
SceKernelModuleInfoEx=packed record
st_size:QWORD;
name:array[0..255] of AnsiChar;
id :Integer;
tls_index :DWORD;
tls_init_addr :QWORD;
tls_init_size :DWORD;
tls_size :DWORD;
tls_offset :DWORD;
tls_align :DWORD;
init_proc_addr :QWORD;
fini_proc_addr :QWORD;
reserved1 :QWORD;
reserved2 :QWORD;
eh_frame_hdr_addr:QWORD;
eh_frame_addr :QWORD;
eh_frame_hdr_size:DWORD;
eh_frame_size :DWORD;
segments:array[0..3] of TKernelModuleSegmentInfo;
segment_count:DWORD;
ref_count :DWORD;
end;
function ps4_sceKernelGetModuleInfoFromAddr(Addr:Pointer;flags:DWORD;info:pSceKernelModuleInfoEx):Integer; SysV_ABI_CDecl;
var
node:TElf_node;
begin
if (info=nil) then Exit(SCE_KERNEL_ERROR_EFAULT);
_sig_lock;
Writeln('GetModuleInfoFromAddr:',HexStr(Addr),':',P2,':',HexStr(info));
node:=ps4_app.AcqureFileByCodeAdr(Addr);
if (node=nil) then
if (flags - 1 < 2) then
begin
_sig_unlock;
Exit(SCE_KERNEL_ERROR_EINVAL);
if (info=nil) then
begin
Result:=-$7ffdfff2;
end else
begin
_sig_lock;
Writeln('GetModuleInfoFromAddr:',HexStr(Addr),':',flags,':',HexStr(info));
node:=ps4_app.AcqureFileByCodeAdr(Addr);
if (node=nil) then
begin
_sig_unlock;
info^:=Default(SceKernelModuleInfoEx);
Exit(-$7ffdfffd);
end;
info^.st_size:=424;
//info^:=node.GetModuleInfo;
node.Release;
_sig_unlock;
Result:=0;
end;
end else
begin
Result:=-$7ffdffea;
info^:=Default(SceKernelModuleInfoEx);
end;
info^:=node.GetModuleInfo;
node.Release;
_sig_unlock;
Result:=0;
end;
function ps4_sceKernelGetModuleInfo(handle:Integer;info:PKernelModuleInfo):Integer; SysV_ABI_CDecl;
@ -161,6 +210,43 @@ begin
Result:=0;
end;
type
PSceModuleInfoForUnwind=^SceModuleInfoForUnwind;
SceModuleInfoForUnwind=packed record
st_size:qword; //304
name:array[0..255] of AnsiChar;
eh_frame_hdr_addr:qword;
eh_frame_addr:qword;
eh_frame_size:qword;
seg0_addr:qword;
seg0_size:qword;
end;
//nop nid:libkernel:4694092552938853:sceKernelGetModuleInfoForUnwind
function ps4_sceKernelGetModuleInfoForUnwind(addr:Pointer;flags:DWORD;info:PSceModuleInfoForUnwind):Integer; SysV_ABI_CDecl;
begin
if (info=nil) then Exit(SCE_KERNEL_ERROR_EFAULT);
if (flags - 1 < 2) then
begin
if (info=nil) then
begin
Result:=-$7ffdfff2;
end else
begin
Result:=-$7ffdffea;
if (info^.st_size > 303) then
begin
//Result:=-$7ffdfffd; //not found
end;
end;
end else
begin
Result:=-$7ffdffea;
info^:=Default(SceModuleInfoForUnwind);
end;
end;
type
PInternalSegmentInfo=^TInternalSegmentInfo;
TInternalSegmentInfo=packed record

View File

@ -1337,6 +1337,45 @@ begin
Result:=0;
end;
function ps4_sceGnmSubmitAndFlipCommandBuffersForWorkload(
workload:QWORD;
count:DWORD;
dcbGpuAddrs:PPointer;
dcbSizesInBytes:PDWORD;
ccbGpuAddrs:PPointer;
ccbSizesInBytes:PDWORD;
videoOutHandle:Integer;
displayBufferIndex:Integer;
flipMode:Integer;
flipArg:QWORD):Integer; SysV_ABI_CDecl; //10
var
Submit:TvSubmitInfo;
Flip:TqcFlipInfo;
begin
if (count=0) or
(dcbGpuAddrs=nil) or
(dcbSizesInBytes=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
Submit:=Default(TvSubmitInfo);
Submit.count :=count ;
Submit.dcbGpuAddrs :=dcbGpuAddrs ;
Submit.dcbSizesInBytes:=dcbSizesInBytes;
Submit.ccbGpuAddrs :=ccbGpuAddrs ;
Submit.ccbSizesInBytes:=ccbSizesInBytes;
Flip.hVideo :=videoOutHandle;
Flip.bufferIndex:=displayBufferIndex;
Flip.flipMode :=flipMode;
Flip.flipArg :=flipArg;
_sig_lock;
//Writeln(GetCurrentThreadId,'>SubmitAndFlip');
Result:=vSubmitCommandBuffers(@Submit,@Flip);
//Writeln(GetCurrentThreadId,'<SubmitAndFlip');
_sig_unlock;
Result:=0;
end;
//Signals the system that every graphics and asynchronous compute command buffer for this frame has been submitted.
function ps4_sceGnmSubmitDone:Integer; SysV_ABI_CDecl;
begin
@ -1398,6 +1437,46 @@ begin
Result:=Integer(SCE_GNM_ERROR_FAILURE);
end;
const
kWorkloadStatusOk = 0;
kWorkloadStatusInvalidStream = 1;
kWorkloadStatusInvalidWorkload = 2;
kWorkloadStatusInvalidPointer = 3;
kWorkloadStatusTooManyStreams = 4;
kWorkloadStatusTooManyWorkloads = 5;
kWorkloadStatusStreamNotAllocated = 6;
kWorkloadStatusInternalError = 7;
function ps4_sceGnmCreateWorkloadStream(name:Pchar;workloadStream:PDWORD):Integer; SysV_ABI_CDecl;
begin
Result:=kWorkloadStatusInvalidPointer;
if (name<>nil) and (workloadStream<>nil) then
begin
Writeln('sceGnmCreateWorkloadStream:',name);
workloadStream^:=1;
Result:=kWorkloadStatusOk;
end;
end;
function ps4_sceGnmBeginWorkload(stream:DWORD;workload:PQWORD):Integer; SysV_ABI_CDecl;
begin
if (workload<>nil) then
begin
workload^:=QWORD(-DWORD(stream < $10) and 1);
Exit(DWORD($f < stream));
end;
Result:=kWorkloadStatusInvalidPointer;
end;
function ps4_sceGnmEndWorkload(workload:QWORD):Integer; SysV_ABI_CDecl;
begin
if (workload<>0) then
begin
Result:=DWORD($f < DWORD(workload shr $38)) * 2;
end;
end;
const
//EqEventType
kEqEventCompute0RelMem = $00; ///< ReleaseMem event from the compute pipe 0.
@ -1534,6 +1613,7 @@ begin
lib^.set_proc($CF0634615F754D32,@ps4_sceGnmSubmitCommandBuffers);
lib^.set_proc($C5BC4D6AD6B0A217,@ps4_sceGnmSubmitAndFlipCommandBuffers);
lib^.set_proc($19AEABEC7E98D112,@ps4_sceGnmSubmitAndFlipCommandBuffersForWorkload);
lib^.set_proc($CAF67BDEE414AAB9,@ps4_sceGnmSubmitDone);
lib^.set_proc($881B7739ED342AF7,@ps4_sceGnmFlushGarlic);
@ -1546,6 +1626,10 @@ begin
lib^.set_proc($645A8A165DB768C7,@ps4_sceGnmRegisterOwner);
lib^.set_proc($9EF1307D8008993B,@ps4_sceGnmRegisterResource);
lib^.set_proc($E6E7409BEE9BA158,@ps4_sceGnmCreateWorkloadStream);
lib^.set_proc($8A1C6B6ECA122967,@ps4_sceGnmBeginWorkload);
lib^.set_proc($15ADF1EF938E2D10,@ps4_sceGnmEndWorkload);
//nop nid:libSceGnmDriver:DBDA0ABCA5F3119A:sceGnmMapComputeQueue
end;