162217bebSHelge Deller /* SPDX-License-Identifier: GPL-2.0 */
262217bebSHelge Deller #ifndef _ASM_PARISC_JUMP_LABEL_H
362217bebSHelge Deller #define _ASM_PARISC_JUMP_LABEL_H
462217bebSHelge Deller
562217bebSHelge Deller #ifndef __ASSEMBLY__
662217bebSHelge Deller
762217bebSHelge Deller #include <linux/types.h>
84d7804d2SHelge Deller #include <linux/stringify.h>
962217bebSHelge Deller #include <asm/assembly.h>
1062217bebSHelge Deller
1162217bebSHelge Deller #define JUMP_LABEL_NOP_SIZE 4
1262217bebSHelge Deller
arch_static_branch(struct static_key * key,bool branch)1362217bebSHelge Deller static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
1462217bebSHelge Deller {
15*aaff74d8SLinus Torvalds asm goto("1:\n\t"
1662217bebSHelge Deller "nop\n\t"
1762217bebSHelge Deller ".pushsection __jump_table, \"aw\"\n\t"
18405870b8SHelge Deller ".align %1\n\t"
1962217bebSHelge Deller ".word 1b - ., %l[l_yes] - .\n\t"
2062217bebSHelge Deller __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
2162217bebSHelge Deller ".popsection\n\t"
22405870b8SHelge Deller : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
23405870b8SHelge Deller : : l_yes);
2462217bebSHelge Deller
2562217bebSHelge Deller return false;
2662217bebSHelge Deller l_yes:
2762217bebSHelge Deller return true;
2862217bebSHelge Deller }
2962217bebSHelge Deller
arch_static_branch_jump(struct static_key * key,bool branch)3062217bebSHelge Deller static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
3162217bebSHelge Deller {
32*aaff74d8SLinus Torvalds asm goto("1:\n\t"
3362217bebSHelge Deller "b,n %l[l_yes]\n\t"
3462217bebSHelge Deller ".pushsection __jump_table, \"aw\"\n\t"
35405870b8SHelge Deller ".align %1\n\t"
3662217bebSHelge Deller ".word 1b - ., %l[l_yes] - .\n\t"
3762217bebSHelge Deller __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
3862217bebSHelge Deller ".popsection\n\t"
39405870b8SHelge Deller : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
40405870b8SHelge Deller : : l_yes);
4162217bebSHelge Deller
4262217bebSHelge Deller return false;
4362217bebSHelge Deller l_yes:
4462217bebSHelge Deller return true;
4562217bebSHelge Deller }
4662217bebSHelge Deller
4762217bebSHelge Deller #endif /* __ASSEMBLY__ */
4862217bebSHelge Deller #endif
49