diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-06-24 11:05:11 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-09 03:14:05 -0400 |
commit | 6c2d458680d49d939ffd4b4cdc84d9e004d65910 (patch) | |
tree | 074be66f819fdf326e8480139a01e489f5a41929 /arch/x86/lib | |
parent | 87e2f1e7f6ab66306320403d4502d7938d3c703e (diff) |
x86: merge getuser asm functions.
getuser_32.S and getuser_64.S are merged into getuser.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/x86/lib')
-rw-r--r-- | arch/x86/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/lib/getuser.S (renamed from arch/x86/lib/getuser_64.S) | 14 | ||||
-rw-r--r-- | arch/x86/lib/getuser_32.S | 79 |
3 files changed, 10 insertions, 85 deletions
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 86960a6c41c0..e92948203a5d 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | obj-$(CONFIG_SMP) := msr-on-cpu.o | 5 | obj-$(CONFIG_SMP) := msr-on-cpu.o |
6 | 6 | ||
7 | lib-y := delay.o | 7 | lib-y := delay.o |
8 | lib-y += usercopy_$(BITS).o getuser_$(BITS).o putuser_$(BITS).o | 8 | lib-y += usercopy_$(BITS).o getuser.o putuser_$(BITS).o |
9 | lib-y += memcpy_$(BITS).o | 9 | lib-y += memcpy_$(BITS).o |
10 | 10 | ||
11 | ifeq ($(CONFIG_X86_32),y) | 11 | ifeq ($(CONFIG_X86_32),y) |
diff --git a/arch/x86/lib/getuser_64.S b/arch/x86/lib/getuser.S index e33388419b7b..ad374003742f 100644 --- a/arch/x86/lib/getuser_64.S +++ b/arch/x86/lib/getuser.S | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * (C) Copyright 1998 Linus Torvalds | 4 | * (C) Copyright 1998 Linus Torvalds |
5 | * (C) Copyright 2005 Andi Kleen | 5 | * (C) Copyright 2005 Andi Kleen |
6 | * (C) Copyright 2008 Glauber Costa | ||
6 | * | 7 | * |
7 | * These functions have a non-standard call interface | 8 | * These functions have a non-standard call interface |
8 | * to make them more efficient, especially as they | 9 | * to make them more efficient, especially as they |
@@ -13,13 +14,13 @@ | |||
13 | /* | 14 | /* |
14 | * __get_user_X | 15 | * __get_user_X |
15 | * | 16 | * |
16 | * Inputs: %rax contains the address. | 17 | * Inputs: %[r|e]ax contains the address. |
17 | * The register is modified, but all changes are undone | 18 | * The register is modified, but all changes are undone |
18 | * before returning because the C code doesn't know about it. | 19 | * before returning because the C code doesn't know about it. |
19 | * | 20 | * |
20 | * Outputs: %rax is error code (0 or -EFAULT) | 21 | * Outputs: %[r|e]ax is error code (0 or -EFAULT) |
21 | * %rdx contains zero-extended value | 22 | * %[r|e]dx contains zero-extended value |
22 | * | 23 | * |
23 | * | 24 | * |
24 | * These functions should not modify any other registers, | 25 | * These functions should not modify any other registers, |
25 | * as they get called from within inline assembly. | 26 | * as they get called from within inline assembly. |
@@ -71,6 +72,7 @@ ENTRY(__get_user_4) | |||
71 | CFI_ENDPROC | 72 | CFI_ENDPROC |
72 | ENDPROC(__get_user_4) | 73 | ENDPROC(__get_user_4) |
73 | 74 | ||
75 | #ifdef CONFIG_X86_64 | ||
74 | ENTRY(__get_user_8) | 76 | ENTRY(__get_user_8) |
75 | CFI_STARTPROC | 77 | CFI_STARTPROC |
76 | add $7,%_ASM_AX | 78 | add $7,%_ASM_AX |
@@ -83,6 +85,7 @@ ENTRY(__get_user_8) | |||
83 | ret | 85 | ret |
84 | CFI_ENDPROC | 86 | CFI_ENDPROC |
85 | ENDPROC(__get_user_8) | 87 | ENDPROC(__get_user_8) |
88 | #endif | ||
86 | 89 | ||
87 | bad_get_user: | 90 | bad_get_user: |
88 | CFI_STARTPROC | 91 | CFI_STARTPROC |
@@ -96,5 +99,6 @@ END(bad_get_user) | |||
96 | _ASM_PTR 1b,bad_get_user | 99 | _ASM_PTR 1b,bad_get_user |
97 | _ASM_PTR 2b,bad_get_user | 100 | _ASM_PTR 2b,bad_get_user |
98 | _ASM_PTR 3b,bad_get_user | 101 | _ASM_PTR 3b,bad_get_user |
102 | #ifdef CONFIG_X86_64 | ||
99 | _ASM_PTR 4b,bad_get_user | 103 | _ASM_PTR 4b,bad_get_user |
100 | .previous | 104 | #endif |
diff --git a/arch/x86/lib/getuser_32.S b/arch/x86/lib/getuser_32.S deleted file mode 100644 index 2bb0a183e066..000000000000 --- a/arch/x86/lib/getuser_32.S +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | * __get_user functions. | ||
3 | * | ||
4 | * (C) Copyright 1998 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 | #include <asm/asm.h> | ||
15 | |||
16 | |||
17 | /* | ||
18 | * __get_user_X | ||
19 | * | ||
20 | * Inputs: %eax contains the address | ||
21 | * | ||
22 | * Outputs: %eax is error code (0 or -EFAULT) | ||
23 | * %edx contains zero-extended value | ||
24 | * | ||
25 | * These functions should not modify any other registers, | ||
26 | * as they get called from within inline assembly. | ||
27 | */ | ||
28 | |||
29 | .text | ||
30 | ENTRY(__get_user_1) | ||
31 | CFI_STARTPROC | ||
32 | GET_THREAD_INFO(%_ASM_DX) | ||
33 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX | ||
34 | jae bad_get_user | ||
35 | 1: movzb (%_ASM_AX),%edx | ||
36 | xor %eax,%eax | ||
37 | ret | ||
38 | CFI_ENDPROC | ||
39 | ENDPROC(__get_user_1) | ||
40 | |||
41 | ENTRY(__get_user_2) | ||
42 | CFI_STARTPROC | ||
43 | add $1,%_ASM_AX | ||
44 | jc bad_get_user | ||
45 | GET_THREAD_INFO(%_ASM_DX) | ||
46 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX | ||
47 | jae bad_get_user | ||
48 | 2: movzwl -1(%_ASM_AX),%edx | ||
49 | xor %eax,%eax | ||
50 | ret | ||
51 | CFI_ENDPROC | ||
52 | ENDPROC(__get_user_2) | ||
53 | |||
54 | ENTRY(__get_user_4) | ||
55 | CFI_STARTPROC | ||
56 | add $3,%_ASM_AX | ||
57 | jc bad_get_user | ||
58 | GET_THREAD_INFO(%_ASM_DX) | ||
59 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX | ||
60 | jae bad_get_user | ||
61 | 3: mov -3(%_ASM_AX),%edx | ||
62 | xor %eax,%eax | ||
63 | ret | ||
64 | CFI_ENDPROC | ||
65 | ENDPROC(__get_user_4) | ||
66 | |||
67 | bad_get_user: | ||
68 | CFI_STARTPROC | ||
69 | xor %edx,%edx | ||
70 | mov $-14,%_ASM_AX | ||
71 | ret | ||
72 | CFI_ENDPROC | ||
73 | END(bad_get_user) | ||
74 | |||
75 | .section __ex_table,"a" | ||
76 | _ASM_PTR 1b,bad_get_user | ||
77 | _ASM_PTR 2b,bad_get_user | ||
78 | _ASM_PTR 3b,bad_get_user | ||
79 | .previous | ||