diff options
Diffstat (limited to 'src/arch/mips/op_jump.c')
-rw-r--r-- | src/arch/mips/op_jump.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/src/arch/mips/op_jump.c b/src/arch/mips/op_jump.c deleted file mode 100644 index c095098..0000000 --- a/src/arch/mips/op_jump.c +++ /dev/null @@ -1,114 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * op_jump.c - décodage des sauts inconditionnels - * - * Copyright (C) 2009-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 <http://www.gnu.org/licenses/>. - */ - - -#include "opcodes.h" - - -#include "../instruction-int.h" -#include "operand.h" - - - -/****************************************************************************** -* * -* Paramètres : data = flux de données à analyser. * -* pos = position courante dans ce flux. [OUT] * -* len = taille totale des données à analyser. * -* addr = adresse virtuelle de l'instruction. * -* proc = architecture ciblée par le désassemblage. * -* * -* Description : Décode une instruction de type 'jr rs'. * -* * -* Retour : Instruction mise en place ou NULL. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArchInstruction *mips_read_instr_jump_register(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GMipsProcessor *proc) -{ - GArchInstruction *result; /* Instruction à retourner */ - - result = g_mips_instruction_new(MOP_JR); - - if (!mips_read_n_operands(result, data, pos, len, 1, MIPS_OTP_RS)) - { - /* TODO free(result);*/ - return NULL; - } - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : data = flux de données à analyser. * -* pos = position courante dans ce flux. [OUT] * -* len = taille totale des données à analyser. * -* addr = adresse virtuelle de l'instruction. * -* proc = architecture ciblée par le désassemblage. * -* * -* Description : Décode une instruction de type 'jalr[.hb] [rd, ]rs'. * -* * -* Retour : Instruction mise en place ou NULL. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GArchInstruction *mips_read_instr_jump_and_link_register(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GMipsProcessor *proc) -{ - GArchInstruction *result; /* Instruction à retourner */ - off_t tmp; /* Pour ne pas toucher à 'pos' */ - uint32_t code; /* Code binaire à décoder */ - GArchOperand *operand; /* Opérande à analyser */ - const mips_register *reg; /* Registre implicite ? */ - - tmp = *pos; - - if (!read_u32(&code, data, &tmp, len, SRE_LITTLE/* FIXME */)) - return NULL; - - if (code & 0x400) result = g_mips_instruction_new(MOP_JALR_HB); - else result = g_mips_instruction_new(MOP_JALR); - - if (!mips_read_n_operands(result, data, pos, len, 2, MIPS_OTP_RD, MIPS_OTP_RS)) - { - /* TODO free(result);*/ - return NULL; - } - - operand = G_ARCH_INSTRUCTION(result)->operands[0]; - reg = g_mips_register_operand_get_register(G_MIPS_REGISTER_OPERAND(operand)); - - if (is_mips_register_return_address(reg)) - { - g_arch_instruction_detach_operand(G_ARCH_INSTRUCTION(result), operand); - /* TODO free(operand);*/ - } - - return result; - -} |