From 0b21474b79b45614956861cec25c7de6aa3a26fb Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 25 Feb 2015 14:48:12 +0300 Subject: [PATCH] Logging fixed --- rpcs3/Emu/Cell/PPUInterpreter.h | 28 +--------------------------- rpcs3/Emu/Cell/SPUInterpreter.h | 6 +----- rpcs3/Emu/SysCalls/Modules.cpp | 7 ++++++- rpcs3/Emu/SysCalls/SysCalls.cpp | 21 +++++++++++++++------ rpcs3/Emu/SysCalls/SysCalls.h | 2 +- 5 files changed, 24 insertions(+), 40 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index a21a524fc6..9a96beeb30 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -18,10 +18,6 @@ #include -#if 0//def _DEBUG -#define HLE_CALL_DEBUG -#endif - extern u64 rotate_mask[64][64]; // defined in PPUThread.cpp, static didn't work correctly in GCC 4.9 for some reason inline void InitRotateMask() { @@ -107,28 +103,6 @@ private: if (fetestexcept(FE_OVERFLOW)) CPU.SetFPSCRException(FPSCR_OX); } - void Exit() {} - - void SysCall() - { - const u64 sc = CPU.GPR[11]; - const u64 old_sc = CPU.m_last_syscall; - - CPU.m_last_syscall = sc; - SysCalls::DoSyscall(CPU, (u32)sc); - - if(Ini.HLELogging.GetValue()) - { - LOG_WARNING(PPU, "SysCall[0x%llx ('%s')] done with code [0x%llx]! #pc: 0x%x", - sc, SysCalls::GetHLEFuncName((u32)sc).c_str(), CPU.GPR[3], CPU.PC); - } -#ifdef HLE_CALL_DEBUG - LOG_NOTICE(PPU, "SysCall[%lld] done with code [0x%llx]! #pc: 0x%x", sc, CPU.GPR[3], CPU.PC); -#endif - - CPU.m_last_syscall = old_sc; - } - void NULL_OP() { throw "Null operation"; @@ -2260,7 +2234,7 @@ private: { switch (lev) { - case 0x0: SysCall(); break; + case 0x0: SysCalls::DoSyscall(CPU, CPU.GPR[11]); break; case 0x1: throw "SC(): HyperCall LV1"; case 0x3: CPU.FastStop(); break; default: throw fmt::Format("SC(): unknown level (0x%x)", lev); diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index 7c56b4c9ac..774478c1d2 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -91,10 +91,6 @@ public: } private: - void SysCall() - { - } - //0 - 10 void STOP(u32 code) { @@ -1096,7 +1092,7 @@ private: } else if (result == 0.0f) { - if (a != 0.0f & b != 0.0f) + if (a != 0.0f && b != 0.0f) CPU.FPSCR.setSinglePrecisionExceptionFlags(w, FPSCR_SUNF | FPSCR_SDIFF); result = +0.0f; } diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index 91e543ac84..2797429603 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -106,11 +106,16 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index) } else if (func->func) { + if (Ini.HLELogging.GetValue()) + { + LOG_NOTICE(HLE, "HLE function called: %s", SysCalls::GetHLEFuncName(func->id)); + } + func->func(CPU); } else { - LOG_ERROR(HLE, "Unimplemented function: %s", SysCalls::GetHLEFuncName(func->id)); + LOG_ERROR(HLE, "Unimplemented function: %s -> CELL_OK", SysCalls::GetHLEFuncName(func->id)); CPU.GPR[3] = 0; } diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 6a6ed229d9..a5500723a6 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -921,23 +921,32 @@ void null_func(PPUThread& CPU) return; } - LOG_ERROR(HLE, "Unknown syscall: %d - %08x", code, code); + LOG_ERROR(HLE, "Unknown syscall: %d - %08x -> CELL_OK", code, code); CPU.GPR[3] = 0; return; } -void SysCalls::DoSyscall(PPUThread& CPU, u32 code) +void SysCalls::DoSyscall(PPUThread& CPU, u64 code) { + auto old_last_syscall = CPU.m_last_syscall; + CPU.m_last_syscall = code; + + if (code >= 1024) + { + throw "Invalid syscall number"; + } + //Auto Pause using simple singleton. Debug::AutoPause::getInstance().TryPause(code); - if(code < 1024) + if (Ini.HLELogging.GetValue()) { - sc_table[code](CPU); - return; + LOG_NOTICE(PPU, "SysCall called: %s [0x%llx]", "unknown", code); } - throw "Invalid syscall number"; + sc_table[code](CPU); + + CPU.m_last_syscall = old_last_syscall; } IdManager& SysCallBase::GetIdManager() const diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 5cf99e50cd..5d27667da0 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -66,6 +66,6 @@ class PPUThread; class SysCalls { public: - static void DoSyscall(PPUThread& CPU, u32 code); + static void DoSyscall(PPUThread& CPU, u64 code); static std::string GetHLEFuncName(const u32 fid); };