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>
38 GET_THREAD_INFO(%_ASM_DX)
39 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
42 1: movzbl (%_ASM_AX),%edx
51 GET_THREAD_INFO(%_ASM_DX)
52 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
55 2: movzwl -1(%_ASM_AX),%edx
64 GET_THREAD_INFO(%_ASM_DX)
65 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
68 3: movl -3(%_ASM_AX),%edx
78 GET_THREAD_INFO(%_ASM_DX)
79 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
82 4: movq -7(%_ASM_AX),%rdx
89 GET_THREAD_INFO(%_ASM_DX)
90 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
93 4: movl -7(%_ASM_AX),%edx
94 5: movl -3(%_ASM_AX),%ecx
104 mov $(-EFAULT),%_ASM_AX
113 mov $(-EFAULT),%_ASM_AX
119 _ASM_EXTABLE(1b,bad_get_user)
120 _ASM_EXTABLE(2b,bad_get_user)
121 _ASM_EXTABLE(3b,bad_get_user)
123 _ASM_EXTABLE(4b,bad_get_user)
125 _ASM_EXTABLE(4b,bad_get_user_8)
126 _ASM_EXTABLE(5b,bad_get_user_8)