linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
@ 2016-12-04 16:55 PrasannaKumar Muralidharan
  2016-12-05  8:23 ` Naveen N. Rao
  2016-12-06  6:36 ` Naveen N. Rao
  0 siblings, 2 replies; 8+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-04 16:55 UTC (permalink / raw)
  To: benh, paulus, mpe, linuxppc-dev; +Cc: PrasannaKumar Muralidharan

Add modsw and moduw instruction emulation support to analyse_instr.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
---
 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;
+
+		case 267:	/* moduw */
+			regs->gpr[rd] = (unsigned int) regs->gpr[ra] %
+				(unsigned int) regs->gpr[rb];
+			goto arith_done;
 
 /*
  * Logical instructions
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-04 16:55 [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation PrasannaKumar Muralidharan
@ 2016-12-05  8:23 ` Naveen N. Rao
  2016-12-05 19:51   ` PrasannaKumar Muralidharan
  2016-12-06  6:36 ` Naveen N. Rao
  1 sibling, 1 reply; 8+ messages in thread
From: Naveen N. Rao @ 2016-12-05  8:23 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: benh, paulus, mpe, linuxppc-dev, Ananth N

On 2016/12/04 10:25PM, PrasannaKumar Muralidharan wrote:
> Add modsw and moduw instruction emulation support to analyse_instr.
> 
> Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>

Hi Prasanna,
Thanks for the patch! A few minor comments below...

> ---
>  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.

> +
> +		case 267:	/* moduw */

Please move this case further up so that the extended opcodes are in 
numerical order.


- Naveen

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-05  8:23 ` Naveen N. Rao
@ 2016-12-05 19:51   ` PrasannaKumar Muralidharan
  2016-12-06  6:35     ` Naveen N. Rao
  0 siblings, 1 reply; 8+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-05 19:51 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: benh, paulus, mpe, linuxppc-dev, Ananth N

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-05 19:51   ` PrasannaKumar Muralidharan
@ 2016-12-06  6:35     ` Naveen N. Rao
  2016-12-06 16:38       ` PrasannaKumar Muralidharan
  0 siblings, 1 reply; 8+ messages in thread
From: Naveen N. Rao @ 2016-12-06  6:35 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: benh, paulus, mpe, linuxppc-dev, Ananth N

On 2016/12/06 01:21AM, PrasannaKumar Muralidharan wrote:
> >> +
> >> +             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.

I guessed as much, but if you look at the existing function, you'll see 
that things have been arranged in numerical order. As such, it's best to 
stick to that convention.

- Naveen

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-04 16:55 [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation PrasannaKumar Muralidharan
  2016-12-05  8:23 ` Naveen N. Rao
@ 2016-12-06  6:36 ` Naveen N. Rao
  2016-12-06 16:48   ` PrasannaKumar Muralidharan
  1 sibling, 1 reply; 8+ messages in thread
From: Naveen N. Rao @ 2016-12-06  6:36 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: benh, paulus, mpe, linuxppc-dev

By the way, I missed mentioning previously: please use 'powerpc: ' 
prefix for the subject, rather than PPC.


On 2016/12/04 10:25PM, PrasannaKumar Muralidharan wrote:
> Add modsw and moduw instruction emulation support to analyse_instr.

And, it will be better if you can briefly describe what these functions 
do for the benefit of others.

- Naveen

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-06  6:35     ` Naveen N. Rao
@ 2016-12-06 16:38       ` PrasannaKumar Muralidharan
  0 siblings, 0 replies; 8+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-06 16:38 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: benh, paulus, mpe, linuxppc-dev, Ananth N

> I guessed as much, but if you look at the existing function, you'll see
> that things have been arranged in numerical order. As such, it's best to
> stick to that convention.

Makes sense. Will do.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-06  6:36 ` Naveen N. Rao
@ 2016-12-06 16:48   ` PrasannaKumar Muralidharan
  2016-12-06 17:21     ` Naveen N. Rao
  0 siblings, 1 reply; 8+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-06 16:48 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: benh, paulus, mpe, linuxppc-dev

> By the way, I missed mentioning previously: please use 'powerpc: '
> prefix for the subject, rather than PPC.

I will change it. Wondering how they are different.

>> Add modsw and moduw instruction emulation support to analyse_instr.
>
> And, it will be better if you can briefly describe what these functions
> do for the benefit of others.

Sure. I will add description.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation
  2016-12-06 16:48   ` PrasannaKumar Muralidharan
@ 2016-12-06 17:21     ` Naveen N. Rao
  0 siblings, 0 replies; 8+ messages in thread
From: Naveen N. Rao @ 2016-12-06 17:21 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: paulus, linuxppc-dev

On 2016/12/06 10:18PM, PrasannaKumar Muralidharan wrote:
> > By the way, I missed mentioning previously: please use 'powerpc: '
> > prefix for the subject, rather than PPC.
> 
> I will change it. Wondering how they are different.

It's by convention. Maintainers are picky ;)

- Naveen

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-06 17:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-04 16:55 [PATCH] PPC: sstep.c: Add modsw, moduw instruction emulation PrasannaKumar Muralidharan
2016-12-05  8:23 ` Naveen N. Rao
2016-12-05 19:51   ` PrasannaKumar Muralidharan
2016-12-06  6:35     ` Naveen N. Rao
2016-12-06 16:38       ` PrasannaKumar Muralidharan
2016-12-06  6:36 ` Naveen N. Rao
2016-12-06 16:48   ` PrasannaKumar Muralidharan
2016-12-06 17:21     ` Naveen N. Rao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).