mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-25 01:00:01 +00:00
Show replaced instructions correctly in disassembly
This commit is contained in:
parent
041ed9a4b8
commit
2d4c28826a
@ -198,8 +198,21 @@ const ReplacementTableEntry *GetReplacementFunc(int i) {
|
||||
void WriteReplaceInstruction(u32 address, u64 hash, int size) {
|
||||
int index = GetReplacementFuncIndex(hash, size);
|
||||
if (index >= 0) {
|
||||
replacedInstructions[address] = Memory::Read_U32(address);
|
||||
ILOG("Replaced %s at %08x", entries[index].name, address);
|
||||
u32 prevInstr = Memory::Read_U32(address);
|
||||
if (MIPS_IS_REPLACEMENT(prevInstr))
|
||||
return;
|
||||
replacedInstructions[address] = prevInstr;
|
||||
INFO_LOG(HLE, "Replaced %s at %08x", entries[index].name, address);
|
||||
Memory::Write_U32(MIPS_EMUHACK_CALL_REPLACEMENT | (int)index, address);
|
||||
}
|
||||
}
|
||||
|
||||
bool GetReplacedOpAt(u32 address, u32 *op) {
|
||||
auto iter = replacedInstructions.find(address);
|
||||
if (iter != replacedInstructions.end()) {
|
||||
*op = iter->second;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,6 @@ void Replacement_Shutdown();
|
||||
int GetNumReplacementFuncs();
|
||||
int GetReplacementFuncIndex(u64 hash, int funcSize);
|
||||
const ReplacementTableEntry *GetReplacementFunc(int index);
|
||||
|
||||
void WriteReplaceInstruction(u32 address, u64 hash, int size);
|
||||
bool GetReplacedOpAt(u32 address, u32 *op);
|
||||
|
@ -42,15 +42,15 @@ struct JitBlock;
|
||||
#define MIPS_JITBLOCK_MASK 0xFF000000
|
||||
#define MIPS_EMUHACK_VALUE_MASK 0x00FFFFFF
|
||||
|
||||
#define MIPS_IS_EMUHACK(op) (((op) & 0xFC000000) == MIPS_EMUHACK_OPCODE) // masks away the subop
|
||||
#define MIPS_IS_RUNBLOCK(op) (((op) & 0xFF000000) == MIPS_EMUHACK_OPCODE) // masks away the subop
|
||||
#define MIPS_IS_REPLACEMENT(op) (((op) & 0xFF000000) == (MIPS_EMUHACK_OPCODE | (EMUOP_CALL_REPLACEMENT << 24))) // masks away the subop
|
||||
|
||||
// There are 2 bits available for sub-opcodes, 0x03000000.
|
||||
#define EMUOP_RUNBLOCK 0 // Runs a JIT block
|
||||
#define EMUOP_RETKERNEL 1 // Returns to the simulated PSP kernel from a thread
|
||||
#define EMUOP_CALL_REPLACEMENT 2
|
||||
|
||||
#define MIPS_IS_EMUHACK(op) (((op) & 0xFC000000) == MIPS_EMUHACK_OPCODE) // masks away the subop
|
||||
#define MIPS_IS_RUNBLOCK(op) (((op) & 0xFF000000) == MIPS_EMUHACK_OPCODE) // masks away the subop
|
||||
#define MIPS_IS_REPLACEMENT(op) (((op) & 0xFF000000) == (MIPS_EMUHACK_OPCODE | (EMUOP_CALL_REPLACEMENT << 24))) // masks away the subop
|
||||
|
||||
#define MIPS_EMUHACK_CALL_REPLACEMENT (MIPS_EMUHACK_OPCODE | (EMUOP_CALL_REPLACEMENT << 24))
|
||||
|
||||
namespace MIPSComp {
|
||||
|
@ -23,17 +23,18 @@
|
||||
#include "ChunkFile.h"
|
||||
|
||||
#include "MemMap.h"
|
||||
#include "Core.h"
|
||||
#include "MIPS/MIPS.h"
|
||||
#include "MIPS/JitCommon/JitCommon.h"
|
||||
#include "HLE/HLE.h"
|
||||
#include "CPU.h"
|
||||
|
||||
#include "Core/CPU.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/Debugger/Breakpoints.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/HLE/ReplaceTables.h"
|
||||
|
||||
namespace Memory
|
||||
{
|
||||
namespace Memory {
|
||||
|
||||
// The base pointer to the auto-mirrored arena.
|
||||
u8* base = NULL;
|
||||
@ -173,7 +174,7 @@ void Clear()
|
||||
Opcode Read_Instruction(u32 address)
|
||||
{
|
||||
Opcode inst = Opcode(Read_U32(address));
|
||||
if (MIPS_IS_RUNBLOCK(inst) && MIPSComp::jit)
|
||||
if (MIPS_IS_RUNBLOCK(inst.encoding) && MIPSComp::jit)
|
||||
{
|
||||
JitBlockCache *bc = MIPSComp::jit->GetBlockCache();
|
||||
int block_num = bc->GetBlockNumberFromEmuHackOp(inst, true);
|
||||
@ -182,8 +183,13 @@ Opcode Read_Instruction(u32 address)
|
||||
} else {
|
||||
return inst;
|
||||
}
|
||||
} else if (MIPS_IS_REPLACEMENT(inst)) {
|
||||
} else if (MIPS_IS_REPLACEMENT(inst.encoding)) {
|
||||
u32 op;
|
||||
if (GetReplacedOpAt(address, &op)) {
|
||||
return Opcode(op);
|
||||
} else {
|
||||
return inst;
|
||||
}
|
||||
} else {
|
||||
return inst;
|
||||
}
|
||||
@ -204,9 +210,8 @@ void Write_Opcode_JIT(const u32 _Address, const Opcode _Value)
|
||||
void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
|
||||
{
|
||||
u8 *ptr = GetPointer(_Address);
|
||||
if (ptr != NULL)
|
||||
{
|
||||
memset(ptr,_iValue,_iLength);
|
||||
if (ptr != NULL) {
|
||||
memset(ptr, _iValue, _iLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user