arm64: insn: Add helpers for adrp offsets
Adds helpers for decoding/encoding the PC relative addresses for adrp. This will be used for handling dynamic patching of 'adrp' instructions in alternative code patching. Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:

committed by
Will Deacon

parent
baa763b565
commit
46084bc253
@@ -1202,6 +1202,19 @@ u32 aarch64_set_branch_offset(u32 insn, s32 offset)
|
||||
BUG();
|
||||
}
|
||||
|
||||
s32 aarch64_insn_adrp_get_offset(u32 insn)
|
||||
{
|
||||
BUG_ON(!aarch64_insn_is_adrp(insn));
|
||||
return aarch64_insn_decode_immediate(AARCH64_INSN_IMM_ADR, insn) << 12;
|
||||
}
|
||||
|
||||
u32 aarch64_insn_adrp_set_offset(u32 insn, s32 offset)
|
||||
{
|
||||
BUG_ON(!aarch64_insn_is_adrp(insn));
|
||||
return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_ADR, insn,
|
||||
offset >> 12);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the Op/CR data from a msr/mrs instruction.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user