mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-23 01:41:34 +08:00
[core] more leaf for speedup
This commit is contained in:
@@ -482,6 +482,8 @@ public sealed partial class DirectExecutionBackend
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LastError = $"HLE dispatch error for {importStubEntry.Nid}: {ex.GetType().Name}: {ex.Message}";
|
LastError = $"HLE dispatch error for {importStubEntry.Nid}: {ex.GetType().Name}: {ex.Message}";
|
||||||
|
Console.Error.WriteLine($"[LOADER][ERROR] {LastError}");
|
||||||
|
Console.Error.WriteLine($"[LOADER][ERROR] {ex.StackTrace}");
|
||||||
cpuContext[CpuRegister.Rax] = 18446744071562199298uL;
|
cpuContext[CpuRegister.Rax] = 18446744071562199298uL;
|
||||||
return 18446744071562199298uL;
|
return 18446744071562199298uL;
|
||||||
}
|
}
|
||||||
@@ -533,11 +535,22 @@ public sealed partial class DirectExecutionBackend
|
|||||||
$"ret=0x{returnRip:X16}");
|
$"ret=0x{returnRip:X16}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int returnValue;
|
||||||
|
if (IsNoBlockLeafImport(importStubEntry.Nid))
|
||||||
|
{
|
||||||
|
cpuContext.ClearRaxWriteFlag();
|
||||||
|
returnValue = export.Function(cpuContext);
|
||||||
|
if (!cpuContext.WasRaxWritten)
|
||||||
|
{
|
||||||
|
cpuContext[CpuRegister.Rax] = unchecked((ulong)returnValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
var previousImportCallFrame = GuestThreadExecution.EnterImportCallFrame(
|
var previousImportCallFrame = GuestThreadExecution.EnterImportCallFrame(
|
||||||
returnRip,
|
returnRip,
|
||||||
(ulong)argPackPtr + 104uL,
|
(ulong)argPackPtr + 104uL,
|
||||||
ActiveGuestReturnSlotAddress);
|
ActiveGuestReturnSlotAddress);
|
||||||
int returnValue;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cpuContext.ClearRaxWriteFlag();
|
cpuContext.ClearRaxWriteFlag();
|
||||||
@@ -551,6 +564,7 @@ public sealed partial class DirectExecutionBackend
|
|||||||
{
|
{
|
||||||
GuestThreadExecution.RestoreImportCallFrame(previousImportCallFrame);
|
GuestThreadExecution.RestoreImportCallFrame(previousImportCallFrame);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (returnValue != (int)OrbisGen2Result.ORBIS_GEN2_OK)
|
if (returnValue != (int)OrbisGen2Result.ORBIS_GEN2_OK)
|
||||||
{
|
{
|
||||||
@@ -594,6 +608,28 @@ public sealed partial class DirectExecutionBackend
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsNoBlockLeafImport(string nid) =>
|
||||||
|
nid is
|
||||||
|
"8aI7R7WaOlc" or // sceAmprCommandBufferConstructor
|
||||||
|
"a8uLzYY--tM" or // sceAmprAprCommandBufferConstructor
|
||||||
|
"Qs1xtplKo0U" or // sceAmprAprCommandBufferDestructor
|
||||||
|
"GuchCTefuZw" or // sceAmprCommandBufferDestructor
|
||||||
|
"N-FSPA4S3nI" or // sceAmprCommandBufferSetBuffer
|
||||||
|
"baQO9ez2gL4" or // sceAmprCommandBufferReset
|
||||||
|
"ULvXMDz56po" or // sceAmprCommandBufferClearBuffer
|
||||||
|
"mQ16-QdKv7k" or // sceAmprAprCommandBufferReadFile
|
||||||
|
"vWU-odnS+fU" or // sceAmprMeasureCommandSizeReadFile
|
||||||
|
"sSAUCCU1dv4" or // sceAmprMeasureCommandSizeWriteKernelEventQueue_04_00
|
||||||
|
"C+IEj+BsAFM" or // sceAmprMeasureCommandSizeWriteAddressOnCompletion
|
||||||
|
"tZDDEo2tE5k" or // sceAmprCommandBufferGetSize
|
||||||
|
"GnxKOHEawhk" or // sceAmprCommandBufferGetCurrentOffset
|
||||||
|
"H896Pt-yB4I" or // sceAmprCommandBufferWriteKernelEventQueue_04_00
|
||||||
|
"sJXyWHjP-F8" or // sceAmprCommandBufferWriteAddressOnCompletion
|
||||||
|
"ASoW5WE-UPo" or // sceKernelAprSubmitCommandBufferAndGetResult
|
||||||
|
"rqwFKI4PAiM" or // sceKernelAprWaitCommandBuffer
|
||||||
|
"eE4Szl8sil8" or // sceKernelAprSubmitCommandBuffer
|
||||||
|
"qvMUCyyaCSI"; // sceKernelAprSubmitCommandBufferAndGetId
|
||||||
|
|
||||||
private bool ShouldLogImportResult(string nid, OrbisGen2Result result)
|
private bool ShouldLogImportResult(string nid, OrbisGen2Result result)
|
||||||
{
|
{
|
||||||
var expectedFileProbeMiss =
|
var expectedFileProbeMiss =
|
||||||
@@ -602,7 +638,10 @@ public sealed partial class DirectExecutionBackend
|
|||||||
var expectedTimedWaitTimeout =
|
var expectedTimedWaitTimeout =
|
||||||
string.Equals(nid, "27bAgiJmOh0", StringComparison.Ordinal) &&
|
string.Equals(nid, "27bAgiJmOh0", StringComparison.Ordinal) &&
|
||||||
unchecked((int)result) == 60;
|
unchecked((int)result) == 60;
|
||||||
if (!expectedFileProbeMiss && !expectedTimedWaitTimeout)
|
var expectedMutexTrylockBusy =
|
||||||
|
string.Equals(nid, "K-jXhbt2gn4", StringComparison.Ordinal) &&
|
||||||
|
result == OrbisGen2Result.ORBIS_GEN2_ERROR_BUSY;
|
||||||
|
if (!expectedFileProbeMiss && !expectedTimedWaitTimeout && !expectedMutexTrylockBusy)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -684,7 +723,11 @@ public sealed partial class DirectExecutionBackend
|
|||||||
"Vo5V8KAwCmk" or // sceSystemServiceHideSplashScreen
|
"Vo5V8KAwCmk" or // sceSystemServiceHideSplashScreen
|
||||||
"TywrFKCoLGY" or // sceSaveDataInitialize3
|
"TywrFKCoLGY" or // sceSaveDataInitialize3
|
||||||
"dyIhnXq-0SM" or // sceSaveDataDirNameSearch
|
"dyIhnXq-0SM" or // sceSaveDataDirNameSearch
|
||||||
|
"ERKzksauAJA" or // sceSaveDataDialogGetStatus
|
||||||
|
"KK3Bdg1RWK0" or // sceSaveDataDialogUpdateStatus
|
||||||
|
"en7gNVnh878" or // sceSaveDataDialogIsReadyToDisplay
|
||||||
"jO8DM8oyego" or // sceNpEntitlementAccessInitialize
|
"jO8DM8oyego" or // sceNpEntitlementAccessInitialize
|
||||||
|
"TFyU+KFBv54" or // sceNpEntitlementAccessGetAddcontEntitlementInfoList
|
||||||
"27bAgiJmOh0" or // pthread_cond_timedwait
|
"27bAgiJmOh0" or // pthread_cond_timedwait
|
||||||
"iQw3iQPhvUQ" or // sceNetCtlCheckCallback
|
"iQw3iQPhvUQ" or // sceNetCtlCheckCallback
|
||||||
"Q2V+iqvjgC0" or // vsnprintf
|
"Q2V+iqvjgC0" or // vsnprintf
|
||||||
|
|||||||
Reference in New Issue
Block a user