[RFC PATCH] powerpc: Emulate nop too
Michael Neuling
mikey at neuling.org
Fri May 28 12:28:43 EST 2010
In message <20100527141203.GA20770 at in.ibm.com> you wrote:
> Hi Paul,
>
> While we are at it, can we also add nop to the list of emulated
> instructions?
>
> Ananth
> ---
> From: Ananth N Mavinakayanahalli <ananth at in.ibm.com>
>
> Emulate ori 0,0,0 (nop).
>
> The long winded way is to do:
>
> case 24:
> rd = (instr >> 21) & 0x1f;
> if (rd != 0)
> break;
> rb = (instr >> 11) & 0x1f;
> if (rb != 0)
> break;
Don't we just need rb == rd?
> imm = (instr & 0xffff);
> if (imm == 0) {
> regs->nip += 4;
> return 1;
> }
> break;
>
> But, the following is more straightforward for this case at least.
>
> Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>
> Signed-off-by: Srikar Dronamraju <srikar at linux.vnet.ibm.com>
> ---
> arch/powerpc/lib/sstep.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> Index: linux-27may/arch/powerpc/lib/sstep.c
> ===================================================================
> --- linux-27may.orig/arch/powerpc/lib/sstep.c
> +++ linux-27may/arch/powerpc/lib/sstep.c
> @@ -412,6 +412,12 @@ int __kprobes emulate_step(struct pt_reg
> int err;
> mm_segment_t oldfs;
>
> + /* ori 0,0,0 is a nop. Emulate that too */
> + if (instr == 0x60000000) {
> + regs->nip += 4;
> + return 1;
> + }
> +
> opcode = instr >> 26;
> switch (opcode) {
> case 16: /* bc */
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
More information about the Linuxppc-dev
mailing list