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

TOMOYO Linux Cross Reference
Linux/arch/m68k/lib/uaccess.c

Version: ~ [ linux-5.10-rc5 ] ~ [ linux-5.9.10 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.79 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.159 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.208 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.245 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.245 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * This file is subject to the terms and conditions of the GNU General Public
  3  * License.  See the file COPYING in the main directory of this archive
  4  * for more details.
  5  */
  6 
  7 #include <linux/module.h>
  8 #include <linux/uaccess.h>
  9 
 10 unsigned long __generic_copy_from_user(void *to, const void __user *from,
 11                                        unsigned long n)
 12 {
 13         unsigned long tmp, res;
 14 
 15         asm volatile ("\n"
 16                 "       tst.l   %0\n"
 17                 "       jeq     2f\n"
 18                 "1:     "MOVES".l       (%1)+,%3\n"
 19                 "       move.l  %3,(%2)+\n"
 20                 "       subq.l  #1,%0\n"
 21                 "       jne     1b\n"
 22                 "2:     btst    #1,%5\n"
 23                 "       jeq     4f\n"
 24                 "3:     "MOVES".w       (%1)+,%3\n"
 25                 "       move.w  %3,(%2)+\n"
 26                 "4:     btst    #0,%5\n"
 27                 "       jeq     6f\n"
 28                 "5:     "MOVES".b       (%1)+,%3\n"
 29                 "       move.b  %3,(%2)+\n"
 30                 "6:\n"
 31                 "       .section .fixup,\"ax\"\n"
 32                 "       .even\n"
 33                 "10:    lsl.l   #2,%0\n"
 34                 "       btst    #1,%5\n"
 35                 "       jeq     8f\n"
 36                 "30:    addq.l  #2,%0\n"
 37                 "8:     btst    #0,%5\n"
 38                 "       jeq     6b\n"
 39                 "50:    addq.l  #1,%0\n"
 40                 "       jra     6b\n"
 41                 "       .previous\n"
 42                 "\n"
 43                 "       .section __ex_table,\"a\"\n"
 44                 "       .align  4\n"
 45                 "       .long   1b,10b\n"
 46                 "       .long   3b,30b\n"
 47                 "       .long   5b,50b\n"
 48                 "       .previous"
 49                 : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
 50                 : "" (n / 4), "d" (n & 3));
 51 
 52         return res;
 53 }
 54 EXPORT_SYMBOL(__generic_copy_from_user);
 55 
 56 unsigned long __generic_copy_to_user(void __user *to, const void *from,
 57                                      unsigned long n)
 58 {
 59         unsigned long tmp, res;
 60 
 61         asm volatile ("\n"
 62                 "       tst.l   %0\n"
 63                 "       jeq     4f\n"
 64                 "1:     move.l  (%1)+,%3\n"
 65                 "2:     "MOVES".l       %3,(%2)+\n"
 66                 "3:     subq.l  #1,%0\n"
 67                 "       jne     1b\n"
 68                 "4:     btst    #1,%5\n"
 69                 "       jeq     6f\n"
 70                 "       move.w  (%1)+,%3\n"
 71                 "5:     "MOVES".w       %3,(%2)+\n"
 72                 "6:     btst    #0,%5\n"
 73                 "       jeq     8f\n"
 74                 "       move.b  (%1)+,%3\n"
 75                 "7:     "MOVES".b  %3,(%2)+\n"
 76                 "8:\n"
 77                 "       .section .fixup,\"ax\"\n"
 78                 "       .even\n"
 79                 "20:    lsl.l   #2,%0\n"
 80                 "50:    add.l   %5,%0\n"
 81                 "       jra     8b\n"
 82                 "       .previous\n"
 83                 "\n"
 84                 "       .section __ex_table,\"a\"\n"
 85                 "       .align  4\n"
 86                 "       .long   2b,20b\n"
 87                 "       .long   3b,20b\n"
 88                 "       .long   5b,50b\n"
 89                 "       .long   6b,50b\n"
 90                 "       .long   7b,50b\n"
 91                 "       .long   8b,50b\n"
 92                 "       .previous"
 93                 : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
 94                 : "" (n / 4), "d" (n & 3));
 95 
 96         return res;
 97 }
 98 EXPORT_SYMBOL(__generic_copy_to_user);
 99 
100 /*
101  * Zero Userspace
102  */
103 
104 unsigned long __clear_user(void __user *to, unsigned long n)
105 {
106         unsigned long res;
107 
108         asm volatile ("\n"
109                 "       tst.l   %0\n"
110                 "       jeq     3f\n"
111                 "1:     "MOVES".l       %2,(%1)+\n"
112                 "2:     subq.l  #1,%0\n"
113                 "       jne     1b\n"
114                 "3:     btst    #1,%4\n"
115                 "       jeq     5f\n"
116                 "4:     "MOVES".w       %2,(%1)+\n"
117                 "5:     btst    #0,%4\n"
118                 "       jeq     7f\n"
119                 "6:     "MOVES".b       %2,(%1)\n"
120                 "7:\n"
121                 "       .section .fixup,\"ax\"\n"
122                 "       .even\n"
123                 "10:    lsl.l   #2,%0\n"
124                 "40:    add.l   %4,%0\n"
125                 "       jra     7b\n"
126                 "       .previous\n"
127                 "\n"
128                 "       .section __ex_table,\"a\"\n"
129                 "       .align  4\n"
130                 "       .long   1b,10b\n"
131                 "       .long   2b,10b\n"
132                 "       .long   4b,40b\n"
133                 "       .long   5b,40b\n"
134                 "       .long   6b,40b\n"
135                 "       .long   7b,40b\n"
136                 "       .previous"
137                 : "=d" (res), "+a" (to)
138                 : "d" (0), "" (n / 4), "d" (n & 3));
139 
140     return res;
141 }
142 EXPORT_SYMBOL(__clear_user);
143 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp