aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-06-24 16:40:14 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-09 03:14:13 -0400
commit5cbbc3b1eb37bdc72eefd2de03b39f5e784400c2 (patch)
treeb4e340963f7a4e2d55ff00a14b3d4bca912c85ab /arch
parent2528de431ddb200653d1dc6ca90074bad9520f09 (diff)
x86: merge putuser asm functions.
putuser_32.S and putuser_64.S are merged into putuser.S. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/lib/Makefile2
-rw-r--r--arch/x86/lib/putuser.S (renamed from arch/x86/lib/putuser_32.S)11
-rw-r--r--arch/x86/lib/putuser_64.S94
3 files changed, 10 insertions, 97 deletions
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index e92948203a5d..83226e0a7ce4 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -5,7 +5,7 @@
5obj-$(CONFIG_SMP) := msr-on-cpu.o 5obj-$(CONFIG_SMP) := msr-on-cpu.o
6 6
7lib-y := delay.o 7lib-y := delay.o
8lib-y += usercopy_$(BITS).o getuser.o putuser_$(BITS).o 8lib-y += usercopy_$(BITS).o getuser.o putuser.o
9lib-y += memcpy_$(BITS).o 9lib-y += memcpy_$(BITS).o
10 10
11ifeq ($(CONFIG_X86_32),y) 11ifeq ($(CONFIG_X86_32),y)
diff --git a/arch/x86/lib/putuser_32.S b/arch/x86/lib/putuser.S
index e7eda34feb34..36b0d15ae6e9 100644
--- a/arch/x86/lib/putuser_32.S
+++ b/arch/x86/lib/putuser.S
@@ -2,6 +2,8 @@
2 * __put_user functions. 2 * __put_user functions.
3 * 3 *
4 * (C) Copyright 2005 Linus Torvalds 4 * (C) Copyright 2005 Linus Torvalds
5 * (C) Copyright 2005 Andi Kleen
6 * (C) Copyright 2008 Glauber Costa
5 * 7 *
6 * These functions have a non-standard call interface 8 * These functions have a non-standard call interface
7 * to make them more efficient, especially as they 9 * to make them more efficient, especially as they
@@ -11,6 +13,7 @@
11#include <linux/linkage.h> 13#include <linux/linkage.h>
12#include <asm/dwarf2.h> 14#include <asm/dwarf2.h>
13#include <asm/thread_info.h> 15#include <asm/thread_info.h>
16#include <asm/errno.h>
14#include <asm/asm.h> 17#include <asm/asm.h>
15 18
16 19
@@ -69,15 +72,17 @@ ENTRY(__put_user_8)
69 sub $7,%_ASM_BX 72 sub $7,%_ASM_BX
70 cmp %_ASM_BX,%_ASM_CX 73 cmp %_ASM_BX,%_ASM_CX
71 jae bad_put_user 74 jae bad_put_user
724: movl %_ASM_AX,(%_ASM_CX) 754: mov %_ASM_AX,(%_ASM_CX)
76#ifdef CONFIG_X86_32
735: movl %edx,4(%_ASM_CX) 775: movl %edx,4(%_ASM_CX)
78#endif
74 xor %eax,%eax 79 xor %eax,%eax
75 EXIT 80 EXIT
76ENDPROC(__put_user_8) 81ENDPROC(__put_user_8)
77 82
78bad_put_user: 83bad_put_user:
79 CFI_STARTPROC 84 CFI_STARTPROC
80 movl $-14,%eax 85 movl $-EFAULT,%eax
81 EXIT 86 EXIT
82END(bad_put_user) 87END(bad_put_user)
83 88
@@ -86,5 +91,7 @@ END(bad_put_user)
86 _ASM_PTR 2b,bad_put_user 91 _ASM_PTR 2b,bad_put_user
87 _ASM_PTR 3b,bad_put_user 92 _ASM_PTR 3b,bad_put_user
88 _ASM_PTR 4b,bad_put_user 93 _ASM_PTR 4b,bad_put_user
94#ifdef CONFIG_X86_32
89 _ASM_PTR 5b,bad_put_user 95 _ASM_PTR 5b,bad_put_user
96#endif
90.previous 97.previous
diff --git a/arch/x86/lib/putuser_64.S b/arch/x86/lib/putuser_64.S
deleted file mode 100644
index d496cc8e7308..000000000000
--- a/arch/x86/lib/putuser_64.S
+++ /dev/null
@@ -1,94 +0,0 @@
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
41ENTRY(__put_user_1)
42 ENTER
43 cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
44 jae bad_put_user
451: movb %al,(%_ASM_CX)
46 xor %eax,%eax
47 EXIT
48ENDPROC(__put_user_1)
49
50ENTRY(__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
562: movw %ax,(%_ASM_CX)
57 xor %eax,%eax
58 EXIT
59ENDPROC(__put_user_2)
60
61ENTRY(__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
673: movl %eax,(%_ASM_CX)
68 xor %eax,%eax
69 EXIT
70ENDPROC(__put_user_4)
71
72ENTRY(__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
784: movq %_ASM_AX,(%_ASM_CX)
79 xor %eax,%eax
80 EXIT
81ENDPROC(__put_user_8)
82
83bad_put_user:
84 CFI_STARTPROC
85 mov $(-EFAULT),%eax
86 EXIT
87END(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