[PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation

PrasannaKumar Muralidharan prasannatsmkumar at gmail.com
Tue Dec 6 06:51:03 AEDT 2016


Hi Naveen,

Thanks for the review.

>> ---
>>  arch/powerpc/lib/sstep.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
>> index 9c78a9c..5acef72 100644
>> --- a/arch/powerpc/lib/sstep.c
>> +++ b/arch/powerpc/lib/sstep.c
>> @@ -1148,6 +1148,15 @@ int __kprobes analyse_instr(struct instruction_op *op, struct pt_regs *regs,
>>                               (int) regs->gpr[rb];
>>                       goto arith_done;
>>
>> +             case 779:       /* modsw */
>> +                     regs->gpr[rd] = (int) regs->gpr[ra] %
>> +                             (int) regs->gpr[rb];
>> +                     goto arith_done;
>
> Since these instructions don't update CR, you can directly goto
> instr_done.

Sure. Will use that.

>> +
>> +             case 267:       /* moduw */
>
> Please move this case further up so that the extended opcodes are in
> numerical order.

Placed it after divide instruction as it appeared logical. Also placed
267 below 779 as it is the order in which the instructions are
documented in the ISA book. This may help in finding related
instructions together. If this style is not preferred I can arrange it
in numerical order.

Regards,
PrasannaKumar


More information about the Linuxppc-dev mailing list