Implement BL
Jeffrey Pfau jeffrey@endrift.com
Thu, 11 Apr 2013 03:14:09 -0700
1 files changed,
11 insertions(+),
2 deletions(-)
jump to
M
src/isa-thumb.c
→
src/isa-thumb.c
@@ -291,8 +291,17 @@
DEFINE_INSTRUCTION_THUMB(ILL, ARM_STUB) DEFINE_INSTRUCTION_THUMB(BKPT, ARM_STUB) DEFINE_INSTRUCTION_THUMB(B, ARM_STUB) -DEFINE_INSTRUCTION_THUMB(BL1, ARM_STUB) -DEFINE_INSTRUCTION_THUMB(BL2, ARM_STUB) +DEFINE_INSTRUCTION_THUMB(BL1, \ + int16_t immediate = (opcode & 0x07FF) << 7; \ + cpu->gprs[ARM_LR] = cpu->gprs[ARM_PC] + (((int32_t) immediate) << 4);) + +DEFINE_INSTRUCTION_THUMB(BL2, \ + uint16_t immediate = (opcode & 0x07FF) << 1; \ + uint32_t pc = cpu->gprs[ARM_PC]; \ + cpu->gprs[ARM_PC] = cpu->gprs[ARM_LR] + immediate; \ + cpu->gprs[ARM_LR] = pc - 1; \ + THUMB_WRITE_PC;) + DEFINE_INSTRUCTION_THUMB(BX, ARM_STUB) DEFINE_INSTRUCTION_THUMB(SWI, ARM_STUB)