Skip to content

Commit a370b72

Browse files
mhiramatrostedt
authored andcommitted
tracing: Add a comment about ftrace_regs definition
To clarify what will be expected on ftrace_regs, add a comment to the architecture independent definition of the ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) <[email protected]> Acked-by: Mark Rutland <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent c54a1a0 commit a370b72

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

include/linux/ftrace.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,32 @@ extern int ftrace_enabled;
117117

118118
#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
119119

120+
/**
121+
* ftrace_regs - ftrace partial/optimal register set
122+
*
123+
* ftrace_regs represents a group of registers which is used at the
124+
* function entry and exit. There are three types of registers.
125+
*
126+
* - Registers for passing the parameters to callee, including the stack
127+
* pointer. (e.g. rcx, rdx, rdi, rsi, r8, r9 and rsp on x86_64)
128+
* - Registers for passing the return values to caller.
129+
* (e.g. rax and rdx on x86_64)
130+
* - Registers for hooking the function call and return including the
131+
* frame pointer (the frame pointer is architecture/config dependent)
132+
* (e.g. rip, rbp and rsp for x86_64)
133+
*
134+
* Also, architecture dependent fields can be used for internal process.
135+
* (e.g. orig_ax on x86_64)
136+
*
137+
* On the function entry, those registers will be restored except for
138+
* the stack pointer, so that user can change the function parameters
139+
* and instruction pointer (e.g. live patching.)
140+
* On the function exit, only registers which is used for return values
141+
* are restored.
142+
*
143+
* NOTE: user *must not* access regs directly, only do it via APIs, because
144+
* the member can be changed according to the architecture.
145+
*/
120146
struct ftrace_regs {
121147
struct pt_regs regs;
122148
};

0 commit comments

Comments
 (0)