jump_label.h 792 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef _ASM_S390_JUMP_LABEL_H
  2. #define _ASM_S390_JUMP_LABEL_H
  3. #ifndef __ASSEMBLY__
  4. #include <linux/types.h>
  5. #define JUMP_LABEL_NOP_SIZE 6
  6. #define JUMP_LABEL_NOP_OFFSET 2
  7. /*
  8. * We use a brcl 0,2 instruction for jump labels at compile time so it
  9. * can be easily distinguished from a hotpatch generated instruction.
  10. */
  11. static __always_inline bool arch_static_branch(struct static_key *key)
  12. {
  13. asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
  14. ".pushsection __jump_table, \"aw\"\n"
  15. ".balign 8\n"
  16. ".quad 0b, %l[label], %0\n"
  17. ".popsection\n"
  18. : : "X" (key) : : label);
  19. return false;
  20. label:
  21. return true;
  22. }
  23. typedef unsigned long jump_label_t;
  24. struct jump_entry {
  25. jump_label_t code;
  26. jump_label_t target;
  27. jump_label_t key;
  28. };
  29. #endif /* __ASSEMBLY__ */
  30. #endif