Put stub definitions in all of Thumb

This commit is contained in:
Jeffrey Pfau 2013-04-10 23:38:18 -07:00
parent 7e5de27f43
commit a511df7920
1 changed files with 65 additions and 64 deletions

View File

@ -80,16 +80,16 @@ void ThumbStep(struct ARMCore* cpu) {
#define DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(NAME, BODY) \ #define DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_5(DEFINE_IMMEDIATE_5_INSTRUCTION_EX_THUMB, NAME ## _, BODY) COUNT_5(DEFINE_IMMEDIATE_5_INSTRUCTION_EX_THUMB, NAME ## _, BODY)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSL1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSL1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSR1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSR1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDR1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDR1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDRB1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDRB1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDRH1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDRH1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STR1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STR1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STRB1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STRB1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STRH1, ) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STRH1, ARM_STUB)
#define DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \ #define DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -99,8 +99,8 @@ DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(STRH1, )
#define DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(NAME, BODY) \ #define DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB, NAME ## 3_R, BODY) COUNT_3(DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB, NAME ## 3_R, BODY)
DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(ADD, ) DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(ADD, ARM_STUB)
DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, ) DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, ARM_STUB)
#define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \ #define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -110,8 +110,8 @@ DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, )
#define DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(NAME, BODY) \ #define DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY) COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY)
DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, ) DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, ARM_STUB)
DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, ) DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, ARM_STUB)
#define DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB(NAME, RD, BODY) \ #define DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB(NAME, RD, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -121,10 +121,10 @@ DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, )
#define DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(NAME, BODY) \ #define DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB, NAME ## _R, BODY) COUNT_3(DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB, NAME ## _R, BODY)
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(ADD2, ) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(ADD2, ARM_STUB)
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(CMP1, ) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(CMP1, ARM_STUB)
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(MOV1, ) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(MOV1, ARM_STUB)
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, ) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, ARM_STUB)
#define DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(NAME, BODY) \ #define DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(NAME, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -132,22 +132,22 @@ DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, )
int rn = (opcode >> 3) & 0x0007; \ int rn = (opcode >> 3) & 0x0007; \
BODY;) BODY;)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(AND, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(AND, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(EOR, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(EOR, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSL2, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSL2, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSR2, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSR2, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ASR2, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ASR2, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ADC, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ADC, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(SBC, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(SBC, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ROR, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ROR, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(TST, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(TST, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(NEG, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(NEG, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(CMP2, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(CMP2, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(CMN, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(CMN, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ORR, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(ORR, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MUL, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MUL, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(BIC, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(BIC, ARM_STUB)
DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MVN, ) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MVN, ARM_STUB)
#define DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME, H1, H2, BODY) \ #define DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME, H1, H2, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -161,9 +161,9 @@ DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MVN, )
DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 10, 8, 0, BODY) \ DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 10, 8, 0, BODY) \
DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 11, 8, 8, BODY) DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME ## 11, 8, 8, BODY)
DEFINE_INSTRUCTION_WITH_HIGH_THUMB(ADD4, ) DEFINE_INSTRUCTION_WITH_HIGH_THUMB(ADD4, ARM_STUB)
DEFINE_INSTRUCTION_WITH_HIGH_THUMB(CMP3, ) DEFINE_INSTRUCTION_WITH_HIGH_THUMB(CMP3, ARM_STUB)
DEFINE_INSTRUCTION_WITH_HIGH_THUMB(MOV3, ) DEFINE_INSTRUCTION_WITH_HIGH_THUMB(MOV3, ARM_STUB)
#define DEFINE_IMMEDIATE_WITH_REGISTER_EX_THUMB(NAME, RD, BODY) \ #define DEFINE_IMMEDIATE_WITH_REGISTER_EX_THUMB(NAME, RD, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -173,12 +173,12 @@ DEFINE_INSTRUCTION_WITH_HIGH_THUMB(MOV3, )
#define DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(NAME, BODY) \ #define DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(NAME, BODY) \
COUNT_3(DEFINE_IMMEDIATE_WITH_REGISTER_EX_THUMB, NAME ## _R, BODY) COUNT_3(DEFINE_IMMEDIATE_WITH_REGISTER_EX_THUMB, NAME ## _R, BODY)
DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(LDR3, ) DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(LDR3, ARM_STUB)
DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(LDR4, ) DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(LDR4, ARM_STUB)
DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(STR3, ) DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(STR3, ARM_STUB)
DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(ADD5, ) DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(ADD5, ARM_STUB)
DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(ADD6, ) DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(ADD6, ARM_STUB)
#define DEFINE_LOAD_STORE_WITH_REGISTER_EX_THUMB(NAME, RM, BODY) \ #define DEFINE_LOAD_STORE_WITH_REGISTER_EX_THUMB(NAME, RM, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -188,14 +188,14 @@ DEFINE_IMMEDIATE_WITH_REGISTER_THUMB(ADD6, )
#define DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(NAME, BODY) \ #define DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(NAME, BODY) \
COUNT_3(DEFINE_LOAD_STORE_WITH_REGISTER_EX_THUMB, NAME ## _R, BODY) COUNT_3(DEFINE_LOAD_STORE_WITH_REGISTER_EX_THUMB, NAME ## _R, BODY)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDR2, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDR2, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRB2, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRB2, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRH2, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRH2, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRSB, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRSB, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRSH, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(LDRSH, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STR2, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STR2, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STRB2, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STRB2, ARM_STUB)
DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STRH2, ) DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STRH2, ARM_STUB)
#define DEFINE_LOAD_STORE_MULTIPLE_EX_THUMB(NAME, RS, BODY) \ #define DEFINE_LOAD_STORE_MULTIPLE_EX_THUMB(NAME, RS, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \ DEFINE_INSTRUCTION_THUMB(NAME, \
@ -205,12 +205,13 @@ DEFINE_LOAD_STORE_WITH_REGISTER_THUMB(STRH2, )
#define DEFINE_LOAD_STORE_MULTIPLE_THUMB(NAME, BODY) \ #define DEFINE_LOAD_STORE_MULTIPLE_THUMB(NAME, BODY) \
COUNT_3(DEFINE_LOAD_STORE_MULTIPLE_EX_THUMB, NAME ## _R, BODY) COUNT_3(DEFINE_LOAD_STORE_MULTIPLE_EX_THUMB, NAME ## _R, BODY)
DEFINE_LOAD_STORE_MULTIPLE_THUMB(LDMIA, ) DEFINE_LOAD_STORE_MULTIPLE_THUMB(LDMIA, ARM_STUB)
DEFINE_LOAD_STORE_MULTIPLE_THUMB(STMIA, ) DEFINE_LOAD_STORE_MULTIPLE_THUMB(STMIA, ARM_STUB)
#define DEFINE_CONDITIONAL_BRANCH_THUMB(COND) \ #define DEFINE_CONDITIONAL_BRANCH_THUMB(COND) \
DEFINE_INSTRUCTION_THUMB(B ## COND, \ DEFINE_INSTRUCTION_THUMB(B ## COND, \
if (ARM_COND_ ## COND) { \ if (ARM_COND_ ## COND) { \
ARM_STUB; \
}) })
DEFINE_CONDITIONAL_BRANCH_THUMB(EQ) DEFINE_CONDITIONAL_BRANCH_THUMB(EQ)
@ -228,21 +229,21 @@ DEFINE_CONDITIONAL_BRANCH_THUMB(LT)
DEFINE_CONDITIONAL_BRANCH_THUMB(GT) DEFINE_CONDITIONAL_BRANCH_THUMB(GT)
DEFINE_CONDITIONAL_BRANCH_THUMB(LE) DEFINE_CONDITIONAL_BRANCH_THUMB(LE)
DEFINE_INSTRUCTION_THUMB(ADD7, ) DEFINE_INSTRUCTION_THUMB(ADD7, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(SUB4, ) DEFINE_INSTRUCTION_THUMB(SUB4, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(POP, ) DEFINE_INSTRUCTION_THUMB(POP, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(POPR, ) DEFINE_INSTRUCTION_THUMB(POPR, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(PUSH, ) DEFINE_INSTRUCTION_THUMB(PUSH, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(PUSHR, ) DEFINE_INSTRUCTION_THUMB(PUSHR, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(ILL, ) DEFINE_INSTRUCTION_THUMB(ILL, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(BKPT, ) DEFINE_INSTRUCTION_THUMB(BKPT, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(B, ) DEFINE_INSTRUCTION_THUMB(B, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(BL1, ) DEFINE_INSTRUCTION_THUMB(BL1, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(BL2, ) DEFINE_INSTRUCTION_THUMB(BL2, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(BX, ) DEFINE_INSTRUCTION_THUMB(BX, ARM_STUB)
DEFINE_INSTRUCTION_THUMB(SWI, ) DEFINE_INSTRUCTION_THUMB(SWI, ARM_STUB)
#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \ #define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \
EMITTER ## NAME EMITTER ## NAME