In discussion on LKML (https://lkml.org/lkml/2014/11/28/158), Russell King suggests to move all probe related code to arch/arm/probes. This patch does the work. Due to dependency on 'arch/arm/kernel/patch.h', this patch also moves patch.h to 'arch/arm/include/asm/patch.h', and related '#include' directives are also midified to '#include <asm/patch.h>'. Following is an overview of this patch: ./arch/arm/kernel/ ./arch/arm/probes/ |-- Makefile |-- Makefile |-- probes-arm.c ==> |-- decode-arm.c |-- probes-arm.h ==> |-- decode-arm.h |-- probes-thumb.c ==> |-- decode-thumb.c |-- probes-thumb.h ==> |-- decode-thumb.h |-- probes.c ==> |-- decode.c |-- probes.h ==> |-- decode.h | |-- kprobes | | |-- Makefile |-- kprobes-arm.c ==> | |-- actions-arm.c |-- kprobes-common.c ==> | |-- actions-common.c |-- kprobes-thumb.c ==> | |-- actions-thumb.c |-- kprobes.c ==> | |-- core.c |-- kprobes.h ==> | |-- core.h |-- kprobes-test-arm.c ==> | |-- test-arm.c |-- kprobes-test.c ==> | |-- test-core.c |-- kprobes-test.h ==> | |-- test-core.h |-- kprobes-test-thumb.c ==> | `-- test-thumb.c | `-- uprobes | |-- Makefile |-- uprobes-arm.c ==> |-- actions-arm.c |-- uprobes.c ==> |-- core.c |-- uprobes.h ==> `-- core.h | `-- patch.h ==> arch/arm/include/asm/patch.h Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
40 lines
812 B
C
40 lines
812 B
C
#include <linux/kernel.h>
|
|
#include <linux/jump_label.h>
|
|
#include <asm/patch.h>
|
|
|
|
#include "insn.h"
|
|
|
|
#ifdef HAVE_JUMP_LABEL
|
|
|
|
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_ENABLE)
|
|
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);
|
|
}
|
|
|
|
void arch_jump_label_transform_static(struct jump_entry *entry,
|
|
enum jump_label_type type)
|
|
{
|
|
__arch_jump_label_transform(entry, type, true);
|
|
}
|
|
|
|
#endif
|