1*ac5f89c7SMichael Ellerman #ifndef _ASM_POWERPC_JUMP_LABEL_H 2*ac5f89c7SMichael Ellerman #define _ASM_POWERPC_JUMP_LABEL_H 3*ac5f89c7SMichael Ellerman 4*ac5f89c7SMichael Ellerman /* 5*ac5f89c7SMichael Ellerman * Copyright 2010 Michael Ellerman, IBM Corp. 6*ac5f89c7SMichael Ellerman * 7*ac5f89c7SMichael Ellerman * This program is free software; you can redistribute it and/or 8*ac5f89c7SMichael Ellerman * modify it under the terms of the GNU General Public License 9*ac5f89c7SMichael Ellerman * as published by the Free Software Foundation; either version 10*ac5f89c7SMichael Ellerman * 2 of the License, or (at your option) any later version. 11*ac5f89c7SMichael Ellerman */ 12*ac5f89c7SMichael Ellerman 13*ac5f89c7SMichael Ellerman #include <linux/types.h> 14*ac5f89c7SMichael Ellerman 15*ac5f89c7SMichael Ellerman #include <asm/feature-fixups.h> 16*ac5f89c7SMichael Ellerman 17*ac5f89c7SMichael Ellerman #define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG) 18*ac5f89c7SMichael Ellerman #define JUMP_LABEL_NOP_SIZE 4 19*ac5f89c7SMichael Ellerman 20*ac5f89c7SMichael Ellerman static __always_inline bool arch_static_branch(struct jump_label_key *key) 21*ac5f89c7SMichael Ellerman { 22*ac5f89c7SMichael Ellerman asm goto("1:\n\t" 23*ac5f89c7SMichael Ellerman "nop\n\t" 24*ac5f89c7SMichael Ellerman ".pushsection __jump_table, \"aw\"\n\t" 25*ac5f89c7SMichael Ellerman ".align 4\n\t" 26*ac5f89c7SMichael Ellerman JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" 27*ac5f89c7SMichael Ellerman ".popsection \n\t" 28*ac5f89c7SMichael Ellerman : : "i" (key) : : l_yes); 29*ac5f89c7SMichael Ellerman return false; 30*ac5f89c7SMichael Ellerman l_yes: 31*ac5f89c7SMichael Ellerman return true; 32*ac5f89c7SMichael Ellerman } 33*ac5f89c7SMichael Ellerman 34*ac5f89c7SMichael Ellerman #ifdef CONFIG_PPC64 35*ac5f89c7SMichael Ellerman typedef u64 jump_label_t; 36*ac5f89c7SMichael Ellerman #else 37*ac5f89c7SMichael Ellerman typedef u32 jump_label_t; 38*ac5f89c7SMichael Ellerman #endif 39*ac5f89c7SMichael Ellerman 40*ac5f89c7SMichael Ellerman struct jump_entry { 41*ac5f89c7SMichael Ellerman jump_label_t code; 42*ac5f89c7SMichael Ellerman jump_label_t target; 43*ac5f89c7SMichael Ellerman jump_label_t key; 44*ac5f89c7SMichael Ellerman jump_label_t pad; 45*ac5f89c7SMichael Ellerman }; 46*ac5f89c7SMichael Ellerman 47*ac5f89c7SMichael Ellerman #endif /* _ASM_POWERPC_JUMP_LABEL_H */ 48