diff options
| author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-05-06 21:34:14 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2014-05-14 11:37:29 -0400 |
| commit | 7413af1fb70e7efa6dbc7f27663e7a5126b3aa33 (patch) | |
| tree | c3060be62f4f8a6d94cfe1f390c12e2d0285435e /kernel | |
| parent | 94792ea07ce2cceef48803c4df3cb5efacb21c9a (diff) | |
ftrace: Make get_ftrace_addr() and get_ftrace_addr_old() global
Move and rename get_ftrace_addr() and get_ftrace_addr_old() to
ftrace_get_addr_new() and ftrace_get_addr_curr() respectively.
This moves these two helper functions in the generic code out from
the arch specific code, and renames them to have a better generic
name. This will allow other archs to use them as well as makes it
a bit easier to work on getting separate trampolines for different
functions.
ftrace_get_addr_new() returns the trampoline address that the mcount
call address will be converted to.
ftrace_get_addr_curr() returns the trampoline address of what the
mcount call address currently jumps to.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/trace/ftrace.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 98fa931b6864..e825fded435d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1755,6 +1755,42 @@ int ftrace_test_record(struct dyn_ftrace *rec, int enable) | |||
| 1755 | return ftrace_check_record(rec, enable, 0); | 1755 | return ftrace_check_record(rec, enable, 0); |
| 1756 | } | 1756 | } |
| 1757 | 1757 | ||
| 1758 | /** | ||
| 1759 | * ftrace_get_addr_new - Get the call address to set to | ||
| 1760 | * @rec: The ftrace record descriptor | ||
| 1761 | * | ||
| 1762 | * If the record has the FTRACE_FL_REGS set, that means that it | ||
| 1763 | * wants to convert to a callback that saves all regs. If FTRACE_FL_REGS | ||
| 1764 | * is not not set, then it wants to convert to the normal callback. | ||
| 1765 | * | ||
| 1766 | * Returns the address of the trampoline to set to | ||
| 1767 | */ | ||
| 1768 | unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec) | ||
| 1769 | { | ||
| 1770 | if (rec->flags & FTRACE_FL_REGS) | ||
| 1771 | return (unsigned long)FTRACE_REGS_ADDR; | ||
| 1772 | else | ||
| 1773 | return (unsigned long)FTRACE_ADDR; | ||
| 1774 | } | ||
| 1775 | |||
| 1776 | /** | ||
| 1777 | * ftrace_get_addr_curr - Get the call address that is already there | ||
| 1778 | * @rec: The ftrace record descriptor | ||
| 1779 | * | ||
| 1780 | * The FTRACE_FL_REGS_EN is set when the record already points to | ||
| 1781 | * a function that saves all the regs. Basically the '_EN' version | ||
| 1782 | * represents the current state of the function. | ||
| 1783 | * | ||
| 1784 | * Returns the address of the trampoline that is currently being called | ||
| 1785 | */ | ||
| 1786 | unsigned long ftrace_get_addr_curr(struct dyn_ftrace *rec) | ||
| 1787 | { | ||
| 1788 | if (rec->flags & FTRACE_FL_REGS_EN) | ||
| 1789 | return (unsigned long)FTRACE_REGS_ADDR; | ||
| 1790 | else | ||
| 1791 | return (unsigned long)FTRACE_ADDR; | ||
| 1792 | } | ||
| 1793 | |||
| 1758 | static int | 1794 | static int |
| 1759 | __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | 1795 | __ftrace_replace_code(struct dyn_ftrace *rec, int enable) |
| 1760 | { | 1796 | { |
