Credit to SGINut.

Changes:
- ARM7: Added support for the BLX opcode in THUMB mode.
This commit is contained in:
Ryan Holtz 2008-01-24 04:10:40 +00:00
parent f1d2bde333
commit a67e5be6db
2 changed files with 34 additions and 14 deletions

View File

@ -1200,17 +1200,26 @@ UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
} }
break; break;
case 0xe: /* B #offs */ case 0xe: /* B #offs */
offs = ( opcode & THUMB_BRANCH_OFFS ) << 1; if( insn & THUMB_BLOP_LO )
if( offs & 0x00000800 ) {
{ addr = ( ( opcode & THUMB_BLOP_OFFS ) << 1 ) & 0xfffc;
offs |= 0xfffff800; pBuf += sprintf( pBuf, "BLX (LO) %08x", addr );
} dasmflags = DASMFLAG_STEP_OVER;
pBuf += sprintf( pBuf, "B #%08x (%08x)", offs, pc + 4 + offs); }
else
{
offs = ( opcode & THUMB_BRANCH_OFFS ) << 1;
if( offs & 0x00000800 )
{
offs |= 0xfffff800;
}
pBuf += sprintf( pBuf, "B #%08x (%08x)", offs, pc + 4 + offs);
}
break; break;
case 0xf: /* BL */ case 0xf: /* BL */
if( opcode & THUMB_BLOP_LO ) if( opcode & THUMB_BLOP_LO )
{ {
pBuf += sprintf( pBuf, "BL (LO) %04x", ( opcode & THUMB_BLOP_OFFS ) << 1 ); pBuf += sprintf( pBuf, "BL (LO) %08x", ( opcode & THUMB_BLOP_OFFS ) << 1 );
dasmflags = DASMFLAG_STEP_OVER; dasmflags = DASMFLAG_STEP_OVER;
} }
else else
@ -1220,7 +1229,7 @@ UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
{ {
addr |= 0xff800000; addr |= 0xff800000;
} }
pBuf += sprintf( pBuf, "BL (HI) %04x", ( opcode & THUMB_BLOP_OFFS ) << 12 ); pBuf += sprintf( pBuf, "BL (HI) %08x", addr );
dasmflags = DASMFLAG_STEP_OVER; dasmflags = DASMFLAG_STEP_OVER;
} }
break; break;

View File

@ -1109,12 +1109,23 @@
} }
break; break;
case 0xe: /* B #offs */ case 0xe: /* B #offs */
offs = ( insn & THUMB_BRANCH_OFFS ) << 1; if( insn & THUMB_BLOP_LO )
if( offs & 0x00000800 ) {
{ addr = GET_REGISTER(14);
offs |= 0xfffff800; addr += ( insn & THUMB_BLOP_OFFS ) << 1;
} addr &= 0xfffffffc;
R15 += 4 + offs; SET_REGISTER( 14, ( R15 + 4 ) | 1 );
R15 = addr;
}
else
{
offs = ( insn & THUMB_BRANCH_OFFS ) << 1;
if( offs & 0x00000800 )
{
offs |= 0xfffff800;
}
R15 += 4 + offs;
}
break; break;
case 0xf: /* BL */ case 0xf: /* BL */
if( insn & THUMB_BLOP_LO ) if( insn & THUMB_BLOP_LO )