mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
f02644e32c
Add support for jump labels based on the ARM64 version. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
23 lines
561 B
C
23 lines
561 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2023 Loongson Technology Corporation Limited
|
|
*
|
|
* Based on arch/arm64/kernel/jump_label.c
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/jump_label.h>
|
|
#include <asm/inst.h>
|
|
|
|
void arch_jump_label_transform(struct jump_entry *entry, enum jump_label_type type)
|
|
{
|
|
u32 insn;
|
|
void *addr = (void *)jump_entry_code(entry);
|
|
|
|
if (type == JUMP_LABEL_JMP)
|
|
insn = larch_insn_gen_b(jump_entry_code(entry), jump_entry_target(entry));
|
|
else
|
|
insn = larch_insn_gen_nop();
|
|
|
|
larch_insn_patch_text(addr, insn);
|
|
}
|