From e74749f2b2f2528cbc622a5651186293491be969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 9 Mar 2017 11:36:16 +0100 Subject: [PATCH] A function renamed, some logging improvements --- Common/ArmEmitter.cpp | 5 +++-- Core/HLE/HLE.cpp | 11 ++++++----- Core/HLE/HLE.h | 2 +- Core/HLE/sceKernelModule.cpp | 13 +++++-------- Core/MIPS/ARM/ArmAsm.cpp | 22 +++++++--------------- Core/MIPS/ARM/ArmCompBranch.cpp | 2 +- Core/MIPS/ARM64/Arm64CompBranch.cpp | 2 +- Core/MIPS/x86/CompBranch.cpp | 2 +- GPU/D3D11/TextureCacheD3D11.cpp | 7 ++++++- ppsspp_config.h | 3 +++ 10 files changed, 34 insertions(+), 35 deletions(-) diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index 039c68b41e..906468d635 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -754,6 +754,7 @@ void ARMXEmitter::BL(ARMReg src) { Write32(condition | 0x012FFF30 | src); } + void ARMXEmitter::PUSH(const int num, ...) { u16 RegList = 0; @@ -761,14 +762,14 @@ void ARMXEmitter::PUSH(const int num, ...) int i; va_list vl; va_start(vl, num); - for (i=0;i> 6) & 0xFFFFF; //20 bits int funcnum = callno & 0xFFF; @@ -488,13 +488,14 @@ const HLEFunction *GetSyscallInfo(MIPSOpcode op) return NULL; } if (modulenum >= (int)moduleDB.size()) { - ERROR_LOG(HLE, "Syscall had bad module number %i - probably executing garbage", modulenum); + ERROR_LOG(HLE, "Syscall had bad module number %d - probably executing garbage", modulenum); return NULL; } if (funcnum >= moduleDB[modulenum].numFunctions) { - ERROR_LOG(HLE, "Syscall had bad function number %i in module %i - probably executing garbage", funcnum, modulenum); + ERROR_LOG(HLE, "Syscall had bad function number %d in module %d - probably executing garbage", funcnum, modulenum); return NULL; } + INFO_LOG(HLE, "Compiling syscall to %s", moduleDB[modulenum].funcTable[funcnum].name); return &moduleDB[modulenum].funcTable[funcnum]; } @@ -504,7 +505,7 @@ void *GetQuickSyscallFunc(MIPSOpcode op) if (g_Config.bShowDebugStats) return NULL; - const HLEFunction *info = GetSyscallInfo(op); + const HLEFunction *info = GetSyscallFuncPointer(op); if (!info || !info->func) return NULL; @@ -532,7 +533,7 @@ void CallSyscall(MIPSOpcode op) start = time_now_d(); } - const HLEFunction *info = GetSyscallInfo(op); + const HLEFunction *info = GetSyscallFuncPointer(op); if (!info) { RETURN(SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED); return; diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index 516e409d0c..1784ac2140 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -148,7 +148,7 @@ void CallSyscall(MIPSOpcode op); void WriteFuncStub(u32 stubAddr, u32 symAddr); void WriteFuncMissingStub(u32 stubAddr, u32 nid); -const HLEFunction *GetSyscallInfo(MIPSOpcode op); +const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op); // For jit, takes arg: const HLEFunction * void *GetQuickSyscallFunc(MIPSOpcode op); diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 51671fe12e..ef60bd0a3c 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -722,7 +722,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting) { // It hasn't been exported yet, but hopefully it will later. bool isKnownModule = GetModuleIndex(func.moduleName) != -1; if (isKnownModule) { - WARN_LOG_REPORT(LOADER, "Unknown syscall in known module: %s 0x%08x", func.moduleName, func.nid); + WARN_LOG_REPORT(LOADER, "Unknown syscall in known module '%s': 0x%08x", func.moduleName, func.nid); } else { INFO_LOG(LOADER, "Function (%s,%08x) unresolved, storing for later resolving", func.moduleName, func.nid); } @@ -1443,29 +1443,26 @@ static Module *__KernelLoadModule(u8 *fileptr, SceKernelLMOption *options, std:: { Module *module = 0; // Check for PBP - if (memcmp(fileptr, "\0PBP", 4) == 0) - { + if (memcmp(fileptr, "\0PBP", 4) == 0) { // PBP! u32_le version; memcpy(&version, fileptr + 4, 4); u32_le offset0, offsets[16]; - int numfiles; memcpy(&offset0, fileptr + 8, 4); - numfiles = (offset0 - 8)/4; + int numfiles = (offset0 - 8)/4; offsets[0] = offset0; for (int i = 1; i < numfiles; i++) memcpy(&offsets[i], fileptr + 12 + 4*i, 4); + u32 magic = 0; - - u8 *temp = 0; if (offsets[5] & 3) { // Our loader does NOT like to load from an unaligned address on ARM! size_t size = offsets[6] - offsets[5]; temp = new u8[size]; memcpy(temp, fileptr + offsets[5], size); - INFO_LOG(LOADER, "Elf unaligned, aligning!"); + INFO_LOG(LOADER, "PBP: ELF unaligned (%d: %d), aligning!", offsets[5], offsets[5] & 3); } u32 error; diff --git a/Core/MIPS/ARM/ArmAsm.cpp b/Core/MIPS/ARM/ArmAsm.cpp index e53f930488..2ee8b1f434 100644 --- a/Core/MIPS/ARM/ArmAsm.cpp +++ b/Core/MIPS/ARM/ArmAsm.cpp @@ -56,11 +56,7 @@ static const bool disasm = false; extern volatile CoreState coreState; void ShowPC(u32 sp) { - if (currentMIPS) { - ERROR_LOG(JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp); - } else { - ERROR_LOG(JIT, "Universe corrupt?"); - } + ERROR_LOG(JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp); } void DisassembleArm(const u8 *data, int size); @@ -149,13 +145,15 @@ void ArmJit::GenerateFixedCode() { SetCC(CC_AL); PUSH(9, R4, R5, R6, R7, R8, R9, R10, R11, R_LR); - // Take care to 8-byte align stack for function calls. // We are misaligned here because of an odd number of args for PUSH. // It's not like x86 where you need to account for an extra 4 bytes // consumed by CALL. SUB(R_SP, R_SP, 4); // Now we are correctly aligned and plan to stay that way. + if (cpu_info.bNEON) { + VPUSH(D8, 8); + } // Fixed registers, these are always kept when in Jit context. // R8 is used to hold flags during delay slots. Not always needed. @@ -169,11 +167,6 @@ void ArmJit::GenerateFixedCode() { MOVP2R(CTXREG, mips_); MOVP2R(JITBASEREG, GetBasePtr()); - // Doing this down here for better pipelining, just in case. - if (cpu_info.bNEON) { - VPUSH(D8, 8); - } - RestoreDowncount(); MovFromPC(R0); outerLoopPCInR0 = GetCodePtr(); @@ -259,19 +252,18 @@ void ArmJit::GenerateFixedCode() { SetJumpTarget(badCoreState); breakpointBailout = GetCodePtr(); + SaveDowncount(); + RestoreRoundingMode(true); + // Doing this above the downcount for better pipelining (slightly.) if (cpu_info.bNEON) { VPOP(D8, 8); } - SaveDowncount(); - RestoreRoundingMode(true); - ADD(R_SP, R_SP, 4); POP(9, R4, R5, R6, R7, R8, R9, R10, R11, R_PC); // Returns - // Uncomment if you want to see the output... if (disasm) { INFO_LOG(JIT, "THE DISASM ========================"); diff --git a/Core/MIPS/ARM/ArmCompBranch.cpp b/Core/MIPS/ARM/ArmCompBranch.cpp index e6d990fd4a..7d4e29f77f 100644 --- a/Core/MIPS/ARM/ArmCompBranch.cpp +++ b/Core/MIPS/ARM/ArmCompBranch.cpp @@ -620,7 +620,7 @@ void ArmJit::Comp_Syscall(MIPSOpcode op) void *quickFunc = GetQuickSyscallFunc(op); if (quickFunc) { - gpr.SetRegImm(R0, (u32)(intptr_t)GetSyscallInfo(op)); + gpr.SetRegImm(R0, (u32)(intptr_t)GetSyscallFuncPointer(op)); // Already flushed, so R1 is safe. QuickCallFunction(R1, quickFunc); } diff --git a/Core/MIPS/ARM64/Arm64CompBranch.cpp b/Core/MIPS/ARM64/Arm64CompBranch.cpp index 0692e88f57..04b3f04adf 100644 --- a/Core/MIPS/ARM64/Arm64CompBranch.cpp +++ b/Core/MIPS/ARM64/Arm64CompBranch.cpp @@ -602,7 +602,7 @@ void Arm64Jit::Comp_Syscall(MIPSOpcode op) // Skip the CallSyscall where possible. void *quickFunc = GetQuickSyscallFunc(op); if (quickFunc) { - MOVI2R(X0, (uintptr_t)GetSyscallInfo(op)); + MOVI2R(X0, (uintptr_t)GetSyscallFuncPointer(op)); // Already flushed, so X1 is safe. QuickCallFunction(X1, quickFunc); } else { diff --git a/Core/MIPS/x86/CompBranch.cpp b/Core/MIPS/x86/CompBranch.cpp index e388eefa27..d1afdba1c2 100644 --- a/Core/MIPS/x86/CompBranch.cpp +++ b/Core/MIPS/x86/CompBranch.cpp @@ -790,7 +790,7 @@ void Jit::Comp_Syscall(MIPSOpcode op) // Skip the CallSyscall where possible. void *quickFunc = GetQuickSyscallFunc(op); if (quickFunc) - ABI_CallFunctionP(quickFunc, (void *)GetSyscallInfo(op)); + ABI_CallFunctionP(quickFunc, (void *)GetSyscallFuncPointer(op)); else ABI_CallFunctionC(&CallSyscall, op.encoding); #endif diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index 0f0bb7ec75..4ec1954819 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -711,7 +711,12 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture & mapRowPitch = w * scaleFactor * 4; } else { mapRowPitch = std::max(bufw, w) * bpp; - mapData = (u32 *)AllocateAlignedMemory(sizeof(u32) * (mapRowPitch / bpp) * h, 16); + size_t bufSize = sizeof(u32) * (mapRowPitch / bpp) * h; + mapData = (u32 *)AllocateAlignedMemory(bufSize, 16); + if (!mapData) { + ERROR_LOG(G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (alloc size: %d, %dx%d)", bufSize, mapRowPitch / sizeof(u32), h); + return; + } pixelData = (u32 *)mapData; decPitch = mapRowPitch; } diff --git a/ppsspp_config.h b/ppsspp_config.h index 9d7a38b41c..e1ff1869b2 100644 --- a/ppsspp_config.h +++ b/ppsspp_config.h @@ -84,6 +84,9 @@ #if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_PARTITION) #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #define PPSSPP_PLATFORM_UWP 1 + #ifdef _M_ARM + #define PPSSPP_ARCH_ARM_HARDFP 1 + #endif #endif #endif #elif defined(__APPLE__)