mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
powerpc/trace: Add support for HAVE_FUNCTION_ARG_ACCESS_API
When creating a kprobe on function entry through tracefs, enable arguments to be recorded to be specified using $argN syntax. Signed-off-by: Naveen N Rao <naveen@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230614085926.2176641-1-naveen@kernel.org
This commit is contained in:
parent
d42f55e8ae
commit
f01b0edd56
@ -237,6 +237,7 @@ config PPC
|
||||
select HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
select HAVE_FAST_GUP
|
||||
select HAVE_FTRACE_MCOUNT_RECORD
|
||||
select HAVE_FUNCTION_ARG_ACCESS_API
|
||||
select HAVE_FUNCTION_DESCRIPTORS if PPC64_ELF_ABI_V1
|
||||
select HAVE_FUNCTION_ERROR_INJECTION
|
||||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
|
@ -397,6 +397,23 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* regs_get_kernel_argument() - get Nth function argument in kernel
|
||||
* @regs: pt_regs of that context
|
||||
* @n: function argument number (start from 0)
|
||||
*
|
||||
* We support up to 8 arguments and assume they are sent in through the GPRs.
|
||||
* This will fail for fp/vector arguments, but those aren't usually found in
|
||||
* kernel code. This is expected to be called from kprobes or ftrace with regs.
|
||||
*/
|
||||
static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs, unsigned int n)
|
||||
{
|
||||
#define NR_REG_ARGUMENTS 8
|
||||
if (n < NR_REG_ARGUMENTS)
|
||||
return regs_get_register(regs, offsetof(struct pt_regs, gpr[3 + n]));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifndef __powerpc64__
|
||||
|
Loading…
Reference in New Issue
Block a user