From c3c4660ca77e771d3a34a7e9029d02588e1ecd92 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 18 Jun 2018 20:44:55 +0200 Subject: Fixed various bugs in ARMv7 operand decoding helpers. --- plugins/arm/v7/helpers.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/arm/v7/helpers.h b/plugins/arm/v7/helpers.h index 29ba021..4f9a8f9 100644 --- a/plugins/arm/v7/helpers.h +++ b/plugins/arm/v7/helpers.h @@ -330,9 +330,11 @@ #define NextDoubleWordVector(ref, n) \ ({ \ GArchOperand *__result; \ - uint8_t __idx; \ GArchRegister *__reg; \ - __idx = g_arm_register_get_index(G_ARM_REGISTER(ref)); \ + uint8_t __idx; \ + __reg = g_register_operand_get_register(G_REGISTER_OPERAND(ref)); \ + __idx = g_arm_register_get_index(G_ARM_REGISTER(__reg)); \ + g_object_unref(G_OBJECT(__reg)); \ __reg = g_armv7_simd_register_new(SRM_DOUBLE_WORD, __idx + n); \ if (__reg == NULL) \ __result = NULL; \ @@ -358,9 +360,11 @@ #define NextSingleWordVector(prev) \ ({ \ GArchOperand *__result; \ - uint8_t __idx; \ GArchRegister *__reg; \ - __idx = g_arm_register_get_index(G_ARM_REGISTER(prev)); \ + uint8_t __idx; \ + __reg = g_register_operand_get_register(G_REGISTER_OPERAND(prev)); \ + __idx = g_arm_register_get_index(G_ARM_REGISTER(__reg)); \ + g_object_unref(G_OBJECT(__reg)); \ __reg = g_armv7_simd_register_new(SRM_SINGLE_WORD, __idx + 1); \ if (__reg == NULL) \ __result = NULL; \ @@ -413,7 +417,7 @@ if (__result != NULL) \ { \ __pc = G_ARMV7_REGISTER(g_armv7_basic_register_new(15)); \ - __list = G_ARMV7_REGLIST_OPERAND(result); \ + __list = G_ARMV7_REGLIST_OPERAND(__result); \ if (g_armv7_reglist_operand_has_register(__list, __pc)) \ { \ g_object_unref(G_OBJECT(__result)); \ @@ -434,7 +438,7 @@ if (__result != NULL) \ { \ __pc = G_ARMV7_REGISTER(g_armv7_basic_register_new(15)); \ - __list = G_ARMV7_REGLIST_OPERAND(result); \ + __list = G_ARMV7_REGLIST_OPERAND(__result); \ if (!g_armv7_reglist_operand_has_register(__list, __pc)) \ { \ g_object_unref(G_OBJECT(__result)); \ -- cgit v0.11.2-87-g4458