jump_label.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_PARISC_JUMP_LABEL_H
  3. #define _ASM_PARISC_JUMP_LABEL_H
  4. #ifndef __ASSEMBLY__
  5. #include <linux/types.h>
  6. #include <linux/stringify.h>
  7. #include <asm/assembly.h>
  8. #define JUMP_LABEL_NOP_SIZE 4
  9. static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
  10. {
  11. asm_volatile_goto("1:\n\t"
  12. "nop\n\t"
  13. ".pushsection __jump_table, \"aw\"\n\t"
  14. ".align %1\n\t"
  15. ".word 1b - ., %l[l_yes] - .\n\t"
  16. __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
  17. ".popsection\n\t"
  18. : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
  19. : : l_yes);
  20. return false;
  21. l_yes:
  22. return true;
  23. }
  24. static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
  25. {
  26. asm_volatile_goto("1:\n\t"
  27. "b,n %l[l_yes]\n\t"
  28. ".pushsection __jump_table, \"aw\"\n\t"
  29. ".align %1\n\t"
  30. ".word 1b - ., %l[l_yes] - .\n\t"
  31. __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
  32. ".popsection\n\t"
  33. : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
  34. : : l_yes);
  35. return false;
  36. l_yes:
  37. return true;
  38. }
  39. #endif /* __ASSEMBLY__ */
  40. #endif