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

TOMOYO Linux Cross Reference
Linux/arch/alpha/lib/csum_ipv6_magic.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 /*
  3  * arch/alpha/lib/csum_ipv6_magic.S
  4  * Contributed by Richard Henderson <rth@tamu.edu>
  5  *
  6  * unsigned short csum_ipv6_magic(struct in6_addr *saddr,
  7  *                                struct in6_addr *daddr,
  8  *                                __u32 len,
  9  *                                unsigned short proto,
 10  *                                unsigned int csum);
 11  *
 12  * Misalignment handling (which costs 16 instructions / 8 cycles)
 13  * added by Ivan Kokshaysky <ink@jurassic.park.msu.ru>
 14  */
 15 
 16 #include <linux/export.h>
 17         .globl csum_ipv6_magic
 18         .align 4
 19         .ent csum_ipv6_magic
 20         .frame $30,0,$26,0
 21 csum_ipv6_magic:
 22         .prologue 0
 23 
 24         ldq_u   $0,0($16)       # e0    : load src & dst addr words
 25         zapnot  $20,15,$20      # .. e1 : zero extend incoming csum
 26         extqh   $18,1,$4        # e0    : byte swap len & proto while we wait
 27         ldq_u   $21,7($16)      # .. e1 : handle misalignment
 28 
 29         extbl   $18,1,$5        # e0    :
 30         ldq_u   $1,8($16)       # .. e1 :
 31         extbl   $18,2,$6        # e0    :
 32         ldq_u   $22,15($16)     # .. e1 :
 33 
 34         extbl   $18,3,$18       # e0    :
 35         ldq_u   $2,0($17)       # .. e1 :
 36         sra     $4,32,$4        # e0    :
 37         ldq_u   $23,7($17)      # .. e1 :
 38 
 39         extql   $0,$16,$0       # e0    :
 40         ldq_u   $3,8($17)       # .. e1 :
 41         extqh   $21,$16,$21     # e0    :
 42         ldq_u   $24,15($17)     # .. e1 :
 43 
 44         sll     $5,16,$5        # e0    :
 45         or      $0,$21,$0       # .. e1 : 1st src word complete
 46         extql   $1,$16,$1       # e0    :
 47         addq    $20,$0,$20      # .. e1 : begin summing the words
 48 
 49         extqh   $22,$16,$22     # e0    :
 50         cmpult  $20,$0,$0       # .. e1 :
 51         sll     $6,8,$6         # e0    :
 52         or      $1,$22,$1       # .. e1 : 2nd src word complete
 53 
 54         extql   $2,$17,$2       # e0    :
 55         or      $4,$18,$18      # .. e1 :
 56         extqh   $23,$17,$23     # e0    :
 57         or      $5,$6,$5        # .. e1 :
 58 
 59         extql   $3,$17,$3       # e0    :
 60         or      $2,$23,$2       # .. e1 : 1st dst word complete
 61         extqh   $24,$17,$24     # e0    :
 62         or      $18,$5,$18      # .. e1 : len complete
 63 
 64         extwh   $19,7,$7        # e0    :
 65         or      $3,$24,$3       # .. e1 : 2nd dst word complete
 66         extbl   $19,1,$19       # e0    :
 67         addq    $20,$1,$20      # .. e1 :
 68 
 69         or      $19,$7,$19      # e0    :
 70         cmpult  $20,$1,$1       # .. e1 :
 71         sll     $19,48,$19      # e0    :
 72         nop                     # .. e0 :
 73 
 74         sra     $19,32,$19      # e0    : proto complete
 75         addq    $20,$2,$20      # .. e1 :
 76         cmpult  $20,$2,$2       # e0    :
 77         addq    $20,$3,$20      # .. e1 :
 78 
 79         cmpult  $20,$3,$3       # e0    :
 80         addq    $20,$18,$20     # .. e1 :
 81         cmpult  $20,$18,$18     # e0    :
 82         addq    $20,$19,$20     # .. e1 :
 83 
 84         cmpult  $20,$19,$19     # e0    :
 85         addq    $0,$1,$0        # .. e1 : merge the carries back into the csum
 86         addq    $2,$3,$2        # e0    :
 87         addq    $18,$19,$18     # .. e1 :
 88 
 89         addq    $0,$2,$0        # e0    :
 90         addq    $20,$18,$20     # .. e1 :
 91         addq    $0,$20,$0       # e0    :
 92         unop                    #       :
 93 
 94         extwl   $0,2,$2         # e0    : begin folding the 64-bit value
 95         zapnot  $0,3,$3         # .. e1 :
 96         extwl   $0,4,$1         # e0    :
 97         addq    $2,$3,$3        # .. e1 :
 98 
 99         extwl   $0,6,$0         # e0    :
100         addq    $3,$1,$3        # .. e1 :
101         addq    $0,$3,$0        # e0    :
102         unop                    #       :
103 
104         extwl   $0,2,$1         # e0    : fold 18-bit value
105         zapnot  $0,3,$0         # .. e1 :
106         addq    $0,$1,$0        # e0    :
107         unop                    #       :
108 
109         extwl   $0,2,$1         # e0    : fold 17-bit value
110         zapnot  $0,3,$0         # .. e1 :
111         addq    $0,$1,$0        # e0    :
112         not     $0,$0           # .. e1 : and complement.
113 
114         zapnot  $0,3,$0         # e0    :
115         ret                     # .. e1 :
116 
117         .end csum_ipv6_magic
118         EXPORT_SYMBOL(csum_ipv6_magic)

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