From 1f443a15b4a06cb758bee67eef4ed16ee54bb093 Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Fri, 13 Nov 2020 17:15:11 -0500 Subject: [PATCH] Fix to ARM switch function fixups --- Ghidra/Processors/ARM/data/languages/ARM.cspec | 12 ++++-------- Ghidra/Processors/ARM/data/languages/ARM_v45.cspec | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Ghidra/Processors/ARM/data/languages/ARM.cspec b/Ghidra/Processors/ARM/data/languages/ARM.cspec index 19c8bb9b00..5e1a9e1181 100644 --- a/Ghidra/Processors/ARM/data/languages/ARM.cspec +++ b/Ghidra/Processors/ARM/data/languages/ARM.cspec @@ -158,8 +158,7 @@ tmpptr = lr & 0xfffffffe; offset = *:1 (tmpptr + r0); - offset = offset * 2; - lr = lr + zext(offset); + lr = lr + 2 * zext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; @@ -177,8 +176,7 @@ tmpptr = lr & 0xfffffffe; offset = *:1 (tmpptr + r0); - offset = offset * 2; - lr = lr + sext(offset); + lr = lr + 2 * sext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; @@ -197,8 +195,7 @@ index = r0 * 2; offset = *:2 (tmpptr + index); - offset = offset * 2; - lr = lr + sext(offset); + lr = lr + 2 * sext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; @@ -217,8 +214,7 @@ index = r0 * 2; offset = *:2 (tmpptr + index); - offset = offset * 2; - lr = lr + zext(offset); + lr = lr + 2 * zext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; diff --git a/Ghidra/Processors/ARM/data/languages/ARM_v45.cspec b/Ghidra/Processors/ARM/data/languages/ARM_v45.cspec index db5ca37aae..c444bda2e9 100644 --- a/Ghidra/Processors/ARM/data/languages/ARM_v45.cspec +++ b/Ghidra/Processors/ARM/data/languages/ARM_v45.cspec @@ -117,8 +117,7 @@ tmpptr = lr & 0xfffffffe; offset = *:1 (tmpptr + r0); - offset = offset * 2; - lr = lr + zext(offset); + lr = lr + 2 * zext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; @@ -136,8 +135,7 @@ tmpptr = lr & 0xfffffffe; offset = *:1 (tmpptr + r0); - offset = offset * 2; - lr = lr + sext(offset); + lr = lr + 2 * sext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; @@ -156,8 +154,7 @@ index = r0 * 2; offset = *:2 (tmpptr + index); - offset = offset * 2; - lr = lr + sext(offset); + lr = lr + 2 * sext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch; @@ -176,8 +173,7 @@ index = r0 * 2; offset = *:2 (tmpptr + index); - offset = offset * 2; - lr = lr + zext(offset); + lr = lr + 2 * zext(offset); ISAModeSwitch = (lr & 1) != 0; TB = ISAModeSwitch;