Pull thermal into release branch
[linux-drm-fsl-dcu.git] / arch / i386 / lib / getuser.S
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 <linux/linkage.h>
12 #include <asm/dwarf2.h>
13 #include <asm/thread_info.h>
14
15
16 /*
17  * __get_user_X
18  *
19  * Inputs:      %eax contains the address
20  *
21  * Outputs:     %eax is error code (0 or -EFAULT)
22  *              %edx contains zero-extended value
23  *
24  * These functions should not modify any other registers,
25  * as they get called from within inline assembly.
26  */
27
28 .text
29 ENTRY(__get_user_1)
30         CFI_STARTPROC
31         GET_THREAD_INFO(%edx)
32         cmpl TI_addr_limit(%edx),%eax
33         jae bad_get_user
34 1:      movzbl (%eax),%edx
35         xorl %eax,%eax
36         ret
37         CFI_ENDPROC
38 ENDPROC(__get_user_1)
39
40 ENTRY(__get_user_2)
41         CFI_STARTPROC
42         addl $1,%eax
43         jc bad_get_user
44         GET_THREAD_INFO(%edx)
45         cmpl TI_addr_limit(%edx),%eax
46         jae bad_get_user
47 2:      movzwl -1(%eax),%edx
48         xorl %eax,%eax
49         ret
50         CFI_ENDPROC
51 ENDPROC(__get_user_2)
52
53 ENTRY(__get_user_4)
54         CFI_STARTPROC
55         addl $3,%eax
56         jc bad_get_user
57         GET_THREAD_INFO(%edx)
58         cmpl TI_addr_limit(%edx),%eax
59         jae bad_get_user
60 3:      movl -3(%eax),%edx
61         xorl %eax,%eax
62         ret
63         CFI_ENDPROC
64 ENDPROC(__get_user_4)
65
66 bad_get_user:
67         CFI_STARTPROC
68         xorl %edx,%edx
69         movl $-14,%eax
70         ret
71         CFI_ENDPROC
72 END(bad_get_user)
73
74 .section __ex_table,"a"
75         .long 1b,bad_get_user
76         .long 2b,bad_get_user
77         .long 3b,bad_get_user
78 .previous