[PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall
Michael Ellerman
mpe at ellerman.id.au
Fri Mar 13 16:01:30 AEDT 2015
On Fri, 2015-03-13 at 15:39 +1100, Michael Ellerman wrote:
> diff --git a/tools/testing/selftests/powerpc/syscalls/endian-test.S b/tools/testing/selftests/powerpc/syscalls/endian-test.S
> new file mode 100644
> index 000000000000..0beca323247a
> --- /dev/null
> +++ b/tools/testing/selftests/powerpc/syscalls/endian-test.S
> @@ -0,0 +1,247 @@
> +#include <ppc-asm.h>
> +#include <asm/unistd.h>
> +
> +#ifndef __NR_switch_endian
> +#define __NR_switch_endian 363
> +#endif
> +
> + .data
> + .balign 8
> +message:
> + .ascii "success: endian-test\n"
> +
> + .section .toc
> + .balign 8
> +pattern:
> + .llong 0x5555AAAA5555AAAA
> +
> + .text
> +FUNC_START(_start)
> + /* Load some addresses to start with */
> + ld r14, message at got(%r2)
> + ld r15, pattern at toc(%r2)
Because ... stupid, the "toc" references above break on big endian.
Fixed by doing:
.section ".toc"
and:
ld r15, pattern at TOC(%r2)
cheers
More information about the Linuxppc-dev
mailing list