MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ScanForAllocaSignature

Function ScanForAllocaSignature

pcsx2/DebugTools/MipsStackWalk.cpp:78–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 }
77
78 bool ScanForAllocaSignature(DebugInterface* cpu, u32 pc)
79 {
80 // In God Eater Burst, for example, after 0880E750, there's what looks like an alloca().
81 // It's surrounded by "mov fp, sp" and "mov sp, fp", which is unlikely to be used for other reasons.
82
83 // It ought to be pretty close.
84 u32 stop = pc - 32 * 4;
85 for (; cpu->isValidAddress(pc) && pc >= stop; pc -= 4)
86 {
87 u32 rawOp = cpu->Read32(pc);
88 const R5900::OPCODE& op = R5900::GetInstruction(rawOp);
89
90 // We're looking for a "mov fp, sp" close by a "addiu sp, sp, -N".
91 if (IsMovRegsInstr(op, rawOp) && _RD == MIPS_REG_FP && (_RS == MIPS_REG_SP || _RT == MIPS_REG_SP))
92 {
93 return true;
94 }
95 }
96 return false;
97 }
98
99 bool ScanForEntry(DebugInterface* cpu, StackFrame& frame, u32 entry, u32& ra)
100 {

Callers 1

ScanForEntryFunction · 0.85

Calls 3

IsMovRegsInstrFunction · 0.85
isValidAddressMethod · 0.80
Read32Method · 0.45

Tested by

no test coverage detected