diff options
| author | Galen Williamson <galen@vector35.com> | 2025-04-09 20:40:21 -0400 |
|---|---|---|
| committer | Galen Williamson <galen@vector35.com> | 2025-04-09 20:40:21 -0400 |
| commit | 7168283c96afcce608fd1ee3241cd63dbe5dd09e (patch) | |
| tree | f1ebb423b4bc7fd4e4708ba6e7142c090203cf43 /arch/arm64 | |
| parent | eeb7cf79184094cd78847a7ed568daf263e63c97 (diff) | |
[aarch64] add lifting for B.NV instruction, fix branch generation for B.AL and B.NV, fix AlwaysBranch patching to generate a valid B instruction
Diffstat (limited to 'arch/arm64')
| -rw-r--r-- | arch/arm64/arch_arm64.cpp | 6 | ||||
| -rw-r--r-- | arch/arm64/il.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm64/arch_arm64.cpp b/arch/arm64/arch_arm64.cpp index b0dee144..1032c15c 100644 --- a/arch/arm64/arch_arm64.cpp +++ b/arch/arm64/arch_arm64.cpp @@ -348,6 +348,7 @@ class Arm64Architecture : public Architecture result.AddBranch(CallDestination, instr.operands[0].immediate); break; + case ARM64_B_AL: case ARM64_B: if (instr.operands[0].operandClass == LABEL) result.AddBranch(UnconditionalBranch, instr.operands[0].immediate); @@ -369,9 +370,8 @@ class Arm64Architecture : public Architecture case ARM64_B_LT: case ARM64_B_GT: case ARM64_B_LE: - case ARM64_B_AL: - case ARM64_B_NV: result.AddBranch(TrueBranch, instr.operands[0].immediate); + case ARM64_B_NV: result.AddBranch(FalseBranch, addr + 4); break; case ARM64_TBZ: @@ -1232,7 +1232,7 @@ class Arm64Architecture : public Architecture uint32_t* value = (uint32_t*)data; // Combine the immediate in the first operand with the unconditional branch opcode to form // an unconditional branch instruction - *value = (5 << 26) | (uint32_t)((instr.operands[0].immediate - addr) >> 2); + *value = (5 << 26) | (((uint32_t)((instr.operands[0].immediate - addr) >> 2)) & 0x03ffffff); return true; } diff --git a/arch/arm64/il.cpp b/arch/arm64/il.cpp index 31c7f094..6dd1afe1 100644 --- a/arch/arm64/il.cpp +++ b/arch/arm64/il.cpp @@ -1422,6 +1422,10 @@ bool GetLowLevelILForInstruction( case ARM64_BTI: il.AddInstruction(il.Intrinsic({}, ARM64_INTRIN_HINT_BTI, {})); break; + + case ARM64_B_NV: + il.AddInstruction(DirectJump(arch, il, addr + 4, addrSize)); + break; case ARM64_B: case ARM64_B_AL: il.AddInstruction(DirectJump(arch, il, IMM_O(operand1), addrSize)); |
