[PATCH 1/2] powerpc: Reject probes on instructions that can't be single stepped

Christophe Leroy christophe.leroy at csgroup.eu
Tue Mar 29 05:36:30 AEDT 2022



Le 28/03/2022 à 19:20, Naveen N. Rao a écrit :
> Michael Ellerman wrote:
>> Murilo Opsfelder Araújo <mopsfelder at gmail.com> writes:
>>> On 3/23/22 08:51, Naveen N. Rao wrote:
>>>> +static inline bool can_single_step(u32 inst)
>>>> +{
>>>> +    switch (inst >> 26) {
>>>
>>> Can't ppc_inst_primary_opcode() be used instead?
> 
> I didn't want to add a dependency on inst.h. But I guess I can very well 
> move this out of the header into some .c file. I will see if I can make 
> that work.

Maybe use get_op() from asm/disassemble.h ?

> 
>>>> +    case 31:
>>>> +        switch ((inst >> 1) & 0x3ff) {

For that one you have get_xop() in asm/disassemble.h

>>>> +        case 4:        /* tw */

OP_31_XOP_TRAP

>>>> +            return false;
>>>> +        case 68:    /* td */

OP_31_XOP_TRAP_64

>>>> +            return false;
>>>> +        case 146:    /* mtmsr */
>>>> +            return false;
>>>> +        case 178:    /* mtmsrd */
>>>> +            return false;
>>>> +        }
>>>> +        break;
>>>> +    }
>>>> +    return true;
>>>> +}
>>>> +
>>>
>>> Can't OP_* definitions from ppc-opcode.h be used for all of these 
>>> switch-case statements?
>>
>> Yes please. And add any that are missing.
> 
> We only have OP_31 from the above list now. I'll add the rest.

Isn't there also OP_TRAP and OP_TRAP_64 ?

Christophe


More information about the Linuxppc-dev mailing list