2 * __get_user functions.
4 * (C) Copyright 1998 Linus Torvalds
5 * (C) Copyright 2005 Andi Kleen
6 * (C) Copyright 2008 Glauber Costa
8 * These functions have a non-standard call interface
9 * to make them more efficient, especially as they
10 * return an error value in addition to the "real"
17 * Inputs: %[r|e]ax contains the address.
19 * Outputs: %[r|e]ax is error code (0 or -EFAULT)
20 * %[r|e]dx contains zero-extended value
21 * %ecx contains the high half for 32-bit __get_user_8
24 * These functions should not modify any other registers,
25 * as they get called from within inline assembly.
28 #include <linux/linkage.h>
29 #include <asm/dwarf2.h>
30 #include <asm/page_types.h>
31 #include <asm/errno.h>
32 #include <asm/asm-offsets.h>
33 #include <asm/thread_info.h>
40 GET_THREAD_INFO(%_ASM_DX)
41 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
44 1: movzbl (%_ASM_AX),%edx
55 GET_THREAD_INFO(%_ASM_DX)
56 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
59 2: movzwl -1(%_ASM_AX),%edx
70 GET_THREAD_INFO(%_ASM_DX)
71 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
74 3: movl -3(%_ASM_AX),%edx
86 GET_THREAD_INFO(%_ASM_DX)
87 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
90 4: movq -7(%_ASM_AX),%rdx
97 GET_THREAD_INFO(%_ASM_DX)
98 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
101 4: movl -7(%_ASM_AX),%edx
102 5: movl -3(%_ASM_AX),%ecx
108 ENDPROC(__get_user_8)
114 mov $(-EFAULT),%_ASM_AX
125 mov $(-EFAULT),%_ASM_AX
132 _ASM_EXTABLE(1b,bad_get_user)
133 _ASM_EXTABLE(2b,bad_get_user)
134 _ASM_EXTABLE(3b,bad_get_user)
136 _ASM_EXTABLE(4b,bad_get_user)
138 _ASM_EXTABLE(4b,bad_get_user_8)
139 _ASM_EXTABLE(5b,bad_get_user_8)