]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/x86/lib/putuser_64.S
x86: use macros from asm.h.
[linux-2.6-omap-h63xx.git] / arch / x86 / lib / putuser_64.S
1 /*
2  * __put_user functions.
3  *
4  * (C) Copyright 1998 Linus Torvalds
5  * (C) Copyright 2005 Andi Kleen
6  *
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"
10  * return value.
11  */
12
13 /*
14  * __put_user_X
15  *
16  * Inputs:      %rcx contains the address
17  *              %rdx contains new value
18  *
19  * Outputs:     %rax is error code (0 or -EFAULT)
20  *
21  * %rbx is destroyed.
22  *
23  * These functions should not modify any other registers,
24  * as they get called from within inline assembly.
25  */
26
27 #include <linux/linkage.h>
28 #include <asm/dwarf2.h>
29 #include <asm/page.h>
30 #include <asm/errno.h>
31 #include <asm/asm-offsets.h>
32 #include <asm/thread_info.h>
33 #include <asm/asm.h>
34
35 #define ENTER   CFI_STARTPROC ; \
36                 GET_THREAD_INFO(%_ASM_BX)
37 #define EXIT    ret ; \
38                 CFI_ENDPROC
39
40         .text
41 ENTRY(__put_user_1)
42         ENTER
43         cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
44         jae bad_put_user
45 1:      movb %al,(%_ASM_CX)
46         xor %eax,%eax
47         EXIT
48 ENDPROC(__put_user_1)
49
50 ENTRY(__put_user_2)
51         ENTER
52         mov TI_addr_limit(%_ASM_BX),%_ASM_BX
53         sub  $1, %_ASM_BX
54         cmp %_ASM_BX ,%_ASM_CX
55         jae  bad_put_user
56 2:      movw %ax,(%_ASM_CX)
57         xor %eax,%eax
58         EXIT
59 ENDPROC(__put_user_2)
60
61 ENTRY(__put_user_4)
62         ENTER
63         mov TI_addr_limit(%_ASM_BX),%_ASM_BX
64         sub  $3, %_ASM_BX
65         cmp  %_ASM_BX, %_ASM_CX
66         jae bad_put_user
67 3:      movl %eax,(%_ASM_CX)
68         xor %eax,%eax
69         EXIT
70 ENDPROC(__put_user_4)
71
72 ENTRY(__put_user_8)
73         ENTER
74         mov TI_addr_limit(%_ASM_BX),%_ASM_BX
75         sub  $7, %_ASM_BX
76         cmp  %_ASM_BX, %_ASM_CX
77         jae bad_put_user
78 4:      movq %_ASM_AX,(%_ASM_CX)
79         xor %eax,%eax
80         EXIT
81 ENDPROC(__put_user_8)
82
83 bad_put_user:
84         CFI_STARTPROC
85         mov $(-EFAULT),%eax
86         EXIT
87 END(bad_put_user)
88
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
94 .previous