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

TOMOYO Linux Cross Reference
Linux/arch/sparc/lib/copy_in_user.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 /* copy_in_user.S: Copy from userspace to userspace.
  3  *
  4  * Copyright (C) 1999, 2000, 2004 David S. Miller (davem@redhat.com)
  5  */
  6 
  7 #include <linux/export.h>
  8 #include <linux/linkage.h>
  9 #include <asm/asi.h>
 10 
 11 #define XCC xcc
 12 
 13 #define EX(x,y,z)               \
 14 98:     x,y;                    \
 15         .section __ex_table,"a";\
 16         .align 4;               \
 17         .word 98b, z;           \
 18         .text;                  \
 19         .align 4;
 20 
 21 #define EX_O4(x,y) EX(x,y,__retl_o4_plus_8)
 22 #define EX_O2_4(x,y) EX(x,y,__retl_o2_plus_4)
 23 #define EX_O2_1(x,y) EX(x,y,__retl_o2_plus_1)
 24 
 25         .register       %g2,#scratch
 26         .register       %g3,#scratch
 27 
 28         .text
 29 __retl_o4_plus_8:
 30         add     %o4, %o2, %o4
 31         retl
 32          add    %o4, 8, %o0
 33 __retl_o2_plus_4:
 34         retl
 35          add    %o2, 4, %o0
 36 __retl_o2_plus_1:
 37         retl
 38          add    %o2, 1, %o0
 39 
 40         .align  32
 41 
 42         /* Don't try to get too fancy here, just nice and
 43          * simple.  This is predominantly used for well aligned
 44          * small copies in the compat layer.  It is also used
 45          * to copy register windows around during thread cloning.
 46          */
 47 
 48 ENTRY(raw_copy_in_user) /* %o0=dst, %o1=src, %o2=len */
 49         cmp             %o2, 0
 50         be,pn           %XCC, 85f
 51          or             %o0, %o1, %o3
 52         cmp             %o2, 16
 53         bleu,a,pn       %XCC, 80f
 54          or             %o3, %o2, %o3
 55 
 56         /* 16 < len <= 64 */
 57         andcc           %o3, 0x7, %g0
 58         bne,pn          %XCC, 90f
 59          nop
 60 
 61         andn            %o2, 0x7, %o4
 62         and             %o2, 0x7, %o2
 63 1:      subcc           %o4, 0x8, %o4
 64         EX_O4(ldxa [%o1] %asi, %o5)
 65         EX_O4(stxa %o5, [%o0] %asi)
 66         add             %o1, 0x8, %o1
 67         bgu,pt          %XCC, 1b
 68          add            %o0, 0x8, %o0
 69         andcc           %o2, 0x4, %g0
 70         be,pt           %XCC, 1f
 71          nop
 72         sub             %o2, 0x4, %o2
 73         EX_O2_4(lduwa [%o1] %asi, %o5)
 74         EX_O2_4(stwa %o5, [%o0] %asi)
 75         add             %o1, 0x4, %o1
 76         add             %o0, 0x4, %o0
 77 1:      cmp             %o2, 0
 78         be,pt           %XCC, 85f
 79          nop
 80         ba,pt           %xcc, 90f
 81          nop
 82 
 83 80:     /* 0 < len <= 16 */
 84         andcc           %o3, 0x3, %g0
 85         bne,pn          %XCC, 90f
 86          nop
 87 
 88 82:
 89         subcc           %o2, 4, %o2
 90         EX_O2_4(lduwa [%o1] %asi, %g1)
 91         EX_O2_4(stwa %g1, [%o0] %asi)
 92         add             %o1, 4, %o1
 93         bgu,pt          %XCC, 82b
 94          add            %o0, 4, %o0
 95 
 96 85:     retl
 97          clr            %o0
 98 
 99         .align  32
100 90:
101         subcc           %o2, 1, %o2
102         EX_O2_1(lduba [%o1] %asi, %g1)
103         EX_O2_1(stba %g1, [%o0] %asi)
104         add             %o1, 1, %o1
105         bgu,pt          %XCC, 90b
106          add            %o0, 1, %o0
107         retl
108          clr            %o0
109 ENDPROC(raw_copy_in_user)
110 EXPORT_SYMBOL(raw_copy_in_user)

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