diff options
author | Abhishek Sagar <sagar.abhishek@gmail.com> | 2008-06-21 14:17:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-23 16:10:56 -0400 |
commit | 395a59d0f8e86bb39cd700c3d185d30c670bb958 (patch) | |
tree | 1558e635efcede901c5dbe9acd625d475db5b369 /arch/sparc64/kernel/ftrace.c | |
parent | f34bfb1beef8a17ba3d46b60f8fa19ffedc1ed8d (diff) |
ftrace: store mcount address in rec->ip
Record the address of the mcount call-site. Currently all archs except sparc64
record the address of the instruction following the mcount call-site. Some
general cleanups are entailed. Storing mcount addresses in rec->ip enables
looking them up in the kprobe hash table later on to check if they're kprobe'd.
Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: davem@davemloft.net
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sparc64/kernel/ftrace.c')
-rw-r--r-- | arch/sparc64/kernel/ftrace.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc64/kernel/ftrace.c index c17373195b1e..4298d0aee713 100644 --- a/arch/sparc64/kernel/ftrace.c +++ b/arch/sparc64/kernel/ftrace.c | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/list.h> | 6 | #include <linux/list.h> |
7 | 7 | ||
8 | #include <asm/ftrace.h> | ||
9 | |||
8 | static const u32 ftrace_nop = 0x01000000; | 10 | static const u32 ftrace_nop = 0x01000000; |
9 | 11 | ||
10 | notrace unsigned char *ftrace_nop_replace(void) | 12 | notrace unsigned char *ftrace_nop_replace(void) |
@@ -60,9 +62,9 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code, | |||
60 | notrace int ftrace_update_ftrace_func(ftrace_func_t func) | 62 | notrace int ftrace_update_ftrace_func(ftrace_func_t func) |
61 | { | 63 | { |
62 | unsigned long ip = (unsigned long)(&ftrace_call); | 64 | unsigned long ip = (unsigned long)(&ftrace_call); |
63 | unsigned char old[4], *new; | 65 | unsigned char old[MCOUNT_INSN_SIZE], *new; |
64 | 66 | ||
65 | memcpy(old, &ftrace_call, 4); | 67 | memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE); |
66 | new = ftrace_call_replace(ip, (unsigned long)func); | 68 | new = ftrace_call_replace(ip, (unsigned long)func); |
67 | return ftrace_modify_code(ip, old, new); | 69 | return ftrace_modify_code(ip, old, new); |
68 | } | 70 | } |
@@ -71,13 +73,13 @@ notrace int ftrace_mcount_set(unsigned long *data) | |||
71 | { | 73 | { |
72 | unsigned long ip = (long)(&mcount_call); | 74 | unsigned long ip = (long)(&mcount_call); |
73 | unsigned long *addr = data; | 75 | unsigned long *addr = data; |
74 | unsigned char old[4], *new; | 76 | unsigned char old[MCOUNT_INSN_SIZE], *new; |
75 | 77 | ||
76 | /* | 78 | /* |
77 | * Replace the mcount stub with a pointer to the | 79 | * Replace the mcount stub with a pointer to the |
78 | * ip recorder function. | 80 | * ip recorder function. |
79 | */ | 81 | */ |
80 | memcpy(old, &mcount_call, 4); | 82 | memcpy(old, &mcount_call, MCOUNT_INSN_SIZE); |
81 | new = ftrace_call_replace(ip, *addr); | 83 | new = ftrace_call_replace(ip, *addr); |
82 | *addr = ftrace_modify_code(ip, old, new); | 84 | *addr = ftrace_modify_code(ip, old, new); |
83 | 85 | ||