2 * __put_user functions.
4 * (C) Copyright 2005 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"
13 #include <linux/linkage.h>
14 #include <asm/thread_info.h>
15 #include <asm/errno.h>
18 #include <asm/export.h>
24 * Inputs: %eax[:%edx] contains the data
25 * %ecx contains the address
27 * Outputs: %eax is error code (0 or -EFAULT)
29 * These functions should not modify any other registers,
30 * as they get called from within inline assembly.
33 #define ENTER mov PER_CPU_VAR(current_task), %_ASM_BX
34 #define EXIT ASM_CLAC ; \
40 cmp TASK_addr_limit(%_ASM_BX),%_ASM_CX
43 1: movb %al,(%_ASM_CX)
47 EXPORT_SYMBOL(__put_user_1)
51 mov TASK_addr_limit(%_ASM_BX),%_ASM_BX
56 2: movw %ax,(%_ASM_CX)
60 EXPORT_SYMBOL(__put_user_2)
64 mov TASK_addr_limit(%_ASM_BX),%_ASM_BX
69 3: movl %eax,(%_ASM_CX)
73 EXPORT_SYMBOL(__put_user_4)
77 mov TASK_addr_limit(%_ASM_BX),%_ASM_BX
82 4: mov %_ASM_AX,(%_ASM_CX)
84 5: movl %edx,4(%_ASM_CX)
89 EXPORT_SYMBOL(__put_user_8)
96 _ASM_EXTABLE(1b,bad_put_user)
97 _ASM_EXTABLE(2b,bad_put_user)
98 _ASM_EXTABLE(3b,bad_put_user)
99 _ASM_EXTABLE(4b,bad_put_user)
101 _ASM_EXTABLE(5b,bad_put_user)