mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Invalidate stubs/var imports when writing them.
This commit is contained in:
parent
b558189c37
commit
da0c9a86e5
4 changed files with 26 additions and 18 deletions
|
@ -116,6 +116,5 @@ u32 GetSyscallOp(const char *module, u32 nib);
|
|||
bool FuncImportIsSyscall(const char *module, u32 nib);
|
||||
bool WriteSyscall(const char *module, u32 nib, u32 address);
|
||||
void CallSyscall(MIPSOpcode op);
|
||||
void ResolveSyscall(const char *moduleName, u32 nib, u32 address);
|
||||
void WriteFuncStub(u32 stubAddr, u32 symAddr);
|
||||
void WriteFuncMissingStub(u32 stubAddr, u32 nid);
|
||||
|
|
|
@ -20,31 +20,31 @@
|
|||
#include <set>
|
||||
|
||||
#include "native/base/stringutil.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/HLETables.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "../Host.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSAnalyst.h"
|
||||
#include "Core/ELF/ElfReader.h"
|
||||
#include "Core/ELF/PBPReader.h"
|
||||
#include "Core/ELF/PrxDecrypter.h"
|
||||
#include "../Debugger/SymbolMap.h"
|
||||
#include "../FileSystems/FileSystem.h"
|
||||
#include "../FileSystems/MetaFileSystem.h"
|
||||
#include "../Util/BlockAllocator.h"
|
||||
#include "Core/FileSystems/FileSystem.h"
|
||||
#include "Core/FileSystems/MetaFileSystem.h"
|
||||
#include "Core/Util/BlockAllocator.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/PSPLoaders.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
|
||||
#include "sceKernel.h"
|
||||
#include "sceKernelModule.h"
|
||||
#include "sceKernelThread.h"
|
||||
#include "sceKernelMemory.h"
|
||||
#include "sceIo.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/sceKernelModule.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceIo.h"
|
||||
|
||||
enum {
|
||||
PSP_THREAD_ATTR_USER = 0x80000000
|
||||
|
@ -500,6 +500,7 @@ void WriteVarSymbol(u32 exportAddress, u32 relocAddress, u8 type, bool reverse =
|
|||
}
|
||||
|
||||
Memory::Write_U32(relocData, relocAddress);
|
||||
currentMIPS->InvalidateICache(relocAddress, 4);
|
||||
}
|
||||
|
||||
void ImportVarSymbol(const VarSymbolImport &var) {
|
||||
|
@ -575,6 +576,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func) {
|
|||
// TODO: Or not?
|
||||
if (FuncImportIsSyscall(func.moduleName, func.nid)) {
|
||||
WriteSyscall(func.moduleName, func.nid, func.stubAddr);
|
||||
currentMIPS->InvalidateICache(func.stubAddr, 8);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -589,6 +591,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func) {
|
|||
for (auto it = module->exportedFuncs.begin(), end = module->exportedFuncs.end(); it != end; ++it) {
|
||||
if (it->Matches(func)) {
|
||||
WriteFuncStub(func.stubAddr, it->symAddr);
|
||||
currentMIPS->InvalidateICache(func.stubAddr, 8);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -601,6 +604,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func) {
|
|||
INFO_LOG(LOADER, "Function (%s,%08x) unresolved, storing for later resolving", func.moduleName, func.nid);
|
||||
}
|
||||
WriteFuncMissingStub(func.stubAddr, func.nid);
|
||||
currentMIPS->InvalidateICache(func.stubAddr, 8);
|
||||
}
|
||||
|
||||
void ExportFuncSymbol(const FuncSymbolExport &func) {
|
||||
|
@ -622,6 +626,7 @@ void ExportFuncSymbol(const FuncSymbolExport &func) {
|
|||
if (func.Matches(*it)) {
|
||||
INFO_LOG(LOADER, "Resolving function %s/%08x", func.moduleName, func.nid);
|
||||
WriteFuncStub(it->stubAddr, func.symAddr);
|
||||
currentMIPS->InvalidateICache(it->stubAddr, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -645,6 +650,7 @@ void UnexportFuncSymbol(const FuncSymbolExport &func) {
|
|||
if (func.Matches(*it)) {
|
||||
INFO_LOG(LOADER, "Unresolving function %s/%08x", func.moduleName, func.nid);
|
||||
WriteFuncMissingStub(it->stubAddr, it->nid);
|
||||
currentMIPS->InvalidateICache(it->stubAddr, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,6 +230,13 @@ u32 MIPSState::ReadFCR(int reg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void MIPSState::InvalidateICache(u32 address, int length)
|
||||
{
|
||||
// Only really applies to jit.
|
||||
if (MIPSComp::jit)
|
||||
MIPSComp::jit->ClearCacheAt(address, length);
|
||||
}
|
||||
|
||||
|
||||
// Interrupts should be served directly on the running thread.
|
||||
void MIPSState::Irq()
|
||||
|
|
|
@ -168,6 +168,8 @@ public:
|
|||
|
||||
void SingleStep();
|
||||
int RunLoopUntil(u64 globalTicks);
|
||||
// To clear jit caches, etc.
|
||||
void InvalidateICache(u32 address, int length = 4);
|
||||
|
||||
// for logging messages only.
|
||||
const char *DisasmAt(u32 compilerPC);
|
||||
|
@ -181,12 +183,6 @@ extern MIPSState *currentMIPS;
|
|||
extern MIPSDebugInterface *currentDebugMIPS;
|
||||
extern MIPSState mipsr4k;
|
||||
|
||||
void MIPS_Init();
|
||||
int MIPS_SingleStep();
|
||||
|
||||
void MIPS_Shutdown();
|
||||
|
||||
void MIPS_Irq();
|
||||
void MIPS_SWI();
|
||||
|
||||
extern const float cst_constants[32];
|
||||
|
|
Loading…
Add table
Reference in a new issue