jump_label.h 674 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _ASM_S390_JUMP_LABEL_H
  2. #define _ASM_S390_JUMP_LABEL_H
  3. #include <linux/types.h>
  4. #define JUMP_LABEL_NOP_SIZE 6
  5. #ifdef CONFIG_64BIT
  6. #define ASM_PTR ".quad"
  7. #define ASM_ALIGN ".balign 8"
  8. #else
  9. #define ASM_PTR ".long"
  10. #define ASM_ALIGN ".balign 4"
  11. #endif
  12. static __always_inline bool arch_static_branch(struct static_key *key)
  13. {
  14. asm_volatile_goto("0: brcl 0,0\n"
  15. ".pushsection __jump_table, \"aw\"\n"
  16. ASM_ALIGN "\n"
  17. ASM_PTR " 0b, %l[label], %0\n"
  18. ".popsection\n"
  19. : : "X" (key) : : label);
  20. return false;
  21. label:
  22. return true;
  23. }
  24. typedef unsigned long 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