| 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 | { |
no test coverage detected