[PATCH 5/5] powerpc/lib/sstep: Add isel instruction emulation

Matt Brown matthew.brown.dev at gmail.com
Fri Jul 14 10:49:46 AEST 2017


On Thu, Jul 13, 2017 at 5:47 PM, Segher Boessenkool
<segher at kernel.crashing.org> wrote:
> On Thu, Jul 13, 2017 at 01:25:48PM +1000, Matt Brown wrote:
>> +             case 585:       /* isel */
>
> The secondary opcode for isel is only 5 bits, not 10 like most other
> insns have.

Yet another conversion mistake, I'll get there one day!

>
>> +                     mb = (instr >> 6) & 0x1f; /* bc */
>> +                     val = (regs->ccr >> (mb + 32)) & 1;
>
> regs->ccr >> (31 - mb)  ?
>
>> +
>> +                     if (val)
>> +                             regs->gpr[rd] = regs->gpr[ra];
>
> You need to treat ra=0 separately (as 0, not reg 0).
>
Ah I missed that. The wording in the ISA doesn't make that completely obvious.

Thanks,
Matt

>> +                     else
>> +                             regs->gpr[rd] = regs->gpr[rb];
>> +                     goto logical_done;
>
>
> Segher


More information about the Linuxppc-dev mailing list