[PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall

Michael Ellerman mpe at ellerman.id.au
Fri Mar 13 18:16:42 AEDT 2015


On Fri, 2015-03-13 at 00:10 -0700, Ram Pai wrote:
> On Fri, Mar 13, 2015 at 03:39:24PM +1100, Michael Ellerman wrote:
> > This adds a test of the switch_endian() syscall we added in the previous
> > commit.
> > 
> > We test it by calling the endian switch syscall, and then executing some
> > code in the other endian to check everything went as expected. That code
> > checks registers we expect to be maintained are, and then writes to
> > stdout and then does exit(0).
> > 
> > If the endian switch failed to happen that code sequence will be illegal
> > and cause the test to abort.
> > 
> > Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> > ---
> ..snip..
> > +	.long 0x04000038
> > +	# li      r3,1
> > +	.long 0x01006038
> > +	# mr      r4,r14
> > +	.long 0x7873c47d
> > +	# li      r5,21
> > +	.long 0x1500a038
> > +	# sc
> > +	.long 0x02000044
> > +	# li      r3,0
> > +	.long 0x00006038
> > +	# 1:
> > +	# li      r0, __NR_exit
> 
> Would it make sense to toggle the endianness here,
> checking for the same register sanity before exiting?
> 
> That way endian switching is tested both ways?

Yeah that is a good idea.

/me keeps working on this "trivial" patch ;)

cheers




More information about the Linuxppc-dev mailing list