jump_label.c 812 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <linux/kernel.h>
  2. #include <linux/jump_label.h>
  3. #include <asm/patch.h>
  4. #include <asm/insn.h>
  5. #ifdef HAVE_JUMP_LABEL
  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. }
  26. void arch_jump_label_transform_static(struct jump_entry *entry,
  27. enum jump_label_type type)
  28. {
  29. __arch_jump_label_transform(entry, type, true);
  30. }
  31. #endif