Skip to content

Commit fca08f3

Browse files
WangNan0tixy
authored andcommitted
ARM: probes: move all probe code to dedicate directory
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>
1 parent b1940cd commit fca08f3

27 files changed

Lines changed: 69 additions & 57 deletions

‎arch/arm/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ core-$(CONFIG_KVM_ARM_HOST) += arch/arm/kvm/
266266

267267
# If we have a machine-specific directory, then include it in the build.
268268
core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
269+
core-y += arch/arm/probes/
269270
core-y += arch/arm/net/
270271
core-y += arch/arm/crypto/
271272
core-y += arch/arm/firmware/

‎arch/arm/kernel/Makefile‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,8 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o
5151
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o
5252
obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o
5353
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
54-
obj-$(CONFIG_UPROBES) += probes.o probes-arm.o uprobes.o uprobes-arm.o
55-
obj-$(CONFIG_KPROBES) += probes.o kprobes.o kprobes-common.o patch.o
56-
ifdef CONFIG_THUMB2_KERNEL
57-
obj-$(CONFIG_KPROBES) += kprobes-thumb.o probes-thumb.o
58-
else
59-
obj-$(CONFIG_KPROBES) += kprobes-arm.o probes-arm.o
60-
endif
61-
obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o
62-
test-kprobes-objs := kprobes-test.o
63-
ifdef CONFIG_THUMB2_KERNEL
64-
test-kprobes-objs += kprobes-test-thumb.o
65-
else
66-
test-kprobes-objs += kprobes-test-arm.o
67-
endif
54+
# Main staffs in KPROBES are in arch/arm/probes/ .
55+
obj-$(CONFIG_KPROBES) += patch.o
6856
obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
6957
obj-$(CONFIG_ARM_THUMBEE) += thumbee.o
7058
obj-$(CONFIG_KGDB) += kgdb.o patch.o

‎arch/arm/kernel/jump_label.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <linux/kernel.h>
22
#include <linux/jump_label.h>
3+
#include <asm/patch.h>
34

45
#include "insn.h"
5-
#include "patch.h"
66

77
#ifdef HAVE_JUMP_LABEL
88

‎arch/arm/kernel/kgdb.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
#include <linux/kgdb.h>
1515
#include <linux/uaccess.h>
1616

17+
#include <asm/patch.h>
1718
#include <asm/traps.h>
1819

19-
#include "patch.h"
20-
2120
struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
2221
{
2322
{ "r0", 4, offsetof(struct pt_regs, ARM_r0)},

‎arch/arm/kernel/patch.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include <asm/fixmap.h>
99
#include <asm/smp_plat.h>
1010
#include <asm/opcodes.h>
11-
12-
#include "patch.h"
11+
#include <asm/patch.h>
1312

1413
struct patch {
1514
void *addr;

‎arch/arm/probes/Makefile‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
obj-$(CONFIG_UPROBES) += decode.o decode-arm.o uprobes/
2+
obj-$(CONFIG_KPROBES) += decode.o kprobes/
3+
ifdef CONFIG_THUMB2_KERNEL
4+
obj-$(CONFIG_KPROBES) += decode-thumb.o
5+
else
6+
obj-$(CONFIG_KPROBES) += decode-arm.o
7+
endif
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
2-
* arch/arm/kernel/probes-arm.c
2+
*
3+
* arch/arm/probes/decode-arm.c
34
*
45
* Some code moved here from arch/arm/kernel/kprobes-arm.c
56
*
@@ -20,8 +21,8 @@
2021
#include <linux/stddef.h>
2122
#include <linux/ptrace.h>
2223

23-
#include "probes.h"
24-
#include "probes-arm.h"
24+
#include "decode.h"
25+
#include "decode-arm.h"
2526

2627
#define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit)))))
2728

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* arch/arm/kernel/probes-arm.h
2+
* arch/arm/probes/decode-arm.h
33
*
44
* Copyright 2013 Linaro Ltd.
55
* Written by: David A. Long
@@ -15,6 +15,8 @@
1515
#ifndef _ARM_KERNEL_PROBES_ARM_H
1616
#define _ARM_KERNEL_PROBES_ARM_H
1717

18+
#include "decode.h"
19+
1820
enum probes_arm_action {
1921
PROBES_EMULATE_NONE,
2022
PROBES_SIMULATE_NOP,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* arch/arm/kernel/probes-thumb.c
2+
* arch/arm/probes/decode-thumb.c
33
*
44
* Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
55
*
@@ -12,8 +12,8 @@
1212
#include <linux/kernel.h>
1313
#include <linux/module.h>
1414

15-
#include "probes.h"
16-
#include "probes-thumb.h"
15+
#include "decode.h"
16+
#include "decode-thumb.h"
1717

1818

1919
static const union decode_item t32_table_1110_100x_x0xx[] = {

0 commit comments

Comments
 (0)