diff --git a/src/isa-thumb.c b/src/isa-thumb.c index 9fc1e1d0f..9be964d50 100644 --- a/src/isa-thumb.c +++ b/src/isa-thumb.c @@ -122,12 +122,18 @@ DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, ARM_STUB) #define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ int immediate = IMMEDIATE; \ + int rd = opcode & 0x0007; \ + int rn = (opcode >> 3) & 0x0007; \ BODY;) #define DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(NAME, BODY) \ COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY) -DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, ARM_STUB) +DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, \ + int n = cpu->gprs[rn]; \ + cpu->gprs[rd] = n + immediate; \ + THUMB_ADDITION_S(n, immediate, cpu->gprs[rd])) + DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, ARM_STUB) #define DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB(NAME, RD, BODY) \