diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-10-23 09:32:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-23 10:00:13 -0400 |
commit | 593eb8a2d63e95772a5f22d746f18a997c5ee463 (patch) | |
tree | 2a99c61ccffc2c0fd280bb2e5f81ac2f22e2f471 /include | |
parent | 34698bcbdf7b0629d6c873b5da7c63073fb45361 (diff) |
ftrace: return error on failed modified text.
Have the ftrace_modify_code return error values:
-EFAULT on error of reading the address
-EINVAL if what is read does not match what it expected
-EPERM if the write fails to update after a successful match.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ftrace.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 0e9529589151..79fa10cbdcfb 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -72,13 +72,33 @@ extern unsigned char *ftrace_nop_replace(void); | |||
72 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); | 72 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); |
73 | extern int ftrace_dyn_arch_init(void *data); | 73 | extern int ftrace_dyn_arch_init(void *data); |
74 | extern int ftrace_mcount_set(unsigned long *data); | 74 | extern int ftrace_mcount_set(unsigned long *data); |
75 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
76 | unsigned char *new_code); | ||
77 | extern int ftrace_update_ftrace_func(ftrace_func_t func); | 75 | extern int ftrace_update_ftrace_func(ftrace_func_t func); |
78 | extern void ftrace_caller(void); | 76 | extern void ftrace_caller(void); |
79 | extern void ftrace_call(void); | 77 | extern void ftrace_call(void); |
80 | extern void mcount_call(void); | 78 | extern void mcount_call(void); |
81 | 79 | ||
80 | /** | ||
81 | * ftrace_modify_code - modify code segment | ||
82 | * @ip: the address of the code segment | ||
83 | * @old_code: the contents of what is expected to be there | ||
84 | * @new_code: the code to patch in | ||
85 | * | ||
86 | * This is a very sensitive operation and great care needs | ||
87 | * to be taken by the arch. The operation should carefully | ||
88 | * read the location, check to see if what is read is indeed | ||
89 | * what we expect it to be, and then on success of the compare, | ||
90 | * it should write to the location. | ||
91 | * | ||
92 | * Return must be: | ||
93 | * 0 on success | ||
94 | * -EFAULT on error reading the location | ||
95 | * -EINVAL on a failed compare of the contents | ||
96 | * -EPERM on error writing to the location | ||
97 | * Any other value will be considered a failure. | ||
98 | */ | ||
99 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
100 | unsigned char *new_code); | ||
101 | |||
82 | extern int skip_trace(unsigned long ip); | 102 | extern int skip_trace(unsigned long ip); |
83 | 103 | ||
84 | extern void ftrace_release(void *start, unsigned long size); | 104 | extern void ftrace_release(void *start, unsigned long size); |