]> git.karo-electronics.de Git - linux-beck.git/blob - arch/x86/lib/putuser_32.S
x86: don't save ebx in putuser_32.S.
[linux-beck.git] / arch / x86 / lib / putuser_32.S
1 /*
2  * __put_user functions.
3  *
4  * (C) Copyright 2005 Linus Torvalds
5  *
6  * These functions have a non-standard call interface
7  * to make them more efficient, especially as they
8  * return an error value in addition to the "real"
9  * return value.
10  */
11 #include <linux/linkage.h>
12 #include <asm/dwarf2.h>
13 #include <asm/thread_info.h>
14
15
16 /*
17  * __put_user_X
18  *
19  * Inputs:      %eax[:%edx] contains the data
20  *              %ecx contains the address
21  *
22  * Outputs:     %eax is error code (0 or -EFAULT)
23  *
24  * These functions should not modify any other registers,
25  * as they get called from within inline assembly.
26  */
27
28 #define ENTER   CFI_STARTPROC ; \
29                 GET_THREAD_INFO(%ebx)
30 #define EXIT    ret ; \
31                 CFI_ENDPROC
32
33 .text
34 ENTRY(__put_user_1)
35         ENTER
36         cmpl TI_addr_limit(%ebx),%ecx
37         jae bad_put_user
38 1:      movb %al,(%ecx)
39         xorl %eax,%eax
40         EXIT
41 ENDPROC(__put_user_1)
42
43 ENTRY(__put_user_2)
44         ENTER
45         movl TI_addr_limit(%ebx),%ebx
46         subl $1,%ebx
47         cmpl %ebx,%ecx
48         jae bad_put_user
49 2:      movw %ax,(%ecx)
50         xorl %eax,%eax
51         EXIT
52 ENDPROC(__put_user_2)
53
54 ENTRY(__put_user_4)
55         ENTER
56         movl TI_addr_limit(%ebx),%ebx
57         subl $3,%ebx
58         cmpl %ebx,%ecx
59         jae bad_put_user
60 3:      movl %eax,(%ecx)
61         xorl %eax,%eax
62         EXIT
63 ENDPROC(__put_user_4)
64
65 ENTRY(__put_user_8)
66         ENTER
67         movl TI_addr_limit(%ebx),%ebx
68         subl $7,%ebx
69         cmpl %ebx,%ecx
70         jae bad_put_user
71 4:      movl %eax,(%ecx)
72 5:      movl %edx,4(%ecx)
73         xorl %eax,%eax
74         EXIT
75 ENDPROC(__put_user_8)
76
77 bad_put_user:
78         CFI_STARTPROC
79         movl $-14,%eax
80         EXIT
81 END(bad_put_user)
82
83 .section __ex_table,"a"
84         .long 1b,bad_put_user
85         .long 2b,bad_put_user
86         .long 3b,bad_put_user
87         .long 4b,bad_put_user
88         .long 5b,bad_put_user
89 .previous