# Re: \[PATCH\] powerpc/kprobes: Pass ppc\_inst as a pointer to emulate\_step() on ppc32

- From: Naveen N. Rao \<hidden\>
- Date: 2021-05-21 07:02:50 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2021/05/9522845
- Thread: https://ratatoskr.run/linuxppc-dev/2021/05/9522827/t.md

```text
Christophe Leroy wrote:
>
>
> Le 20/05/2021 à 12:54, Naveen N. Rao a écrit :
>> Christophe Leroy wrote:
>>>
>>>
>>> Le 20/05/2021 à 09:29, Naveen N. Rao a écrit :
>>>> diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c
>>>> index cdf87086fa33a0..2bc53fa48a1b33 100644
>>>> --- a/arch/powerpc/kernel/optprobes.c
>>>> +++ b/arch/powerpc/kernel/optprobes.c
>>>> @@ -281,8 +281,12 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *p)
>>>>       /*
>>>>        * 3. load instruction to be emulated into relevant register, and
>>>>        */
>>>> -    temp = ppc_inst_read((struct ppc_inst *)p->ainsn.insn);
>>>> -    patch_imm_load_insns(ppc_inst_as_ulong(temp), 4, buff + TMPL_INSN_IDX);
>>>> +    if (IS_ENABLED(CONFIG_PPC64)) {
>>>> +        temp = ppc_inst_read((struct ppc_inst *)p->ainsn.insn);
>>>> +        patch_imm_load_insns(ppc_inst_as_ulong(temp), 4, buff + TMPL_INSN_IDX);
>>>> +    } else {
>>>> +        patch_imm_load_insns((unsigned long)p->ainsn.insn, 4, buff + TMPL_INSN_IDX);
>>>> +    }
>>>
>>> It means commit https://github.com/linuxppc/linux/commit/693557ebf407a85ea400a0b501bb97687d8f4856 was not necessary and may be reverted.
>>
>> Indeed, I will send a revert for it.
>>
>
> I'm not completely sure it is worth reverting, on an other hand it is pointless anyway to have something to convert to a u64 something that cannot be more than 32 bits on a PPC32, so now that we have ppc_inst_as_ulong() it is as good I think.

Sure. If necessary, the revert can go in separately as part of your other cleanup series.

- Naveen

```
