jump_label.c 802 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <linux/kernel.h>
  2. #include <linux/jump_label.h>
  3. #include "insn.h"
  4. #include "patch.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_ENABLE)
  13. insn = arm_gen_branch(entry->code, entry->target);
  14. else
  15. insn = arm_gen_nop();
  16. if (is_static)
  17. __patch_text(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