aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c36
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 */
1768unsigned 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 */
1786unsigned 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
1758static int 1794static int
1759__ftrace_replace_code(struct dyn_ftrace *rec, int enable) 1795__ftrace_replace_code(struct dyn_ftrace *rec, int enable)
1760{ 1796{