~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php