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

TOMOYO Linux Cross Reference
Linux/arch/arm/lib/copy_from_user.S

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  *  linux/arch/arm/lib/copy_from_user.S
  4  *
  5  *  Author:     Nicolas Pitre
  6  *  Created:    Sep 29, 2005
  7  *  Copyright:  MontaVista Software, Inc.
  8  */
  9 
 10 #include <linux/linkage.h>
 11 #include <asm/assembler.h>
 12 #include <asm/unwind.h>
 13 
 14 /*
 15  * Prototype:
 16  *
 17  *      size_t arm_copy_from_user(void *to, const void *from, size_t n)
 18  *
 19  * Purpose:
 20  *
 21  *      copy a block to kernel memory from user memory
 22  *
 23  * Params:
 24  *
 25  *      to = kernel memory
 26  *      from = user memory
 27  *      n = number of bytes to copy
 28  *
 29  * Return value:
 30  *
 31  *      Number of bytes NOT copied.
 32  */
 33 
 34 #ifdef CONFIG_CPU_USE_DOMAINS
 35 
 36 #ifndef CONFIG_THUMB2_KERNEL
 37 #define LDR1W_SHIFT     0
 38 #else
 39 #define LDR1W_SHIFT     1
 40 #endif
 41 
 42         .macro ldr1w ptr reg abort
 43         ldrusr  \reg, \ptr, 4, abort=\abort
 44         .endm
 45 
 46         .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
 47         ldr1w \ptr, \reg1, \abort
 48         ldr1w \ptr, \reg2, \abort
 49         ldr1w \ptr, \reg3, \abort
 50         ldr1w \ptr, \reg4, \abort
 51         .endm
 52 
 53         .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
 54         ldr4w \ptr, \reg1, \reg2, \reg3, \reg4, \abort
 55         ldr4w \ptr, \reg5, \reg6, \reg7, \reg8, \abort
 56         .endm
 57 
 58 #else
 59 
 60 #define LDR1W_SHIFT     0
 61 
 62         .macro ldr1w ptr reg abort
 63         USERL(\abort, W(ldr) \reg, [\ptr], #4)
 64         .endm
 65 
 66         .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
 67         USERL(\abort, ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4})
 68         .endm
 69 
 70         .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
 71         USERL(\abort, ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8})
 72         .endm
 73 
 74 #endif /* CONFIG_CPU_USE_DOMAINS */
 75 
 76         .macro ldr1b ptr reg cond=al abort
 77         ldrusr  \reg, \ptr, 1, \cond, abort=\abort
 78         .endm
 79 
 80 #define STR1W_SHIFT     0
 81 
 82         .macro str1w ptr reg abort
 83         W(str) \reg, [\ptr], #4
 84         .endm
 85 
 86         .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
 87         stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
 88         .endm
 89 
 90         .macro str1b ptr reg cond=al abort
 91         strb\cond \reg, [\ptr], #1
 92         .endm
 93 
 94         .macro enter regs:vararg
 95         mov     r3, #0
 96 UNWIND( .save   {r0, r2, r3, \regs}             )
 97         stmdb   sp!, {r0, r2, r3, \regs}
 98         .endm
 99 
100         .macro exit regs:vararg
101         add     sp, sp, #8
102         ldmfd   sp!, {r0, \regs}
103         .endm
104 
105         .text
106 
107 ENTRY(arm_copy_from_user)
108 #ifdef CONFIG_CPU_SPECTRE
109         ldr     r3, =TASK_SIZE
110         uaccess_mask_range_ptr r1, r2, r3, ip
111 #endif
112 
113 #include "copy_template.S"
114 
115 ENDPROC(arm_copy_from_user)
116 
117         .pushsection .text.fixup,"ax"
118         .align 0
119         copy_abort_preamble
120         ldmfd   sp!, {r1, r2, r3}
121         sub     r0, r0, r1
122         rsb     r0, r0, r2
123         copy_abort_end
124         .popsection
125 

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