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

View File

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