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/dwarf2.h>
15 #include <asm/thread_info.h>
16 #include <asm/errno.h>
23 * Inputs: %eax[:%edx] contains the data
24 * %ecx contains the address
26 * Outputs: %eax is error code (0 or -EFAULT)
28 * These functions should not modify any other registers,
29 * as they get called from within inline assembly.
32 #define ENTER CFI_STARTPROC ; \
33 GET_THREAD_INFO(%_ASM_BX)
40 cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
42 1: movb %al,(%_ASM_CX)
49 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
53 2: movw %ax,(%_ASM_CX)
60 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
64 3: movl %eax,(%_ASM_CX)
71 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
75 4: mov %_ASM_AX,(%_ASM_CX)
77 5: movl %edx,4(%_ASM_CX)
89 .section __ex_table,"a"
90 _ASM_PTR 1b,bad_put_user
91 _ASM_PTR 2b,bad_put_user
92 _ASM_PTR 3b,bad_put_user
93 _ASM_PTR 4b,bad_put_user
95 _ASM_PTR 5b,bad_put_user