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

TOMOYO Linux Cross Reference
Linux/arch/alpha/lib/strncpy.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/strncpy.S (Architecture sparc) and /arch/alpha/lib/strncpy.S (Architecture alpha)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * arch/alpha/lib/strncpy.S                         3  * arch/alpha/lib/strncpy.S
  4  * Contributed by Richard Henderson (rth@tamu.      4  * Contributed by Richard Henderson (rth@tamu.edu)
  5  *                                                  5  *
  6  * Copy no more than COUNT bytes of the null-t      6  * Copy no more than COUNT bytes of the null-terminated string from
  7  * SRC to DST.  If SRC does not cover all of C      7  * SRC to DST.  If SRC does not cover all of COUNT, the balance is
  8  * zeroed.                                          8  * zeroed.
  9  *                                                  9  *
 10  * Or, rather, if the kernel cared about that      10  * Or, rather, if the kernel cared about that weird ANSI quirk.  This
 11  * version has cropped that bit o' nastiness a     11  * version has cropped that bit o' nastiness as well as assuming that
 12  * __stxncpy is in range of a branch.              12  * __stxncpy is in range of a branch.
 13  */                                                13  */
 14 #include <linux/export.h>                          14 #include <linux/export.h>
 15         .set noat                                  15         .set noat
 16         .set noreorder                             16         .set noreorder
 17                                                    17 
 18         .text                                      18         .text
 19                                                    19 
 20         .align 4                                   20         .align 4
 21         .globl strncpy                             21         .globl strncpy
 22         .ent strncpy                               22         .ent strncpy
 23 strncpy:                                           23 strncpy:
 24         .frame $30, 0, $26                         24         .frame $30, 0, $26
 25         .prologue 0                                25         .prologue 0
 26                                                    26 
 27         mov     $16, $0         # set return v     27         mov     $16, $0         # set return value now
 28         beq     $18, $zerolen                      28         beq     $18, $zerolen
 29         unop                                       29         unop
 30         bsr     $23, __stxncpy  # do the work      30         bsr     $23, __stxncpy  # do the work of the copy
 31                                                    31 
 32         unop                                       32         unop
 33         bne     $18, $multiword # do we have f     33         bne     $18, $multiword # do we have full words left?
 34         subq    $24, 1, $3      # nope             34         subq    $24, 1, $3      # nope
 35         subq    $27, 1, $4                         35         subq    $27, 1, $4
 36                                                    36 
 37         or      $3, $24, $3     # clear the bi     37         or      $3, $24, $3     # clear the bits between the last
 38         or      $4, $27, $4     # written byte     38         or      $4, $27, $4     # written byte and the last byte in COUNT
 39         andnot  $3, $4, $4                         39         andnot  $3, $4, $4
 40         zap     $1, $4, $1                         40         zap     $1, $4, $1
 41                                                    41 
 42         stq_u   $1, 0($16)                         42         stq_u   $1, 0($16)
 43         ret                                        43         ret
 44                                                    44 
 45         .align  4                                  45         .align  4
 46 $multiword:                                        46 $multiword:
 47         subq    $27, 1, $2      # clear the fi     47         subq    $27, 1, $2      # clear the final bits in the prev word
 48         or      $2, $27, $2                        48         or      $2, $27, $2
 49         zapnot  $1, $2, $1                         49         zapnot  $1, $2, $1
 50         subq    $18, 1, $18                        50         subq    $18, 1, $18
 51                                                    51 
 52         stq_u   $1, 0($16)                         52         stq_u   $1, 0($16)
 53         addq    $16, 8, $16                        53         addq    $16, 8, $16
 54         unop                                       54         unop
 55         beq     $18, 1f                            55         beq     $18, 1f
 56                                                    56 
 57         nop                                        57         nop
 58         unop                                       58         unop
 59         nop                                        59         nop
 60         blbc    $18, 0f                            60         blbc    $18, 0f
 61                                                    61 
 62         stq_u   $31, 0($16)     # zero one wor     62         stq_u   $31, 0($16)     # zero one word
 63         subq    $18, 1, $18                        63         subq    $18, 1, $18
 64         addq    $16, 8, $16                        64         addq    $16, 8, $16
 65         beq     $18, 1f                            65         beq     $18, 1f
 66                                                    66 
 67 0:      stq_u   $31, 0($16)     # zero two wor     67 0:      stq_u   $31, 0($16)     # zero two words
 68         subq    $18, 2, $18                        68         subq    $18, 2, $18
 69         stq_u   $31, 8($16)                        69         stq_u   $31, 8($16)
 70         addq    $16, 16, $16                       70         addq    $16, 16, $16
 71         bne     $18, 0b                            71         bne     $18, 0b
 72                                                    72 
 73 1:      ldq_u   $1, 0($16)      # clear the le     73 1:      ldq_u   $1, 0($16)      # clear the leading bits in the final word
 74         subq    $24, 1, $2                         74         subq    $24, 1, $2
 75         or      $2, $24, $2                        75         or      $2, $24, $2
 76                                                    76 
 77         zap     $1, $2, $1                         77         zap     $1, $2, $1
 78         stq_u   $1, 0($16)                         78         stq_u   $1, 0($16)
 79 $zerolen:                                          79 $zerolen:
 80         ret                                        80         ret
 81                                                    81 
 82         .end    strncpy                            82         .end    strncpy
 83         EXPORT_SYMBOL(strncpy)                     83         EXPORT_SYMBOL(strncpy)
                                                      

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