aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/lib/getuser.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/i386/lib/getuser.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/i386/lib/getuser.S')
-rw-r--r--arch/i386/lib/getuser.S70
1 files changed, 70 insertions, 0 deletions
diff --git a/arch/i386/lib/getuser.S b/arch/i386/lib/getuser.S
new file mode 100644
index 000000000000..62d7f178a326
--- /dev/null
+++ b/arch/i386/lib/getuser.S
@@ -0,0 +1,70 @@
1/*
2 * __get_user functions.
3 *
4 * (C) Copyright 1998 Linus Torvalds
5 *
6 * These functions have a non-standard call interface
7 * to make them more efficient, especially as they
8 * return an error value in addition to the "real"
9 * return value.
10 */
11#include <asm/thread_info.h>
12
13
14/*
15 * __get_user_X
16 *
17 * Inputs: %eax contains the address
18 *
19 * Outputs: %eax is error code (0 or -EFAULT)
20 * %edx contains zero-extended value
21 *
22 * These functions should not modify any other registers,
23 * as they get called from within inline assembly.
24 */
25
26.text
27.align 4
28.globl __get_user_1
29__get_user_1:
30 GET_THREAD_INFO(%edx)
31 cmpl TI_addr_limit(%edx),%eax
32 jae bad_get_user
331: movzbl (%eax),%edx
34 xorl %eax,%eax
35 ret
36
37.align 4
38.globl __get_user_2
39__get_user_2:
40 addl $1,%eax
41 jc bad_get_user
42 GET_THREAD_INFO(%edx)
43 cmpl TI_addr_limit(%edx),%eax
44 jae bad_get_user
452: movzwl -1(%eax),%edx
46 xorl %eax,%eax
47 ret
48
49.align 4
50.globl __get_user_4
51__get_user_4:
52 addl $3,%eax
53 jc bad_get_user
54 GET_THREAD_INFO(%edx)
55 cmpl TI_addr_limit(%edx),%eax
56 jae bad_get_user
573: movl -3(%eax),%edx
58 xorl %eax,%eax
59 ret
60
61bad_get_user:
62 xorl %edx,%edx
63 movl $-14,%eax
64 ret
65
66.section __ex_table,"a"
67 .long 1b,bad_get_user
68 .long 2b,bad_get_user
69 .long 3b,bad_get_user
70.previous