Skip to content

Commit

Permalink
Clean up after the block linker. armdis: add BKPT
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Nov 17, 2014
1 parent e43c7af commit 74d8a9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
13 changes: 12 additions & 1 deletion Core/MIPS/JitCommon/JitBlockCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,19 @@ void JitBlockCache::LinkBlockExits(int i) {
int destinationBlock = GetBlockNumberFromStartAddress(b.exitAddress[e]);
if (destinationBlock != -1) {
#if defined(ARM)
const u8 *nextExit = b.exitPtrs[e + 1];
if (!nextExit) {
nextExit = b.normalEntry + b.codeSize;
}
ARMXEmitter emit(b.exitPtrs[e]);
emit.B(blocks_[destinationBlock].checkedEntry);
u32 op = 0;
// Overwrite with nops until the next unconditional branch.
do {
emit.BKPT(1);
op = *((const u32 *)emit.GetCodePtr());
} while ((op & 0xFF000000) != 0xEA000000);
emit.BKPT(1);
emit.FlushIcache();

#elif defined(_M_IX86) || defined(_M_X64)
Expand Down Expand Up @@ -609,7 +620,7 @@ void JitBlockCache::InvalidateICache(u32 address, const u32 length) {

int JitBlockCache::GetBlockExitSize() {
#if defined(ARM)
// TODO
// Will depend on the sequence found to encode the destination address.
return 0;
#elif defined(_M_IX86) || defined(_M_X64)
return 15;
Expand Down
10 changes: 5 additions & 5 deletions ext/disarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,6 @@ static bool DisasmNeonLDST(uint32_t op, char *text) {
return true;
}

static bool DisasmNeonF3(uint32_t op, char *text) {
sprintf(text, "NEON F3");
return true;
}

static bool DisasmNeonF2F3(uint32_t op, char *text) {
sprintf(text, "NEON F2");
if (((op >> 20) & 0xFFC) == 0xF20 || ((op >> 20) & 0xFFC) == 0xF30) {
Expand Down Expand Up @@ -727,6 +722,11 @@ instr_disassemble(word instr, address addr, pDisOptions opts) {
mnemonic = "BL";
format = "0";
break;
} else if ((instr & 0x0FF000F0) == 0x01200070) {
int imm = ((instr & 0xFFF00) >> 4) | (instr & 0xF);
snprintf(result.text, sizeof(result.text), "BKPT %d", imm);
result.undefined = 0;
return &result;
}
case 3:
if (instr >> 24 == 0xF3) {
Expand Down

0 comments on commit 74d8a9b

Please sign in to comment.