jump_label.c 661 B

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/kernel.h>
  3. #include <linux/jump_label.h>
  4. #include <asm/patch.h>
  5. #include <asm/insn.h>
  6. static void __arch_jump_label_transform(struct jump_entry *entry,
  7. enum jump_label_type type,
  8. bool is_static)
  9. {
  10. void *addr = (void *)entry->code;
  11. unsigned int insn;
  12. if (type == JUMP_LABEL_JMP)
  13. insn = arm_gen_branch(entry->code, entry->target);
  14. else
  15. insn = arm_gen_nop();
  16. if (is_static)
  17. __patch_text_early(addr, insn);
  18. else
  19. patch_text(addr, insn);
  20. }
  21. void arch_jump_label_transform(struct jump_entry *entry,
  22. enum jump_label_type type)
  23. {
  24. __arch_jump_label_transform(entry, type, false);
  25. }