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/page_types.h>
30 #include <asm/errno.h>
31 #include <asm/asm-offsets.h>
32 #include <asm/thread_info.h>
35 #include <asm/export.h>
39 mov PER_CPU_VAR(current_task), %_ASM_DX
40 cmp TASK_addr_limit(%_ASM_DX),%_ASM_AX
43 1: movzbl (%_ASM_AX),%edx
48 EXPORT_SYMBOL(__get_user_1)
53 mov PER_CPU_VAR(current_task), %_ASM_DX
54 cmp TASK_addr_limit(%_ASM_DX),%_ASM_AX
57 2: movzwl -1(%_ASM_AX),%edx
62 EXPORT_SYMBOL(__get_user_2)
67 mov PER_CPU_VAR(current_task), %_ASM_DX
68 cmp TASK_addr_limit(%_ASM_DX),%_ASM_AX
71 3: movl -3(%_ASM_AX),%edx
76 EXPORT_SYMBOL(__get_user_4)
82 mov PER_CPU_VAR(current_task), %_ASM_DX
83 cmp TASK_addr_limit(%_ASM_DX),%_ASM_AX
86 4: movq -7(%_ASM_AX),%rdx
93 mov PER_CPU_VAR(current_task), %_ASM_DX
94 cmp TASK_addr_limit(%_ASM_DX),%_ASM_AX
97 4: movl -7(%_ASM_AX),%edx
98 5: movl -3(%_ASM_AX),%ecx
103 ENDPROC(__get_user_8)
104 EXPORT_SYMBOL(__get_user_8)
109 mov $(-EFAULT),%_ASM_AX
118 mov $(-EFAULT),%_ASM_AX
124 _ASM_EXTABLE(1b,bad_get_user)
125 _ASM_EXTABLE(2b,bad_get_user)
126 _ASM_EXTABLE(3b,bad_get_user)
128 _ASM_EXTABLE(4b,bad_get_user)
130 _ASM_EXTABLE(4b,bad_get_user_8)
131 _ASM_EXTABLE(5b,bad_get_user_8)