aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/lib/uaccess.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/uaccess.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/uaccess.S')
-rw-r--r--arch/s390/lib/uaccess.S210
1 files changed, 210 insertions, 0 deletions
diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S
new file mode 100644
index 000000000000..e8029ef42ef2
--- /dev/null
+++ b/arch/s390/lib/uaccess.S
@@ -0,0 +1,210 @@
1/*
2 * arch/s390/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 slr %r0,%r0
220: mvcp 0(%r3,%r2),0(%r4),%r0
23 jnz 1f
24 slr %r2,%r2
25 br %r14
261: la %r2,256(%r2)
27 la %r4,256(%r4)
28 ahi %r3,-256
292: mvcp 0(%r3,%r2),0(%r4),%r0
30 jnz 1b
313: slr %r2,%r2
32 br %r14
334: lhi %r0,-4096
34 lr %r5,%r4
35 slr %r5,%r0
36 nr %r5,%r0 # %r5 = (%r4 + 4096) & -4096
37 slr %r5,%r4 # %r5 = #bytes to next user page boundary
38 clr %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 slr %r3,%r5
436: lr %r2,%r3
44 br %r14
45 .section __ex_table,"a"
46 .long 0b,4b
47 .long 2b,4b
48 .long 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 slr %r0,%r0
570: mvcs 0(%r3,%r4),0(%r2),%r0
58 jnz 1f
59 slr %r2,%r2
60 br %r14
611: la %r2,256(%r2)
62 la %r4,256(%r4)
63 ahi %r3,-256
642: mvcs 0(%r3,%r4),0(%r2),%r0
65 jnz 1b
663: slr %r2,%r2
67 br %r14
684: lhi %r0,-4096
69 lr %r5,%r4
70 slr %r5,%r0
71 nr %r5,%r0 # %r5 = (%r4 + 4096) & -4096
72 slr %r5,%r4 # %r5 = #bytes to next user page boundary
73 clr %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 slr %r3,%r5
786: lr %r2,%r3
79 br %r14
80 .section __ex_table,"a"
81 .long 0b,4b
82 .long 2b,4b
83 .long 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: ahi %r3,-256
98 jnm 0b
992: ex %r3,0(%r1)
100 sacf 0
101 slr %r2,%r2
102 br 14
1033: mvc 0(1,%r4),0(%r2)
104 la %r2,1(%r2)
105 la %r4,1(%r4)
106 ahi %r3,-1
107 jnm 3b
1084: lr %r2,%r3
109 sacf 0
110 br %r14
111 .section __ex_table,"a"
112 .long 0b,3b
113 .long 2b,3b
114 .long 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 bras %r5,0f
123 .long empty_zero_page
1240: l %r5,0(%r5)
125 slr %r0,%r0
1261: mvcs 0(%r3,%r2),0(%r5),%r0
127 jnz 2f
128 slr %r2,%r2
129 br %r14
1302: la %r2,256(%r2)
131 ahi %r3,-256
1323: mvcs 0(%r3,%r2),0(%r5),%r0
133 jnz 2b
1344: slr %r2,%r2
135 br %r14
1365: lhi %r0,-4096
137 lr %r4,%r2
138 slr %r4,%r0
139 nr %r4,%r0 # %r4 = (%r2 + 4096) & -4096
140 slr %r4,%r2 # %r4 = #bytes to next user page boundary
141 clr %r3,%r4 # clear crosses next page boundary ?
142 jnh 7f # no, the current page faulted
143 # clear with the reduced length which is < 256
1446: mvcs 0(%r4,%r2),0(%r5),%r0
145 slr %r3,%r4
1467: lr %r2,%r3
147 br %r14
148 .section __ex_table,"a"
149 .long 1b,5b
150 .long 3b,5b
151 .long 6b,7b
152 .previous
153
154 .align 4
155 .text
156 .globl __strncpy_from_user_asm
157 # %r2 = count, %r3 = dst, %r4 = src
158__strncpy_from_user_asm:
159 lhi %r0,0
160 lr %r1,%r4
161 la %r4,0(%r4) # clear high order bit from %r4
162 la %r2,0(%r2,%r4) # %r2 points to first byte after string
163 sacf 256
1640: srst %r2,%r1
165 jo 0b
166 sacf 0
167 lr %r1,%r2
168 jh 1f # \0 found in string ?
169 ahi %r1,1 # include \0 in copy
1701: slr %r1,%r4 # %r1 = copy length (without \0)
171 slr %r2,%r4 # %r2 = return length (including \0)
1722: mvcp 0(%r1,%r3),0(%r4),%r0
173 jnz 3f
174 br %r14
1753: la %r3,256(%r3)
176 la %r4,256(%r4)
177 ahi %r1,-256
178 mvcp 0(%r1,%r3),0(%r4),%r0
179 jnz 3b
180 br %r14
1814: sacf 0
182 lhi %r2,-EFAULT
183 br %r14
184 .section __ex_table,"a"
185 .long 0b,4b
186 .previous
187
188 .align 4
189 .text
190 .globl __strnlen_user_asm
191 # %r2 = count, %r3 = src
192__strnlen_user_asm:
193 lhi %r0,0
194 lr %r1,%r3
195 la %r3,0(%r3) # clear high order bit from %r4
196 la %r2,0(%r2,%r3) # %r2 points to first byte after string
197 sacf 256
1980: srst %r2,%r1
199 jo 0b
200 sacf 0
201 jh 1f # \0 found in string ?
202 ahi %r2,1 # strnlen_user result includes the \0
2031: slr %r2,%r3
204 br %r14
2052: sacf 0
206 lhi %r2,-EFAULT
207 br %r14
208 .section __ex_table,"a"
209 .long 0b,2b
210 .previous