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

TOMOYO Linux Cross Reference
Linux/arch/alpha/lib/ev67-strncat.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 ] ~

Diff markup

Differences between /arch/alpha/lib/ev67-strncat.S (Architecture sparc) and /arch/alpha/lib/ev67-strncat.S (Architecture alpha)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * arch/alpha/lib/ev67-strncat.S                    3  * arch/alpha/lib/ev67-strncat.S
  4  * 21264 version contributed by Rick Gorton <ri      4  * 21264 version contributed by Rick Gorton <rick.gorton@api-networks.com>
  5  *                                                  5  *
  6  * Append no more than COUNT characters from t      6  * Append no more than COUNT characters from the null-terminated string SRC
  7  * to the null-terminated string DST.  Always       7  * to the null-terminated string DST.  Always null-terminate the new DST.
  8  *                                                  8  *
  9  * This differs slightly from the semantics in      9  * This differs slightly from the semantics in libc in that we never write
 10  * past count, whereas libc may write to count     10  * past count, whereas libc may write to count+1.  This follows the generic
 11  * implementation in lib/string.c and is, IMHO     11  * implementation in lib/string.c and is, IMHO, more sensible.
 12  *                                                 12  *
 13  * Much of the information about 21264 schedul     13  * Much of the information about 21264 scheduling/coding comes from:
 14  *      Compiler Writer's Guide for the Alpha      14  *      Compiler Writer's Guide for the Alpha 21264
 15  *      abbreviated as 'CWG' in other comments     15  *      abbreviated as 'CWG' in other comments here
 16  *      ftp.digital.com/pub/Digital/info/semic     16  *      ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html
 17  * Scheduling notation:                            17  * Scheduling notation:
 18  *      E       - either cluster                   18  *      E       - either cluster
 19  *      U       - upper subcluster; U0 - subcl     19  *      U       - upper subcluster; U0 - subcluster U0; U1 - subcluster U1
 20  *      L       - lower subcluster; L0 - subcl     20  *      L       - lower subcluster; L0 - subcluster L0; L1 - subcluster L1
 21  * Try not to change the actual algorithm if p     21  * Try not to change the actual algorithm if possible for consistency.
 22  */                                                22  */
 23                                                    23 
 24 #include <linux/export.h>                          24 #include <linux/export.h>
 25         .text                                      25         .text
 26                                                    26 
 27         .align 4                                   27         .align 4
 28         .globl strncat                             28         .globl strncat
 29         .ent strncat                               29         .ent strncat
 30 strncat:                                           30 strncat:
 31         .frame $30, 0, $26                         31         .frame $30, 0, $26
 32         .prologue 0                                32         .prologue 0
 33                                                    33 
 34         mov     $16, $0         # set up retur     34         mov     $16, $0         # set up return value
 35         beq     $18, $zerocount # U :              35         beq     $18, $zerocount # U :
 36         /* Find the end of the string.  */         36         /* Find the end of the string.  */
 37         ldq_u   $1, 0($16)      # L : load fir     37         ldq_u   $1, 0($16)      # L : load first quadword ($16 may be misaligned)
 38         lda     $2, -1($31)     # E :              38         lda     $2, -1($31)     # E :
 39                                                    39 
 40         insqh   $2, $0, $2      # U :              40         insqh   $2, $0, $2      # U :
 41         andnot  $16, 7, $16     # E :              41         andnot  $16, 7, $16     # E :
 42         nop                     # E :              42         nop                     # E :
 43         or      $2, $1, $1      # E :              43         or      $2, $1, $1      # E :
 44                                                    44 
 45         nop                     # E :              45         nop                     # E :
 46         nop                     # E :              46         nop                     # E :
 47         cmpbge  $31, $1, $2     # E : bits set     47         cmpbge  $31, $1, $2     # E : bits set iff byte == 0
 48         bne     $2, $found      # U :              48         bne     $2, $found      # U :
 49                                                    49 
 50 $loop:  ldq     $1, 8($16)      # L :              50 $loop:  ldq     $1, 8($16)      # L :
 51         addq    $16, 8, $16     # E :              51         addq    $16, 8, $16     # E :
 52         cmpbge  $31, $1, $2     # E :              52         cmpbge  $31, $1, $2     # E :
 53         beq     $2, $loop       # U :              53         beq     $2, $loop       # U :
 54                                                    54 
 55 $found: cttz    $2, $3          # U0 :             55 $found: cttz    $2, $3          # U0 :
 56         addq    $16, $3, $16    # E :              56         addq    $16, $3, $16    # E :
 57         nop                     # E :              57         nop                     # E :
 58         bsr     $23, __stxncpy  # L0 :/* Now d     58         bsr     $23, __stxncpy  # L0 :/* Now do the append.  */
 59                                                    59 
 60         /* Worry about the null termination.       60         /* Worry about the null termination.  */
 61                                                    61 
 62         zapnot  $1, $27, $2     # U : was last     62         zapnot  $1, $27, $2     # U : was last byte a null?
 63         cmplt   $27, $24, $5    # E : did we f     63         cmplt   $27, $24, $5    # E : did we fill the buffer completely?
 64         bne     $2, 0f          # U :              64         bne     $2, 0f          # U :
 65         ret                     # L0 :             65         ret                     # L0 :
 66                                                    66 
 67 0:      or      $5, $18, $2     # E :              67 0:      or      $5, $18, $2     # E :
 68         nop                                        68         nop
 69         bne     $2, 2f          # U :              69         bne     $2, 2f          # U :
 70         and     $24, 0x80, $3   # E : no zero      70         and     $24, 0x80, $3   # E : no zero next byte
 71                                                    71 
 72         nop                     # E :              72         nop                     # E :
 73         bne     $3, 1f          # U :              73         bne     $3, 1f          # U :
 74         /* Here there are bytes left in the cu     74         /* Here there are bytes left in the current word.  Clear one.  */
 75         addq    $24, $24, $24   # E : end-of-c     75         addq    $24, $24, $24   # E : end-of-count bit <<= 1
 76         nop                     # E :              76         nop                     # E :
 77                                                    77 
 78 2:      zap     $1, $24, $1     # U :              78 2:      zap     $1, $24, $1     # U :
 79         nop                     # E :              79         nop                     # E :
 80         stq_u   $1, 0($16)      # L :              80         stq_u   $1, 0($16)      # L :
 81         ret                     # L0 :             81         ret                     # L0 :
 82                                                    82 
 83 1:      /* Here we must clear the first byte o     83 1:      /* Here we must clear the first byte of the next DST word */
 84         stb     $31, 8($16)     # L :              84         stb     $31, 8($16)     # L :
 85         nop                     # E :              85         nop                     # E :
 86         nop                     # E :              86         nop                     # E :
 87         ret                     # L0 :             87         ret                     # L0 :
 88                                                    88 
 89 $zerocount:                                        89 $zerocount:
 90         nop                     # E :              90         nop                     # E :
 91         nop                     # E :              91         nop                     # E :
 92         nop                     # E :              92         nop                     # E :
 93         ret                     # L0 :             93         ret                     # L0 :
 94                                                    94 
 95         .end strncat                               95         .end strncat
 96         EXPORT_SYMBOL(strncat)                     96         EXPORT_SYMBOL(strncat)
                                                      

~ [ 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