All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation
@ 2016-12-07 17:45 PrasannaKumar Muralidharan
  2016-12-13  6:03 ` Naveen N. Rao
  0 siblings, 1 reply; 5+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-07 17:45 UTC (permalink / raw)
  To: benh, paulus, mpe, naveen.n.rao, ananth, linuxppc-dev
  Cc: PrasannaKumar Muralidharan

Add modsw and moduw instruction emulation support to analyse_instr.
modsw is an x-form instruction that calculates signed modulo of values
stored in registers. moduw is similar to modsw but it works with
unsigned values.

Changes in v2:
Don't update CR register as the instruction does not touch that
Arrange extended opcode in numerical order

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..b0acdbc 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1128,6 +1128,11 @@ int __kprobes analyse_instr(struct instruction_op *op, struct pt_regs *regs,
 		case 266:	/* add */
 			regs->gpr[rd] = regs->gpr[ra] + regs->gpr[rb];
 			goto arith_done;
+
+		case 267:	/* moduw */
+			regs->gpr[rd] = (unsigned int) regs->gpr[ra] %
+				(unsigned int) regs->gpr[rb];
+			goto instr_done;
 #ifdef __powerpc64__
 		case 457:	/* divdu */
 			regs->gpr[rd] = regs->gpr[ra] / regs->gpr[rb];
@@ -1148,6 +1153,10 @@ 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 instr_done;
 
 /*
  * Logical instructions
-- 
2.9.3

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

* Re: [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation
  2016-12-07 17:45 [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation PrasannaKumar Muralidharan
@ 2016-12-13  6:03 ` Naveen N. Rao
  2016-12-13  7:36   ` PrasannaKumar Muralidharan
  0 siblings, 1 reply; 5+ messages in thread
From: Naveen N. Rao @ 2016-12-13  6:03 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: benh, paulus, mpe, ananth, linuxppc-dev

On 2016/12/07 11:15PM, PrasannaKumar Muralidharan wrote:
> Add modsw and moduw instruction emulation support to analyse_instr.
> modsw is an x-form instruction that calculates signed modulo of values
> stored in registers. moduw is similar to modsw but it works with
> unsigned values.
> 
> Changes in v2:
> Don't update CR register as the instruction does not touch that
> Arrange extended opcode in numerical order

This changelog should come after '---' below so that it doesn't get 
included in the commit message.

Apart from that, for this patch:
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>


Thanks!

> 
> 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..b0acdbc 100644
> --- a/arch/powerpc/lib/sstep.c
> +++ b/arch/powerpc/lib/sstep.c
> @@ -1128,6 +1128,11 @@ int __kprobes analyse_instr(struct instruction_op *op, struct pt_regs *regs,
>  		case 266:	/* add */
>  			regs->gpr[rd] = regs->gpr[ra] + regs->gpr[rb];
>  			goto arith_done;
> +
> +		case 267:	/* moduw */
> +			regs->gpr[rd] = (unsigned int) regs->gpr[ra] %
> +				(unsigned int) regs->gpr[rb];
> +			goto instr_done;
>  #ifdef __powerpc64__
>  		case 457:	/* divdu */
>  			regs->gpr[rd] = regs->gpr[ra] / regs->gpr[rb];
> @@ -1148,6 +1153,10 @@ 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 instr_done;
> 
>  /*
>   * Logical instructions
> -- 
> 2.9.3
> 

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

* Re: [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation
  2016-12-13  6:03 ` Naveen N. Rao
@ 2016-12-13  7:36   ` PrasannaKumar Muralidharan
  2016-12-13  7:49     ` Naveen N. Rao
  0 siblings, 1 reply; 5+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-13  7:36 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: benh, paulus, mpe, Ananth N, linuxppc-dev

Hi Naveen,

>> Add modsw and moduw instruction emulation support to analyse_instr.
>> modsw is an x-form instruction that calculates signed modulo of values
>> stored in registers. moduw is similar to modsw but it works with
>> unsigned values.
>>
>> Changes in v2:
>> Don't update CR register as the instruction does not touch that
>> Arrange extended opcode in numerical order
>
> This changelog should come after '---' below so that it doesn't get
> included in the commit message.

Oh, I see. Should I send the patch again with the above change? If so
should I mark it v3 or just v2?

> Apart from that, for this patch:
> Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Thanks and regards,
PrasannaKumar

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

* Re: [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation
  2016-12-13  7:36   ` PrasannaKumar Muralidharan
@ 2016-12-13  7:49     ` Naveen N. Rao
  2016-12-13  7:54       ` PrasannaKumar Muralidharan
  0 siblings, 1 reply; 5+ messages in thread
From: Naveen N. Rao @ 2016-12-13  7:49 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: benh, paulus, mpe, Ananth N, linuxppc-dev

On 2016/12/13 01:06PM, PrasannaKumar Muralidharan wrote:
> Hi Naveen,
> 
> >> Add modsw and moduw instruction emulation support to analyse_instr.
> >> modsw is an x-form instruction that calculates signed modulo of values
> >> stored in registers. moduw is similar to modsw but it works with
> >> unsigned values.
> >>
> >> Changes in v2:
> >> Don't update CR register as the instruction does not touch that
> >> Arrange extended opcode in numerical order
> >
> > This changelog should come after '---' below so that it doesn't get
> > included in the commit message.
> 
> Oh, I see. Should I send the patch again with the above change? If so
> should I mark it v3 or just v2?

Easier for benh/mpe if you do ;)
Be sure to include my reviewed-by tag in your v3.

- Naveen

> 
> > Apart from that, for this patch:
> > Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> 
> Thanks and regards,
> PrasannaKumar
> 

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

* Re: [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation
  2016-12-13  7:49     ` Naveen N. Rao
@ 2016-12-13  7:54       ` PrasannaKumar Muralidharan
  0 siblings, 0 replies; 5+ messages in thread
From: PrasannaKumar Muralidharan @ 2016-12-13  7:54 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: benh, paulus, mpe, Ananth N, linuxppc-dev

>> Oh, I see. Should I send the patch again with the above change? If so
>> should I mark it v3 or just v2?
>
> Easier for benh/mpe if you do ;)
> Be sure to include my reviewed-by tag in your v3.

Sure. I will send v3.

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

end of thread, other threads:[~2016-12-13  7:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-07 17:45 [PATCH v2] powerpc: sstep.c: Add modsw, moduw instruction emulation PrasannaKumar Muralidharan
2016-12-13  6:03 ` Naveen N. Rao
2016-12-13  7:36   ` PrasannaKumar Muralidharan
2016-12-13  7:49     ` Naveen N. Rao
2016-12-13  7:54       ` PrasannaKumar Muralidharan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.