mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 00:24:12 +08:00
caab277b1d
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not see http www gnu org licenses extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 503 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Enrico Weigelt <info@metux.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190602204653.811534538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2013 Huawei Ltd.
|
|
* Author: Jiang Liu <liuj97@gmail.com>
|
|
*
|
|
* Based on arch/arm/include/asm/jump_label.h
|
|
*/
|
|
#ifndef __ASM_JUMP_LABEL_H
|
|
#define __ASM_JUMP_LABEL_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/types.h>
|
|
#include <asm/insn.h>
|
|
|
|
#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
|
|
|
|
static __always_inline bool arch_static_branch(struct static_key *key,
|
|
bool branch)
|
|
{
|
|
asm_volatile_goto(
|
|
"1: nop \n\t"
|
|
" .pushsection __jump_table, \"aw\" \n\t"
|
|
" .align 3 \n\t"
|
|
" .long 1b - ., %l[l_yes] - . \n\t"
|
|
" .quad %c0 - . \n\t"
|
|
" .popsection \n\t"
|
|
: : "i"(&((char *)key)[branch]) : : l_yes);
|
|
|
|
return false;
|
|
l_yes:
|
|
return true;
|
|
}
|
|
|
|
static __always_inline bool arch_static_branch_jump(struct static_key *key,
|
|
bool branch)
|
|
{
|
|
asm_volatile_goto(
|
|
"1: b %l[l_yes] \n\t"
|
|
" .pushsection __jump_table, \"aw\" \n\t"
|
|
" .align 3 \n\t"
|
|
" .long 1b - ., %l[l_yes] - . \n\t"
|
|
" .quad %c0 - . \n\t"
|
|
" .popsection \n\t"
|
|
: : "i"(&((char *)key)[branch]) : : l_yes);
|
|
|
|
return false;
|
|
l_yes:
|
|
return true;
|
|
}
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* __ASM_JUMP_LABEL_H */
|