mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix function replacement on ARM
This commit is contained in:
parent
2eab4aa1bf
commit
1d2f1efd06
4 changed files with 23 additions and 11 deletions
|
@ -452,7 +452,7 @@ public:
|
|||
if (handle < handleOffset || handle >= handleOffset+maxCount || !occupied[handle-handleOffset])
|
||||
{
|
||||
// Tekken 6 spams 0x80020001 gets wrong with no ill effects, also on the real PSP
|
||||
if (handle != 0 && handle != 0x80020001)
|
||||
if (handle != 0 && (u32)handle != 0x80020001)
|
||||
{
|
||||
WARN_LOG(SCEKERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "native/base/stringutil.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/HLETables.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
@ -235,13 +236,13 @@ public:
|
|||
p.Do(isStarted);
|
||||
ModuleWaitingThread mwt = {0};
|
||||
p.Do(waitingThreads, mwt);
|
||||
FuncSymbolExport fsx = {0};
|
||||
FuncSymbolExport fsx = {{0}};
|
||||
p.Do(exportedFuncs, fsx);
|
||||
FuncSymbolImport fsi = {0};
|
||||
FuncSymbolImport fsi = {{0}};
|
||||
p.Do(importedFuncs, fsi);
|
||||
VarSymbolExport vsx = {0};
|
||||
VarSymbolExport vsx = {{0}};
|
||||
p.Do(exportedVars, vsx);
|
||||
VarSymbolImport vsi = {0};
|
||||
VarSymbolImport vsi = {{0}};
|
||||
p.Do(importedVars, vsi);
|
||||
RebuildImpExpModuleNames();
|
||||
}
|
||||
|
@ -824,9 +825,10 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
|||
bool gotSymbols = reader.LoadSymbols();
|
||||
MIPSAnalyst::ScanForFunctions(textStart, textStart + textSize, !gotSymbols);
|
||||
#else
|
||||
// Scan for functions (for the analysis results which can help the JIT).
|
||||
// But don't insert into the symbol map.
|
||||
// MIPSAnalyst::ScanForFunctions(textStart, textStart + textSize, false);
|
||||
if (g_Config.bFuncHashMap) {
|
||||
bool gotSymbols = reader.LoadSymbols();
|
||||
MIPSAnalyst::ScanForFunctions(textStart, textStart + textSize, !gotSymbols);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -983,6 +985,11 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
|||
#if !defined(USING_GLES2)
|
||||
bool gotSymbols = reader.LoadSymbols();
|
||||
MIPSAnalyst::ScanForFunctions(textStart, textEnd, !gotSymbols);
|
||||
#else
|
||||
if (g_Config.bFuncHashMap) {
|
||||
bool gotSymbols = reader.LoadSymbols();
|
||||
MIPSAnalyst::ScanForFunctions(textStart, textEnd, !gotSymbols);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -151,8 +151,8 @@ void Jit::GenerateFixedCode()
|
|||
// TODO: In practice, do we ever run code from uncached space (| 0x40000000)? If not, we can remove this BIC.
|
||||
BIC(R0, R0, Operand2(0xC0, 4)); // &= 0x3FFFFFFF
|
||||
LDR(R0, MEMBASEREG, R0);
|
||||
AND(R1, R0, Operand2(0xFC, 4)); // rotation is to the right, in 2-bit increments.
|
||||
BIC(R0, R0, Operand2(0xFC, 4));
|
||||
AND(R1, R0, Operand2(0xFF, 4)); // rotation is to the right, in 2-bit increments.
|
||||
BIC(R0, R0, Operand2(0xFF, 4));
|
||||
CMP(R1, Operand2(MIPS_EMUHACK_OPCODE >> 24, 4));
|
||||
SetCC(CC_EQ);
|
||||
// IDEA - we have 26 bits, why not just use offsets from base of code?
|
||||
|
|
|
@ -366,7 +366,12 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
|||
FlushAll();
|
||||
// Standard function call, nothing fancy.
|
||||
// The function returns the number of cycles it took in EAX.
|
||||
BL((const void *)(entry->replaceFunc));
|
||||
if (BLInRange((const void *)(entry->replaceFunc))) {
|
||||
BL((const void *)(entry->replaceFunc));
|
||||
} else {
|
||||
MOVI2R(R0, (u32)entry->replaceFunc);
|
||||
BL(R0);
|
||||
}
|
||||
// Alternatively, we could inline it here, instead of calling out, if it's a function
|
||||
// we can emit.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue