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>
40 GET_THREAD_INFO(%_ASM_DX)
41 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
43 1: movzb (%_ASM_AX),%edx
53 GET_THREAD_INFO(%_ASM_DX)
54 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
56 2: movzwl -1(%_ASM_AX),%edx
66 GET_THREAD_INFO(%_ASM_DX)
67 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
69 3: mov -3(%_ASM_AX),%edx
80 GET_THREAD_INFO(%_ASM_DX)
81 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
83 4: movq -7(%_ASM_AX),%_ASM_DX
93 mov $(-EFAULT),%_ASM_AX
98 .section __ex_table,"a"
99 _ASM_PTR 1b,bad_get_user
100 _ASM_PTR 2b,bad_get_user
101 _ASM_PTR 3b,bad_get_user
103 _ASM_PTR 4b,bad_get_user