aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/lib/uaccess64.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/s390/lib/uaccess64.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/s390/lib/uaccess64.S')
-rw-r--r--arch/s390/lib/uaccess64.S206
1 files changed, 206 insertions, 0 deletions
diff --git a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S
new file mode 100644
index 000000000000..0ca56972f4f0
--- /dev/null
+++ b/arch/s390/lib/uaccess64.S
@@ -0,0 +1,206 @@
1/*
2 * arch/s390x/lib/uaccess.S
3 * __copy_{from|to}_user functions.
4 *
5 * s390
6 * Copyright (C) 2000,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Authors(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8 *
9 * These functions have standard call interface
10 */
11
12#include <linux/errno.h>
13#include <asm/lowcore.h>
14#include <asm/offsets.h>
15
16 .text
17 .align 4
18 .globl __copy_from_user_asm
19 # %r2 = to, %r3 = n, %r4 = from
20__copy_from_user_asm:
21 slgr %r0,%r0
220: mvcp 0(%r3,%r2),0(%r4),%r0
23 jnz 1f
24 slgr %r2,%r2
25 br %r14
261: la %r2,256(%r2)
27 la %r4,256(%r4)
28 aghi %r3,-256
292: mvcp 0(%r3,%r2),0(%r4),%r0
30 jnz 1b
313: slgr %r2,%r2
32 br %r14
334: lghi %r0,-4096
34 lgr %r5,%r4
35 slgr %r5,%r0
36 ngr %r5,%r0 # %r5 = (%r4 + 4096) & -4096
37 slgr %r5,%r4 # %r5 = #bytes to next user page boundary
38 clgr %r3,%r5 # copy crosses next page boundary ?
39 jnh 6f # no, the current page faulted
40 # move with the reduced length which is < 256
415: mvcp 0(%r5,%r2),0(%r4),%r0
42 slgr %r3,%r5
436: lgr %r2,%r3
44 br %r14
45 .section __ex_table,"a"
46 .quad 0b,4b
47 .quad 2b,4b
48 .quad 5b,6b
49 .previous
50
51 .align 4
52 .text
53 .globl __copy_to_user_asm
54 # %r2 = from, %r3 = n, %r4 = to
55__copy_to_user_asm:
56 slgr %r0,%r0
570: mvcs 0(%r3,%r4),0(%r2),%r0
58 jnz 1f
59 slgr %r2,%r2
60 br %r14
611: la %r2,256(%r2)
62 la %r4,256(%r4)
63 aghi %r3,-256
642: mvcs 0(%r3,%r4),0(%r2),%r0
65 jnz 1b
663: slgr %r2,%r2
67 br %r14
684: lghi %r0,-4096
69 lgr %r5,%r4
70 slgr %r5,%r0
71 ngr %r5,%r0 # %r5 = (%r4 + 4096) & -4096
72 slgr %r5,%r4 # %r5 = #bytes to next user page boundary
73 clgr %r3,%r5 # copy crosses next page boundary ?
74 jnh 6f # no, the current page faulted
75 # move with the reduced length which is < 256
765: mvcs 0(%r5,%r4),0(%r2),%r0
77 slgr %r3,%r5
786: lgr %r2,%r3
79 br %r14
80 .section __ex_table,"a"
81 .quad 0b,4b
82 .quad 2b,4b
83 .quad 5b,6b
84 .previous
85
86 .align 4
87 .text
88 .globl __copy_in_user_asm
89 # %r2 = from, %r3 = n, %r4 = to
90__copy_in_user_asm:
91 sacf 256
92 bras 1,1f
93 mvc 0(1,%r4),0(%r2)
940: mvc 0(256,%r4),0(%r2)
95 la %r2,256(%r2)
96 la %r4,256(%r4)
971: aghi %r3,-256
98 jnm 0b
992: ex %r3,0(%r1)
100 sacf 0
101 slgr %r2,%r2
102 br 14
1033: mvc 0(1,%r4),0(%r2)
104 la %r2,1(%r2)
105 la %r4,1(%r4)
106 aghi %r3,-1
107 jnm 3b
1084: lgr %r2,%r3
109 sacf 0
110 br %r14
111 .section __ex_table,"a"
112 .quad 0b,3b
113 .quad 2b,3b
114 .quad 3b,4b
115 .previous
116
117 .align 4
118 .text
119 .globl __clear_user_asm
120 # %r2 = to, %r3 = n
121__clear_user_asm:
122 slgr %r0,%r0
123 larl %r5,empty_zero_page
1241: mvcs 0(%r3,%r2),0(%r5),%r0
125 jnz 2f
126 slgr %r2,%r2
127 br %r14
1282: la %r2,256(%r2)
129 aghi %r3,-256
1303: mvcs 0(%r3,%r2),0(%r5),%r0
131 jnz 2b
1324: slgr %r2,%r2
133 br %r14
1345: lghi %r0,-4096
135 lgr %r4,%r2
136 slgr %r4,%r0
137 ngr %r4,%r0 # %r4 = (%r2 + 4096) & -4096
138 slgr %r4,%r2 # %r4 = #bytes to next user page boundary
139 clgr %r3,%r4 # clear crosses next page boundary ?
140 jnh 7f # no, the current page faulted
141 # clear with the reduced length which is < 256
1426: mvcs 0(%r4,%r2),0(%r5),%r0
143 slgr %r3,%r4
1447: lgr %r2,%r3
145 br %r14
146 .section __ex_table,"a"
147 .quad 1b,5b
148 .quad 3b,5b
149 .quad 6b,7b
150 .previous
151
152 .align 4
153 .text
154 .globl __strncpy_from_user_asm
155 # %r2 = count, %r3 = dst, %r4 = src
156__strncpy_from_user_asm:
157 lghi %r0,0
158 lgr %r1,%r4
159 la %r2,0(%r2,%r4) # %r2 points to first byte after string
160 sacf 256
1610: srst %r2,%r1
162 jo 0b
163 sacf 0
164 lgr %r1,%r2
165 jh 1f # \0 found in string ?
166 aghi %r1,1 # include \0 in copy
1671: slgr %r1,%r4 # %r1 = copy length (without \0)
168 slgr %r2,%r4 # %r2 = return length (including \0)
1692: mvcp 0(%r1,%r3),0(%r4),%r0
170 jnz 3f
171 br %r14
1723: la %r3,256(%r3)
173 la %r4,256(%r4)
174 aghi %r1,-256
175 mvcp 0(%r1,%r3),0(%r4),%r0
176 jnz 3b
177 br %r14
1784: sacf 0
179 lghi %r2,-EFAULT
180 br %r14
181 .section __ex_table,"a"
182 .quad 0b,4b
183 .previous
184
185 .align 4
186 .text
187 .globl __strnlen_user_asm
188 # %r2 = count, %r3 = src
189__strnlen_user_asm:
190 lghi %r0,0
191 lgr %r1,%r3
192 la %r2,0(%r2,%r3) # %r2 points to first byte after string
193 sacf 256
1940: srst %r2,%r1
195 jo 0b
196 sacf 0
197 jh 1f # \0 found in string ?
198 aghi %r2,1 # strnlen_user result includes the \0
1991: slgr %r2,%r3
200 br %r14
2012: sacf 0
202 lghi %r2,-EFAULT
203 br %r14
204 .section __ex_table,"a"
205 .quad 0b,2b
206 .previous