diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 22:15:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 22:15:20 -0400 |
commit | f59b51fe3d3092c08d7d554ecb40db24011b2ebc (patch) | |
tree | f19a5cb72adda3963f83609dbe2314620a4cf63e /arch/x86/um/asm | |
parent | aac2b1f5747ea34696d0da5bdc4d8247aa6437af (diff) | |
parent | 062d52672446014222942cae6934d97769b329f0 (diff) |
Merge branch 'for-linus-37rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull UML changes from Richard Weinberger:
"UML receives this time only cleanups.
The most outstanding change is the 'include "foo.h"' do 'include
<foo.h>' conversion done by Al Viro.
It touches many files, that's why the diffstat is rather big."
* 'for-linus-37rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
typo in UserModeLinux-HOWTO
hppfs: fix the return value of get_inode()
hostfs: drop vmtruncate
um: get rid of pointless include "..." where include <...> will do
um: move sysrq.h out of include/shared
um/x86: merge 32 and 64 bit variants of ptrace.h
um/x86: merge 32 and 64bit variants of checksum.h
Diffstat (limited to 'arch/x86/um/asm')
-rw-r--r-- | arch/x86/um/asm/checksum.h | 144 | ||||
-rw-r--r-- | arch/x86/um/asm/checksum_32.h | 140 | ||||
-rw-r--r-- | arch/x86/um/asm/checksum_64.h | 125 | ||||
-rw-r--r-- | arch/x86/um/asm/elf.h | 2 | ||||
-rw-r--r-- | arch/x86/um/asm/ptrace.h | 58 | ||||
-rw-r--r-- | arch/x86/um/asm/ptrace_32.h | 28 | ||||
-rw-r--r-- | arch/x86/um/asm/ptrace_64.h | 46 |
7 files changed, 199 insertions, 344 deletions
diff --git a/arch/x86/um/asm/checksum.h b/arch/x86/um/asm/checksum.h index b6efe2381b5d..4b181b74454f 100644 --- a/arch/x86/um/asm/checksum.h +++ b/arch/x86/um/asm/checksum.h | |||
@@ -1,6 +1,150 @@ | |||
1 | #ifndef __UM_CHECKSUM_H | 1 | #ifndef __UM_CHECKSUM_H |
2 | #define __UM_CHECKSUM_H | 2 | #define __UM_CHECKSUM_H |
3 | 3 | ||
4 | #include <linux/string.h> | ||
5 | #include <linux/in6.h> | ||
6 | |||
7 | /* | ||
8 | * computes the checksum of a memory block at buff, length len, | ||
9 | * and adds in "sum" (32-bit) | ||
10 | * | ||
11 | * returns a 32-bit number suitable for feeding into itself | ||
12 | * or csum_tcpudp_magic | ||
13 | * | ||
14 | * this function must be called with even lengths, except | ||
15 | * for the last fragment, which may be odd | ||
16 | * | ||
17 | * it's best to have buff aligned on a 32-bit boundary | ||
18 | */ | ||
19 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
20 | |||
21 | /* | ||
22 | * Note: when you get a NULL pointer exception here this means someone | ||
23 | * passed in an incorrect kernel address to one of these functions. | ||
24 | * | ||
25 | * If you use these functions directly please don't forget the | ||
26 | * access_ok(). | ||
27 | */ | ||
28 | |||
29 | static __inline__ | ||
30 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, | ||
31 | int len, __wsum sum) | ||
32 | { | ||
33 | memcpy(dst, src, len); | ||
34 | return csum_partial(dst, len, sum); | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * the same as csum_partial, but copies from src while it | ||
39 | * checksums, and handles user-space pointer exceptions correctly, when needed. | ||
40 | * | ||
41 | * here even more important to align src and dst on a 32-bit (or even | ||
42 | * better 64-bit) boundary | ||
43 | */ | ||
44 | |||
45 | static __inline__ | ||
46 | __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
47 | int len, __wsum sum, int *err_ptr) | ||
48 | { | ||
49 | if (copy_from_user(dst, src, len)) { | ||
50 | *err_ptr = -EFAULT; | ||
51 | return (__force __wsum)-1; | ||
52 | } | ||
53 | |||
54 | return csum_partial(dst, len, sum); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * csum_fold - Fold and invert a 32bit checksum. | ||
59 | * sum: 32bit unfolded sum | ||
60 | * | ||
61 | * Fold a 32bit running checksum to 16bit and invert it. This is usually | ||
62 | * the last step before putting a checksum into a packet. | ||
63 | * Make sure not to mix with 64bit checksums. | ||
64 | */ | ||
65 | static inline __sum16 csum_fold(__wsum sum) | ||
66 | { | ||
67 | __asm__( | ||
68 | " addl %1,%0\n" | ||
69 | " adcl $0xffff,%0" | ||
70 | : "=r" (sum) | ||
71 | : "r" ((__force u32)sum << 16), | ||
72 | "0" ((__force u32)sum & 0xffff0000) | ||
73 | ); | ||
74 | return (__force __sum16)(~(__force u32)sum >> 16); | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * csum_tcpup_nofold - Compute an IPv4 pseudo header checksum. | ||
79 | * @saddr: source address | ||
80 | * @daddr: destination address | ||
81 | * @len: length of packet | ||
82 | * @proto: ip protocol of packet | ||
83 | * @sum: initial sum to be added in (32bit unfolded) | ||
84 | * | ||
85 | * Returns the pseudo header checksum the input data. Result is | ||
86 | * 32bit unfolded. | ||
87 | */ | ||
88 | static inline __wsum | ||
89 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | ||
90 | unsigned short proto, __wsum sum) | ||
91 | { | ||
92 | asm(" addl %1, %0\n" | ||
93 | " adcl %2, %0\n" | ||
94 | " adcl %3, %0\n" | ||
95 | " adcl $0, %0\n" | ||
96 | : "=r" (sum) | ||
97 | : "g" (daddr), "g" (saddr), "g" ((len + proto) << 8), "0" (sum)); | ||
98 | return sum; | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * computes the checksum of the TCP/UDP pseudo-header | ||
103 | * returns a 16-bit checksum, already complemented | ||
104 | */ | ||
105 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | ||
106 | unsigned short len, | ||
107 | unsigned short proto, | ||
108 | __wsum sum) | ||
109 | { | ||
110 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
111 | } | ||
112 | |||
113 | /** | ||
114 | * ip_fast_csum - Compute the IPv4 header checksum efficiently. | ||
115 | * iph: ipv4 header | ||
116 | * ihl: length of header / 4 | ||
117 | */ | ||
118 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
119 | { | ||
120 | unsigned int sum; | ||
121 | |||
122 | asm( " movl (%1), %0\n" | ||
123 | " subl $4, %2\n" | ||
124 | " jbe 2f\n" | ||
125 | " addl 4(%1), %0\n" | ||
126 | " adcl 8(%1), %0\n" | ||
127 | " adcl 12(%1), %0\n" | ||
128 | "1: adcl 16(%1), %0\n" | ||
129 | " lea 4(%1), %1\n" | ||
130 | " decl %2\n" | ||
131 | " jne 1b\n" | ||
132 | " adcl $0, %0\n" | ||
133 | " movl %0, %2\n" | ||
134 | " shrl $16, %0\n" | ||
135 | " addw %w2, %w0\n" | ||
136 | " adcl $0, %0\n" | ||
137 | " notl %0\n" | ||
138 | "2:" | ||
139 | /* Since the input registers which are loaded with iph and ipl | ||
140 | are modified, we must also specify them as outputs, or gcc | ||
141 | will assume they contain their original values. */ | ||
142 | : "=r" (sum), "=r" (iph), "=r" (ihl) | ||
143 | : "1" (iph), "2" (ihl) | ||
144 | : "memory"); | ||
145 | return (__force __sum16)sum; | ||
146 | } | ||
147 | |||
4 | #ifdef CONFIG_X86_32 | 148 | #ifdef CONFIG_X86_32 |
5 | # include "checksum_32.h" | 149 | # include "checksum_32.h" |
6 | #else | 150 | #else |
diff --git a/arch/x86/um/asm/checksum_32.h b/arch/x86/um/asm/checksum_32.h index caab74252e27..ab77b6f9a4bf 100644 --- a/arch/x86/um/asm/checksum_32.h +++ b/arch/x86/um/asm/checksum_32.h | |||
@@ -5,145 +5,6 @@ | |||
5 | #ifndef __UM_SYSDEP_CHECKSUM_H | 5 | #ifndef __UM_SYSDEP_CHECKSUM_H |
6 | #define __UM_SYSDEP_CHECKSUM_H | 6 | #define __UM_SYSDEP_CHECKSUM_H |
7 | 7 | ||
8 | #include "linux/in6.h" | ||
9 | #include "linux/string.h" | ||
10 | |||
11 | /* | ||
12 | * computes the checksum of a memory block at buff, length len, | ||
13 | * and adds in "sum" (32-bit) | ||
14 | * | ||
15 | * returns a 32-bit number suitable for feeding into itself | ||
16 | * or csum_tcpudp_magic | ||
17 | * | ||
18 | * this function must be called with even lengths, except | ||
19 | * for the last fragment, which may be odd | ||
20 | * | ||
21 | * it's best to have buff aligned on a 32-bit boundary | ||
22 | */ | ||
23 | __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
24 | |||
25 | /* | ||
26 | * Note: when you get a NULL pointer exception here this means someone | ||
27 | * passed in an incorrect kernel address to one of these functions. | ||
28 | * | ||
29 | * If you use these functions directly please don't forget the | ||
30 | * access_ok(). | ||
31 | */ | ||
32 | |||
33 | static __inline__ | ||
34 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, | ||
35 | int len, __wsum sum) | ||
36 | { | ||
37 | memcpy(dst, src, len); | ||
38 | return csum_partial(dst, len, sum); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * the same as csum_partial, but copies from src while it | ||
43 | * checksums, and handles user-space pointer exceptions correctly, when needed. | ||
44 | * | ||
45 | * here even more important to align src and dst on a 32-bit (or even | ||
46 | * better 64-bit) boundary | ||
47 | */ | ||
48 | |||
49 | static __inline__ | ||
50 | __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
51 | int len, __wsum sum, int *err_ptr) | ||
52 | { | ||
53 | if (copy_from_user(dst, src, len)) { | ||
54 | *err_ptr = -EFAULT; | ||
55 | return (__force __wsum)-1; | ||
56 | } | ||
57 | |||
58 | return csum_partial(dst, len, sum); | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
63 | * which always checksum on 4 octet boundaries. | ||
64 | * | ||
65 | * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by | ||
66 | * Arnt Gulbrandsen. | ||
67 | */ | ||
68 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
69 | { | ||
70 | unsigned int sum; | ||
71 | |||
72 | __asm__ __volatile__( | ||
73 | "movl (%1), %0 ;\n" | ||
74 | "subl $4, %2 ;\n" | ||
75 | "jbe 2f ;\n" | ||
76 | "addl 4(%1), %0 ;\n" | ||
77 | "adcl 8(%1), %0 ;\n" | ||
78 | "adcl 12(%1), %0 ;\n" | ||
79 | "1: adcl 16(%1), %0 ;\n" | ||
80 | "lea 4(%1), %1 ;\n" | ||
81 | "decl %2 ;\n" | ||
82 | "jne 1b ;\n" | ||
83 | "adcl $0, %0 ;\n" | ||
84 | "movl %0, %2 ;\n" | ||
85 | "shrl $16, %0 ;\n" | ||
86 | "addw %w2, %w0 ;\n" | ||
87 | "adcl $0, %0 ;\n" | ||
88 | "notl %0 ;\n" | ||
89 | "2: ;\n" | ||
90 | /* Since the input registers which are loaded with iph and ipl | ||
91 | are modified, we must also specify them as outputs, or gcc | ||
92 | will assume they contain their original values. */ | ||
93 | : "=r" (sum), "=r" (iph), "=r" (ihl) | ||
94 | : "1" (iph), "2" (ihl) | ||
95 | : "memory"); | ||
96 | return (__force __sum16)sum; | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * Fold a partial checksum | ||
101 | */ | ||
102 | |||
103 | static inline __sum16 csum_fold(__wsum sum) | ||
104 | { | ||
105 | __asm__( | ||
106 | "addl %1, %0 ;\n" | ||
107 | "adcl $0xffff, %0 ;\n" | ||
108 | : "=r" (sum) | ||
109 | : "r" ((__force u32)sum << 16), | ||
110 | "0" ((__force u32)sum & 0xffff0000) | ||
111 | ); | ||
112 | return (__force __sum16)(~(__force u32)sum >> 16); | ||
113 | } | ||
114 | |||
115 | static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | ||
116 | unsigned short len, | ||
117 | unsigned short proto, | ||
118 | __wsum sum) | ||
119 | { | ||
120 | __asm__( | ||
121 | "addl %1, %0 ;\n" | ||
122 | "adcl %2, %0 ;\n" | ||
123 | "adcl %3, %0 ;\n" | ||
124 | "adcl $0, %0 ;\n" | ||
125 | : "=r" (sum) | ||
126 | : "g" (daddr), "g"(saddr), "g"((len + proto) << 8), "0"(sum)); | ||
127 | return sum; | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | * computes the checksum of the TCP/UDP pseudo-header | ||
132 | * returns a 16-bit checksum, already complemented | ||
133 | */ | ||
134 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | ||
135 | unsigned short len, | ||
136 | unsigned short proto, | ||
137 | __wsum sum) | ||
138 | { | ||
139 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
144 | * in icmp.c | ||
145 | */ | ||
146 | |||
147 | static inline __sum16 ip_compute_csum(const void *buff, int len) | 8 | static inline __sum16 ip_compute_csum(const void *buff, int len) |
148 | { | 9 | { |
149 | return csum_fold (csum_partial(buff, len, 0)); | 10 | return csum_fold (csum_partial(buff, len, 0)); |
@@ -198,4 +59,3 @@ static __inline__ __wsum csum_and_copy_to_user(const void *src, | |||
198 | } | 59 | } |
199 | 60 | ||
200 | #endif | 61 | #endif |
201 | |||
diff --git a/arch/x86/um/asm/checksum_64.h b/arch/x86/um/asm/checksum_64.h index a5be9031ea85..7b6cd1921573 100644 --- a/arch/x86/um/asm/checksum_64.h +++ b/arch/x86/um/asm/checksum_64.h | |||
@@ -5,131 +5,6 @@ | |||
5 | #ifndef __UM_SYSDEP_CHECKSUM_H | 5 | #ifndef __UM_SYSDEP_CHECKSUM_H |
6 | #define __UM_SYSDEP_CHECKSUM_H | 6 | #define __UM_SYSDEP_CHECKSUM_H |
7 | 7 | ||
8 | #include "linux/string.h" | ||
9 | #include "linux/in6.h" | ||
10 | #include "asm/uaccess.h" | ||
11 | |||
12 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
13 | |||
14 | /* | ||
15 | * Note: when you get a NULL pointer exception here this means someone | ||
16 | * passed in an incorrect kernel address to one of these functions. | ||
17 | * | ||
18 | * If you use these functions directly please don't forget the | ||
19 | * access_ok(). | ||
20 | */ | ||
21 | |||
22 | static __inline__ | ||
23 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, | ||
24 | int len, __wsum sum) | ||
25 | { | ||
26 | memcpy(dst, src, len); | ||
27 | return(csum_partial(dst, len, sum)); | ||
28 | } | ||
29 | |||
30 | static __inline__ | ||
31 | __wsum csum_partial_copy_from_user(const void __user *src, | ||
32 | void *dst, int len, __wsum sum, | ||
33 | int *err_ptr) | ||
34 | { | ||
35 | if (copy_from_user(dst, src, len)) { | ||
36 | *err_ptr = -EFAULT; | ||
37 | return (__force __wsum)-1; | ||
38 | } | ||
39 | return csum_partial(dst, len, sum); | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * csum_fold - Fold and invert a 32bit checksum. | ||
44 | * sum: 32bit unfolded sum | ||
45 | * | ||
46 | * Fold a 32bit running checksum to 16bit and invert it. This is usually | ||
47 | * the last step before putting a checksum into a packet. | ||
48 | * Make sure not to mix with 64bit checksums. | ||
49 | */ | ||
50 | static inline __sum16 csum_fold(__wsum sum) | ||
51 | { | ||
52 | __asm__( | ||
53 | " addl %1,%0\n" | ||
54 | " adcl $0xffff,%0" | ||
55 | : "=r" (sum) | ||
56 | : "r" ((__force u32)sum << 16), | ||
57 | "0" ((__force u32)sum & 0xffff0000) | ||
58 | ); | ||
59 | return (__force __sum16)(~(__force u32)sum >> 16); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * csum_tcpup_nofold - Compute an IPv4 pseudo header checksum. | ||
64 | * @saddr: source address | ||
65 | * @daddr: destination address | ||
66 | * @len: length of packet | ||
67 | * @proto: ip protocol of packet | ||
68 | * @sum: initial sum to be added in (32bit unfolded) | ||
69 | * | ||
70 | * Returns the pseudo header checksum the input data. Result is | ||
71 | * 32bit unfolded. | ||
72 | */ | ||
73 | static inline __wsum | ||
74 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | ||
75 | unsigned short proto, __wsum sum) | ||
76 | { | ||
77 | asm(" addl %1, %0\n" | ||
78 | " adcl %2, %0\n" | ||
79 | " adcl %3, %0\n" | ||
80 | " adcl $0, %0\n" | ||
81 | : "=r" (sum) | ||
82 | : "g" (daddr), "g" (saddr), "g" ((len + proto) << 8), "0" (sum)); | ||
83 | return sum; | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * computes the checksum of the TCP/UDP pseudo-header | ||
88 | * returns a 16-bit checksum, already complemented | ||
89 | */ | ||
90 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | ||
91 | unsigned short len, | ||
92 | unsigned short proto, | ||
93 | __wsum sum) | ||
94 | { | ||
95 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
96 | } | ||
97 | |||
98 | /** | ||
99 | * ip_fast_csum - Compute the IPv4 header checksum efficiently. | ||
100 | * iph: ipv4 header | ||
101 | * ihl: length of header / 4 | ||
102 | */ | ||
103 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
104 | { | ||
105 | unsigned int sum; | ||
106 | |||
107 | asm( " movl (%1), %0\n" | ||
108 | " subl $4, %2\n" | ||
109 | " jbe 2f\n" | ||
110 | " addl 4(%1), %0\n" | ||
111 | " adcl 8(%1), %0\n" | ||
112 | " adcl 12(%1), %0\n" | ||
113 | "1: adcl 16(%1), %0\n" | ||
114 | " lea 4(%1), %1\n" | ||
115 | " decl %2\n" | ||
116 | " jne 1b\n" | ||
117 | " adcl $0, %0\n" | ||
118 | " movl %0, %2\n" | ||
119 | " shrl $16, %0\n" | ||
120 | " addw %w2, %w0\n" | ||
121 | " adcl $0, %0\n" | ||
122 | " notl %0\n" | ||
123 | "2:" | ||
124 | /* Since the input registers which are loaded with iph and ipl | ||
125 | are modified, we must also specify them as outputs, or gcc | ||
126 | will assume they contain their original values. */ | ||
127 | : "=r" (sum), "=r" (iph), "=r" (ihl) | ||
128 | : "1" (iph), "2" (ihl) | ||
129 | : "memory"); | ||
130 | return (__force __sum16)sum; | ||
131 | } | ||
132 | |||
133 | static inline unsigned add32_with_carry(unsigned a, unsigned b) | 8 | static inline unsigned add32_with_carry(unsigned a, unsigned b) |
134 | { | 9 | { |
135 | asm("addl %2,%0\n\t" | 10 | asm("addl %2,%0\n\t" |
diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h index 0e07adc8cbe4..0feee2fd5077 100644 --- a/arch/x86/um/asm/elf.h +++ b/arch/x86/um/asm/elf.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #define __UM_ELF_X86_H | 6 | #define __UM_ELF_X86_H |
7 | 7 | ||
8 | #include <asm/user.h> | 8 | #include <asm/user.h> |
9 | #include "skas.h" | 9 | #include <skas.h> |
10 | 10 | ||
11 | #ifdef CONFIG_X86_32 | 11 | #ifdef CONFIG_X86_32 |
12 | 12 | ||
diff --git a/arch/x86/um/asm/ptrace.h b/arch/x86/um/asm/ptrace.h index e72cd0df5ba3..755133258c45 100644 --- a/arch/x86/um/asm/ptrace.h +++ b/arch/x86/um/asm/ptrace.h | |||
@@ -1,11 +1,13 @@ | |||
1 | #ifndef __UM_X86_PTRACE_H | 1 | #ifndef __UM_X86_PTRACE_H |
2 | #define __UM_X86_PTRACE_H | 2 | #define __UM_X86_PTRACE_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_32 | 4 | #include <linux/compiler.h> |
5 | # include "ptrace_32.h" | 5 | #ifndef CONFIG_X86_32 |
6 | #else | 6 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ |
7 | # include "ptrace_64.h" | ||
8 | #endif | 7 | #endif |
8 | #include <asm/ptrace-generic.h> | ||
9 | |||
10 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
9 | 11 | ||
10 | #define PT_REGS_AX(r) UPT_AX(&(r)->regs) | 12 | #define PT_REGS_AX(r) UPT_AX(&(r)->regs) |
11 | #define PT_REGS_BX(r) UPT_BX(&(r)->regs) | 13 | #define PT_REGS_BX(r) UPT_BX(&(r)->regs) |
@@ -36,4 +38,52 @@ static inline long regs_return_value(struct pt_regs *regs) | |||
36 | { | 38 | { |
37 | return PT_REGS_AX(regs); | 39 | return PT_REGS_AX(regs); |
38 | } | 40 | } |
41 | |||
42 | /* | ||
43 | * Forward declaration to avoid including sysdep/tls.h, which causes a | ||
44 | * circular include, and compilation failures. | ||
45 | */ | ||
46 | struct user_desc; | ||
47 | |||
48 | #ifdef CONFIG_X86_32 | ||
49 | |||
50 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 | ||
51 | |||
52 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
53 | struct user_desc __user *user_desc); | ||
54 | |||
55 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
56 | struct user_desc __user *user_desc); | ||
57 | |||
58 | #else | ||
59 | |||
60 | #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 | ||
61 | |||
62 | #define PT_REGS_R8(r) UPT_R8(&(r)->regs) | ||
63 | #define PT_REGS_R9(r) UPT_R9(&(r)->regs) | ||
64 | #define PT_REGS_R10(r) UPT_R10(&(r)->regs) | ||
65 | #define PT_REGS_R11(r) UPT_R11(&(r)->regs) | ||
66 | #define PT_REGS_R12(r) UPT_R12(&(r)->regs) | ||
67 | #define PT_REGS_R13(r) UPT_R13(&(r)->regs) | ||
68 | #define PT_REGS_R14(r) UPT_R14(&(r)->regs) | ||
69 | #define PT_REGS_R15(r) UPT_R15(&(r)->regs) | ||
70 | |||
71 | #include <asm/errno.h> | ||
72 | |||
73 | static inline int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
74 | struct user_desc __user *user_desc) | ||
75 | { | ||
76 | return -ENOSYS; | ||
77 | } | ||
78 | |||
79 | static inline int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
80 | struct user_desc __user *user_desc) | ||
81 | { | ||
82 | return -ENOSYS; | ||
83 | } | ||
84 | |||
85 | extern long arch_prctl(struct task_struct *task, int code, | ||
86 | unsigned long __user *addr); | ||
87 | |||
88 | #endif | ||
39 | #endif /* __UM_X86_PTRACE_H */ | 89 | #endif /* __UM_X86_PTRACE_H */ |
diff --git a/arch/x86/um/asm/ptrace_32.h b/arch/x86/um/asm/ptrace_32.h deleted file mode 100644 index 2cf225351b65..000000000000 --- a/arch/x86/um/asm/ptrace_32.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PTRACE_I386_H | ||
7 | #define __UM_PTRACE_I386_H | ||
8 | |||
9 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 | ||
10 | |||
11 | #include "linux/compiler.h" | ||
12 | #include "asm/ptrace-generic.h" | ||
13 | |||
14 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
15 | |||
16 | /* | ||
17 | * Forward declaration to avoid including sysdep/tls.h, which causes a | ||
18 | * circular include, and compilation failures. | ||
19 | */ | ||
20 | struct user_desc; | ||
21 | |||
22 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
23 | struct user_desc __user *user_desc); | ||
24 | |||
25 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
26 | struct user_desc __user *user_desc); | ||
27 | |||
28 | #endif | ||
diff --git a/arch/x86/um/asm/ptrace_64.h b/arch/x86/um/asm/ptrace_64.h deleted file mode 100644 index ea7bff394320..000000000000 --- a/arch/x86/um/asm/ptrace_64.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PTRACE_X86_64_H | ||
8 | #define __UM_PTRACE_X86_64_H | ||
9 | |||
10 | #include "linux/compiler.h" | ||
11 | #include "asm/errno.h" | ||
12 | |||
13 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | ||
14 | #include "asm/ptrace-generic.h" | ||
15 | |||
16 | #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 | ||
17 | |||
18 | #define PT_REGS_R8(r) UPT_R8(&(r)->regs) | ||
19 | #define PT_REGS_R9(r) UPT_R9(&(r)->regs) | ||
20 | #define PT_REGS_R10(r) UPT_R10(&(r)->regs) | ||
21 | #define PT_REGS_R11(r) UPT_R11(&(r)->regs) | ||
22 | #define PT_REGS_R12(r) UPT_R12(&(r)->regs) | ||
23 | #define PT_REGS_R13(r) UPT_R13(&(r)->regs) | ||
24 | #define PT_REGS_R14(r) UPT_R14(&(r)->regs) | ||
25 | #define PT_REGS_R15(r) UPT_R15(&(r)->regs) | ||
26 | |||
27 | /* XXX */ | ||
28 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
29 | |||
30 | struct user_desc; | ||
31 | |||
32 | static inline int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
33 | struct user_desc __user *user_desc) | ||
34 | { | ||
35 | return -ENOSYS; | ||
36 | } | ||
37 | |||
38 | static inline int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
39 | struct user_desc __user *user_desc) | ||
40 | { | ||
41 | return -ENOSYS; | ||
42 | } | ||
43 | |||
44 | extern long arch_prctl(struct task_struct *task, int code, | ||
45 | unsigned long __user *addr); | ||
46 | #endif | ||