- fix bug in OP_BX_THUMB when Rm=15 (fix bug #1310 "Shiren the Wanderer 4: crashed");
This commit is contained in:
mtabachenko 2013-07-18 06:45:09 +00:00
parent 98d9290a22
commit 53ff80b635
1 changed files with 13 additions and 1 deletions

View File

@ -3758,7 +3758,19 @@ static int op_bx_thumb(Mem srcreg, bool blx, bool test_thumb)
return 1; return 1;
} }
static int OP_BX_THUMB(const u32 i) { if (REG_POS(i, 3) == 15) c.mov(reg_ptr(15), bb_r15); return op_bx_thumb(reg_pos_ptr(3), 0, 0); } static int op_bx_thumbR15()
{
GpVar dst = c.newGpVar(kX86VarTypeGpd);
GpVar thumb = c.newGpVar(kX86VarTypeGpd);
c.mov(dst, bb_next_instruction);
c.and_(cpu_ptr(CPSR), (u32)~(1<< 5));
c.and_(dst, 0xFFFFFFFC);
c.mov(reg_ptr(15), dst);
c.mov(cpu_ptr(instruct_adr), dst);
return 1;
}
static int OP_BX_THUMB(const u32 i) { if (REG_POS(i, 3) == 15) return op_bx_thumbR15(); return op_bx_thumb(reg_pos_ptr(3), 0, 0); }
static int OP_BLX_THUMB(const u32 i) { return op_bx_thumb(reg_pos_ptr(3), 1, 1); } static int OP_BLX_THUMB(const u32 i) { return op_bx_thumb(reg_pos_ptr(3), 1, 1); }
static int OP_SWI_THUMB(const u32 i) { return op_swi(i & 0x1F); } static int OP_SWI_THUMB(const u32 i) { return op_swi(i & 0x1F); }