diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-06-24 10:37:57 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-09 03:14:04 -0400 |
commit | 40faf463e62de0b29722910eded7dd26cd8b684b (patch) | |
tree | ab7a576aec523d750944c53f6c7f340b4a1a3a3a /arch/x86/lib | |
parent | ef8c1a2d0e990d0f4f15e1d45eeb262755e3d4c3 (diff) |
x86: introduce __ASM_REG macro.
There are situations in which the architecture wants to use the
register that represents its word-size, whatever it is. For those,
introduce __ASM_REG in asm.h, along with the first users _ASM_AX
and _ASM_DX. They have users waiting for it, namely the getuser
functions.
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/getuser_32.S | 25 | ||||
-rw-r--r-- | arch/x86/lib/getuser_64.S | 36 |
2 files changed, 31 insertions, 30 deletions
diff --git a/arch/x86/lib/getuser_32.S b/arch/x86/lib/getuser_32.S index 8200fde55f57..2cc3ceee8f91 100644 --- a/arch/x86/lib/getuser_32.S +++ b/arch/x86/lib/getuser_32.S | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/linkage.h> | 11 | #include <linux/linkage.h> |
12 | #include <asm/dwarf2.h> | 12 | #include <asm/dwarf2.h> |
13 | #include <asm/thread_info.h> | 13 | #include <asm/thread_info.h> |
14 | #include <asm/asm.h> | ||
14 | 15 | ||
15 | 16 | ||
16 | /* | 17 | /* |
@@ -28,10 +29,10 @@ | |||
28 | .text | 29 | .text |
29 | ENTRY(__get_user_1) | 30 | ENTRY(__get_user_1) |
30 | CFI_STARTPROC | 31 | CFI_STARTPROC |
31 | GET_THREAD_INFO(%edx) | 32 | GET_THREAD_INFO(%_ASM_DX) |
32 | cmp TI_addr_limit(%edx),%eax | 33 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
33 | jae bad_get_user | 34 | jae bad_get_user |
34 | 1: movzb (%eax),%edx | 35 | 1: movzb (%_ASM_AX),%edx |
35 | xor %eax,%eax | 36 | xor %eax,%eax |
36 | ret | 37 | ret |
37 | CFI_ENDPROC | 38 | CFI_ENDPROC |
@@ -39,12 +40,12 @@ ENDPROC(__get_user_1) | |||
39 | 40 | ||
40 | ENTRY(__get_user_2) | 41 | ENTRY(__get_user_2) |
41 | CFI_STARTPROC | 42 | CFI_STARTPROC |
42 | add $1,%eax | 43 | add $1,%_ASM_AX |
43 | jc bad_get_user | 44 | jc bad_get_user |
44 | GET_THREAD_INFO(%edx) | 45 | GET_THREAD_INFO(%_ASM_DX) |
45 | cmp TI_addr_limit(%edx),%eax | 46 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
46 | jae bad_get_user | 47 | jae bad_get_user |
47 | 2: movzwl -1(%eax),%edx | 48 | 2: movzwl -1(%_ASM_AX),%edx |
48 | xor %eax,%eax | 49 | xor %eax,%eax |
49 | ret | 50 | ret |
50 | CFI_ENDPROC | 51 | CFI_ENDPROC |
@@ -52,12 +53,12 @@ ENDPROC(__get_user_2) | |||
52 | 53 | ||
53 | ENTRY(__get_user_4) | 54 | ENTRY(__get_user_4) |
54 | CFI_STARTPROC | 55 | CFI_STARTPROC |
55 | add $3,%eax | 56 | add $3,%_ASM_AX |
56 | jc bad_get_user | 57 | jc bad_get_user |
57 | GET_THREAD_INFO(%edx) | 58 | GET_THREAD_INFO(%_ASM_DX) |
58 | cmp TI_addr_limit(%edx),%eax | 59 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
59 | jae bad_get_user | 60 | jae bad_get_user |
60 | 3: mov -3(%eax),%edx | 61 | 3: mov -3(%_ASM_AX),%edx |
61 | xor %eax,%eax | 62 | xor %eax,%eax |
62 | ret | 63 | ret |
63 | CFI_ENDPROC | 64 | CFI_ENDPROC |
@@ -66,7 +67,7 @@ ENDPROC(__get_user_4) | |||
66 | bad_get_user: | 67 | bad_get_user: |
67 | CFI_STARTPROC | 68 | CFI_STARTPROC |
68 | xor %edx,%edx | 69 | xor %edx,%edx |
69 | mov $-14,%eax | 70 | mov $-14,%_ASM_AX |
70 | ret | 71 | ret |
71 | CFI_ENDPROC | 72 | CFI_ENDPROC |
72 | END(bad_get_user) | 73 | END(bad_get_user) |
diff --git a/arch/x86/lib/getuser_64.S b/arch/x86/lib/getuser_64.S index 6134752a75fd..63b0e5c1e582 100644 --- a/arch/x86/lib/getuser_64.S +++ b/arch/x86/lib/getuser_64.S | |||
@@ -13,14 +13,13 @@ | |||
13 | /* | 13 | /* |
14 | * __get_user_X | 14 | * __get_user_X |
15 | * | 15 | * |
16 | * Inputs: %rcx contains the address. | 16 | * Inputs: %rax contains the address. |
17 | * The register is modified, but all changes are undone | 17 | * The register is modified, but all changes are undone |
18 | * before returning because the C code doesn't know about it. | 18 | * before returning because the C code doesn't know about it. |
19 | * | 19 | * |
20 | * Outputs: %rax is error code (0 or -EFAULT) | 20 | * Outputs: %rax is error code (0 or -EFAULT) |
21 | * %rdx contains zero-extended value | 21 | * %rdx contains zero-extended value |
22 | * | 22 | * |
23 | * %r8 is destroyed. | ||
24 | * | 23 | * |
25 | * These functions should not modify any other registers, | 24 | * These functions should not modify any other registers, |
26 | * as they get called from within inline assembly. | 25 | * as they get called from within inline assembly. |
@@ -32,14 +31,15 @@ | |||
32 | #include <asm/errno.h> | 31 | #include <asm/errno.h> |
33 | #include <asm/asm-offsets.h> | 32 | #include <asm/asm-offsets.h> |
34 | #include <asm/thread_info.h> | 33 | #include <asm/thread_info.h> |
34 | #include <asm/asm.h> | ||
35 | 35 | ||
36 | .text | 36 | .text |
37 | ENTRY(__get_user_1) | 37 | ENTRY(__get_user_1) |
38 | CFI_STARTPROC | 38 | CFI_STARTPROC |
39 | GET_THREAD_INFO(%rdx) | 39 | GET_THREAD_INFO(%_ASM_DX) |
40 | cmp TI_addr_limit(%rdx),%rax | 40 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
41 | jae bad_get_user | 41 | jae bad_get_user |
42 | 1: movzb (%rax),%edx | 42 | 1: movzb (%_ASM_AX),%edx |
43 | xor %eax,%eax | 43 | xor %eax,%eax |
44 | ret | 44 | ret |
45 | CFI_ENDPROC | 45 | CFI_ENDPROC |
@@ -47,12 +47,12 @@ ENDPROC(__get_user_1) | |||
47 | 47 | ||
48 | ENTRY(__get_user_2) | 48 | ENTRY(__get_user_2) |
49 | CFI_STARTPROC | 49 | CFI_STARTPROC |
50 | add $1,%rax | 50 | add $1,%_ASM_AX |
51 | jc bad_get_user | 51 | jc bad_get_user |
52 | GET_THREAD_INFO(%rdx) | 52 | GET_THREAD_INFO(%_ASM_DX) |
53 | cmp TI_addr_limit(%rdx),%rax | 53 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
54 | jae bad_get_user | 54 | jae bad_get_user |
55 | 2: movzwl -1(%rax),%edx | 55 | 2: movzwl -1(%_ASM_AX),%edx |
56 | xor %eax,%eax | 56 | xor %eax,%eax |
57 | ret | 57 | ret |
58 | CFI_ENDPROC | 58 | CFI_ENDPROC |
@@ -60,12 +60,12 @@ ENDPROC(__get_user_2) | |||
60 | 60 | ||
61 | ENTRY(__get_user_4) | 61 | ENTRY(__get_user_4) |
62 | CFI_STARTPROC | 62 | CFI_STARTPROC |
63 | add $3,%rax | 63 | add $3,%_ASM_AX |
64 | jc bad_get_user | 64 | jc bad_get_user |
65 | GET_THREAD_INFO(%rdx) | 65 | GET_THREAD_INFO(%_ASM_DX) |
66 | cmp TI_addr_limit(%rdx),%rax | 66 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
67 | jae bad_get_user | 67 | jae bad_get_user |
68 | 3: mov -3(%rax),%edx | 68 | 3: mov -3(%_ASM_AX),%edx |
69 | xor %eax,%eax | 69 | xor %eax,%eax |
70 | ret | 70 | ret |
71 | CFI_ENDPROC | 71 | CFI_ENDPROC |
@@ -73,12 +73,12 @@ ENDPROC(__get_user_4) | |||
73 | 73 | ||
74 | ENTRY(__get_user_8) | 74 | ENTRY(__get_user_8) |
75 | CFI_STARTPROC | 75 | CFI_STARTPROC |
76 | add $7,%rax | 76 | add $7,%_ASM_AX |
77 | jc bad_get_user | 77 | jc bad_get_user |
78 | GET_THREAD_INFO(%rdx) | 78 | GET_THREAD_INFO(%_ASM_DX) |
79 | cmp TI_addr_limit(%rdx),%rax | 79 | cmp TI_addr_limit(%_ASM_DX),%_ASM_AX |
80 | jae bad_get_user | 80 | jae bad_get_user |
81 | 4: movq -7(%rax),%rdx | 81 | 4: movq -7(%_ASM_AX),%_ASM_DX |
82 | xor %eax,%eax | 82 | xor %eax,%eax |
83 | ret | 83 | ret |
84 | CFI_ENDPROC | 84 | CFI_ENDPROC |
@@ -87,7 +87,7 @@ ENDPROC(__get_user_8) | |||
87 | bad_get_user: | 87 | bad_get_user: |
88 | CFI_STARTPROC | 88 | CFI_STARTPROC |
89 | xor %edx,%edx | 89 | xor %edx,%edx |
90 | mov $(-EFAULT),%rax | 90 | mov $(-EFAULT),%_ASM_AX |
91 | ret | 91 | ret |
92 | CFI_ENDPROC | 92 | CFI_ENDPROC |
93 | END(bad_get_user) | 93 | END(bad_get_user) |