Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wang Nan and committed by
Jon Medhurst
fca08f32 b1940cd2

+69 -57
+1
arch/arm/Makefile
··· 266 266 267 267 # If we have a machine-specific directory, then include it in the build. 268 268 core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 269 + core-y += arch/arm/probes/ 269 270 core-y += arch/arm/net/ 270 271 core-y += arch/arm/crypto/ 271 272 core-y += arch/arm/firmware/
+2 -14
arch/arm/kernel/Makefile
··· 51 51 obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o 52 52 obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o 53 53 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 68 56 obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 69 57 obj-$(CONFIG_ARM_THUMBEE) += thumbee.o 70 58 obj-$(CONFIG_KGDB) += kgdb.o patch.o
+1 -1
arch/arm/kernel/jump_label.c
··· 1 1 #include <linux/kernel.h> 2 2 #include <linux/jump_label.h> 3 + #include <asm/patch.h> 3 4 4 5 #include "insn.h" 5 - #include "patch.h" 6 6 7 7 #ifdef HAVE_JUMP_LABEL 8 8
+1 -2
arch/arm/kernel/kgdb.c
··· 14 14 #include <linux/kgdb.h> 15 15 #include <linux/uaccess.h> 16 16 17 + #include <asm/patch.h> 17 18 #include <asm/traps.h> 18 - 19 - #include "patch.h" 20 19 21 20 struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = 22 21 {
+3 -3
arch/arm/kernel/kprobes-arm.c arch/arm/probes/kprobes/actions-arm.c
··· 1 1 /* 2 - * arch/arm/kernel/kprobes-decode.c 2 + * arch/arm/probes/kprobes/actions-arm.c 3 3 * 4 4 * Copyright (C) 2006, 2007 Motorola Inc. 5 5 * ··· 62 62 #include <linux/kprobes.h> 63 63 #include <linux/ptrace.h> 64 64 65 - #include "kprobes.h" 66 - #include "probes-arm.h" 65 + #include "../decode-arm.h" 66 + #include "core.h" 67 67 68 68 #if __LINUX_ARM_ARCH__ >= 6 69 69 #define BLX(reg) "blx "reg" \n\t"
+2 -2
arch/arm/kernel/kprobes-common.c arch/arm/probes/kprobes/actions-common.c
··· 1 1 /* 2 - * arch/arm/kernel/kprobes-common.c 2 + * arch/arm/probes/kprobes/actions-common.c 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 * ··· 15 15 #include <linux/kprobes.h> 16 16 #include <asm/opcodes.h> 17 17 18 - #include "kprobes.h" 18 + #include "core.h" 19 19 20 20 21 21 static void __kprobes simulate_ldm1stm1(probes_opcode_t insn,
+1 -1
arch/arm/kernel/kprobes-test-arm.c arch/arm/probes/kprobes/test-arm.c
··· 13 13 #include <asm/system_info.h> 14 14 #include <asm/opcodes.h> 15 15 16 - #include "kprobes-test.h" 16 + #include "test-core.h" 17 17 18 18 19 19 #define TEST_ISA "32"
+2 -2
arch/arm/kernel/kprobes-test-thumb.c arch/arm/probes/kprobes/test-thumb.c
··· 1 1 /* 2 - * arch/arm/kernel/kprobes-test-thumb.c 2 + * arch/arm/probes/kprobes/test-thumb.c 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 * ··· 12 12 #include <linux/module.h> 13 13 #include <asm/opcodes.h> 14 14 15 - #include "kprobes-test.h" 15 + #include "test-core.h" 16 16 17 17 18 18 #define TEST_ISA "16"
+4 -4
arch/arm/kernel/kprobes-test.c arch/arm/probes/kprobes/test-core.c
··· 209 209 #include <linux/bug.h> 210 210 #include <asm/opcodes.h> 211 211 212 - #include "kprobes.h" 213 - #include "probes-arm.h" 214 - #include "probes-thumb.h" 215 - #include "kprobes-test.h" 212 + #include "core.h" 213 + #include "test-core.h" 214 + #include "../decode-arm.h" 215 + #include "../decode-thumb.h" 216 216 217 217 218 218 #define BENCHMARKING 1
+1 -1
arch/arm/kernel/kprobes-test.h arch/arm/probes/kprobes/test-core.h
··· 1 1 /* 2 - * arch/arm/kernel/kprobes-test.h 2 + * arch/arm/probes/kprobes/test-core.h 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 *
+3 -3
arch/arm/kernel/kprobes-thumb.c arch/arm/probes/kprobes/actions-thumb.c
··· 1 1 /* 2 - * arch/arm/kernel/kprobes-thumb.c 2 + * arch/arm/probes/kprobes/actions-thumb.c 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 * ··· 13 13 #include <linux/ptrace.h> 14 14 #include <linux/kprobes.h> 15 15 16 - #include "kprobes.h" 17 - #include "probes-thumb.h" 16 + #include "../decode-thumb.h" 17 + #include "core.h" 18 18 19 19 /* These emulation encodings are functionally equivalent... */ 20 20 #define t32_emulate_rd8rn16rm0ra12_noflags \
+4 -4
arch/arm/kernel/kprobes.c arch/arm/probes/kprobes/core.c
··· 30 30 #include <asm/cacheflush.h> 31 31 #include <linux/percpu.h> 32 32 #include <linux/bug.h> 33 + #include <asm/patch.h> 33 34 34 - #include "kprobes.h" 35 - #include "probes-arm.h" 36 - #include "probes-thumb.h" 37 - #include "patch.h" 35 + #include "../decode-arm.h" 36 + #include "../decode-thumb.h" 37 + #include "core.h" 38 38 39 39 #define MIN_STACK_SIZE(addr) \ 40 40 min((unsigned long)MAX_STACK_SIZE, \
+2 -1
arch/arm/kernel/kprobes.h arch/arm/probes/kprobes/core.h
··· 19 19 #ifndef _ARM_KERNEL_KPROBES_H 20 20 #define _ARM_KERNEL_KPROBES_H 21 21 22 - #include "probes.h" 22 + #include <asm/kprobes.h> 23 + #include "../decode.h" 23 24 24 25 /* 25 26 * These undefined instructions must be unique and
+1 -2
arch/arm/kernel/patch.c
··· 8 8 #include <asm/fixmap.h> 9 9 #include <asm/smp_plat.h> 10 10 #include <asm/opcodes.h> 11 - 12 - #include "patch.h" 11 + #include <asm/patch.h> 13 12 14 13 struct patch { 15 14 void *addr;
arch/arm/kernel/patch.h arch/arm/include/asm/patch.h
+4 -3
arch/arm/kernel/probes-arm.c arch/arm/probes/decode-arm.c
··· 1 1 /* 2 - * arch/arm/kernel/probes-arm.c 2 + * 3 + * arch/arm/probes/decode-arm.c 3 4 * 4 5 * Some code moved here from arch/arm/kernel/kprobes-arm.c 5 6 * ··· 21 20 #include <linux/stddef.h> 22 21 #include <linux/ptrace.h> 23 22 24 - #include "probes.h" 25 - #include "probes-arm.h" 23 + #include "decode.h" 24 + #include "decode-arm.h" 26 25 27 26 #define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit))))) 28 27
+3 -1
arch/arm/kernel/probes-arm.h arch/arm/probes/decode-arm.h
··· 1 1 /* 2 - * arch/arm/kernel/probes-arm.h 2 + * arch/arm/probes/decode-arm.h 3 3 * 4 4 * Copyright 2013 Linaro Ltd. 5 5 * Written by: David A. Long ··· 14 14 15 15 #ifndef _ARM_KERNEL_PROBES_ARM_H 16 16 #define _ARM_KERNEL_PROBES_ARM_H 17 + 18 + #include "decode.h" 17 19 18 20 enum probes_arm_action { 19 21 PROBES_EMULATE_NONE,
+3 -3
arch/arm/kernel/probes-thumb.c arch/arm/probes/decode-thumb.c
··· 1 1 /* 2 - * arch/arm/kernel/probes-thumb.c 2 + * arch/arm/probes/decode-thumb.c 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 * ··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 14 15 - #include "probes.h" 16 - #include "probes-thumb.h" 15 + #include "decode.h" 16 + #include "decode-thumb.h" 17 17 18 18 19 19 static const union decode_item t32_table_1110_100x_x0xx[] = {
+3 -1
arch/arm/kernel/probes-thumb.h arch/arm/probes/decode-thumb.h
··· 1 1 /* 2 - * arch/arm/kernel/probes-thumb.h 2 + * arch/arm/probes/decode-thumb.h 3 3 * 4 4 * Copyright 2013 Linaro Ltd. 5 5 * Written by: David A. Long ··· 14 14 15 15 #ifndef _ARM_KERNEL_PROBES_THUMB_H 16 16 #define _ARM_KERNEL_PROBES_THUMB_H 17 + 18 + #include "decode.h" 17 19 18 20 /* 19 21 * True if current instruction is in an IT block.
+2 -2
arch/arm/kernel/probes.c arch/arm/probes/decode.c
··· 1 1 /* 2 - * arch/arm/kernel/probes.c 2 + * arch/arm/probes/decode.c 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 * ··· 17 17 #include <asm/ptrace.h> 18 18 #include <linux/bug.h> 19 19 20 - #include "probes.h" 20 + #include "decode.h" 21 21 22 22 23 23 #ifndef find_str_pc_offset
+1 -1
arch/arm/kernel/probes.h arch/arm/probes/decode.h
··· 1 1 /* 2 - * arch/arm/kernel/probes.h 2 + * arch/arm/probes/decode.h 3 3 * 4 4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 5 5 *
+3 -3
arch/arm/kernel/uprobes-arm.c arch/arm/probes/uprobes/actions-arm.c
··· 13 13 #include <linux/uprobes.h> 14 14 #include <linux/module.h> 15 15 16 - #include "probes.h" 17 - #include "probes-arm.h" 18 - #include "uprobes.h" 16 + #include "../decode.h" 17 + #include "../decode-arm.h" 18 + #include "core.h" 19 19 20 20 static int uprobes_substitute_pc(unsigned long *pinsn, u32 oregs) 21 21 {
+3 -3
arch/arm/kernel/uprobes.c arch/arm/probes/uprobes/core.c
··· 17 17 #include <asm/opcodes.h> 18 18 #include <asm/traps.h> 19 19 20 - #include "probes.h" 21 - #include "probes-arm.h" 22 - #include "uprobes.h" 20 + #include "../decode.h" 21 + #include "../decode-arm.h" 22 + #include "core.h" 23 23 24 24 #define UPROBE_TRAP_NR UINT_MAX 25 25
arch/arm/kernel/uprobes.h arch/arm/probes/uprobes/core.h
+7
arch/arm/probes/Makefile
··· 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
+11
arch/arm/probes/kprobes/Makefile
··· 1 + obj-$(CONFIG_KPROBES) += core.o actions-common.o 2 + obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o 3 + test-kprobes-objs := test-core.o 4 + 5 + ifdef CONFIG_THUMB2_KERNEL 6 + obj-$(CONFIG_KPROBES) += actions-thumb.o 7 + test-kprobes-objs += test-thumb.o 8 + else 9 + obj-$(CONFIG_KPROBES) += actions-arm.o 10 + test-kprobes-objs += test-arm.o 11 + endif
+1
arch/arm/probes/uprobes/Makefile
··· 1 + obj-$(CONFIG_UPROBES) += core.o actions-arm.o