Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright (C) 2013 Huawei Ltd.
0004  * Author: Jiang Liu <liuj97@gmail.com>
0005  *
0006  * Based on arch/arm/kernel/jump_label.c
0007  */
0008 #include <linux/kernel.h>
0009 #include <linux/jump_label.h>
0010 #include <asm/insn.h>
0011 #include <asm/patching.h>
0012 
0013 void arch_jump_label_transform(struct jump_entry *entry,
0014                    enum jump_label_type type)
0015 {
0016     void *addr = (void *)jump_entry_code(entry);
0017     u32 insn;
0018 
0019     if (type == JUMP_LABEL_JMP) {
0020         insn = aarch64_insn_gen_branch_imm(jump_entry_code(entry),
0021                            jump_entry_target(entry),
0022                            AARCH64_INSN_BRANCH_NOLINK);
0023     } else {
0024         insn = aarch64_insn_gen_nop();
0025     }
0026 
0027     aarch64_insn_patch_text_nosync(addr, insn);
0028 }