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.
18 * The register is modified, but all changes are undone
19 * before returning because the C code doesn't know about it.
21 * Outputs: %[r|e]ax is error code (0 or -EFAULT)
22 * %[r|e]dx contains zero-extended value
25 * These functions should not modify any other registers,
26 * as they get called from within inline assembly.
29 #include <linux/linkage.h>
30 #include <asm/dwarf2.h>
31 #include <asm/page_types.h>
32 #include <asm/errno.h>
33 #include <asm/asm-offsets.h>
34 #include <asm/thread_info.h>
41 GET_THREAD_INFO(%_ASM_DX)
42 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
45 1: movzb (%_ASM_AX),%edx
56 GET_THREAD_INFO(%_ASM_DX)
57 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
60 2: movzwl -1(%_ASM_AX),%edx
71 GET_THREAD_INFO(%_ASM_DX)
72 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
75 3: mov -3(%_ASM_AX),%edx
87 GET_THREAD_INFO(%_ASM_DX)
88 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
91 4: movq -7(%_ASM_AX),%_ASM_DX
102 mov $(-EFAULT),%_ASM_AX
108 _ASM_EXTABLE(1b,bad_get_user)
109 _ASM_EXTABLE(2b,bad_get_user)
110 _ASM_EXTABLE(3b,bad_get_user)
112 _ASM_EXTABLE(4b,bad_get_user)