mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 19:45:08 +07:00
13ddb52c16
Enable support for relative references in jump_label entries. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: Kees Cook <keescook@chromium.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Jessica Yu <jeyu@kernel.org> Link: https://lkml.kernel.org/r/20180919065144.25010-10-ard.biesheuvel@linaro.org
47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_S390_JUMP_LABEL_H
|
|
#define _ASM_S390_JUMP_LABEL_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/stringify.h>
|
|
|
|
#define JUMP_LABEL_NOP_SIZE 6
|
|
#define JUMP_LABEL_NOP_OFFSET 2
|
|
|
|
/*
|
|
* We use a brcl 0,2 instruction for jump labels at compile time so it
|
|
* can be easily distinguished from a hotpatch generated instruction.
|
|
*/
|
|
static inline bool arch_static_branch(struct static_key *key, bool branch)
|
|
{
|
|
asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
|
|
".pushsection __jump_table,\"aw\"\n"
|
|
".balign 8\n"
|
|
".long 0b-.,%l[label]-.\n"
|
|
".quad %0-.\n"
|
|
".popsection\n"
|
|
: : "X" (&((char *)key)[branch]) : : label);
|
|
return false;
|
|
label:
|
|
return true;
|
|
}
|
|
|
|
static inline bool arch_static_branch_jump(struct static_key *key, bool branch)
|
|
{
|
|
asm_volatile_goto("0: brcl 15,%l[label]\n"
|
|
".pushsection __jump_table,\"aw\"\n"
|
|
".balign 8\n"
|
|
".long 0b-.,%l[label]-.\n"
|
|
".quad %0-.\n"
|
|
".popsection\n"
|
|
: : "X" (&((char *)key)[branch]) : : label);
|
|
return false;
|
|
label:
|
|
return true;
|
|
}
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif
|