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

Ram Pai linuxram at us.ibm.com
Fri Mar 13 18:10:55 AEDT 2015


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?

RP



More information about the Linuxppc-dev mailing list