2 * __put_user functions.
4 * (C) Copyright 1998 Linus Torvalds
5 * (C) Copyright 2005 Andi Kleen
7 * These functions have a non-standard call interface
8 * to make them more efficient, especially as they
9 * return an error value in addition to the "real"
16 * Inputs: %rcx contains the address
17 * %rdx contains new value
19 * Outputs: %rax is error code (0 or -EFAULT)
23 * These functions should not modify any other registers,
24 * as they get called from within inline assembly.
27 #include <linux/linkage.h>
28 #include <asm/dwarf2.h>
30 #include <asm/errno.h>
31 #include <asm/asm-offsets.h>
32 #include <asm/thread_info.h>
35 #define ENTER CFI_STARTPROC ; \
36 GET_THREAD_INFO(%_ASM_BX)
43 cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
45 1: movb %al,(%_ASM_CX)
52 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
54 cmp %_ASM_BX ,%_ASM_CX
56 2: movw %ax,(%_ASM_CX)
63 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
65 cmp %_ASM_BX, %_ASM_CX
67 3: movl %eax,(%_ASM_CX)
74 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
76 cmp %_ASM_BX, %_ASM_CX
78 4: movq %_ASM_AX,(%_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