mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
7e6b9db27d
Instead of defaulting to patching NOP opcodes at init time, and leaving it to the architectures to override this if this is not needed, switch to a model where doing nothing is the default. This is the common case by far, as only MIPS requires NOP patching at init time. On all other architectures, the correct encodings are emitted by the compiler and so no initial patching is needed. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20220615154142.1574619-4-ardb@kernel.org
30 lines
661 B
C
30 lines
661 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/kernel.h>
|
|
#include <linux/jump_label.h>
|
|
#include <asm/patch.h>
|
|
#include <asm/insn.h>
|
|
|
|
static void __arch_jump_label_transform(struct jump_entry *entry,
|
|
enum jump_label_type type,
|
|
bool is_static)
|
|
{
|
|
void *addr = (void *)entry->code;
|
|
unsigned int insn;
|
|
|
|
if (type == JUMP_LABEL_JMP)
|
|
insn = arm_gen_branch(entry->code, entry->target);
|
|
else
|
|
insn = arm_gen_nop();
|
|
|
|
if (is_static)
|
|
__patch_text_early(addr, insn);
|
|
else
|
|
patch_text(addr, insn);
|
|
}
|
|
|
|
void arch_jump_label_transform(struct jump_entry *entry,
|
|
enum jump_label_type type)
|
|
{
|
|
__arch_jump_label_transform(entry, type, false);
|
|
}
|