File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,19 @@ ftrace_regs_get_frame_pointer(const struct ftrace_regs *fregs)
135
135
return arch_ftrace_regs (fregs )-> fp ;
136
136
}
137
137
138
+ static __always_inline struct pt_regs *
139
+ ftrace_partial_regs (const struct ftrace_regs * fregs , struct pt_regs * regs )
140
+ {
141
+ struct __arch_ftrace_regs * afregs = arch_ftrace_regs (fregs );
142
+
143
+ memcpy (regs -> regs , afregs -> regs , sizeof (afregs -> regs ));
144
+ regs -> sp = afregs -> sp ;
145
+ regs -> pc = afregs -> pc ;
146
+ regs -> regs [29 ] = afregs -> fp ;
147
+ regs -> regs [30 ] = afregs -> lr ;
148
+ return regs ;
149
+ }
150
+
138
151
int ftrace_regs_query_register_offset (const char * name );
139
152
140
153
int ftrace_init_nop (struct module * mod , struct dyn_ftrace * rec );
Original file line number Diff line number Diff line change @@ -197,6 +197,20 @@ static __always_inline void ftrace_override_function_with_return(struct ftrace_r
197
197
arch_ftrace_regs (fregs )-> epc = arch_ftrace_regs (fregs )-> ra ;
198
198
}
199
199
200
+ static __always_inline struct pt_regs *
201
+ ftrace_partial_regs (const struct ftrace_regs * fregs , struct pt_regs * regs )
202
+ {
203
+ struct __arch_ftrace_regs * afregs = arch_ftrace_regs (fregs );
204
+
205
+ memcpy (& regs -> a0 , afregs -> args , sizeof (afregs -> args ));
206
+ regs -> epc = afregs -> epc ;
207
+ regs -> ra = afregs -> ra ;
208
+ regs -> sp = afregs -> sp ;
209
+ regs -> s0 = afregs -> s0 ;
210
+ regs -> t1 = afregs -> t1 ;
211
+ return regs ;
212
+ }
213
+
200
214
int ftrace_regs_query_register_offset (const char * name );
201
215
202
216
void ftrace_graph_func (unsigned long ip , unsigned long parent_ip ,
Original file line number Diff line number Diff line change @@ -190,6 +190,23 @@ static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs
190
190
return arch_ftrace_get_regs (fregs );
191
191
}
192
192
193
+ #if !defined(CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS ) || \
194
+ defined(CONFIG_HAVE_FTRACE_REGS_HAVING_PT_REGS )
195
+
196
+ static __always_inline struct pt_regs *
197
+ ftrace_partial_regs (struct ftrace_regs * fregs , struct pt_regs * regs )
198
+ {
199
+ /*
200
+ * If CONFIG_HAVE_FTRACE_REGS_HAVING_PT_REGS=y, ftrace_regs memory
201
+ * layout is including pt_regs. So always returns that address.
202
+ * Since arch_ftrace_get_regs() will check some members and may return
203
+ * NULL, we can not use it.
204
+ */
205
+ return & arch_ftrace_regs (fregs )-> regs ;
206
+ }
207
+
208
+ #endif /* !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS || CONFIG_HAVE_FTRACE_REGS_HAVING_PT_REGS */
209
+
193
210
/*
194
211
* When true, the ftrace_regs_{get,set}_*() functions may be used on fregs.
195
212
* Note: this can be true even when ftrace_get_regs() cannot provide a pt_regs.
You can’t perform that action at this time.
0 commit comments