[PATCH v4 07/16] powerpc: Introduce functions for instruction nullity and equality

Nicholas Piggin npiggin at gmail.com
Mon Mar 23 17:43:04 AEDT 2020


Jordan Niethe's on March 20, 2020 3:18 pm:
> In preparation for an instruction data type that can not be directly
> used with the '==' operator use functions for checking equality and
> nullity.
> 
> Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
> ---
>  arch/powerpc/kernel/optprobes.c      |  2 +-
>  arch/powerpc/kernel/trace/ftrace.c   | 33 +++++++++++++++-------------
>  arch/powerpc/lib/code-patching.c     | 16 +++++++-------
>  arch/powerpc/lib/feature-fixups.c    |  2 +-
>  arch/powerpc/lib/test_emulate_step.c |  4 ++--
>  arch/powerpc/xmon/xmon.c             |  4 ++--
>  6 files changed, 32 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c
> index 1025a7a3b3a8..6027425a85f2 100644
> --- a/arch/powerpc/kernel/optprobes.c
> +++ b/arch/powerpc/kernel/optprobes.c
> @@ -259,7 +259,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *p)
>  				(unsigned long)emulate_step_addr,
>  				BRANCH_SET_LINK);
>  
> -	if (!branch_op_callback || !branch_emulate_step)
> +	if (ppc_inst_null(branch_op_callback) || ppc_inst_null(branch_emulate_step))

Is an instruction null, or zeroes?

Oh, most of this comes from create_branch and things. Hmm, would rather
see those functions modified to take a &insn and return an int err.


> @@ -437,7 +438,7 @@ int ftrace_make_nop(struct module *mod,
>  	 * then we had to use a trampoline to make the call.
>  	 * Otherwise just update the call site.
>  	 */
> -	if (test_24bit_addr(ip, addr)) {
> +	if (!ppc_inst_null(test_24bit_addr(ip, addr))) {
>  		/* within range */
>  		old = ftrace_call_replace(ip, addr, 1);
>  		new = PPC_INST(PPC_INST_NOP);

test_24bit_addr shouldn't be passing a ppc_inst back, but a bool.

Thanks,
Nick


More information about the Linuxppc-dev mailing list