diff options
Diffstat (limited to 'plugins/dalvik/operands')
-rw-r--r-- | plugins/dalvik/operands/register.c | 112 | ||||
-rw-r--r-- | plugins/dalvik/operands/register.h | 2 |
2 files changed, 5 insertions, 109 deletions
diff --git a/plugins/dalvik/operands/register.c b/plugins/dalvik/operands/register.c index 7d011a0..ede3eb6 100644 --- a/plugins/dalvik/operands/register.c +++ b/plugins/dalvik/operands/register.c @@ -24,7 +24,7 @@ #include "register.h" -#include <arch/register-int.h> +#include <arch/operands/register-int.h> @@ -58,17 +58,6 @@ static void g_dalvik_register_operand_finalize(GDalvikRegisterOperand *); -/* --------------------- TRANSPOSITIONS VIA CACHE DES OPERANDES --------------------- */ - - -/* Charge un opérande depuis une mémoire tampon. */ -static bool g_dalvik_register_operand_unserialize(GDalvikRegisterOperand *, GAsmStorage *, GBinFormat *, packed_buffer *); - -/* Sauvegarde un opérande dans une mémoire tampon. */ -static bool g_dalvik_register_operand_serialize(const GDalvikRegisterOperand *, GAsmStorage *, packed_buffer *); - - - /* Indique le type défini par la GLib pour un opérande de registre Dalvik. */ G_DEFINE_TYPE(GDalvikRegisterOperand, g_dalvik_register_operand, G_TYPE_REGISTER_OPERAND); @@ -88,18 +77,12 @@ G_DEFINE_TYPE(GDalvikRegisterOperand, g_dalvik_register_operand, G_TYPE_REGISTER static void g_dalvik_register_operand_class_init(GDalvikRegisterOperandClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GArchOperandClass *operand; /* Version de classe parente */ object = G_OBJECT_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_register_operand_dispose; object->finalize = (GObjectFinalizeFunc)g_dalvik_register_operand_finalize; - operand = G_ARCH_OPERAND_CLASS(klass); - - operand->unserialize = (unserialize_operand_fc)g_dalvik_register_operand_unserialize; - operand->serialize = (serialize_operand_fc)g_dalvik_register_operand_serialize; - } @@ -181,7 +164,7 @@ GArchOperand *g_dalvik_register_operand_new(const GBinContent *content, vmpa2t * uint8_t index8; /* Indice sur 8 bits */ uint16_t index16; /* Indice sur 16 bits */ bool test; /* Bilan de lecture */ - GDalvikRegister *reg; /* Registre à représenter */ + GArchRegister *reg; /* Registre à représenter */ result = NULL; @@ -248,13 +231,13 @@ GArchOperand *g_dalvik_register_operand_new(const GBinContent *content, vmpa2t * * * ******************************************************************************/ -GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *reg) +GArchOperand *g_dalvik_register_operand_new_from_existing(GArchRegister *reg) { GDalvikRegisterOperand *result; /* Structure à retourner */ result = g_object_new(G_TYPE_DALVIK_REGISTER_OPERAND, NULL); - G_REGISTER_OPERAND(result)->reg = G_ARCH_REGISTER(reg); + G_REGISTER_OPERAND(result)->reg = reg; return G_ARCH_OPERAND(result); @@ -282,90 +265,3 @@ const GDalvikRegister *g_dalvik_register_operand_get(const GDalvikRegisterOperan return result; } - - - -/* ---------------------------------------------------------------------------------- */ -/* TRANSPOSITIONS VIA CACHE DES OPERANDES */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -* * -* Paramètres : operand = opérande d'assemblage à constituer. * -* storage = mécanisme de sauvegarde à manipuler. * -* format = format binaire chargé associé à l'architecture. * -* pbuf = zone tampon à remplir. * -* * -* Description : Charge un opérande depuis une mémoire tampon. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_dalvik_register_operand_unserialize(GDalvikRegisterOperand *operand, GAsmStorage *storage, GBinFormat *format, packed_buffer *pbuf) -{ - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - uint16_t index; /* Identifiant de registre */ - GDalvikRegister *reg; /* Registre à intégrer */ - - parent = G_ARCH_OPERAND_CLASS(g_dalvik_register_operand_parent_class); - - result = parent->unserialize(G_ARCH_OPERAND(operand), storage, format, pbuf); - - if (result) - { - result = extract_packed_buffer(pbuf, &index, sizeof(uint16_t), true); - - if (result) - { - reg = g_dalvik_register_new(index); - result = (reg != NULL); - } - - if (result) - G_REGISTER_OPERAND(operand)->reg = G_ARCH_REGISTER(reg); - - } - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande d'assemblage à consulter. * -* storage = mécanisme de sauvegarde à manipuler. * -* pbuf = zone tampon à remplir. * -* * -* Description : Sauvegarde un opérande dans une mémoire tampon. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_dalvik_register_operand_serialize(const GDalvikRegisterOperand *operand, GAsmStorage *storage, packed_buffer *pbuf) -{ - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - uint16_t index; /* Identifiant de registre */ - - parent = G_ARCH_OPERAND_CLASS(g_dalvik_register_operand_parent_class); - - result = parent->serialize(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - { - index = g_dalvik_register_get_index(G_DALVIK_REGISTER(G_REGISTER_OPERAND(operand)->reg)); - result = extend_packed_buffer(pbuf, &index, sizeof(uint16_t), true); - } - - return result; - -} diff --git a/plugins/dalvik/operands/register.h b/plugins/dalvik/operands/register.h index 29b14c8..cca1ff4 100644 --- a/plugins/dalvik/operands/register.h +++ b/plugins/dalvik/operands/register.h @@ -59,7 +59,7 @@ GType g_dalvik_register_operand_get_type(void); GArchOperand *g_dalvik_register_operand_new(const GBinContent *, vmpa2t *, bool *, MemoryDataSize, SourceEndian); /* Crée un opérande visant un registre Dalvik. */ -GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *); +GArchOperand *g_dalvik_register_operand_new_from_existing(GArchRegister *); /* Fournit le registre Dalvik associé à l'opérande. */ const GDalvikRegister *g_dalvik_register_operand_get(const GDalvikRegisterOperand *); |