From 5480789b7a18e0eef058c4f702d4afad1c015424 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 20 Apr 2016 10:54:46 +0200 Subject: Discarded initial support of ARM versions older than v7. --- ChangeLog | 18 + src/arch/arm/v456/Makefile.am | 22 -- src/arch/arm/v456/addressing.c | 82 ---- src/arch/arm/v456/addressing.h | 38 -- src/arch/arm/v456/encoding.h | 188 --------- src/arch/arm/v456/instruction-def.h | 91 ----- src/arch/arm/v456/instruction.c | 683 --------------------------------- src/arch/arm/v456/instruction.h | 105 ----- src/arch/arm/v456/operands/Makefile.am | 16 - src/arch/arm/v456/operands/content.c | 257 ------------- src/arch/arm/v456/operands/content.h | 70 ---- src/arch/arm/v456/operands/register.c | 232 ----------- src/arch/arm/v456/operands/register.h | 69 ---- src/arch/arm/v456/register.c | 251 ------------ src/arch/arm/v456/register.h | 69 ---- 15 files changed, 18 insertions(+), 2173 deletions(-) delete mode 100644 src/arch/arm/v456/Makefile.am delete mode 100644 src/arch/arm/v456/addressing.c delete mode 100644 src/arch/arm/v456/addressing.h delete mode 100644 src/arch/arm/v456/encoding.h delete mode 100644 src/arch/arm/v456/instruction-def.h delete mode 100644 src/arch/arm/v456/instruction.c delete mode 100644 src/arch/arm/v456/instruction.h delete mode 100644 src/arch/arm/v456/operands/Makefile.am delete mode 100644 src/arch/arm/v456/operands/content.c delete mode 100644 src/arch/arm/v456/operands/content.h delete mode 100644 src/arch/arm/v456/operands/register.c delete mode 100644 src/arch/arm/v456/operands/register.h delete mode 100644 src/arch/arm/v456/register.c delete mode 100644 src/arch/arm/v456/register.h diff --git a/ChangeLog b/ChangeLog index edde331..3b1f34b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +16-04-20 Cyrille Bagard + + * src/arch/arm/v456/Makefile.am: + * src/arch/arm/v456/addressing.c: + * src/arch/arm/v456/addressing.h: + * src/arch/arm/v456/encoding.h: + * src/arch/arm/v456/instruction-def.h: + * src/arch/arm/v456/instruction.c: + * src/arch/arm/v456/instruction.h: + * src/arch/arm/v456/operands/Makefile.am: + * src/arch/arm/v456/operands/content.c: + * src/arch/arm/v456/operands/content.h: + * src/arch/arm/v456/operands/register.c: + * src/arch/arm/v456/operands/register.h: + * src/arch/arm/v456/register.c: + * src/arch/arm/v456/register.h: + Deleted entries: discard initial support of ARM versions older than v7. + 16-04-19 Cyrille Bagard * .gitattributes: diff --git a/src/arch/arm/v456/Makefile.am b/src/arch/arm/v456/Makefile.am deleted file mode 100644 index 122d9c9..0000000 --- a/src/arch/arm/v456/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ - -noinst_LTLIBRARIES = libarcharmv456.la - -libarcharmv456_la_SOURCES = \ - addressing.h addressing.c \ - encoding.h \ - instruction-def.h \ - instruction.h instruction.c \ - register.h register.c - -libarcharmv456_la_LIBADD = \ - operands/libarcharmv456operands.la - -libarcharmv456_la_CFLAGS = $(AM_CFLAGS) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - - -SUBDIRS = operands diff --git a/src/arch/arm/v456/addressing.c b/src/arch/arm/v456/addressing.c deleted file mode 100644 index bb11d10..0000000 --- a/src/arch/arm/v456/addressing.c +++ /dev/null @@ -1,82 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * addressing.c - prise en compte des modes d'adressage ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#include "addressing.h" - - -#include "encoding.h" -#include "register.h" -#include "operands/content.h" -#include "operands/register.h" - - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à compléter. * -* data = mot de données contenant les indications. * -* format = format du binaire manipulé. * -* * -* Description : Charge les opérandes selon le mode d'adressage § A5.2.1. * -* * -* Retour : true si le décodage s'est bien déroulé. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool build_v456_operands_with_load_immediate_offset(GArmV456Instruction *instr, uint32_t data, const GExeFormat *format) -{ - uint8_t rd_index; /* Indice du registre Rd */ - GArmV456Register *rd_reg; /* Registre Rd en place */ - GArchOperand *op; /* Opérande à ajouter */ - uint8_t rn_index; /* Indice du registre Rn */ - GArmV456Register *rn_reg; /* Registre Rn en place */ - uint16_t value; /* Valeur de décallage */ - GImmOperand *offset; /* Opérande de décallage */ - bool add; /* Utilisation du décallage */ - - /* Destination */ - - rd_index = ARM_V456_REG_RD(data); - rd_reg = g_armv456_register_new(rd_index); - - op = g_armv456_register_operand_new_from_existing(rd_reg); - g_arch_instruction_attach_extra_operand(G_ARCH_INSTRUCTION(instr), op); - - /* Source */ - - rn_index = ARM_V456_REG_RN(data); - rn_reg = g_armv456_register_new(rn_index); - - value = ARM_V456_ADDR_MODE(data); - offset = G_IMM_OPERAND(g_imm_operand_new_from_value(MDS_16_BITS_UNSIGNED, value)); - - add = (data & ARM_V456_BIT_U); - - op = g_armv456_content_operand_new(rn_reg, offset, add); - g_arch_instruction_attach_extra_operand(G_ARCH_INSTRUCTION(instr), op); - - return true; - -} diff --git a/src/arch/arm/v456/addressing.h b/src/arch/arm/v456/addressing.h deleted file mode 100644 index 5e3ce3b..0000000 --- a/src/arch/arm/v456/addressing.h +++ /dev/null @@ -1,38 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * addressing.h - prototypes pour la prise en compte des modes d'adressage ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_ADDRESSING_H -#define _ARCH_ARM_V456_ADDRESSING_H - - -#include "instruction.h" - - - -/* Charge les opérandes selon le mode d'adressage § A5.2.1. */ -bool build_v456_operands_with_load_immediate_offset(GArmV456Instruction *, uint32_t, const GExeFormat *); - - - - -#endif /* _ARCH_ARM_V456_ADDRESSING_H */ diff --git a/src/arch/arm/v456/encoding.h b/src/arch/arm/v456/encoding.h deleted file mode 100644 index 1da11ee..0000000 --- a/src/arch/arm/v456/encoding.h +++ /dev/null @@ -1,188 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * encoding.h - prototypes pour le décodage des instructions ARM v4/v5/v6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_ENCODING_H -#define _ARCH_ARM_V456_ENCODING_H - - -#include - - - -/** - * Coprocessor data processing. - * § A3.1 Instruction set encoding. - */ - - -#define ARM_V456_DATA_PROC_IMM_SHIFT_1_BITS 0x0e000010 -#define ARM_V456_DATA_PROC_IMM_SHIFT_1_MASK 0x00000000 - -#define ARM_V456_MISC_INSTRUCTIONS_BITS 0x0f900010 -#define ARM_V456_MISC_INSTRUCTIONS_MASK 0x01000000 - -#define ARM_V456_DATA_PROC_IMM_SHIFT_2_BITS 0x0e000090 -#define ARM_V456_DATA_PROC_IMM_SHIFT_2_MASK 0x00000010 - -#define ARM_V456_MISC_INSTRS_BITS 0x0f900090 -#define ARM_V456_MISC_INSTRS_MASK 0x01000010 - -#define ARM_V456_MUL_EXTRA_LD_ST_BITS 0x0e000090 -#define ARM_V456_MUL_EXTRA_LD_ST_MASK 0x00000090 - -#define ARM_V456_DATA_PROC_IMM_2_BITS 0x0e000000 -#define ARM_V456_DATA_PROC_IMM_2_MASK 0x02000000 - -#define ARM_V456_UNDEF_INSTR_BITS 0x0fb00000 -#define ARM_V456_UNDEF_INSTR_MASK 0x03000000 - -#define ARM_V456_MOVE_IMM_STATUS_REG_BITS 0x0fb00000 -#define ARM_V456_MOVE_IMM_STATUS_REG_MASK 0x03200000 - -#define ARM_V456_LD_ST_IMM_OFFSET_BITS 0x0e000000 -#define ARM_V456_LD_ST_IMM_OFFSET_MASK 0x04000000 - -#define ARM_V456_ISET_LD_ST_REG_OFFSET_BITS 0x0e000010 -#define ARM_V456_ISET_LD_ST_REG_OFFSET_MASK 0x06000000 - -#define ARM_V456_ISET_MEDIA_INSTRS_4_BITS 0x0e000010 -#define ARM_V456_ISET_MEDIA_INSTRS_4_MASK 0x06000010 - -#define ARM_V456_ISET_ARCH_UNDEFINED_BITS 0x0ff000f0 -#define ARM_V456_ISET_ARCH_UNDEFINED_MASK 0x07f000f0 - -#define ARM_V456_ISET_LD_ST_MULTIPLE_BITS 0x0e000000 -#define ARM_V456_ISET_LD_ST_MULTIPLE_MASK 0x08000000 - -#define ARM_V456_ISET_BRANCH_LINK_BITS 0x0e000000 -#define ARM_V456_ISET_BRANCH_LINK_MASK 0x0a000000 - -#define ARM_V456_ISET_LD_ST_REG_TRANS_BITS 0x0e000000 -#define ARM_V456_ISET_LD_ST_REG_TRANS_MASK 0x0c000000 - -#define ARM_V456_ISET_COPROC_DATA_PROC_BITS 0x0f000010 -#define ARM_V456_ISET_COPROC_DATA_PROC_MASK 0x0e000000 - -#define ARM_V456_ISET_COPROC_REG_TRANS_BITS 0x0f000010 -#define ARM_V456_ISET_COPROC_REG_TRANS_MASK 0x0e000010 - -#define ARM_V456_ISET_SOFT_INTERRUPT_BITS 0x0f000000 -#define ARM_V456_ISET_SOFT_INTERRUPT_MASK 0x0f000000 - -#define ARM_V456_ISET_UNCOND_INSTRS_BITS 0xf0000000 -#define ARM_V456_ISET_UNCOND_INSTRS_MASK 0xf0000000 - - -/* Enumération des jeux possibles */ -typedef enum _ArmV456InstrSets -{ - ARM_V456_ISET_DATA_PROC_IMM_SHIFT_1, /* Data processing immediate shift */ - ARM_V456_ISET_MISC_INSTRUCTIONS, /* Miscellaneous instructions */ - ARM_V456_ISET_DATA_PROC_IMM_SHIFT_2, /* Data processing register shift [2] */ - ARM_V456_MISC_INSTRS, /* Miscellaneous instructions */ - ARM_V456_MUL_EXTRA_LD_ST, /* Multiplies - Extra load/stores */ - ARM_V456_DATA_PROC_IMM_2, /* Data processing immediate [2] */ - ARM_V456_UNDEF_INSTR, /* Undefined instruction */ - ARM_V456_MOVE_IMM_STATUS_REG, /* Move immediate to status register */ - ARM_V456_LD_ST_IMM_OFFSET, /* Load/store immediate offset */ - ARM_V456_ISET_LD_ST_REG_OFFSET, /* Load/store register offset */ - ARM_V456_ISET_MEDIA_INSTRS_4, /* Media instructions [4] */ - ARM_V456_ISET_ARCH_UNDEFINED, /* Architecturally undefined */ - ARM_V456_ISET_LD_ST_MULTIPLE, /* Load/store multiple */ - ARM_V456_ISET_BRANCH_LINK, /* Branch and branch with link */ - ARM_V456_ISET_LD_ST_REG_TRANS, /* Coproc. load/store and double register transfers */ - ARM_V456_ISET_COPROC_DATA_PROC, /* Coprocessor data processing */ - ARM_V456_ISET_COPROC_REG_TRANS, /* Coprocessor register transfers */ - ARM_V456_ISET_SOFT_INTERRUPT, /* Software interrupt */ - ARM_V456_ISET_UNCOND_INSTRS, /* Unconditional instructions */ - - ARM_V456_ISET_COUNT - -} ArmV456InstrSets; - - -/* Jeux réordonnés pour la reconnaissance */ -static const uint32_t _arm_v456_encoding_sets[ARM_V456_ISET_COUNT][2] = { - - /* 0 0 0 */ - { ARM_V456_MISC_INSTRS_BITS, ARM_V456_MISC_INSTRS_MASK }, - { ARM_V456_MISC_INSTRUCTIONS_BITS, ARM_V456_MISC_INSTRUCTIONS_MASK }, - { ARM_V456_DATA_PROC_IMM_SHIFT_2_BITS, ARM_V456_DATA_PROC_IMM_SHIFT_2_MASK }, - { ARM_V456_MUL_EXTRA_LD_ST_BITS, ARM_V456_MUL_EXTRA_LD_ST_MASK }, - { ARM_V456_DATA_PROC_IMM_SHIFT_1_BITS, ARM_V456_DATA_PROC_IMM_SHIFT_1_MASK }, - - /* 0 0 1 */ - { ARM_V456_UNDEF_INSTR_BITS, ARM_V456_UNDEF_INSTR_MASK }, - { ARM_V456_MOVE_IMM_STATUS_REG_BITS, ARM_V456_MOVE_IMM_STATUS_REG_MASK }, - { ARM_V456_DATA_PROC_IMM_2_BITS, ARM_V456_DATA_PROC_IMM_2_MASK }, - - /* 0 1 0 */ - { ARM_V456_LD_ST_IMM_OFFSET_BITS, ARM_V456_LD_ST_IMM_OFFSET_MASK }, - - /* 0 1 1 */ - { ARM_V456_ISET_ARCH_UNDEFINED_BITS, ARM_V456_ISET_ARCH_UNDEFINED_MASK }, - { ARM_V456_ISET_LD_ST_REG_OFFSET_BITS, ARM_V456_ISET_LD_ST_REG_OFFSET_MASK }, - { ARM_V456_ISET_MEDIA_INSTRS_4_BITS, ARM_V456_ISET_MEDIA_INSTRS_4_MASK }, - - /* 1 0 0 */ - { ARM_V456_ISET_LD_ST_MULTIPLE_BITS, ARM_V456_ISET_LD_ST_MULTIPLE_MASK }, - - /* 1 0 1 */ - { ARM_V456_ISET_BRANCH_LINK_BITS, ARM_V456_ISET_BRANCH_LINK_MASK }, - - /* 1 1 0 */ - { ARM_V456_ISET_LD_ST_REG_TRANS_BITS, ARM_V456_ISET_LD_ST_REG_TRANS_MASK }, - - /* 1 1 1 */ - { ARM_V456_ISET_COPROC_DATA_PROC_BITS, ARM_V456_ISET_COPROC_DATA_PROC_MASK }, - { ARM_V456_ISET_COPROC_REG_TRANS_BITS, ARM_V456_ISET_COPROC_REG_TRANS_MASK }, - { ARM_V456_ISET_SOFT_INTERRUPT_BITS, ARM_V456_ISET_SOFT_INTERRUPT_MASK }, - - /* x x x */ - { ARM_V456_ISET_UNCOND_INSTRS_BITS, ARM_V456_ISET_UNCOND_INSTRS_MASK } - -}; - - - - -#define IS_ENCODING_SET(val, set) (((val) & (set[0])) == (set[1])) - - - - -#define ARM_V456_BIT_L (1 << 20) -#define ARM_V456_BIT_W (1 << 21) -#define ARM_V456_BIT_U (1 << 22) -#define ARM_V456_BIT_P (1 << 23) -#define ARM_V456_BIT_I (1 << 24) - -#define ARM_V456_REG_RN(instr) (((instr) >> 16) & 0x0f) -#define ARM_V456_REG_RD(instr) (((instr) >> 12) & 0x0f) - -#define ARM_V456_ADDR_MODE(instr) ((instr) & 0xfff) - - - - -#endif /* _ARCH_ARM_V456_ENCODING_H */ diff --git a/src/arch/arm/v456/instruction-def.h b/src/arch/arm/v456/instruction-def.h deleted file mode 100644 index 7558a86..0000000 --- a/src/arch/arm/v456/instruction-def.h +++ /dev/null @@ -1,91 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * instruction-def.h - définition interne des identifiants d'instructions ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_INSTRUCTION_DEF_H -#define _ARCH_ARM_V456_INSTRUCTION_DEF_H - - - - - -/** - * ARM Architecture Reference Manual. - * A4.2 ARM instructions and architecture versions. - */ - -#define ARM_VERSION_4 (1 << 1) -#define ARM_VERSION_V4T (1 << 2) -#define ARM_VERSION_V5T (1 << 3) -#define ARM_VERSION_V5TE (1 << 4) -#define ARM_VERSION_V5TEJ (1 << 5) -#define ARM_VERSION_V6 (1 << 6) -#define ARM_VERSION_V5TEXP (1 << 7) - -#define ARM_VERSION_ALL_456 (ARM_VERSION_4 \ - | ARM_VERSION_V4T \ - | ARM_VERSION_V5T \ - | ARM_VERSION_V5TE \ - | ARM_VERSION_V5TEJ \ - | ARM_VERSION_V6 \ - | ARM_VERSION_V5TEXP) - - - - -/* Enumération de tous les opcodes */ -typedef enum _ArmV456Opcodes -{ - /** - * ARM Architecture Reference Manual. - * § A3.4 Data-processing instructions. - */ - - AOP_AND, /* and (0x00) */ - AOP_EOR, /* eor (0x01) */ - AOP_SUB, /* sub (0x02) */ - AOP_RSB, /* rsb (0x03) */ - AOP_ADD, /* add (0x04) */ - AOP_ADC, /* adc (0x05) */ - AOP_SBC, /* sbc (0x06) */ - AOP_RSC, /* rsc (0x07) */ - AOP_TST, /* tst (0x08) */ - AOP_TEQ, /* teq (0x09) */ - AOP_CMP, /* cmp (0x0a) */ - AOP_CMN, /* cmn (0x0b) */ - AOP_ORR, /* orr (0x0c) */ - AOP_MOV, /* mov (0x0d) */ - AOP_BIC, /* bic (0x0e) */ - AOP_MVN, /* mvn (0x0f) */ - - - AOP_LDR, - AOP_STR, - - - AOP_COUNT - -} ArmV456Opcodes; - - - -#endif /* _ARCH_ARM_V456_INSTRUCTION_DEF_H */ diff --git a/src/arch/arm/v456/instruction.c b/src/arch/arm/v456/instruction.c deleted file mode 100644 index 4fc78a2..0000000 --- a/src/arch/arm/v456/instruction.c +++ /dev/null @@ -1,683 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * instruction.c - gestion des instructions ARM v4/v5/v6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#include "instruction.h" - - -#include "encoding.h" - - -#include "../instruction-int.h" - - - -//////// -#include -///////// - - - -typedef unsigned char bin_t; - -typedef unsigned int arch_version_t; - - - -/* -------------------------- INSTRUCTIONS POUR ARM v4/5/6 -------------------------- */ - - -/* Définition d'une instruction d'architecture ARM v4/5/6 (instance) */ -struct _GArmV456Instruction -{ - GArchInstruction parent; /* A laisser en premier */ - - ArmV456Opcodes type; /* Type d'instruction en place */ - -}; - -/* Définition d'une instruction d'architecture ARM v4/5/6 (classe) */ -struct _GArmV456InstructionClass -{ - GArchInstructionClass parent; /* A laisser en premier */ - -}; - - -/* Initialise la classe des instructions pour ARM v4/5/6. */ -static void g_armv456_instruction_class_init(GArmV456InstructionClass *); - -/* Initialise une instance d'opérande d'architecture ARM v4/5/6. */ -static void g_armv456_instruction_init(GArmV456Instruction *); - -/* Traduit une instruction en version humainement lisible. */ -static const char *g_armv456_get_instruction_text(const GArmV456Instruction *, const GExeFormat *, AsmSyntax); - - - - -/* --------------------- AIDE A LA MISE EN PLACE D'INSTRUCTIONS --------------------- */ - - -/* Répertoire de toutes les instructions ARM v4/5/6 */ -typedef struct _arm_v456_instruction -{ - bin_t opcode; /* Opcode de l'instruction */ - const char *keyword; /* Mot clef de la commande */ - - arch_version_t version; /* Version de l'architecture */ - - //decomp_instr_fc decomp; /* Procédure de décompilation */ - -} arm_v456_instruction; - - -/* Liste de toutes les instructions */ -static arm_v456_instruction _instructions[AOP_COUNT] = { - - [AOP_AND] = { 0x00, "and", ARM_VERSION_ALL_456 }, - [AOP_EOR] = { 0x01, "eor", ARM_VERSION_ALL_456 }, - [AOP_SUB] = { 0x02, "sub", ARM_VERSION_ALL_456 }, - [AOP_RSB] = { 0x03, "rsb", ARM_VERSION_ALL_456 }, - [AOP_ADD] = { 0x04, "add", ARM_VERSION_ALL_456 }, - [AOP_ADC] = { 0x05, "adc", ARM_VERSION_ALL_456 }, - [AOP_SBC] = { 0x06, "sbc", ARM_VERSION_ALL_456 }, - [AOP_RSC] = { 0x07, "rsc", ARM_VERSION_ALL_456 }, - [AOP_TST] = { 0x08, "tst", ARM_VERSION_ALL_456 }, - [AOP_TEQ] = { 0x09, "teq", ARM_VERSION_ALL_456 }, - [AOP_CMP] = { 0x0a, "cmp", ARM_VERSION_ALL_456 }, - [AOP_CMN] = { 0x0b, "cmn", ARM_VERSION_ALL_456 }, - [AOP_ORR] = { 0x0c, "orr", ARM_VERSION_ALL_456 }, - [AOP_MOV] = { 0x0d, "mov", ARM_VERSION_ALL_456 }, - [AOP_BIC] = { 0x0e, "bic", ARM_VERSION_ALL_456 }, - [AOP_MVN] = { 0x0f, "mov", ARM_VERSION_ALL_456 }, - - [AOP_LDR] = { 0xff, "ldr", ARM_VERSION_ALL_456 }, - [AOP_STR] = { 0xff, "ldr", ARM_VERSION_ALL_456 } - - - -}; - - -/* Constitution d'un groupe */ -static arm_v456_instruction *_data_processing_instrs[17] = { - - &_instructions[AOP_AND], &_instructions[AOP_EOR], &_instructions[AOP_SUB], - &_instructions[AOP_RSB], &_instructions[AOP_ADD], &_instructions[AOP_ADC], - &_instructions[AOP_SBC], &_instructions[AOP_RSC], &_instructions[AOP_TST], - &_instructions[AOP_TEQ], &_instructions[AOP_CMP], &_instructions[AOP_CMN], - &_instructions[AOP_ORR], &_instructions[AOP_MOV], &_instructions[AOP_BIC], - &_instructions[AOP_MVN], NULL - -}; - - - - -/* ---------------------------------------------------------------------------------- */ -/* INSTRUCTIONS POUR ARM v4/5/6 */ -/* ---------------------------------------------------------------------------------- */ - - -/* Indique le type défini pour une instruction d'architecture Dalvik. */ -G_DEFINE_TYPE(GArmV456Instruction, g_armv456_instruction, G_TYPE_ARCH_INSTRUCTION); - - - -/****************************************************************************** -* * -* Paramètres : klass = classe à initialiser. * -* * -* Description : Initialise la classe des instructions pour Dalvik. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_instruction_class_init(GArmV456InstructionClass *klass) -{ - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instance à initialiser. * -* * -* Description : Initialise une instance d'instruction d'architecture Dalvik. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_instruction_init(GArmV456Instruction *instr) -{ - GArchInstruction *parent; /* Instance parente */ - - parent = G_ARCH_INSTRUCTION(instr); - - //parent->get_text = (get_instruction_text_fc)g_armv456_get_instruction_text; - - /* - parent->get_rw_regs = (get_instruction_rw_regs_fc)g_armv456_instruction_get_rw_registers; - parent->get_text = (get_instruction_text_fc)dalvik_get_instruction_text; - parent->get_link = (get_instruction_link_fc)dalvik_get_instruction_link; - parent->is_return = (is_instruction_return_fc)dalvik_instruction_is_return; - parent->decomp = (decomp_instr_fc)dalvik_instruction_decompile; - */ - -} - - -/****************************************************************************** -* * -* Paramètres : type = type d'instruction à représenter. * -* * -* Description : Crée une instruction pour l'architecture Dalvik. * -* * -* Retour : Architecture mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArchInstruction *g_armv456_instruction_new(ArmV456Opcodes type) -{ - GArchInstruction *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_ARMV456_INSTRUCTION, NULL); - - G_ARMV456_INSTRUCTION(result)->type = type; - - return result; - -} - - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à traiter. * -* format = format du binaire manipulé. * -* syntax = type de représentation demandée. * -* * -* Description : Traduit une instruction en version humainement lisible. * -* * -* Retour : Chaîne de caractères à libérer de la mémoire. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static const char *g_armv456_get_instruction_text(const GArmV456Instruction *instr, const GExeFormat *format, AsmSyntax syntax) -{ - return _instructions[instr->type].keyword; - -} - - -#include "addressing.h" - - -GArchInstruction *try_to_decode_arm_v456_instr(bin_t *data) -{ - GArchInstruction *result; /* Instruction à retourner */ - uint32_t *instr; - - ArmV456InstrSets i; /* Boucle de parcours */ - - result = NULL; - - instr = (uint32_t *)data; - - //printf("instr = 0x%x\n", *instr); - - - - for (i = 0; i < ARM_V456_ISET_COUNT; i++) - if (IS_ENCODING_SET(*instr, _arm_v456_encoding_sets[i])) - break; - - switch (i) - { - case ARM_V456_ISET_COUNT: - printf("failed !\n"); - break; - - - case ARM_V456_LD_ST_IMM_OFFSET: - //printf("LOAD !! %s\n", *instr & ARM_V456_BIT_L ? "load" : "store"); - - - - result = g_armv456_instruction_new(*instr & ARM_V456_BIT_L ? AOP_LDR : AOP_STR); - - - /*bool */build_v456_operands_with_load_immediate_offset(result, *instr, NULL); - - - break; - - - default: - //printf("got it !\n"); - break; - - } - - - - - return result; - -} - - - - -#if 0 - -#include "instruction-int.h" -#include "decomp/translate.h" -#include "operands/register.h" -#include "operands/target.h" -#include "../instruction-int.h" -#include "../register-int.h" - - - -/* Initialise la classe des instructions pour Dalvik. */ -static void g_dalvik_instruction_class_init(GDalvikInstructionClass *); - -/* Initialise une instance d'opérande d'architecture Dalvik. */ -static void g_dalvik_instruction_init(GDalvikInstruction *); - -/* Liste les registres lus et écrits par l'instruction. */ -static void g_dalvik_instruction_get_rw_registers(const GDalvikInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *); - - - -/* --------------------- AIDE A LA MISE EN PLACE D'INSTRUCTIONS --------------------- */ - - -/* Répertoire de toutes les instructions Dalvik */ -typedef struct _dalvik_instruction -{ - bin_t opcode; /* Opcode de l'instruction */ - - const char *keyword; /* Mot clef de la commande */ - - decomp_instr_fc decomp; /* Procédure de décompilation */ - -} dalvik_instruction; - - -static dalvik_instruction _instructions[DOP_COUNT] = { - -}; - - -/* Traduit une instruction en version humainement lisible. */ -static const char *dalvik_get_instruction_text(const GDalvikInstruction *, const GExeFormat *, AsmSyntax); - -/* Informe sur une éventuelle référence à une autre instruction. */ -static InstructionLinkType dalvik_get_instruction_link(const GDalvikInstruction *, vmpa_t *); - -/* Indique si l'instruction correspond à un retour de fonction. */ -static bool dalvik_instruction_is_return(const GDalvikInstruction *); - -/* Décompile une instruction de la machine virtuelle Dalvik. */ -GDecInstruction *dalvik_instruction_decompile(const GDalvikInstruction *, GDecContext *); - - - -/* Indique le type défini pour une instruction d'architecture Dalvik. */ -G_DEFINE_TYPE(GDalvikInstruction, g_dalvik_instruction, G_TYPE_ARCH_INSTRUCTION); - - - -/****************************************************************************** -* * -* Paramètres : klass = classe à initialiser. * -* * -* Description : Initialise la classe des instructions pour Dalvik. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_dalvik_instruction_class_init(GDalvikInstructionClass *klass) -{ - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instance à initialiser. * -* * -* Description : Initialise une instance d'instruction d'architecture Dalvik. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_dalvik_instruction_init(GDalvikInstruction *instr) -{ - GArchInstruction *parent; /* Instance parente */ - - parent = G_ARCH_INSTRUCTION(instr); - - parent->get_rw_regs = (get_instruction_rw_regs_fc)g_dalvik_instruction_get_rw_registers; - parent->get_text = (get_instruction_text_fc)dalvik_get_instruction_text; - parent->get_link = (get_instruction_link_fc)dalvik_get_instruction_link; - //parent->is_return = (is_instruction_return_fc)dalvik_instruction_is_return; - parent->decomp = (decomp_instr_fc)dalvik_instruction_decompile; - -} - - -/****************************************************************************** -* * -* Paramètres : type = type d'instruction à représenter. * -* * -* Description : Crée une instruction pour l'architecture Dalvik. * -* * -* Retour : Architecture mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArchInstruction *g_dalvik_instruction_new(DalvikOpcodes type) -{ - GArchInstruction *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_DALVIK_INSTRUCTION, NULL); - - G_DALVIK_INSTRUCTION(result)->type = type; - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction Dalvik à consulter. * -* * -* Description : Indique l'opcode associé à une instruction Dalvik. * -* * -* Retour : Identifiant de l'instruction en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -DalvikOpcodes g_dalvik_instruction_get_opcode(const GDalvikInstruction *instr) -{ - return instr->type; - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à consulter. * -* rregs = liste des rgistres lus. [OUT] * -* rcount = nombre de registres lus. [OUT] * -* wregs = liste des rgistres écrits. [OUT] * -* wcount = nombre de registres écrits. [OUT] * -* * -* Description : Liste les registres lus et écrits par l'instruction. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_dalvik_instruction_get_rw_registers(const GDalvikInstruction *instr, GArchRegister ***rregs, size_t *rcount, GArchRegister ***wregs, size_t *wcount) -{ - GArchInstruction *base; /* Version basique à manipuler */ - size_t i; /* Boucle de parcours */ - GArchOperand *operand; /* Operande à analyser */ - GDalvikRegister *reg; /* Registre concerné */ - - base = G_ARCH_INSTRUCTION(instr); - - for (i = 0; i < base->operands_count; i++) - { - operand = base->operands[i]; - - if (!G_IS_DALVIK_REGISTER_OPERAND(operand)) - continue; - - reg = g_dalvik_register_operand_get(G_DALVIK_REGISTER_OPERAND(operand)); - - if (g_dalvik_register_operand_is_written(G_DALVIK_REGISTER_OPERAND(operand))) - { - (*wregs) = (GArchRegister **)realloc(*wregs, ++(*wcount) * sizeof(GArchRegister *)); - (*wregs)[(*wcount) - 1] = G_ARCH_REGISTER(reg); - } - else - { - (*rregs) = (GArchRegister **)realloc(*rregs, ++(*rcount) * sizeof(GArchRegister *)); - (*rregs)[(*rcount) - 1] = G_ARCH_REGISTER(reg); - } - - } - -} - - - -/* ---------------------------------------------------------------------------------- */ -/* AIDE A LA MISE EN PLACE D'INSTRUCTIONS */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -* * -* Paramètres : data = flux de données à analyser. * -* pos = position courante dans ce flux. * -* end = limite des données à analyser. * -* * -* Description : Recherche l'identifiant de la prochaine instruction. * -* * -* Retour : Identifiant de la prochaine instruction à tenter de charger. * -* * -* Remarques : - * -* * -******************************************************************************/ - -DalvikOpcodes dalvik_guess_next_instruction(const bin_t *data, off_t pos, off_t end) -{ - DalvikOpcodes result; /* Identifiant à retourner */ - - result = (DalvikOpcodes)data[pos]; - - /* Si l'instruction est marquée comme non utilisée... */ - if (_instructions[result].keyword == NULL) - result = DOP_COUNT; - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à traiter. * -* format = format du binaire manipulé. * -* syntax = type de représentation demandée. * -* * -* Description : Traduit une instruction en version humainement lisible. * -* * -* Retour : Chaîne de caractères à libérer de la mémoire. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static const char *dalvik_get_instruction_text(const GDalvikInstruction *instr, const GExeFormat *format, AsmSyntax syntax) -{ - return _instructions[instr->type].keyword; - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à consulter. * -* addr = eventuelle adresse associée à faire connaître. [OUT] * -* * -* Description : Informe sur une éventuelle référence à une autre instruction.* -* * -* Retour : Type de lien trouvé ou ILT_NONE si aucun. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static InstructionLinkType dalvik_get_instruction_link(const GDalvikInstruction *instr, vmpa_t *addr) -{ - InstructionLinkType result; /* Type de lien à retourner */ - GArchOperand *operand; /* Opérande à manipuler */ - const GImmOperand *imm; /* Valeur immédiate */ - - switch (instr->type) - { - case DOP_GOTO: - case DOP_GOTO_16: - case DOP_GOTO_32: - - operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 0); - imm = g_dalvik_target_operand_get_value(G_DALVIK_TARGET_OPERAND(operand)); - - if (g_imm_operand_to_vmpa_t(imm, addr)) result = ILT_JUMP; - else result = ILT_NONE; - - break; - - case DOP_IF_EQ: - case DOP_IF_NE: - case DOP_IF_LT: - case DOP_IF_GE: - case DOP_IF_GT: - case DOP_IF_LE: - - operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 2); - imm = g_dalvik_target_operand_get_value(G_DALVIK_TARGET_OPERAND(operand)); - - if (g_imm_operand_to_vmpa_t(imm, addr)) result = ILT_JUMP_IF_TRUE; - else result = ILT_NONE; - - break; - - case DOP_IF_EQZ: - case DOP_IF_NEZ: - case DOP_IF_LTZ: - case DOP_IF_GEZ: - case DOP_IF_GTZ: - case DOP_IF_LEZ: - - operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 1); - imm = g_dalvik_target_operand_get_value(G_DALVIK_TARGET_OPERAND(operand)); - - if (g_imm_operand_to_vmpa_t(imm, addr)) result = ILT_JUMP_IF_TRUE; - else result = ILT_NONE; - - break; - - default: - result = ILT_NONE; - break; - - } - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à consulter. * -* * -* Description : Indique si l'instruction correspond à un retour de fonction. * -* * -* Retour : true si l'instruction est un 'return' quelconque ou false. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool dalvik_instruction_is_return(const GDalvikInstruction *instr) -{ - return (instr->type == DOP_RETURN_VOID - || instr->type == DOP_RETURN - || instr->type == DOP_RETURN_WIDE - || instr->type == DOP_RETURN_OBJECT); - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction d'origine à convertir. * -* ctx = contexte de la phase de décompilation. * -* * -* Description : Décompile une instruction de la machine virtuelle Dalvik. * -* * -* Retour : Instruction mise en place ou NULL. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GDecInstruction *dalvik_instruction_decompile(const GDalvikInstruction *instr, GDecContext *ctx) -{ - GDecInstruction *result; /* Instruction à retourner */ - - if (_instructions[instr->type].decomp != NULL) - result = _instructions[instr->type].decomp(G_ARCH_INSTRUCTION(instr), ctx); - - else - result = NULL; - - return result; - -} - - - -#endif diff --git a/src/arch/arm/v456/instruction.h b/src/arch/arm/v456/instruction.h deleted file mode 100644 index 34a5eb2..0000000 --- a/src/arch/arm/v456/instruction.h +++ /dev/null @@ -1,105 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * instruction.h - prototypes pour la gestion des instructions ARM v4/v5/v6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_INSTRUCTION_H -#define _ARCH_ARM_V456_INSTRUCTION_H - - -#include "instruction-def.h" -#include "../../instruction.h" - - - -#define G_TYPE_ARMV456_INSTRUCTION g_armv456_instruction_get_type() -#define G_ARMV456_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv456_instruction_get_type(), GArmV456Instruction)) -#define G_IS_ARMV456_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv456_instruction_get_type())) -#define G_ARMV456_INSTRUCTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_armv456_instruction_get_type(), GArmV456InstructionIface)) - - -/* Définition d'une instruction d'architecture ARM v4/5/6 (instance) */ -typedef struct _GArmV456Instruction GArmV456Instruction; - -/* Définition d'une instruction d'architecture ARM v4/5/6 (classe) */ -typedef struct _GArmV456InstructionClass GArmV456InstructionClass; - - -/* Indique le type défini pour une instruction d'architecture ARM v4/5/6. */ -GType g_armv456_instruction_get_type(void); - -/* Crée une instruction pour l'architecture ARM v4/5/6. */ -GArchInstruction *g_armv456_instruction_new(ArmV456Opcodes); - - - - - -GArchInstruction *try_to_decode_arm_v456_instr(bin_t *); - - - - -#if 0 -#include "instruction-def.h" -#include "../../instruction.h" - - - -#define G_TYPE_DALVIK_INSTRUCTION g_dalvik_instruction_get_type() -#define G_DALVIK_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dalvik_instruction_get_type(), GDalvikInstruction)) -#define G_IS_DALVIK_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dalvik_instruction_get_type())) -#define G_DALVIK_INSTRUCTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_dalvik_instruction_get_type(), GDalvikInstructionIface)) - - -/* Définition générique d'une instruction d'architecture Dalvik (instance) */ -typedef struct _GDalvikInstruction GDalvikInstruction; - -/* Définition générique d'une instruction d'architecture Dalvik (classe) */ -typedef struct _GDalvikInstructionClass GDalvikInstructionClass; - - -/* Indique le type défini pour une instruction d'architecture Dalvik. */ -GType g_dalvik_instruction_get_type(void); - -/* Crée une instruction pour l'architecture Dalvik. */ -GArchInstruction *g_dalvik_instruction_new(DalvikOpcodes); - -/* Indique l'opcode associé à une instruction Dalvik. */ -DalvikOpcodes g_dalvik_instruction_get_opcode(const struct _GDalvikInstruction *); - - - -/* --------------------- AIDE A LA MISE EN PLACE D'INSTRUCTIONS --------------------- */ - - -/* Recherche l'identifiant de la prochaine instruction. */ -DalvikOpcodes dalvik_guess_next_instruction(const bin_t *, off_t, off_t); - - - -/* ------------------------ AIDE A LA PHASE DE DECOMPILATION ------------------------ */ - - -#endif - - -#endif /* _ARCH_ARM_V456_INSTRUCTION_H */ diff --git a/src/arch/arm/v456/operands/Makefile.am b/src/arch/arm/v456/operands/Makefile.am deleted file mode 100644 index 1179c99..0000000 --- a/src/arch/arm/v456/operands/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ - -noinst_LTLIBRARIES = libarcharmv456operands.la - -libarcharmv456operands_la_SOURCES = \ - content.h content.c \ - register.h register.c - -libarcharmv456_la_CFLAGS = $(AM_CFLAGS) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - - -SUBDIRS = diff --git a/src/arch/arm/v456/operands/content.c b/src/arch/arm/v456/operands/content.c deleted file mode 100644 index 105b74d..0000000 --- a/src/arch/arm/v456/operands/content.c +++ /dev/null @@ -1,257 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * content.c - opérandes visant un registre ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#include "content.h" - - -#include "../../../operand-int.h" - - - -/* Définition d'un opérande visant un registre ARM v4/5/6 (instance) */ -struct _GArmV456ContentOperand -{ - GArchOperand parent; /* Instance parente */ - - GArmV456Register *reg; /* Registre représenté */ - GImmOperand *offset; /* Décallage à appliquer */ - - bool add; /* Mise à jour du registre ? */ - - bool is_written; /* Changement de contenu */ - -}; - - -/* Définition d'un opérande visant un registre ARM v4/5/6 (classe) */ -struct _GArmV456ContentOperandClass -{ - GArchOperandClass parent; /* Classe parente */ - -}; - - -/* Initialise la classe des opérandes de registre ARM v4/5/6. */ -static void g_armv456_content_operand_class_init(GArmV456ContentOperandClass *); - -/* Initialise une instance d'opérande de registre ARM v4/5/6. */ -static void g_armv456_content_operand_init(GArmV456ContentOperand *); - -/* Compare un opérande avec un autre. */ -static bool g_armv456_content_operand_compare(const GArmV456ContentOperand *, const GArmV456ContentOperand *); - -/* Traduit un opérande en version humainement lisible. */ -static void g_armv456_content_operand_print(const GArmV456ContentOperand *, GBufferLine *, AsmSyntax); - - - -/* Indique le type défini par la GLib pour un opérande de registre ARM v4/5/6. */ -G_DEFINE_TYPE(GArmV456ContentOperand, g_armv456_content_operand, G_TYPE_ARCH_OPERAND); - - -/****************************************************************************** -* * -* Paramètres : klass = classe à initialiser. * -* * -* Description : Initialise la classe des opérandes de registre ARM v4/5/6. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_content_operand_class_init(GArmV456ContentOperandClass *klass) -{ - -} - - -/****************************************************************************** -* * -* Paramètres : operand = instance à initialiser. * -* * -* Description : Initialise une instance d'opérande de registre ARM v4/5/6. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_content_operand_init(GArmV456ContentOperand *operand) -{ - GArchOperand *parent; /* Instance parente */ - - parent = G_ARCH_OPERAND(operand); - - parent->compare = (operand_compare_fc)g_armv456_content_operand_compare; - parent->print = (operand_print_fc)g_armv456_content_operand_print; - - operand->is_written = false; - -} - - -/****************************************************************************** -* * -* Paramètres : reg = registre déjà en place. * -* offset = décallage à appliquer. * -* add = sens du décallage. * -* * -* Description : Crée un opérande visant un registre ARM v4/5/6. * -* * -* Retour : Opérande mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArchOperand *g_armv456_content_operand_new(GArmV456Register *reg, GImmOperand *offset, bool add) -{ - GArmV456ContentOperand *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_ARMV456_CONTENT_OPERAND, NULL); - - result->reg = reg; - result->offset = offset; - - result->add = add; - - return G_ARCH_OPERAND(result); - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande représentant un registre. * -* * -* Description : Fournit le registre ARM v4/5/6 associé à l'opérande. * -* * -* Retour : Représentation interne du registre. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArmV456Register *g_armv456_content_operand_get(const GArmV456ContentOperand *operand) -{ - return operand->reg; - -} - - -/****************************************************************************** -* * -* Paramètres : a = premier opérande à consulter. * -* b = second opérande à consulter. * -* * -* Description : Compare un opérande avec un autre. * -* * -* Retour : Bilan de la comparaison. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_armv456_content_operand_compare(const GArmV456ContentOperand *a, const GArmV456ContentOperand *b) -{ - return false;//(g_armv456_content_compare(a->reg, b->reg) == 0); - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande à traiter. * -* line = ligne tampon où imprimer l'opérande donné. * -* syntax = type de représentation demandée. * -* * -* Description : Traduit un opérande en version humainement lisible. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_content_operand_print(const GArmV456ContentOperand *operand, GBufferLine *line, AsmSyntax syntax) -{ - g_buffer_line_insert_text(line, BLC_ASSEMBLY, "[", 1, RTT_HOOK); - - g_armv456_register_print(operand->reg, line, syntax); - - if (!g_imm_operand_is_null(operand->offset)) - { - g_buffer_line_insert_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT); - g_buffer_line_insert_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW); - - if (!operand->add) - g_buffer_line_insert_text(line, BLC_ASSEMBLY, "-", 1, RTT_SIGNS); - - g_arch_operand_print(G_ARCH_OPERAND(operand->offset), line, syntax); - - } - - g_buffer_line_insert_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK); - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande représentant un registre à mettre à jour. * -* * -* Description : Marque l'opérande comme étant écrit plutôt que consulté. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_armv456_content_operand_mark_as_written(GArmV456ContentOperand *operand) -{ - operand->is_written = true; - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande représentant un registre à consulter. * -* * -* Description : Indique le type d'accès réalisé sur l'opérande. * -* * -* Retour : Type d'accès : true en cas d'écriture, false sinon. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_armv456_content_operand_is_written(const GArmV456ContentOperand *operand) -{ - return operand->is_written; - -} diff --git a/src/arch/arm/v456/operands/content.h b/src/arch/arm/v456/operands/content.h deleted file mode 100644 index 7c3913b..0000000 --- a/src/arch/arm/v456/operands/content.h +++ /dev/null @@ -1,70 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * content.h - prototypes pour les opérandes visant un registre ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_OPERANDS_CONTENT_H -#define _ARCH_ARM_V456_OPERANDS_CONTENT_H - - -#include - - -#include "../register.h" -#include "../../../operand.h" -#include "../../../../arch/immediate.h" -#include "../../../../common/endianness.h" - - - -#define G_TYPE_ARMV456_CONTENT_OPERAND g_armv456_content_operand_get_type() -#define G_ARMV456_CONTENT_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv456_content_operand_get_type(), GArmV456ContentOperand)) -#define G_IS_DALVIK_CONTENT_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv456_content_operand_get_type())) -#define G_ARMV456_CONTENT_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_CONTENT_OPERAND, GArmV456ContentOperandClass)) -#define G_IS_DALVIK_CONTENT_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_CONTENT_OPERAND)) -#define G_ARMV456_CONTENT_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_CONTENT_OPERAND, GArmV456ContentOperandClass)) - - -/* Définition d'un opérande visant un registre ARM v4/5/6 (instance) */ -typedef struct _GArmV456ContentOperand GArmV456ContentOperand; - -/* Définition d'un opérande visant un registre ARM v4/5/6 (classe) */ -typedef struct _GArmV456ContentOperandClass GArmV456ContentOperandClass; - - -/* Indique le type défini par la GLib pour un opérande de registre ARM v4/5/6. */ -GType g_armv456_content_operand_get_type(void); - -/* Crée un opérande visant un registre ARM v4/5/6. */ -GArchOperand *g_armv456_content_operand_new(GArmV456Register *, GImmOperand *, bool); - -/* Fournit le registre ARM v4/5/6 associé à l'opérande. */ -GArmV456Register *g_armv456_content_operand_get(const GArmV456ContentOperand *); - -/* Marque l'opérande comme étant écrit plutôt que consulté. */ -void g_armv456_content_operand_mark_as_written(GArmV456ContentOperand *); - -/* Indique le type d'accès réalisé sur l'opérande. */ -bool g_armv456_content_operand_is_written(const GArmV456ContentOperand *); - - - -#endif /* _ARCH_ARM_V456_OPERANDS_CONTENT_H */ diff --git a/src/arch/arm/v456/operands/register.c b/src/arch/arm/v456/operands/register.c deleted file mode 100644 index 4795363..0000000 --- a/src/arch/arm/v456/operands/register.c +++ /dev/null @@ -1,232 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * register.c - opérandes visant un registre ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#include "register.h" - - -#include "../../../operand-int.h" - - - -/* Définition d'un opérande visant un registre ARM v4/5/6 (instance) */ -struct _GArmV456RegisterOperand -{ - GArchOperand parent; /* Instance parente */ - - GArmV456Register *reg; /* Registre représenté */ - bool is_written; /* Changement de contenu */ - -}; - - -/* Définition d'un opérande visant un registre ARM v4/5/6 (classe) */ -struct _GArmV456RegisterOperandClass -{ - GArchOperandClass parent; /* Classe parente */ - -}; - - -/* Initialise la classe des opérandes de registre ARM v4/5/6. */ -static void g_armv456_register_operand_class_init(GArmV456RegisterOperandClass *); - -/* Initialise une instance d'opérande de registre ARM v4/5/6. */ -static void g_armv456_register_operand_init(GArmV456RegisterOperand *); - -/* Compare un opérande avec un autre. */ -static bool g_armv456_register_operand_compare(const GArmV456RegisterOperand *, const GArmV456RegisterOperand *); - -/* Traduit un opérande en version humainement lisible. */ -static void g_armv456_register_operand_print(const GArmV456RegisterOperand *, GBufferLine *, AsmSyntax); - - - -/* Indique le type défini par la GLib pour un opérande de registre ARM v4/5/6. */ -G_DEFINE_TYPE(GArmV456RegisterOperand, g_armv456_register_operand, G_TYPE_ARCH_OPERAND); - - -/****************************************************************************** -* * -* Paramètres : klass = classe à initialiser. * -* * -* Description : Initialise la classe des opérandes de registre ARM v4/5/6. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_register_operand_class_init(GArmV456RegisterOperandClass *klass) -{ - -} - - -/****************************************************************************** -* * -* Paramètres : operand = instance à initialiser. * -* * -* Description : Initialise une instance d'opérande de registre ARM v4/5/6. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_register_operand_init(GArmV456RegisterOperand *operand) -{ - GArchOperand *parent; /* Instance parente */ - - parent = G_ARCH_OPERAND(operand); - - parent->compare = (operand_compare_fc)g_armv456_register_operand_compare; - parent->print = (operand_print_fc)g_armv456_register_operand_print; - - operand->is_written = false; - -} - - -/****************************************************************************** -* * -* Paramètres : reg = registre déjà en place. * -* * -* Description : Crée un opérande visant un registre ARM v4/5/6. * -* * -* Retour : Opérande mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArchOperand *g_armv456_register_operand_new_from_existing(GArmV456Register *reg) -{ - GArmV456RegisterOperand *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_ARMV456_REGISTER_OPERAND, NULL); - - result->reg = reg; - - return G_ARCH_OPERAND(result); - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande représentant un registre. * -* * -* Description : Fournit le registre ARM v4/5/6 associé à l'opérande. * -* * -* Retour : Représentation interne du registre. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArmV456Register *g_armv456_register_operand_get(const GArmV456RegisterOperand *operand) -{ - return operand->reg; - -} - - -/****************************************************************************** -* * -* Paramètres : a = premier opérande à consulter. * -* b = second opérande à consulter. * -* * -* Description : Compare un opérande avec un autre. * -* * -* Retour : Bilan de la comparaison. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_armv456_register_operand_compare(const GArmV456RegisterOperand *a, const GArmV456RegisterOperand *b) -{ - return (g_armv456_register_compare(a->reg, b->reg) == 0); - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande à traiter. * -* line = ligne tampon où imprimer l'opérande donné. * -* syntax = type de représentation demandée. * -* * -* Description : Traduit un opérande en version humainement lisible. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_register_operand_print(const GArmV456RegisterOperand *operand, GBufferLine *line, AsmSyntax syntax) -{ - g_armv456_register_print(operand->reg, line, syntax); - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande représentant un registre à mettre à jour. * -* * -* Description : Marque l'opérande comme étant écrit plutôt que consulté. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_armv456_register_operand_mark_as_written(GArmV456RegisterOperand *operand) -{ - operand->is_written = true; - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande représentant un registre à consulter. * -* * -* Description : Indique le type d'accès réalisé sur l'opérande. * -* * -* Retour : Type d'accès : true en cas d'écriture, false sinon. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_armv456_register_operand_is_written(const GArmV456RegisterOperand *operand) -{ - return operand->is_written; - -} diff --git a/src/arch/arm/v456/operands/register.h b/src/arch/arm/v456/operands/register.h deleted file mode 100644 index b680349..0000000 --- a/src/arch/arm/v456/operands/register.h +++ /dev/null @@ -1,69 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * register.h - prototypes pour les opérandes visant un registre ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_OPERANDS_REGISTER_H -#define _ARCH_ARM_V456_OPERANDS_REGISTER_H - - -#include - - -#include "../register.h" -#include "../../../operand.h" -#include "../../../../common/endianness.h" - - - -#define G_TYPE_ARMV456_REGISTER_OPERAND g_armv456_register_operand_get_type() -#define G_ARMV456_REGISTER_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv456_register_operand_get_type(), GArmV456RegisterOperand)) -#define G_IS_DALVIK_REGISTER_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv456_register_operand_get_type())) -#define G_ARMV456_REGISTER_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_REGISTER_OPERAND, GArmV456RegisterOperandClass)) -#define G_IS_DALVIK_REGISTER_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_REGISTER_OPERAND)) -#define G_ARMV456_REGISTER_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_REGISTER_OPERAND, GArmV456RegisterOperandClass)) - - -/* Définition d'un opérande visant un registre ARM v4/5/6 (instance) */ -typedef struct _GArmV456RegisterOperand GArmV456RegisterOperand; - -/* Définition d'un opérande visant un registre ARM v4/5/6 (classe) */ -typedef struct _GArmV456RegisterOperandClass GArmV456RegisterOperandClass; - - -/* Indique le type défini par la GLib pour un opérande de registre ARM v4/5/6. */ -GType g_armv456_register_operand_get_type(void); - -/* Crée un opérande visant un registre ARM v4/5/6. */ -GArchOperand *g_armv456_register_operand_new_from_existing(GArmV456Register *); - -/* Fournit le registre ARM v4/5/6 associé à l'opérande. */ -GArmV456Register *g_armv456_register_operand_get(const GArmV456RegisterOperand *); - -/* Marque l'opérande comme étant écrit plutôt que consulté. */ -void g_armv456_register_operand_mark_as_written(GArmV456RegisterOperand *); - -/* Indique le type d'accès réalisé sur l'opérande. */ -bool g_armv456_register_operand_is_written(const GArmV456RegisterOperand *); - - - -#endif /* _ARCH_ARM_V456_OPERANDS_REGISTER_H */ diff --git a/src/arch/arm/v456/register.c b/src/arch/arm/v456/register.c deleted file mode 100644 index 5e6d8bb..0000000 --- a/src/arch/arm/v456/register.c +++ /dev/null @@ -1,251 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * registers.c - aides auxiliaires relatives aux registres ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#include "register.h" - - -#include - - -#include "../../register-int.h" - - - -/* Représentation d'un registre ARM v4/5/6 (instance) */ -struct _GArmV456Register -{ - GArchRegister parent; /* Instance parente */ - - uint8_t index; /* Indice du registre */ - -}; - - -/* Représentation d'un registre ARM v4/5/6 (classe) */ -struct _GArmV456RegisterClass -{ - GArchRegisterClass parent; /* Classe parente */ - -}; - - -#define MAX_REGNAME_LEN 8 - - -/* Initialise la classe des registres ARM v4/5/6. */ -static void g_armv456_register_class_init(GArmV456RegisterClass *); - -/* Initialise une instance de registre ARM v4/5/6. */ -static void g_armv456_register_init(GArmV456Register *); - -/* Produit une empreinte à partir d'un registre. */ -static guint g_armv456_register_hash(const GArmV456Register *); - - - -/* Indique le type défini pour une représentation d'un registre ARM v4/5/6. */ -G_DEFINE_TYPE(GArmV456Register, g_armv456_register, G_TYPE_ARCH_REGISTER); - - -/****************************************************************************** -* * -* Paramètres : klass = classe à initialiser. * -* * -* Description : Initialise la classe des registres ARM v4/5/6. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_register_class_init(GArmV456RegisterClass *klass) -{ - -} - - -/****************************************************************************** -* * -* Paramètres : reg = instance à initialiser. * -* * -* Description : Initialise une instance de registre ARM v4/5/6. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv456_register_init(GArmV456Register *reg) -{ - GArchRegister *base; /* Version basique */ - - base = G_ARCH_REGISTER(reg); - - base->hash = (reg_hash_fc)g_armv456_register_hash; - base->compare = (reg_compare_fc)g_armv456_register_compare; - base->print = (reg_print_fc)g_armv456_register_print; - -} - - -/****************************************************************************** -* * -* Paramètres : index = indice du registre correspondant. * -* * -* Description : Crée une réprésentation de registre ARM v4/5/6. * -* * -* Retour : Adresse de la structure mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArmV456Register *g_armv456_register_new(uint8_t index) -{ - GArmV456Register *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_ARMV456_REGISTER, NULL); - - result->index = index; - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : reg = registre à consulter. * -* * -* Description : Fournit l'indice d'un registre ARM v4/5/6. * -* * -* Retour : Inditifiant représentant le registre. * -* * -* Remarques : - * -* * -******************************************************************************/ - -uint16_t g_armv456_register_get_index(const GArmV456Register *reg) -{ - return reg->index; - -} - - -/****************************************************************************** -* * -* Paramètres : reg = opérande à consulter pour le calcul. * -* * -* Description : Produit une empreinte à partir d'un registre. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static guint g_armv456_register_hash(const GArmV456Register *reg) -{ - return reg->index; - -} - - -/****************************************************************************** -* * -* Paramètres : a = premier opérande à consulter. * -* b = second opérande à consulter. * -* * -* Description : Compare un registre avec un autre. * -* * -* Retour : Bilan de la comparaison. * -* * -* Remarques : - * -* * -******************************************************************************/ - -int g_armv456_register_compare(const GArmV456Register *a, const GArmV456Register *b) -{ - int result; /* Bilan à retourner */ - - if (a->index < b->index) - result = -1; - else if (a->index > b->index) - result = 1; - else - result = 0; - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : reg = registre à transcrire. * -* line = ligne tampon où imprimer l'opérande donné. * -* syntax = type de représentation demandée. * -* * -* Description : Traduit un registre en version humainement lisible. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_armv456_register_print(const GArmV456Register *reg, GBufferLine *line, AsmSyntax syntax) -{ - char key[MAX_REGNAME_LEN]; /* Mot clef principal */ - size_t klen; /* Taille de ce mot clef */ - - switch (reg->index) - { - case 0 ... 12: - klen = snprintf(key, MAX_REGNAME_LEN, "r%hhu", reg->index); - break; - case 13: - klen = snprintf(key, MAX_REGNAME_LEN, "sp"); - break; - case 14: - klen = snprintf(key, MAX_REGNAME_LEN, "lr"); - break; - case 15: - klen = snprintf(key, MAX_REGNAME_LEN, "pc"); - break; - case 16: - klen = snprintf(key, MAX_REGNAME_LEN, "cpsr"); - break; - case 17: - klen = snprintf(key, MAX_REGNAME_LEN, "spsr"); - break; - default: - klen = snprintf(key, MAX_REGNAME_LEN, "r??"); - break; - } - - g_buffer_line_insert_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER); - -} diff --git a/src/arch/arm/v456/register.h b/src/arch/arm/v456/register.h deleted file mode 100644 index 0db0e5b..0000000 --- a/src/arch/arm/v456/register.h +++ /dev/null @@ -1,69 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * registers.h - prototypes pour les aides auxiliaires relatives aux registres ARM v4/5/6 - * - * Copyright (C) 2013 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _ARCH_ARM_V456_REGISTERS_H -#define _ARCH_ARM_V456_REGISTERS_H - - -#include -#include - - -#include "../../archbase.h" -#include "../../../glibext/gbufferline.h" - - - -#define G_TYPE_ARMV456_REGISTER g_armv456_register_get_type() -#define G_ARMV456_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv456_register_get_type(), GArmV456Register)) -#define G_IS_DALVIK_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv456_register_get_type())) -#define G_ARMV456_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_REGISTER, GArmV456RegisterClass)) -#define G_IS_DALVIK_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_REGISTER)) -#define G_ARMV456_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_REGISTER, GArmV456RegisterClass)) - - -/* Représentation d'un registre ARM v4/5/6 (instance) */ -typedef struct _GArmV456Register GArmV456Register; - -/* Représentation d'un registre ARM v4/5/6 (classe) */ -typedef struct _GArmV456RegisterClass GArmV456RegisterClass; - - -/* Indique le type défini pour une représentation d'un registre ARM v4/5/6. */ -GType g_armv456_register_get_type(void); - -/* Crée une réprésentation de registre ARM v4/5/6. */ -GArmV456Register *g_armv456_register_new(uint8_t); - -/* Fournit l'indice d'un registre ARM v4/5/6. */ -uint16_t g_armv456_register_get_index(const GArmV456Register *); - -/* Compare un registre avec un autre. */ -int g_armv456_register_compare(const GArmV456Register *, const GArmV456Register *); - -/* Traduit un registre en version humainement lisible. */ -void g_armv456_register_print(const GArmV456Register *, GBufferLine *, AsmSyntax); - - - -#endif /* _ARCH_ARM_V456_REGISTERS_H */ -- cgit v0.11.2-87-g4458