/* Chrysalide - Outil d'analyse de fichiers binaires
* helper_arm.c - prise en compte des spécifités ARM pour la recherche de gadgets
*
* Copyright (C) 2015 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 "helper_arm.h"
#include
#include
/******************************************************************************
* *
* Paramètres : proc = processeur lié à l'architecture visée. *
* names = noms attribués aux différents contextes. *
* count = nombre de gadgets trouvés. [OUT] *
* *
* Description : Etablit une liste des contextes utiles à la recherche. *
* *
* Retour : Liste de contextes mis en place. *
* *
* Remarques : Toues les tableaux créés sont à libérer après usage. *
* *
******************************************************************************/
GProcContext **get_rop_contexts_for_arm(const GArchProcessor *proc, char ***names, size_t *count)
{
GProcContext **result; /* Contextes à retourner */
result = (GProcContext **)calloc(2, sizeof(GProcContext *));
(*names) = (char **)calloc(2, sizeof(char *));
*count = 2;
/* Thumb */
result[0] = g_arch_processor_get_context(proc);
g_armv7_context_define_encoding(G_ARMV7_CONTEXT(result[0]), 0, AV7IS_THUMB);
(*names)[0] = "Thumb";
/* ARMM */
result[1] = g_arch_processor_get_context(proc);
g_armv7_context_define_encoding(G_ARMV7_CONTEXT(result[1]), 0, AV7IS_ARM);
(*names)[1] = "ARM";
return result;
}