jump_label.h 694 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _ASM_ARM_JUMP_LABEL_H
  2. #define _ASM_ARM_JUMP_LABEL_H
  3. #ifdef __KERNEL__
  4. #include <linux/types.h>
  5. #include <asm/system.h>
  6. #define JUMP_LABEL_NOP_SIZE 4
  7. #ifdef CONFIG_THUMB2_KERNEL
  8. #define JUMP_LABEL_NOP "nop.w"
  9. #else
  10. #define JUMP_LABEL_NOP "nop"
  11. #endif
  12. static __always_inline bool arch_static_branch(struct static_key *key)
  13. {
  14. asm goto("1:\n\t"
  15. JUMP_LABEL_NOP "\n\t"
  16. ".pushsection __jump_table, \"aw\"\n\t"
  17. ".word 1b, %l[l_yes], %c0\n\t"
  18. ".popsection\n\t"
  19. : : "i" (key) : : l_yes);
  20. return false;
  21. l_yes:
  22. return true;
  23. }
  24. #endif /* __KERNEL__ */
  25. typedef u32 jump_label_t;
  26. struct jump_entry {
  27. jump_label_t code;
  28. jump_label_t target;
  29. jump_label_t key;
  30. };
  31. #endif