diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 73d6f9863b..301f13715a 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -735,6 +735,10 @@ static void PerformCallSyscall(const HLEFunction *info) { RETURN(hleLogDebug(Log::HLE, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt")); } else { info->func(); + if (flags & HLE_AUTO_LOG) { + int retval = currentMIPS->r[MIPS_REG_V0]; + retval = hleLogDebugOrError(info->logCat, retval); + } } // Now, g_stackSize should be back to 0. Enable this for "pedantic mode", will find a lot of problems. @@ -769,6 +773,7 @@ const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op) { return &moduleDB[modulenum].funcTable[funcnum]; } +// This almost never returns a direct function, we nearly always return PerformCallSyscall. void *GetQuickSyscallFunc(MIPSOpcode op) { if (coreCollectDebugStats) return nullptr; @@ -789,6 +794,7 @@ void hleSetFlipTime(double t) { hleFlipTime = t; } +// This is only called when debug stats is on. In that case, code is recompiled to call this instead of using GetQuickSyscallFunc to bypass it. void CallSyscall(MIPSOpcode op) { PROFILE_THIS_SCOPE("syscall"); double start = 0.0; // need to initialize to fix the race condition where coreCollectDebugStats is enabled in the middle of this func. diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index 323097f453..aafe7fea78 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -47,6 +47,8 @@ enum { HLE_CLEAR_STACK_BYTES = 1 << 10, // Indicates that this call operates in kernel mode. HLE_KERNEL_SYSCALL = 1 << 11, + // Indicates that the framework performs the logging, depending on the return value. + HLE_AUTO_LOG = 1 << 12, }; struct HLEFunction { @@ -74,6 +76,7 @@ struct HLEFunction { u32 flags; // See HLE_CLEAR_STACK_BYTES. u32 stackBytesToClear; + Log logCat; }; struct HLEModule { diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 17d56c667d..d49fdbe720 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -951,7 +951,7 @@ static void __DisplayWaitForVblanksCB(const char *reason, int vblanks) { static int sceDisplayWaitVblankStart() { __DisplayWaitForVblanks("vblank start waited", 1); - return hleLogDebug(Log::sceDisplay, 0); + return 0; } static int sceDisplayWaitVblank() { @@ -1107,7 +1107,7 @@ const HLEFunction sceDisplay[] = { {0X289D82FE, &WrapI_UIII, "sceDisplaySetFrameBuf", 'i', "xiii"}, {0XEEDA2E54, &WrapU_UUUI, "sceDisplayGetFrameBuf", 'x', "pppi"}, {0X36CDFADE, &WrapI_V, "sceDisplayWaitVblank", 'i', "", HLE_NOT_DISPATCH_SUSPENDED }, - {0X984C27E7, &WrapI_V, "sceDisplayWaitVblankStart", 'i', "", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED }, + {0X984C27E7, &WrapI_V, "sceDisplayWaitVblankStart", 'i', "", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED | HLE_AUTO_LOG, 0, Log::sceDisplay }, {0X40F1469C, &WrapI_I, "sceDisplayWaitVblankStartMulti", 'i', "i" }, {0X8EB9EC49, &WrapI_V, "sceDisplayWaitVblankCB", 'i', "", HLE_NOT_DISPATCH_SUSPENDED }, {0X46F186C3, &WrapI_V, "sceDisplayWaitVblankStartCB", 'i', "", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED }, diff --git a/Core/MIPS/ARM/ArmCompBranch.cpp b/Core/MIPS/ARM/ArmCompBranch.cpp index 526da54a68..28f4f683cc 100644 --- a/Core/MIPS/ARM/ArmCompBranch.cpp +++ b/Core/MIPS/ARM/ArmCompBranch.cpp @@ -690,14 +690,11 @@ void ArmJit::Comp_Syscall(MIPSOpcode op) #else // Skip the CallSyscall where possible. void *quickFunc = GetQuickSyscallFunc(op); - if (quickFunc) - { + if (quickFunc) { gpr.SetRegImm(R0, (u32)(intptr_t)GetSyscallFuncPointer(op)); // Already flushed, so R1 is safe. QuickCallFunction(R1, quickFunc); - } - else - { + } else { gpr.SetRegImm(R0, op.encoding); QuickCallFunction(R1, (void *)&CallSyscall); }