This commit is contained in:
red-prig 2022-10-10 02:32:01 +03:00
parent 989e726f1a
commit 26f3cef67c
6 changed files with 90 additions and 27 deletions

View File

@ -858,13 +858,17 @@ begin
//signal
lib^.set_proc($38C0D128A019F08E,@ps4_sceKernelDebugRaiseException);
lib^.set_proc($CC4FF05C86632E83,@ps4_sceKernelDebugRaiseExceptionOnReleaseMode);
lib^.set_proc($5644C0B2B643709D,@ps4_sigfillset);
lib^.set_proc($2548A616D29ED0A7,@ps4_sigaddset);
lib^.set_proc($68F732A6D6CE899B,@ps4_sigprocmask);
lib^.set_proc($EB1569CB415DABE2,@ps4_sigprocmask);
lib^.set_proc($2592B0E7E5AB9DAC,@ps4_pthread_sigmask);
lib^.set_proc($72B6F98FB9A49357,@ps4_is_signal_return);
lib^.set_proc($2A22443C4591C946,@ps4_sigaction);
lib^.set_proc($5400DCDCC350DDC3,@ps4_signal_);
lib^.set_proc($38C0D128A019F08E,@ps4_sceKernelDebugRaiseException);
lib^.set_proc($CC4FF05C86632E83,@ps4_sceKernelDebugRaiseExceptionOnReleaseMode);
//signal

View File

@ -8,11 +8,13 @@ uses
Windows,
sys_signal;
function ps4_sigfillset(_set:P_sigset_t):Integer; SysV_ABI_CDecl;
function ps4_sigaddset(_set:p_sigset_t;signum:Integer):Integer; SysV_ABI_CDecl;
function ps4_sigprocmask(how:Integer;_set,oldset:P_sigset_t):Integer; SysV_ABI_CDecl;
function ps4_pthread_sigmask(how:Integer;_set,oldset:P_sigset_t):Integer; SysV_ABI_CDecl;
function ps4_is_signal_return(param:PQWORD):Integer; SysV_ABI_CDecl;
function ps4_sigfillset(_set:p_sigset_t):Integer; SysV_ABI_CDecl;
function ps4_sigaddset(_set:p_sigset_t;signum:Integer):Integer; SysV_ABI_CDecl;
function ps4_sigprocmask(how:Integer;_set,oldset:p_sigset_t):Integer; SysV_ABI_CDecl;
function ps4_pthread_sigmask(how:Integer;_set,oldset:p_sigset_t):Integer; SysV_ABI_CDecl;
function ps4_is_signal_return(param:PQWORD):Integer; SysV_ABI_CDecl;
function ps4_sigaction(signum:Integer;act,oldact:p_sigaction_t):Integer; SysV_ABI_CDecl;
function ps4_signal_(sig:Integer;func:sig_t):sig_t; SysV_ABI_CDecl;
type
TsceKernelExceptionHandler=procedure(signum:Integer;context:Pointer); SysV_ABI_CDecl;
@ -69,7 +71,7 @@ begin
Exit(_set_errno(__sigaction(signum,act,oldact)));
end;
function ps4_signal(sig:Integer;func:sig_t):sig_t; SysV_ABI_CDecl;
function ps4_signal_(sig:Integer;func:sig_t):sig_t; SysV_ABI_CDecl;
var
act,old:sigaction_t;
ret:Integer;

View File

@ -1439,6 +1439,7 @@ begin
end;
else;
end;
end;
@ -1535,7 +1536,7 @@ var
begin
Result:=False;
if (cbs=nil) then Exit;
if (nRelaCount=0) then Exit;
if (nRelaCount=0) then Exit(True);
For i:=0 to nRelaCount-1 do
begin
pRela:=@pRelaEntries[i];
@ -1573,7 +1574,7 @@ var
begin
Result:=False;
if (cbs=nil) then Exit;
if nPltRelaCount=0 then Exit;
if (nPltRelaCount=0) then Exit(True);
For i:=0 to nPltRelaCount-1 do
begin
pRela:=@pPltRela[i];
@ -1609,7 +1610,7 @@ begin
Result:=False;
if (cbs=nil) then Exit;
if nSymTabCount=0 then Exit;
if (nSymTabCount=0) then Exit(True);
For i:=0 to nSymTabCount-1 do
begin
symbol:=@pSymTab[i];
@ -2861,11 +2862,28 @@ begin
Result.segment_count:=ModuleInfo.segmentCount;
end;
procedure _Entry(P:TEntryPoint;pFileName:Pchar);
var
StartupParams:TPS4StartupParams;
begin
StartupParams:=Default(TPS4StartupParams);
StartupParams.argc:=1;
StartupParams.argv[0]:=pFileName;
//OpenOrbis relies on the fact that besides %rdi and %rsp also link to StartupParams, a very strange thing
asm
xor %esi,%esi
lea StartupParams,%rdi
mov %rdi,%rsp
jmp P
end;
//P(@StartupParams,nil);
end;
procedure Telf_file.mapCodeEntry;
var
P:TEntryPoint;
StartupParams:TPS4StartupParams;
begin
Pointer(P):=Pointer(pEntryPoint);
Writeln('EntryPoint:',HexStr(P));
@ -2875,12 +2893,7 @@ begin
begin
Pointer(P):=Pointer(mMap.pAddr+QWORD(P));
StartupParams:=Default(TPS4StartupParams);
StartupParams.argc:=1;
StartupParams.argv[0]:=PChar(pFileName);
P(@StartupParams,nil);
_Entry(P,PChar(pFileName));
end;
end;

View File

@ -20,6 +20,7 @@ type
procedure emit_V_CVT_OFF_F32_I4;
procedure emit_V_CVT_F32_UBYTE0;
procedure emit_V_EXT_F32(OpId:DWORD);
procedure emit_V_SIN_COS(OpId:DWORD);
procedure emit_V_RCP_F32;
procedure emit_V_FFBL_B32;
end;
@ -92,6 +93,21 @@ begin
OpGlsl1(OpId,dtFloat32,dst,src);
end;
procedure TEmit_VOP1.emit_V_SIN_COS(OpId:DWORD);
const
PI2:Single=2*PI;
Var
dst:PsrRegSlot;
src:PsrRegNode;
begin
dst:=get_vdst8(FSPI.VOP1.VDST);
src:=fetch_ssrc9(FSPI.VOP1.SRC0,dtFloat32);
src:=OpFMulToS(src,PI2);
OpGlsl1(OpId,dtFloat32,dst,src);
end;
procedure TEmit_VOP1.emit_V_RCP_F32;
Var
dst:PsrRegSlot;
@ -148,8 +164,8 @@ begin
V_SQRT_F32 : emit_V_EXT_F32(GlslOp.Sqrt);
V_SIN_F32 : emit_V_EXT_F32(GlslOp.Sin);
V_COS_F32 : emit_V_EXT_F32(GlslOp.Cos);
V_SIN_F32 : emit_V_SIN_COS(GlslOp.Sin);
V_COS_F32 : emit_V_SIN_COS(GlslOp.Cos);
V_RCP_F32 : emit_V_RCP_F32;

View File

@ -50,6 +50,7 @@ type
procedure emit_V_CUBE(OpId:DWORD);
procedure emit_V_MOV_B32;
procedure emit_V2_EXT_F32(OpId:DWORD);
procedure emit_V2_SIN_COS(OpId:DWORD);
procedure emit_V_RCP_F32;
end;
@ -661,6 +662,28 @@ begin
emit_dst_clamp_f(dst);
end;
procedure TEmit_VOP3.emit_V2_SIN_COS(OpId:DWORD);
const
PI2:Single=2*PI;
Var
dst:PsrRegSlot;
src:PsrRegNode;
begin
dst:=get_vdst8(FSPI.VOP3a.VDST);
src:=fetch_ssrc9(FSPI.VOP3a.SRC0,dtFloat32);
src:=OpFMulToS(src,PI2);
emit_src_abs_bit(@src,1);
emit_src_neg_bit(@src,1);
OpGlsl1(OpId,dtFloat32,dst,src);
emit_dst_omod_f(dst);
emit_dst_clamp_f(dst);
end;
procedure TEmit_VOP3.emit_V_RCP_F32;
Var
dst:PsrRegSlot;
@ -894,8 +917,8 @@ begin
384+V_SQRT_F32 : emit_V2_EXT_F32(GlslOp.Sqrt);
384+V_SIN_F32 : emit_V2_EXT_F32(GlslOp.Sin);
384+V_COS_F32 : emit_V2_EXT_F32(GlslOp.Cos);
384+V_SIN_F32 : emit_V2_SIN_COS(GlslOp.Sin);
384+V_COS_F32 : emit_V2_SIN_COS(GlslOp.Cos);
384+V_RCP_F32 : emit_V_RCP_F32;

View File

@ -339,9 +339,14 @@ begin
Assert(false);
end;
FShader:=TvShaderExt.Create;
FShader.FDescSetId:=FDescSetId;
FShader.LoadFromFile(ChangeFileExt(fdump,'.spv'));
if FileExists(ChangeFileExt(fdump,'.spv')) then
begin
FShader:=TvShaderExt.Create;
FShader.FDescSetId:=FDescSetId;
FShader.LoadFromFile(ChangeFileExt(fdump,'.spv'));
Result:=FShader;
Exit;
end;
}