diff options
| author | Galen Williamson <galen@vector35.com> | 2024-03-12 13:26:16 -0400 |
|---|---|---|
| committer | galenbwill <galenbwill@users.noreply.github.com> | 2024-03-12 13:49:08 -0400 |
| commit | 45a674447579e350cf380dbacba5c5f6360c5ac1 (patch) | |
| tree | bc6daa4644a5c78caa7d834740b70f3bf3550230 /arch/armv7/il.cpp | |
| parent | c924e7f746f7f81fab1f35d8adc936dfba706b58 (diff) | |
moved over from https://github.com/Vector35/arch-armv7/pull/81
Diffstat (limited to 'arch/armv7/il.cpp')
| -rw-r--r-- | arch/armv7/il.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/armv7/il.cpp b/arch/armv7/il.cpp index d946e77c..5fbbb729 100644 --- a/arch/armv7/il.cpp +++ b/arch/armv7/il.cpp @@ -312,8 +312,20 @@ static void Load( memValue = il.ZeroExtend(dstSize, memValue); } - il.AddInstruction(SetRegisterOrBranch(il, dst.reg, memValue)); - il.AddInstruction(SetRegisterOrBranch(il, src.reg, value)); + if (dst.reg == REG_PC) + { + // don't update Rd, update Rs, jump to pre-updated Rs + il.AddInstruction(il.SetRegister(4, LLIL_TEMP(0), memValue)); + il.AddInstruction(SetRegisterOrBranch(il, src.reg, value)); + il.AddInstruction(il.Jump(il.Register(4, LLIL_TEMP(0)))); + } + else + { + // set Rd, update Rs, don't jump + il.AddInstruction(il.SetRegister(get_register_size(dst.reg), dst.reg, memValue)); + il.AddInstruction(SetRegisterOrBranch(il, src.reg, value)); + } + break; case MEM_IMM: case LABEL: |
