1#include "common.h" 2 3 .data 4 .balign 8 5message: 6 .ascii "success: switch_endian_test\n\0" 7 8 .section ".toc" 9 .balign 8 10pattern: 11 .llong 0x5555AAAA5555AAAA 12 13 .text 14FUNC_START(_start) 15 /* Load the pattern */ 16 ld r15, pattern@TOC(%r2) 17 18 /* Setup CR, only CR2-CR4 are maintained */ 19 lis r3, 0x00FF 20 ori r3, r3, 0xF000 21 mtcr r3 22 23 /* Load the pattern slightly modified into the registers */ 24 mr r3, r15 25 addi r4, r15, 4 26 27 addi r5, r15, 32 28 mtlr r5 29 30 addi r5, r15, 5 31 addi r6, r15, 6 32 addi r7, r15, 7 33 addi r8, r15, 8 34 35 /* r9 - r12 are clobbered */ 36 37 addi r13, r15, 13 38 addi r14, r15, 14 39 40 /* Skip r15 we're using it */ 41 42 addi r16, r15, 16 43 addi r17, r15, 17 44 addi r18, r15, 18 45 addi r19, r15, 19 46 addi r20, r15, 20 47 addi r21, r15, 21 48 addi r22, r15, 22 49 addi r23, r15, 23 50 addi r24, r15, 24 51 addi r25, r15, 25 52 addi r26, r15, 26 53 addi r27, r15, 27 54 addi r28, r15, 28 55 addi r29, r15, 29 56 addi r30, r15, 30 57 addi r31, r15, 31 58 59 /* 60 * Call the syscall to switch endian. 61 * It clobbers r9-r12, XER, CTR and CR0-1,5-7. 62 */ 63 li r0, __NR_switch_endian 64 sc 65 66#include "check-reversed.S" 67 68 /* Flip back, r0 already has the switch syscall number */ 69 .long 0x02000044 /* sc */ 70 71#include "check.S" 72 73 li r0, __NR_write 74 li r3, 1 /* stdout */ 75 ld r4, message@got(%r2) 76 li r5, 28 /* strlen(message3) */ 77 sc 78 li r0, __NR_exit 79 li r3, 0 80 sc 81 b . 82