From 84f86b7860014dad1a80aabd4e0bf7504710bfe8 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Tue, 19 Jun 2018 19:23:48 +0200 Subject: Built ARMv7 dynamic vector tables with the right number of registers. --- plugins/arm/v7/helpers.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plugins/arm/v7/helpers.h b/plugins/arm/v7/helpers.h index 4f9a8f9..08b14e2 100644 --- a/plugins/arm/v7/helpers.h +++ b/plugins/arm/v7/helpers.h @@ -211,17 +211,28 @@ }) -#define DynamicVectorTable(target, count, first, inc) \ +#define DynamicVectorTable(target, count, first, rel) \ ({ \ GArchOperand *__result; \ size_t __i; \ GArchRegister *__reg; \ - __result = g_armv7_reglist_operand_new(0); \ - for (__i = 0; __i < count; __i += inc) \ + if (count % rel != 0) \ + __result = NULL; \ + else \ { \ - __reg = g_armv7_simd_register_new(target, first + __i); \ - g_armv7_reglist_add_register(G_ARMV7_REGLIST_OPERAND(__result), \ - G_ARMV7_REGISTER(__reg)); \ + __result = g_armv7_reglist_operand_new(0); \ + for (__i = 0; __i < (count / rel); __i++) \ + { \ + __reg = g_armv7_simd_register_new(target, first + __i); \ + if (__reg == NULL) \ + { \ + g_object_unref(G_OBJECT(__result)); \ + __result = NULL; \ + break; \ + } \ + g_armv7_reglist_add_register(G_ARMV7_REGLIST_OPERAND(__result), \ + G_ARMV7_REGISTER(__reg)); \ + } \ } \ __result; \ }) -- cgit v0.11.2-87-g4458