diff options
Diffstat (limited to 'arch/x86')
28 files changed, 247 insertions, 392 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 | ||
diff --git a/arch/x86/um/bugs_32.c b/arch/x86/um/bugs_32.c index 17d88cf2c6c4..33daff4dade4 100644 --- a/arch/x86/um/bugs_32.c +++ b/arch/x86/um/bugs_32.c | |||
@@ -4,9 +4,9 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <signal.h> | 6 | #include <signal.h> |
7 | #include "kern_util.h" | 7 | #include <kern_util.h> |
8 | #include "longjmp.h" | 8 | #include <longjmp.h> |
9 | #include "sysdep/ptrace.h" | 9 | #include <sysdep/ptrace.h> |
10 | #include <generated/asm-offsets.h> | 10 | #include <generated/asm-offsets.h> |
11 | 11 | ||
12 | /* Set during early boot */ | 12 | /* Set during early boot */ |
diff --git a/arch/x86/um/bugs_64.c b/arch/x86/um/bugs_64.c index 44e02ba2a265..8cc8256c698d 100644 --- a/arch/x86/um/bugs_64.c +++ b/arch/x86/um/bugs_64.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Licensed under the GPL | 4 | * Licensed under the GPL |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "sysdep/ptrace.h" | 7 | #include <sysdep/ptrace.h> |
8 | 8 | ||
9 | void arch_check_bugs(void) | 9 | void arch_check_bugs(void) |
10 | { | 10 | { |
diff --git a/arch/x86/um/fault.c b/arch/x86/um/fault.c index d670f68532f4..8784ab30d91b 100644 --- a/arch/x86/um/fault.c +++ b/arch/x86/um/fault.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "sysdep/ptrace.h" | 6 | #include <sysdep/ptrace.h> |
7 | 7 | ||
8 | /* These two are from asm-um/uaccess.h and linux/module.h, check them. */ | 8 | /* These two are from asm-um/uaccess.h and linux/module.h, check them. */ |
9 | struct exception_table_entry | 9 | struct exception_table_entry |
diff --git a/arch/x86/um/ldt.c b/arch/x86/um/ldt.c index 26b0e39d2ce9..8e08176f0bcb 100644 --- a/arch/x86/um/ldt.c +++ b/arch/x86/um/ldt.c | |||
@@ -7,11 +7,11 @@ | |||
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <asm/unistd.h> | 9 | #include <asm/unistd.h> |
10 | #include "os.h" | 10 | #include <os.h> |
11 | #include "proc_mm.h" | 11 | #include <proc_mm.h> |
12 | #include "skas.h" | 12 | #include <skas.h> |
13 | #include "skas_ptrace.h" | 13 | #include <skas_ptrace.h> |
14 | #include "sysdep/tls.h" | 14 | #include <sysdep/tls.h> |
15 | 15 | ||
16 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); | 16 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); |
17 | 17 | ||
diff --git a/arch/x86/um/mem_64.c b/arch/x86/um/mem_64.c index 546518727a73..c6492e75797b 100644 --- a/arch/x86/um/mem_64.c +++ b/arch/x86/um/mem_64.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "linux/mm.h" | 1 | #include <linux/mm.h> |
2 | #include "asm/page.h" | 2 | #include <asm/page.h> |
3 | #include "asm/mman.h" | 3 | #include <asm/mman.h> |
4 | 4 | ||
5 | const char *arch_vma_name(struct vm_area_struct *vma) | 5 | const char *arch_vma_name(struct vm_area_struct *vma) |
6 | { | 6 | { |
diff --git a/arch/x86/um/os-Linux/registers.c b/arch/x86/um/os-Linux/registers.c index 0cdbb86b012b..41bfe84e11ab 100644 --- a/arch/x86/um/os-Linux/registers.c +++ b/arch/x86/um/os-Linux/registers.c | |||
@@ -9,8 +9,8 @@ | |||
9 | #ifdef __i386__ | 9 | #ifdef __i386__ |
10 | #include <sys/user.h> | 10 | #include <sys/user.h> |
11 | #endif | 11 | #endif |
12 | #include "longjmp.h" | 12 | #include <longjmp.h> |
13 | #include "sysdep/ptrace_user.h" | 13 | #include <sysdep/ptrace_user.h> |
14 | 14 | ||
15 | int save_fp_registers(int pid, unsigned long *fp_regs) | 15 | int save_fp_registers(int pid, unsigned long *fp_regs) |
16 | { | 16 | { |
diff --git a/arch/x86/um/os-Linux/task_size.c b/arch/x86/um/os-Linux/task_size.c index efb16c5c9bcf..8502ad30e61b 100644 --- a/arch/x86/um/os-Linux/task_size.c +++ b/arch/x86/um/os-Linux/task_size.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <signal.h> | 3 | #include <signal.h> |
4 | #include <sys/mman.h> | 4 | #include <sys/mman.h> |
5 | #include "longjmp.h" | 5 | #include <longjmp.h> |
6 | 6 | ||
7 | #ifdef __i386__ | 7 | #ifdef __i386__ |
8 | 8 | ||
diff --git a/arch/x86/um/os-Linux/tls.c b/arch/x86/um/os-Linux/tls.c index 82276b6071af..9d94b3b76c74 100644 --- a/arch/x86/um/os-Linux/tls.c +++ b/arch/x86/um/os-Linux/tls.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <sys/syscall.h> | 5 | #include <sys/syscall.h> |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | 7 | ||
8 | #include "sysdep/tls.h" | 8 | #include <sysdep/tls.h> |
9 | 9 | ||
10 | #ifndef PTRACE_GET_THREAD_AREA | 10 | #ifndef PTRACE_GET_THREAD_AREA |
11 | #define PTRACE_GET_THREAD_AREA 25 | 11 | #define PTRACE_GET_THREAD_AREA 25 |
diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c index 3b949daa095c..ce3dd4f36f3f 100644 --- a/arch/x86/um/ptrace_32.c +++ b/arch/x86/um/ptrace_32.c | |||
@@ -3,10 +3,10 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/mm.h" | 6 | #include <linux/mm.h> |
7 | #include "linux/sched.h" | 7 | #include <linux/sched.h> |
8 | #include "asm/uaccess.h" | 8 | #include <asm/uaccess.h> |
9 | #include "skas.h" | 9 | #include <skas.h> |
10 | 10 | ||
11 | extern int arch_switch_tls(struct task_struct *to); | 11 | extern int arch_switch_tls(struct task_struct *to); |
12 | 12 | ||
diff --git a/arch/x86/um/ptrace_user.c b/arch/x86/um/ptrace_user.c index 3960ca1dd35a..617885b18992 100644 --- a/arch/x86/um/ptrace_user.c +++ b/arch/x86/um/ptrace_user.c | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <errno.h> | 6 | #include <errno.h> |
7 | #include "ptrace_user.h" | 7 | #include <ptrace_user.h> |
8 | 8 | ||
9 | int ptrace_getregs(long pid, unsigned long *regs_out) | 9 | int ptrace_getregs(long pid, unsigned long *regs_out) |
10 | { | 10 | { |
diff --git a/arch/x86/um/shared/sysdep/ptrace.h b/arch/x86/um/shared/sysdep/ptrace.h index 6ce2d76eb908..eb9356904ad3 100644 --- a/arch/x86/um/shared/sysdep/ptrace.h +++ b/arch/x86/um/shared/sysdep/ptrace.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __SYSDEP_X86_PTRACE_H | 2 | #define __SYSDEP_X86_PTRACE_H |
3 | 3 | ||
4 | #include <generated/user_constants.h> | 4 | #include <generated/user_constants.h> |
5 | #include "sysdep/faultinfo.h" | 5 | #include <sysdep/faultinfo.h> |
6 | 6 | ||
7 | #define MAX_REG_OFFSET (UM_FRAME_SIZE) | 7 | #define MAX_REG_OFFSET (UM_FRAME_SIZE) |
8 | #define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long)) | 8 | #define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long)) |
diff --git a/arch/x86/um/shared/sysdep/stub.h b/arch/x86/um/shared/sysdep/stub.h index bd161e300102..3f55e5bd3cec 100644 --- a/arch/x86/um/shared/sysdep/stub.h +++ b/arch/x86/um/shared/sysdep/stub.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #include <asm/unistd.h> | 1 | #include <asm/unistd.h> |
2 | #include <sys/mman.h> | 2 | #include <sys/mman.h> |
3 | #include <signal.h> | 3 | #include <signal.h> |
4 | #include "as-layout.h" | 4 | #include <as-layout.h> |
5 | #include "stub-data.h" | 5 | #include <stub-data.h> |
6 | 6 | ||
7 | #ifdef __i386__ | 7 | #ifdef __i386__ |
8 | #include "stub_32.h" | 8 | #include "stub_32.h" |
diff --git a/arch/x86/um/shared/sysdep/syscalls_32.h b/arch/x86/um/shared/sysdep/syscalls_32.h index 05cb796aecb5..8436079be914 100644 --- a/arch/x86/um/shared/sysdep/syscalls_32.h +++ b/arch/x86/um/shared/sysdep/syscalls_32.h | |||
@@ -3,8 +3,8 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "asm/unistd.h" | 6 | #include <asm/unistd.h> |
7 | #include "sysdep/ptrace.h" | 7 | #include <sysdep/ptrace.h> |
8 | 8 | ||
9 | typedef long syscall_handler_t(struct pt_regs); | 9 | typedef long syscall_handler_t(struct pt_regs); |
10 | 10 | ||
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c index ba7363ecf896..bdaa08cfbcf4 100644 --- a/arch/x86/um/signal.c +++ b/arch/x86/um/signal.c | |||
@@ -11,8 +11,8 @@ | |||
11 | #include <asm/unistd.h> | 11 | #include <asm/unistd.h> |
12 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
13 | #include <asm/ucontext.h> | 13 | #include <asm/ucontext.h> |
14 | #include "frame_kern.h" | 14 | #include <frame_kern.h> |
15 | #include "skas.h" | 15 | #include <skas.h> |
16 | 16 | ||
17 | #ifdef CONFIG_X86_32 | 17 | #ifdef CONFIG_X86_32 |
18 | 18 | ||
diff --git a/arch/x86/um/stub_32.S b/arch/x86/um/stub_32.S index 54a36ec20cb7..b972649d3a18 100644 --- a/arch/x86/um/stub_32.S +++ b/arch/x86/um/stub_32.S | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "as-layout.h" | 1 | #include <as-layout.h> |
2 | 2 | ||
3 | .globl syscall_stub | 3 | .globl syscall_stub |
4 | .section .__syscall_stub, "ax" | 4 | .section .__syscall_stub, "ax" |
diff --git a/arch/x86/um/stub_64.S b/arch/x86/um/stub_64.S index 20e4a96a6dcb..7160b20172d0 100644 --- a/arch/x86/um/stub_64.S +++ b/arch/x86/um/stub_64.S | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "as-layout.h" | 1 | #include <as-layout.h> |
2 | 2 | ||
3 | .globl syscall_stub | 3 | .globl syscall_stub |
4 | .section .__syscall_stub, "ax" | 4 | .section .__syscall_stub, "ax" |
diff --git a/arch/x86/um/stub_segv.c b/arch/x86/um/stub_segv.c index b7450bd22e7d..1518d2805ae8 100644 --- a/arch/x86/um/stub_segv.c +++ b/arch/x86/um/stub_segv.c | |||
@@ -3,9 +3,9 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "sysdep/stub.h" | 6 | #include <sysdep/stub.h> |
7 | #include "sysdep/faultinfo.h" | 7 | #include <sysdep/faultinfo.h> |
8 | #include "sysdep/mcontext.h" | 8 | #include <sysdep/mcontext.h> |
9 | 9 | ||
10 | void __attribute__ ((__section__ (".__syscall_stub"))) | 10 | void __attribute__ ((__section__ (".__syscall_stub"))) |
11 | stub_segv_handler(int sig, siginfo_t *info, void *p) | 11 | stub_segv_handler(int sig, siginfo_t *info, void *p) |
diff --git a/arch/x86/um/sysrq_32.c b/arch/x86/um/sysrq_32.c index 2d5cc51e9bef..c9bee5b8c0d3 100644 --- a/arch/x86/um/sysrq_32.c +++ b/arch/x86/um/sysrq_32.c | |||
@@ -3,12 +3,12 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/kernel.h" | 6 | #include <linux/kernel.h> |
7 | #include "linux/smp.h" | 7 | #include <linux/smp.h> |
8 | #include "linux/sched.h" | 8 | #include <linux/sched.h> |
9 | #include "linux/kallsyms.h" | 9 | #include <linux/kallsyms.h> |
10 | #include "asm/ptrace.h" | 10 | #include <asm/ptrace.h> |
11 | #include "sysrq.h" | 11 | #include <asm/sysrq.h> |
12 | 12 | ||
13 | /* This is declared by <linux/sched.h> */ | 13 | /* This is declared by <linux/sched.h> */ |
14 | void show_regs(struct pt_regs *regs) | 14 | void show_regs(struct pt_regs *regs) |
diff --git a/arch/x86/um/sysrq_64.c b/arch/x86/um/sysrq_64.c index 08258f179969..a0e7fb1134a0 100644 --- a/arch/x86/um/sysrq_64.c +++ b/arch/x86/um/sysrq_64.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/utsname.h> | 10 | #include <linux/utsname.h> |
11 | #include <asm/current.h> | 11 | #include <asm/current.h> |
12 | #include <asm/ptrace.h> | 12 | #include <asm/ptrace.h> |
13 | #include "sysrq.h" | 13 | #include <asm/sysrq.h> |
14 | 14 | ||
15 | void __show_regs(struct pt_regs *regs) | 15 | void __show_regs(struct pt_regs *regs) |
16 | { | 16 | { |
diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c index baba84f8ecb8..5f5feff3d24c 100644 --- a/arch/x86/um/tls_32.c +++ b/arch/x86/um/tls_32.c | |||
@@ -3,12 +3,12 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/percpu.h" | 6 | #include <linux/percpu.h> |
7 | #include "linux/sched.h" | 7 | #include <linux/sched.h> |
8 | #include "asm/uaccess.h" | 8 | #include <asm/uaccess.h> |
9 | #include "os.h" | 9 | #include <os.h> |
10 | #include "skas.h" | 10 | #include <skas.h> |
11 | #include "sysdep/tls.h" | 11 | #include <sysdep/tls.h> |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * If needed we can detect when it's uninitialized. | 14 | * If needed we can detect when it's uninitialized. |
diff --git a/arch/x86/um/tls_64.c b/arch/x86/um/tls_64.c index f7ba46200ecd..d22363cb854e 100644 --- a/arch/x86/um/tls_64.c +++ b/arch/x86/um/tls_64.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "linux/sched.h" | 1 | #include <linux/sched.h> |
2 | 2 | ||
3 | void clear_flushed_tls(struct task_struct *task) | 3 | void clear_flushed_tls(struct task_struct *task) |
4 | { | 4 | { |