[PATCH] powerpc: 32 bit getcpu VDSO function uses 64 bit instructions
Segher Boessenkool
segher at kernel.crashing.org
Fri Nov 28 07:50:15 AEDT 2014
On Thu, Nov 27, 2014 at 11:41:40AM -0600, Peter Bergner wrote:
> On Thu, 2014-11-27 at 10:08 -0600, Segher Boessenkool wrote:
> > On Wed, Nov 26, 2014 at 05:50:27PM -0600, Peter Bergner wrote:
> > > Nope, you don't get a SIGILL when executing 64-bit instructions in
> > > 32-bit mode, so it'll happily just execute the instruction, doing
> > > a full 64-bit compare. I'm guessing that the upper 32-bits of both
> > > r3 and r4 contain zeros, so we're probably just getting lucky.
> >
> > You will get a SIGILL if you run on 32-bit hardware.
>
> Ha, I completely forgot about 32-bit hardware. Anyway, I looked
> at the ISA, and cmpdi and cmpwi are just extended mnemonics for
> cmpi, with cmpdi setting the L field to 1. Probably on 32-bit
> hardware, the hardware is just ignoring the L bit being set and
> doing a cmpwi for us???
Huh. Yes, maybe some implementations do that.
The good news is that those then compute the correct thing ;-)
Can QEMU help catch such bugs more reliably?
Segher
More information about the Linuxppc-dev
mailing list