diff options
Diffstat (limited to 'src/arch/arm/v7/arm.c')
-rw-r--r-- | src/arch/arm/v7/arm.c | 163 |
1 files changed, 161 insertions, 2 deletions
diff --git a/src/arch/arm/v7/arm.c b/src/arch/arm/v7/arm.c index 60e0e22..2c0cabb 100644 --- a/src/arch/arm/v7/arm.c +++ b/src/arch/arm/v7/arm.c @@ -46,6 +46,12 @@ static GArchInstruction *process_armv7_arm_data_processing_immediate(uint32_t); /* Désassemble une instruction ARMv7 liées aux multiplications. */ static GArchInstruction *process_armv7_arm_multiply_and_multiply_accumulate(uint32_t); + + +/* Désassemble une instruction ARMv7 de données ou autre. */ +static GArchInstruction *process_armv7_arm_load_store_word_and_unsigned_byte(uint32_t); + + /* Désassemble une instruction ARMv7 de données ou autre. */ static GArchInstruction *process_armv7_arm_branch_branch_with_link_and_block_data_transfer(uint32_t); @@ -53,8 +59,8 @@ static GArchInstruction *process_armv7_arm_branch_branch_with_link_and_block_dat // process_armv7_arm_instruction_set_encoding -#define process_armv7_arm_load_store_word_and_unsigned_byte(raw) NULL -#define process_armv7_arm_load_store_word_and_unsigned_byte(raw) NULL +//#define process_armv7_arm_load_store_word_and_unsigned_byte(raw) NULL +//#define process_armv7_arm_load_store_word_and_unsigned_byte(raw) NULL #define process_armv7_arm_media_instructions(raw) NULL //#define process_armv7_arm_branch_branch_with_link_and_block_data_transfer(raw) NULL #define process_armv7_arm_coprocessor_instructions_and_Supervisor_call(raw) NULL @@ -583,6 +589,159 @@ static GArchInstruction *process_armv7_arm_multiply_and_multiply_accumulate(uint * * ******************************************************************************/ +static GArchInstruction *process_armv7_arm_load_store_word_and_unsigned_byte(uint32_t raw) +{ + GArchInstruction *result; /* Instruction à retourner */ + uint32_t a; /* Champ 'a' à retrouver */ + uint32_t op1; /* Champ 'op1' à retrouver */ + uint32_t rn; /* Champ 'rn' à retrouver */ + uint32_t b; /* Champ 'b' à retrouver */ + + /** + * Suit les directives de : + * § A5.3 Load/store word and unsigned byte + */ + + result = NULL; + + a = (raw >> 25) & 0x1; + op1 = (raw >> 20) & 0x1f; + rn = (raw >> 16) & 0xf; + b = (raw >> 4) & 0x1; + + if ((op1 & b10111) == b00010) + { + if (a == b0) + { + result = armv7_read_arm_instr_strt(raw); + goto a53_done; + } + else if (/*a == b1 && */b == b0) + goto a53_done; + } + else if ((op1 & b00101) == b00000) + { + if (a == b0) + { + result = armv7_read_arm_instr_str_immediate_arm(raw); + goto a53_done; + } + else if (/*a == b1 && */b == b0) + { + result = armv7_read_arm_instr_str_register(raw); + goto a53_done; + } + } + + if ((op1 & b10111) == b00011) + { + if (a == b0) + { + result = armv7_read_arm_instr_strt(raw); + goto a53_done; + } + else if (/*a == b1 && */b == b0) + goto a53_done; + } + else if ((op1 & b00101) == b00001) + { + if (a == b0) + { + if (rn == b1111) + result = armv7_read_arm_instr_ldr_literal(raw); + else + result = armv7_read_arm_instr_ldr_immediate_arm(raw); + + goto a53_done; + + } + else if (/*a == b1 && */b == b0) + { + result = armv7_read_arm_instr_str_register(raw); + goto a53_done; + } + } + + if ((op1 & b10111) == b00110) + { + if (a == b0) + { + result = armv7_read_arm_instr_strt(raw); + goto a53_done; + } + else if (/*a == b1 && */b == b0) + goto a53_done; + } + else if ((op1 & b00101) == b00100) + { + if (a == b0) + { + result = armv7_read_arm_instr_str_immediate_arm(raw); + goto a53_done; + } + else if (/*a == b1 && */b == b0) + { + result = armv7_read_arm_instr_str_register(raw); + goto a53_done; + } + } + + if ((op1 & b10111) == b00111) + { + if (a == b0) + { + result = armv7_read_arm_instr_strt(raw); + goto a53_done; + } + else if (/*a == b1 && */b == b0) + goto a53_done; + } + else if ((op1 & b00101) == b00101) + { + if (a == b0) + { + if (rn == b1111) + result = armv7_read_arm_instr_ldr_literal(raw); + else + result = armv7_read_arm_instr_ldr_immediate_arm(raw); + + goto a53_done; + + } + else if (/*a == b1 && */b == b0) + { + result = armv7_read_arm_instr_str_register(raw); + goto a53_done; + } + } + + a53_done: + + return result; + +} + + + + + + + + + + +/****************************************************************************** +* * +* Paramètres : raw = donnée brute de 32 bits à désassembler. * +* * +* Description : Désassemble une instruction ARMv7 de données ou autre. * +* * +* Retour : Instruction mise en place ou NULL en cas d'échec. * +* * +* Remarques : - * +* * +******************************************************************************/ + static GArchInstruction *process_armv7_arm_branch_branch_with_link_and_block_data_transfer(uint32_t raw) { GArchInstruction *result; /* Instruction à retourner */ |