jump_label.h 679 B

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