# ppc64_personality ________________________________________
#
# long ppc64_personality(unsigned long personality)
#

@define _SYSCALL_PPC64_PERSONALITY_NAME
%(
	name = "personality"
%)

@define _SYSCALL_PPC64_PERSONALITY_ARGSTR
%(
	argstr = sprintf("%#x", persona);
%)

probe syscall.ppc64_personality = dw_syscall.ppc64_personality !,
                                  nd_syscall.ppc64_personality ? {}
probe syscall.ppc64_personality.return = dw_syscall.ppc64_personality.return !,
                                         nd_syscall.ppc64_personality.return ? {}

# Note that these probes used to hook up to the ppc64_personality()
# kernel function. However, that was just a wrapper around
# sys_personality(). To avoid syscall nesting, we'll just ignore
# ppc64_personality(), which also makes things easier for user scripts,
# since they can just probe 'syscall.personality'.

# dw_ppc64_personality _____________________________________________________

%( systemtap_v <= "3.1" %?
probe dw_syscall.ppc64_personality = kernel.function("ppc64_personality").call ?
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	persona = $personality
	@_SYSCALL_PPC64_PERSONALITY_ARGSTR
}
probe dw_syscall.ppc64_personality.return =
	kernel.function("ppc64_personality").return ?
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	@SYSC_RETVALSTR($return)
}
%:
probe dw_syscall.ppc64_personality = never
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	persona = 0
	@_SYSCALL_PPC64_PERSONALITY_ARGSTR
}
probe dw_syscall.ppc64_personality.return = never
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	retstr = "0"
}
%)

# nd_ppc64_personality _____________________________________________________

%( systemtap_v <= "3.1" %?
probe nd_syscall.ppc64_personality = kprobe.function("ppc64_personality") ?
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	asmlinkage()
	persona = ulong_arg(1)
	@_SYSCALL_PPC64_PERSONALITY_ARGSTR
}
probe nd_syscall.ppc64_personality.return =
	kprobe.function("ppc64_personality").return ?
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	@SYSC_RETVALSTR(returnval())
}
%:
probe nd_syscall.ppc64_personality = never
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	persona = 0
	@_SYSCALL_PPC64_PERSONALITY_ARGSTR
}
probe nd_syscall.ppc64_personality.return = never
{
	@_SYSCALL_PPC64_PERSONALITY_NAME
	retstr = "0"
}
%)
