diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-18 21:44:32 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-23 01:55:21 -0400 |
commit | f5ad6a42b700d9687bb97cf461e7f2506e3006d6 (patch) | |
tree | 1bd92ee745ce1bdf459147dd9cbdb440c72cd9f8 /arch/um/include | |
parent | 17dcf75d3ea11d7e26110ba85677cfadbccecf45 (diff) |
x86, um: get rid of sysdep symlink
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/um/include')
40 files changed, 0 insertions, 2284 deletions
diff --git a/arch/um/include/shared/sysdep-i386/archsetjmp.h b/arch/um/include/shared/sysdep-i386/archsetjmp.h deleted file mode 100644 index 0f312085ce1d..000000000000 --- a/arch/um/include/shared/sysdep-i386/archsetjmp.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/um/include/sysdep-i386/archsetjmp.h | ||
3 | */ | ||
4 | |||
5 | #ifndef _KLIBC_ARCHSETJMP_H | ||
6 | #define _KLIBC_ARCHSETJMP_H | ||
7 | |||
8 | struct __jmp_buf { | ||
9 | unsigned int __ebx; | ||
10 | unsigned int __esp; | ||
11 | unsigned int __ebp; | ||
12 | unsigned int __esi; | ||
13 | unsigned int __edi; | ||
14 | unsigned int __eip; | ||
15 | }; | ||
16 | |||
17 | typedef struct __jmp_buf jmp_buf[1]; | ||
18 | |||
19 | #define JB_IP __eip | ||
20 | #define JB_SP __esp | ||
21 | |||
22 | #endif /* _SETJMP_H */ | ||
diff --git a/arch/um/include/shared/sysdep-i386/barrier.h b/arch/um/include/shared/sysdep-i386/barrier.h deleted file mode 100644 index b58d52c5b2f4..000000000000 --- a/arch/um/include/shared/sysdep-i386/barrier.h +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #ifndef __SYSDEP_I386_BARRIER_H | ||
2 | #define __SYSDEP_I386_BARRIER_H | ||
3 | |||
4 | /* Copied from include/asm-i386 for use by userspace. i386 has the option | ||
5 | * of using mfence, but I'm just using this, which works everywhere, for now. | ||
6 | */ | ||
7 | #define mb() asm volatile("lock; addl $0,0(%esp)") | ||
8 | |||
9 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/checksum.h b/arch/um/include/shared/sysdep-i386/checksum.h deleted file mode 100644 index 0cb4645cbeb8..000000000000 --- a/arch/um/include/shared/sysdep-i386/checksum.h +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /* | ||
2 | * Licensed under the GPL | ||
3 | */ | ||
4 | |||
5 | #ifndef __UM_SYSDEP_CHECKSUM_H | ||
6 | #define __UM_SYSDEP_CHECKSUM_H | ||
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) | ||
148 | { | ||
149 | return csum_fold (csum_partial(buff, len, 0)); | ||
150 | } | ||
151 | |||
152 | #define _HAVE_ARCH_IPV6_CSUM | ||
153 | static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | ||
154 | const struct in6_addr *daddr, | ||
155 | __u32 len, unsigned short proto, | ||
156 | __wsum sum) | ||
157 | { | ||
158 | __asm__( | ||
159 | "addl 0(%1), %0 ;\n" | ||
160 | "adcl 4(%1), %0 ;\n" | ||
161 | "adcl 8(%1), %0 ;\n" | ||
162 | "adcl 12(%1), %0 ;\n" | ||
163 | "adcl 0(%2), %0 ;\n" | ||
164 | "adcl 4(%2), %0 ;\n" | ||
165 | "adcl 8(%2), %0 ;\n" | ||
166 | "adcl 12(%2), %0 ;\n" | ||
167 | "adcl %3, %0 ;\n" | ||
168 | "adcl %4, %0 ;\n" | ||
169 | "adcl $0, %0 ;\n" | ||
170 | : "=&r" (sum) | ||
171 | : "r" (saddr), "r" (daddr), | ||
172 | "r"(htonl(len)), "r"(htonl(proto)), "0"(sum)); | ||
173 | |||
174 | return csum_fold(sum); | ||
175 | } | ||
176 | |||
177 | /* | ||
178 | * Copy and checksum to user | ||
179 | */ | ||
180 | #define HAVE_CSUM_COPY_USER | ||
181 | static __inline__ __wsum csum_and_copy_to_user(const void *src, | ||
182 | void __user *dst, | ||
183 | int len, __wsum sum, int *err_ptr) | ||
184 | { | ||
185 | if (access_ok(VERIFY_WRITE, dst, len)) { | ||
186 | if (copy_to_user(dst, src, len)) { | ||
187 | *err_ptr = -EFAULT; | ||
188 | return (__force __wsum)-1; | ||
189 | } | ||
190 | |||
191 | return csum_partial(src, len, sum); | ||
192 | } | ||
193 | |||
194 | if (len) | ||
195 | *err_ptr = -EFAULT; | ||
196 | |||
197 | return (__force __wsum)-1; /* invalid checksum */ | ||
198 | } | ||
199 | |||
200 | #endif | ||
201 | |||
202 | /* | ||
203 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
204 | * Emacs will notice this stuff at the end of the file and automatically | ||
205 | * adjust the settings for this buffer only. This must remain at the end | ||
206 | * of the file. | ||
207 | * --------------------------------------------------------------------------- | ||
208 | * Local variables: | ||
209 | * c-file-style: "linux" | ||
210 | * End: | ||
211 | */ | ||
diff --git a/arch/um/include/shared/sysdep-i386/faultinfo.h b/arch/um/include/shared/sysdep-i386/faultinfo.h deleted file mode 100644 index db437cc373bc..000000000000 --- a/arch/um/include/shared/sysdep-i386/faultinfo.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
3 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __FAULTINFO_I386_H | ||
8 | #define __FAULTINFO_I386_H | ||
9 | |||
10 | /* this structure contains the full arch-specific faultinfo | ||
11 | * from the traps. | ||
12 | * On i386, ptrace_faultinfo unfortunately doesn't provide | ||
13 | * all the info, since trap_no is missing. | ||
14 | * All common elements are defined at the same position in | ||
15 | * both structures, thus making it easy to copy the | ||
16 | * contents without knowledge about the structure elements. | ||
17 | */ | ||
18 | struct faultinfo { | ||
19 | int error_code; /* in ptrace_faultinfo misleadingly called is_write */ | ||
20 | unsigned long cr2; /* in ptrace_faultinfo called addr */ | ||
21 | int trap_no; /* missing in ptrace_faultinfo */ | ||
22 | }; | ||
23 | |||
24 | #define FAULT_WRITE(fi) ((fi).error_code & 2) | ||
25 | #define FAULT_ADDRESS(fi) ((fi).cr2) | ||
26 | |||
27 | #define PTRACE_FULL_FAULTINFO 0 | ||
28 | |||
29 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/host_ldt.h b/arch/um/include/shared/sysdep-i386/host_ldt.h deleted file mode 100644 index 0953cc4df652..000000000000 --- a/arch/um/include/shared/sysdep-i386/host_ldt.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | #ifndef __ASM_HOST_LDT_I386_H | ||
2 | #define __ASM_HOST_LDT_I386_H | ||
3 | |||
4 | #include <asm/ldt.h> | ||
5 | |||
6 | /* | ||
7 | * macros stolen from include/asm-i386/desc.h | ||
8 | */ | ||
9 | #define LDT_entry_a(info) \ | ||
10 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
11 | |||
12 | #define LDT_entry_b(info) \ | ||
13 | (((info)->base_addr & 0xff000000) | \ | ||
14 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
15 | ((info)->limit & 0xf0000) | \ | ||
16 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
17 | ((info)->contents << 10) | \ | ||
18 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
19 | ((info)->seg_32bit << 22) | \ | ||
20 | ((info)->limit_in_pages << 23) | \ | ||
21 | ((info)->useable << 20) | \ | ||
22 | 0x7000) | ||
23 | |||
24 | #define LDT_empty(info) (\ | ||
25 | (info)->base_addr == 0 && \ | ||
26 | (info)->limit == 0 && \ | ||
27 | (info)->contents == 0 && \ | ||
28 | (info)->read_exec_only == 1 && \ | ||
29 | (info)->seg_32bit == 0 && \ | ||
30 | (info)->limit_in_pages == 0 && \ | ||
31 | (info)->seg_not_present == 1 && \ | ||
32 | (info)->useable == 0 ) | ||
33 | |||
34 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/kernel-offsets.h b/arch/um/include/shared/sysdep-i386/kernel-offsets.h deleted file mode 100644 index 5868526b5eef..000000000000 --- a/arch/um/include/shared/sysdep-i386/kernel-offsets.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #include <linux/stddef.h> | ||
2 | #include <linux/sched.h> | ||
3 | #include <linux/elf.h> | ||
4 | #include <linux/crypto.h> | ||
5 | #include <asm/mman.h> | ||
6 | |||
7 | #define DEFINE(sym, val) \ | ||
8 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
9 | |||
10 | #define STR(x) #x | ||
11 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) | ||
12 | |||
13 | #define BLANK() asm volatile("\n->" : : ) | ||
14 | |||
15 | #define OFFSET(sym, str, mem) \ | ||
16 | DEFINE(sym, offsetof(struct str, mem)); | ||
17 | |||
18 | void foo(void) | ||
19 | { | ||
20 | #include <common-offsets.h> | ||
21 | } | ||
diff --git a/arch/um/include/shared/sysdep-i386/ptrace.h b/arch/um/include/shared/sysdep-i386/ptrace.h deleted file mode 100644 index 11c08969d134..000000000000 --- a/arch/um/include/shared/sysdep-i386/ptrace.h +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_I386_PTRACE_H | ||
7 | #define __SYSDEP_I386_PTRACE_H | ||
8 | |||
9 | #include "uml-config.h" | ||
10 | #include "user_constants.h" | ||
11 | #include "sysdep/faultinfo.h" | ||
12 | |||
13 | #define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long)) | ||
14 | #define MAX_REG_OFFSET (UM_FRAME_SIZE) | ||
15 | |||
16 | static inline void update_debugregs(int seq) {} | ||
17 | |||
18 | /* syscall emulation path in ptrace */ | ||
19 | |||
20 | #ifndef PTRACE_SYSEMU | ||
21 | #define PTRACE_SYSEMU 31 | ||
22 | #endif | ||
23 | |||
24 | void set_using_sysemu(int value); | ||
25 | int get_using_sysemu(void); | ||
26 | extern int sysemu_supported; | ||
27 | |||
28 | #include "skas_ptregs.h" | ||
29 | |||
30 | #define REGS_IP(r) ((r)[HOST_IP]) | ||
31 | #define REGS_SP(r) ((r)[HOST_SP]) | ||
32 | #define REGS_EFLAGS(r) ((r)[HOST_EFLAGS]) | ||
33 | #define REGS_EAX(r) ((r)[HOST_EAX]) | ||
34 | #define REGS_EBX(r) ((r)[HOST_EBX]) | ||
35 | #define REGS_ECX(r) ((r)[HOST_ECX]) | ||
36 | #define REGS_EDX(r) ((r)[HOST_EDX]) | ||
37 | #define REGS_ESI(r) ((r)[HOST_ESI]) | ||
38 | #define REGS_EDI(r) ((r)[HOST_EDI]) | ||
39 | #define REGS_EBP(r) ((r)[HOST_EBP]) | ||
40 | #define REGS_CS(r) ((r)[HOST_CS]) | ||
41 | #define REGS_SS(r) ((r)[HOST_SS]) | ||
42 | #define REGS_DS(r) ((r)[HOST_DS]) | ||
43 | #define REGS_ES(r) ((r)[HOST_ES]) | ||
44 | #define REGS_FS(r) ((r)[HOST_FS]) | ||
45 | #define REGS_GS(r) ((r)[HOST_GS]) | ||
46 | |||
47 | #define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res) | ||
48 | |||
49 | #define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r)) | ||
50 | |||
51 | #ifndef PTRACE_SYSEMU_SINGLESTEP | ||
52 | #define PTRACE_SYSEMU_SINGLESTEP 32 | ||
53 | #endif | ||
54 | |||
55 | struct uml_pt_regs { | ||
56 | unsigned long gp[MAX_REG_NR]; | ||
57 | struct faultinfo faultinfo; | ||
58 | long syscall; | ||
59 | int is_user; | ||
60 | }; | ||
61 | |||
62 | #define EMPTY_UML_PT_REGS { } | ||
63 | |||
64 | #define UPT_IP(r) REGS_IP((r)->gp) | ||
65 | #define UPT_SP(r) REGS_SP((r)->gp) | ||
66 | #define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp) | ||
67 | #define UPT_EAX(r) REGS_EAX((r)->gp) | ||
68 | #define UPT_EBX(r) REGS_EBX((r)->gp) | ||
69 | #define UPT_ECX(r) REGS_ECX((r)->gp) | ||
70 | #define UPT_EDX(r) REGS_EDX((r)->gp) | ||
71 | #define UPT_ESI(r) REGS_ESI((r)->gp) | ||
72 | #define UPT_EDI(r) REGS_EDI((r)->gp) | ||
73 | #define UPT_EBP(r) REGS_EBP((r)->gp) | ||
74 | #define UPT_ORIG_EAX(r) ((r)->syscall) | ||
75 | #define UPT_CS(r) REGS_CS((r)->gp) | ||
76 | #define UPT_SS(r) REGS_SS((r)->gp) | ||
77 | #define UPT_DS(r) REGS_DS((r)->gp) | ||
78 | #define UPT_ES(r) REGS_ES((r)->gp) | ||
79 | #define UPT_FS(r) REGS_FS((r)->gp) | ||
80 | #define UPT_GS(r) REGS_GS((r)->gp) | ||
81 | |||
82 | #define UPT_SYSCALL_ARG1(r) UPT_EBX(r) | ||
83 | #define UPT_SYSCALL_ARG2(r) UPT_ECX(r) | ||
84 | #define UPT_SYSCALL_ARG3(r) UPT_EDX(r) | ||
85 | #define UPT_SYSCALL_ARG4(r) UPT_ESI(r) | ||
86 | #define UPT_SYSCALL_ARG5(r) UPT_EDI(r) | ||
87 | #define UPT_SYSCALL_ARG6(r) UPT_EBP(r) | ||
88 | |||
89 | extern int user_context(unsigned long sp); | ||
90 | |||
91 | #define UPT_IS_USER(r) ((r)->is_user) | ||
92 | |||
93 | struct syscall_args { | ||
94 | unsigned long args[6]; | ||
95 | }; | ||
96 | |||
97 | #define SYSCALL_ARGS(r) ((struct syscall_args) \ | ||
98 | { .args = { UPT_SYSCALL_ARG1(r), \ | ||
99 | UPT_SYSCALL_ARG2(r), \ | ||
100 | UPT_SYSCALL_ARG3(r), \ | ||
101 | UPT_SYSCALL_ARG4(r), \ | ||
102 | UPT_SYSCALL_ARG5(r), \ | ||
103 | UPT_SYSCALL_ARG6(r) } } ) | ||
104 | |||
105 | #define UPT_REG(regs, reg) \ | ||
106 | ({ unsigned long val; \ | ||
107 | switch(reg){ \ | ||
108 | case EIP: val = UPT_IP(regs); break; \ | ||
109 | case UESP: val = UPT_SP(regs); break; \ | ||
110 | case EAX: val = UPT_EAX(regs); break; \ | ||
111 | case EBX: val = UPT_EBX(regs); break; \ | ||
112 | case ECX: val = UPT_ECX(regs); break; \ | ||
113 | case EDX: val = UPT_EDX(regs); break; \ | ||
114 | case ESI: val = UPT_ESI(regs); break; \ | ||
115 | case EDI: val = UPT_EDI(regs); break; \ | ||
116 | case EBP: val = UPT_EBP(regs); break; \ | ||
117 | case ORIG_EAX: val = UPT_ORIG_EAX(regs); break; \ | ||
118 | case CS: val = UPT_CS(regs); break; \ | ||
119 | case SS: val = UPT_SS(regs); break; \ | ||
120 | case DS: val = UPT_DS(regs); break; \ | ||
121 | case ES: val = UPT_ES(regs); break; \ | ||
122 | case FS: val = UPT_FS(regs); break; \ | ||
123 | case GS: val = UPT_GS(regs); break; \ | ||
124 | case EFL: val = UPT_EFLAGS(regs); break; \ | ||
125 | default : \ | ||
126 | panic("Bad register in UPT_REG : %d\n", reg); \ | ||
127 | val = -1; \ | ||
128 | } \ | ||
129 | val; \ | ||
130 | }) | ||
131 | |||
132 | #define UPT_SET(regs, reg, val) \ | ||
133 | do { \ | ||
134 | switch(reg){ \ | ||
135 | case EIP: UPT_IP(regs) = val; break; \ | ||
136 | case UESP: UPT_SP(regs) = val; break; \ | ||
137 | case EAX: UPT_EAX(regs) = val; break; \ | ||
138 | case EBX: UPT_EBX(regs) = val; break; \ | ||
139 | case ECX: UPT_ECX(regs) = val; break; \ | ||
140 | case EDX: UPT_EDX(regs) = val; break; \ | ||
141 | case ESI: UPT_ESI(regs) = val; break; \ | ||
142 | case EDI: UPT_EDI(regs) = val; break; \ | ||
143 | case EBP: UPT_EBP(regs) = val; break; \ | ||
144 | case ORIG_EAX: UPT_ORIG_EAX(regs) = val; break; \ | ||
145 | case CS: UPT_CS(regs) = val; break; \ | ||
146 | case SS: UPT_SS(regs) = val; break; \ | ||
147 | case DS: UPT_DS(regs) = val; break; \ | ||
148 | case ES: UPT_ES(regs) = val; break; \ | ||
149 | case FS: UPT_FS(regs) = val; break; \ | ||
150 | case GS: UPT_GS(regs) = val; break; \ | ||
151 | case EFL: UPT_EFLAGS(regs) = val; break; \ | ||
152 | default : \ | ||
153 | panic("Bad register in UPT_SET : %d\n", reg); \ | ||
154 | break; \ | ||
155 | } \ | ||
156 | } while (0) | ||
157 | |||
158 | #define UPT_SET_SYSCALL_RETURN(r, res) \ | ||
159 | REGS_SET_SYSCALL_RETURN((r)->regs, (res)) | ||
160 | |||
161 | #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp) | ||
162 | |||
163 | #define UPT_ORIG_SYSCALL(r) UPT_EAX(r) | ||
164 | #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) | ||
165 | #define UPT_SYSCALL_RET(r) UPT_EAX(r) | ||
166 | |||
167 | #define UPT_FAULTINFO(r) (&(r)->faultinfo) | ||
168 | |||
169 | extern void arch_init_registers(int pid); | ||
170 | |||
171 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/ptrace_user.h b/arch/um/include/shared/sysdep-i386/ptrace_user.h deleted file mode 100644 index ef56247e4143..000000000000 --- a/arch/um/include/shared/sysdep-i386/ptrace_user.h +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_I386_PTRACE_USER_H__ | ||
7 | #define __SYSDEP_I386_PTRACE_USER_H__ | ||
8 | |||
9 | #include <sys/ptrace.h> | ||
10 | #include <linux/ptrace.h> | ||
11 | #include <asm/ptrace.h> | ||
12 | #include "user_constants.h" | ||
13 | |||
14 | #define PT_OFFSET(r) ((r) * sizeof(long)) | ||
15 | |||
16 | #define PT_SYSCALL_NR(regs) ((regs)[ORIG_EAX]) | ||
17 | #define PT_SYSCALL_NR_OFFSET PT_OFFSET(ORIG_EAX) | ||
18 | |||
19 | #define PT_SYSCALL_ARG1_OFFSET PT_OFFSET(EBX) | ||
20 | #define PT_SYSCALL_ARG2_OFFSET PT_OFFSET(ECX) | ||
21 | #define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX) | ||
22 | #define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI) | ||
23 | #define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI) | ||
24 | #define PT_SYSCALL_ARG6_OFFSET PT_OFFSET(EBP) | ||
25 | |||
26 | #define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX) | ||
27 | |||
28 | #define REGS_SYSCALL_NR EAX /* This is used before a system call */ | ||
29 | #define REGS_SYSCALL_ARG1 EBX | ||
30 | #define REGS_SYSCALL_ARG2 ECX | ||
31 | #define REGS_SYSCALL_ARG3 EDX | ||
32 | #define REGS_SYSCALL_ARG4 ESI | ||
33 | #define REGS_SYSCALL_ARG5 EDI | ||
34 | #define REGS_SYSCALL_ARG6 EBP | ||
35 | |||
36 | #define REGS_IP_INDEX EIP | ||
37 | #define REGS_SP_INDEX UESP | ||
38 | |||
39 | #define PT_IP_OFFSET PT_OFFSET(EIP) | ||
40 | #define PT_IP(regs) ((regs)[EIP]) | ||
41 | #define PT_SP_OFFSET PT_OFFSET(UESP) | ||
42 | #define PT_SP(regs) ((regs)[UESP]) | ||
43 | |||
44 | #define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE) | ||
45 | |||
46 | #ifndef FRAME_SIZE | ||
47 | #define FRAME_SIZE (17) | ||
48 | #endif | ||
49 | |||
50 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/sc.h b/arch/um/include/shared/sysdep-i386/sc.h deleted file mode 100644 index c57d1780ad37..000000000000 --- a/arch/um/include/shared/sysdep-i386/sc.h +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | #ifndef __SYSDEP_I386_SC_H | ||
2 | #define __SYSDEP_I386_SC_H | ||
3 | |||
4 | #include <user_constants.h> | ||
5 | |||
6 | #define SC_OFFSET(sc, field) \ | ||
7 | *((unsigned long *) &(((char *) (sc))[HOST_##field])) | ||
8 | #define SC_FP_OFFSET(sc, field) \ | ||
9 | *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field])) | ||
10 | #define SC_FP_OFFSET_PTR(sc, field, type) \ | ||
11 | ((type *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field])) | ||
12 | |||
13 | #define SC_IP(sc) SC_OFFSET(sc, SC_IP) | ||
14 | #define SC_SP(sc) SC_OFFSET(sc, SC_SP) | ||
15 | #define SC_FS(sc) SC_OFFSET(sc, SC_FS) | ||
16 | #define SC_GS(sc) SC_OFFSET(sc, SC_GS) | ||
17 | #define SC_DS(sc) SC_OFFSET(sc, SC_DS) | ||
18 | #define SC_ES(sc) SC_OFFSET(sc, SC_ES) | ||
19 | #define SC_SS(sc) SC_OFFSET(sc, SC_SS) | ||
20 | #define SC_CS(sc) SC_OFFSET(sc, SC_CS) | ||
21 | #define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS) | ||
22 | #define SC_EAX(sc) SC_OFFSET(sc, SC_EAX) | ||
23 | #define SC_EBX(sc) SC_OFFSET(sc, SC_EBX) | ||
24 | #define SC_ECX(sc) SC_OFFSET(sc, SC_ECX) | ||
25 | #define SC_EDX(sc) SC_OFFSET(sc, SC_EDX) | ||
26 | #define SC_EDI(sc) SC_OFFSET(sc, SC_EDI) | ||
27 | #define SC_ESI(sc) SC_OFFSET(sc, SC_ESI) | ||
28 | #define SC_EBP(sc) SC_OFFSET(sc, SC_EBP) | ||
29 | #define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO) | ||
30 | #define SC_ERR(sc) SC_OFFSET(sc, SC_ERR) | ||
31 | #define SC_CR2(sc) SC_OFFSET(sc, SC_CR2) | ||
32 | #define SC_FPSTATE(sc) SC_OFFSET(sc, SC_FPSTATE) | ||
33 | #define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK) | ||
34 | #define SC_FP_CW(sc) SC_FP_OFFSET(sc, SC_FP_CW) | ||
35 | #define SC_FP_SW(sc) SC_FP_OFFSET(sc, SC_FP_SW) | ||
36 | #define SC_FP_TAG(sc) SC_FP_OFFSET(sc, SC_FP_TAG) | ||
37 | #define SC_FP_IPOFF(sc) SC_FP_OFFSET(sc, SC_FP_IPOFF) | ||
38 | #define SC_FP_CSSEL(sc) SC_FP_OFFSET(sc, SC_FP_CSSEL) | ||
39 | #define SC_FP_DATAOFF(sc) SC_FP_OFFSET(sc, SC_FP_DATAOFF) | ||
40 | #define SC_FP_DATASEL(sc) SC_FP_OFFSET(sc, SC_FP_DATASEL) | ||
41 | #define SC_FP_ST(sc) SC_FP_OFFSET_PTR(sc, SC_FP_ST, struct _fpstate) | ||
42 | #define SC_FXSR_ENV(sc) SC_FP_OFFSET_PTR(sc, SC_FXSR_ENV, void) | ||
43 | |||
44 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/sigcontext.h b/arch/um/include/shared/sysdep-i386/sigcontext.h deleted file mode 100644 index f583c87111a0..000000000000 --- a/arch/um/include/shared/sysdep-i386/sigcontext.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYS_SIGCONTEXT_I386_H | ||
7 | #define __SYS_SIGCONTEXT_I386_H | ||
8 | |||
9 | #include "sysdep/sc.h" | ||
10 | |||
11 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) | ||
12 | |||
13 | #define GET_FAULTINFO_FROM_SC(fi, sc) \ | ||
14 | { \ | ||
15 | (fi).cr2 = SC_CR2(sc); \ | ||
16 | (fi).error_code = SC_ERR(sc); \ | ||
17 | (fi).trap_no = SC_TRAPNO(sc); \ | ||
18 | } | ||
19 | |||
20 | /* This is Page Fault */ | ||
21 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) | ||
22 | |||
23 | /* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */ | ||
24 | #define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo) | ||
25 | |||
26 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/skas_ptrace.h b/arch/um/include/shared/sysdep-i386/skas_ptrace.h deleted file mode 100644 index e27b8a791773..000000000000 --- a/arch/um/include/shared/sysdep-i386/skas_ptrace.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_I386_SKAS_PTRACE_H | ||
7 | #define __SYSDEP_I386_SKAS_PTRACE_H | ||
8 | |||
9 | struct ptrace_faultinfo { | ||
10 | int is_write; | ||
11 | unsigned long addr; | ||
12 | }; | ||
13 | |||
14 | struct ptrace_ldt { | ||
15 | int func; | ||
16 | void *ptr; | ||
17 | unsigned long bytecount; | ||
18 | }; | ||
19 | |||
20 | #define PTRACE_LDT 54 | ||
21 | |||
22 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/stub.h b/arch/um/include/shared/sysdep-i386/stub.h deleted file mode 100644 index 8c097b87fca7..000000000000 --- a/arch/um/include/shared/sysdep-i386/stub.h +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_STUB_H | ||
7 | #define __SYSDEP_STUB_H | ||
8 | |||
9 | #include <sys/mman.h> | ||
10 | #include <asm/ptrace.h> | ||
11 | #include <asm/unistd.h> | ||
12 | #include "as-layout.h" | ||
13 | #include "stub-data.h" | ||
14 | #include "kern_constants.h" | ||
15 | #include "uml-config.h" | ||
16 | |||
17 | extern void stub_segv_handler(int sig); | ||
18 | extern void stub_clone_handler(void); | ||
19 | |||
20 | #define STUB_SYSCALL_RET EAX | ||
21 | #define STUB_MMAP_NR __NR_mmap2 | ||
22 | #define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT) | ||
23 | |||
24 | static inline long stub_syscall0(long syscall) | ||
25 | { | ||
26 | long ret; | ||
27 | |||
28 | __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall)); | ||
29 | |||
30 | return ret; | ||
31 | } | ||
32 | |||
33 | static inline long stub_syscall1(long syscall, long arg1) | ||
34 | { | ||
35 | long ret; | ||
36 | |||
37 | __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1)); | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | static inline long stub_syscall2(long syscall, long arg1, long arg2) | ||
43 | { | ||
44 | long ret; | ||
45 | |||
46 | __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), | ||
47 | "c" (arg2)); | ||
48 | |||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) | ||
53 | { | ||
54 | long ret; | ||
55 | |||
56 | __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), | ||
57 | "c" (arg2), "d" (arg3)); | ||
58 | |||
59 | return ret; | ||
60 | } | ||
61 | |||
62 | static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, | ||
63 | long arg4) | ||
64 | { | ||
65 | long ret; | ||
66 | |||
67 | __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), | ||
68 | "c" (arg2), "d" (arg3), "S" (arg4)); | ||
69 | |||
70 | return ret; | ||
71 | } | ||
72 | |||
73 | static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3, | ||
74 | long arg4, long arg5) | ||
75 | { | ||
76 | long ret; | ||
77 | |||
78 | __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), | ||
79 | "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)); | ||
80 | |||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | static inline void trap_myself(void) | ||
85 | { | ||
86 | __asm("int3"); | ||
87 | } | ||
88 | |||
89 | static inline void remap_stack(int fd, unsigned long offset) | ||
90 | { | ||
91 | __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" | ||
92 | "movl %7, %%ebx ; movl %%eax, (%%ebx)" | ||
93 | : : "g" (STUB_MMAP_NR), "b" (STUB_DATA), | ||
94 | "c" (UM_KERN_PAGE_SIZE), | ||
95 | "d" (PROT_READ | PROT_WRITE), | ||
96 | "S" (MAP_FIXED | MAP_SHARED), "D" (fd), | ||
97 | "a" (offset), | ||
98 | "i" (&((struct stub_data *) STUB_DATA)->err) | ||
99 | : "memory"); | ||
100 | } | ||
101 | |||
102 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/syscalls.h b/arch/um/include/shared/sysdep-i386/syscalls.h deleted file mode 100644 index 905698197e35..000000000000 --- a/arch/um/include/shared/sysdep-i386/syscalls.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include "asm/unistd.h" | ||
7 | #include "sysdep/ptrace.h" | ||
8 | |||
9 | typedef long syscall_handler_t(struct pt_regs); | ||
10 | |||
11 | /* Not declared on x86, incompatible declarations on x86_64, so these have | ||
12 | * to go here rather than in sys_call_table.c | ||
13 | */ | ||
14 | extern syscall_handler_t sys_rt_sigaction; | ||
15 | |||
16 | extern syscall_handler_t old_mmap_i386; | ||
17 | |||
18 | extern syscall_handler_t *sys_call_table[]; | ||
19 | |||
20 | #define EXECUTE_SYSCALL(syscall, regs) \ | ||
21 | ((long (*)(struct syscall_args)) \ | ||
22 | (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) | ||
23 | |||
24 | extern long sys_mmap2(unsigned long addr, unsigned long len, | ||
25 | unsigned long prot, unsigned long flags, | ||
26 | unsigned long fd, unsigned long pgoff); | ||
diff --git a/arch/um/include/shared/sysdep-i386/system.h b/arch/um/include/shared/sysdep-i386/system.h deleted file mode 100644 index d1b93c436200..000000000000 --- a/arch/um/include/shared/sysdep-i386/system.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | #ifndef _ASM_X86_SYSTEM_H_ | ||
2 | #define _ASM_X86_SYSTEM_H_ | ||
3 | |||
4 | #include <asm/asm.h> | ||
5 | #include <asm/segment.h> | ||
6 | #include <asm/cpufeature.h> | ||
7 | #include <asm/cmpxchg.h> | ||
8 | #include <asm/nops.h> | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/irqflags.h> | ||
12 | |||
13 | /* entries in ARCH_DLINFO: */ | ||
14 | #ifdef CONFIG_IA32_EMULATION | ||
15 | # define AT_VECTOR_SIZE_ARCH 2 | ||
16 | #else | ||
17 | # define AT_VECTOR_SIZE_ARCH 1 | ||
18 | #endif | ||
19 | |||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | void default_idle(void); | ||
23 | |||
24 | /* | ||
25 | * Force strict CPU ordering. | ||
26 | * And yes, this is required on UP too when we're talking | ||
27 | * to devices. | ||
28 | */ | ||
29 | #ifdef CONFIG_X86_32 | ||
30 | /* | ||
31 | * Some non-Intel clones support out of order store. wmb() ceases to be a | ||
32 | * nop for these. | ||
33 | */ | ||
34 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | ||
35 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | ||
36 | #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | ||
37 | #else | ||
38 | #define mb() asm volatile("mfence":::"memory") | ||
39 | #define rmb() asm volatile("lfence":::"memory") | ||
40 | #define wmb() asm volatile("sfence" ::: "memory") | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * read_barrier_depends - Flush all pending reads that subsequents reads | ||
45 | * depend on. | ||
46 | * | ||
47 | * No data-dependent reads from memory-like regions are ever reordered | ||
48 | * over this barrier. All reads preceding this primitive are guaranteed | ||
49 | * to access memory (but not necessarily other CPUs' caches) before any | ||
50 | * reads following this primitive that depend on the data return by | ||
51 | * any of the preceding reads. This primitive is much lighter weight than | ||
52 | * rmb() on most CPUs, and is never heavier weight than is | ||
53 | * rmb(). | ||
54 | * | ||
55 | * These ordering constraints are respected by both the local CPU | ||
56 | * and the compiler. | ||
57 | * | ||
58 | * Ordering is not guaranteed by anything other than these primitives, | ||
59 | * not even by data dependencies. See the documentation for | ||
60 | * memory_barrier() for examples and URLs to more information. | ||
61 | * | ||
62 | * For example, the following code would force ordering (the initial | ||
63 | * value of "a" is zero, "b" is one, and "p" is "&a"): | ||
64 | * | ||
65 | * <programlisting> | ||
66 | * CPU 0 CPU 1 | ||
67 | * | ||
68 | * b = 2; | ||
69 | * memory_barrier(); | ||
70 | * p = &b; q = p; | ||
71 | * read_barrier_depends(); | ||
72 | * d = *q; | ||
73 | * </programlisting> | ||
74 | * | ||
75 | * because the read of "*q" depends on the read of "p" and these | ||
76 | * two reads are separated by a read_barrier_depends(). However, | ||
77 | * the following code, with the same initial values for "a" and "b": | ||
78 | * | ||
79 | * <programlisting> | ||
80 | * CPU 0 CPU 1 | ||
81 | * | ||
82 | * a = 2; | ||
83 | * memory_barrier(); | ||
84 | * b = 3; y = b; | ||
85 | * read_barrier_depends(); | ||
86 | * x = a; | ||
87 | * </programlisting> | ||
88 | * | ||
89 | * does not enforce ordering, since there is no data dependency between | ||
90 | * the read of "a" and the read of "b". Therefore, on some CPUs, such | ||
91 | * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() | ||
92 | * in cases like this where there are no data dependencies. | ||
93 | **/ | ||
94 | |||
95 | #define read_barrier_depends() do { } while (0) | ||
96 | |||
97 | #ifdef CONFIG_SMP | ||
98 | #define smp_mb() mb() | ||
99 | #ifdef CONFIG_X86_PPRO_FENCE | ||
100 | # define smp_rmb() rmb() | ||
101 | #else | ||
102 | # define smp_rmb() barrier() | ||
103 | #endif | ||
104 | #ifdef CONFIG_X86_OOSTORE | ||
105 | # define smp_wmb() wmb() | ||
106 | #else | ||
107 | # define smp_wmb() barrier() | ||
108 | #endif | ||
109 | #define smp_read_barrier_depends() read_barrier_depends() | ||
110 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
111 | #else | ||
112 | #define smp_mb() barrier() | ||
113 | #define smp_rmb() barrier() | ||
114 | #define smp_wmb() barrier() | ||
115 | #define smp_read_barrier_depends() do { } while (0) | ||
116 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
117 | #endif | ||
118 | |||
119 | /* | ||
120 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | ||
121 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | ||
122 | * code region. | ||
123 | * | ||
124 | * (Could use an alternative three way for this if there was one.) | ||
125 | */ | ||
126 | static inline void rdtsc_barrier(void) | ||
127 | { | ||
128 | alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); | ||
129 | alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); | ||
130 | } | ||
131 | |||
132 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/tls.h b/arch/um/include/shared/sysdep-i386/tls.h deleted file mode 100644 index 34550755b2a1..000000000000 --- a/arch/um/include/shared/sysdep-i386/tls.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #ifndef _SYSDEP_TLS_H | ||
2 | #define _SYSDEP_TLS_H | ||
3 | |||
4 | # ifndef __KERNEL__ | ||
5 | |||
6 | /* Change name to avoid conflicts with the original one from <asm/ldt.h>, which | ||
7 | * may be named user_desc (but in 2.4 and in header matching its API was named | ||
8 | * modify_ldt_ldt_s). */ | ||
9 | |||
10 | typedef struct um_dup_user_desc { | ||
11 | unsigned int entry_number; | ||
12 | unsigned int base_addr; | ||
13 | unsigned int limit; | ||
14 | unsigned int seg_32bit:1; | ||
15 | unsigned int contents:2; | ||
16 | unsigned int read_exec_only:1; | ||
17 | unsigned int limit_in_pages:1; | ||
18 | unsigned int seg_not_present:1; | ||
19 | unsigned int useable:1; | ||
20 | } user_desc_t; | ||
21 | |||
22 | # else /* __KERNEL__ */ | ||
23 | |||
24 | # include <ldt.h> | ||
25 | typedef struct user_desc user_desc_t; | ||
26 | |||
27 | # endif /* __KERNEL__ */ | ||
28 | |||
29 | #define GDT_ENTRY_TLS_MIN_I386 6 | ||
30 | #define GDT_ENTRY_TLS_MIN_X86_64 12 | ||
31 | |||
32 | #endif /* _SYSDEP_TLS_H */ | ||
diff --git a/arch/um/include/shared/sysdep-i386/vm-flags.h b/arch/um/include/shared/sysdep-i386/vm-flags.h deleted file mode 100644 index e0d24c568dbc..000000000000 --- a/arch/um/include/shared/sysdep-i386/vm-flags.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __VM_FLAGS_I386_H | ||
7 | #define __VM_FLAGS_I386_H | ||
8 | |||
9 | #define VM_DATA_DEFAULT_FLAGS \ | ||
10 | (VM_READ | VM_WRITE | \ | ||
11 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ | ||
12 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
13 | |||
14 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-ia64/ptrace.h b/arch/um/include/shared/sysdep-ia64/ptrace.h deleted file mode 100644 index 42dd8fb6f2f9..000000000000 --- a/arch/um/include/shared/sysdep-ia64/ptrace.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_IA64_PTRACE_H | ||
7 | #define __SYSDEP_IA64_PTRACE_H | ||
8 | |||
9 | struct sys_pt_regs { | ||
10 | int foo; | ||
11 | }; | ||
12 | |||
13 | #define EMPTY_REGS { 0 } | ||
14 | |||
15 | #endif | ||
16 | |||
17 | /* | ||
18 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
19 | * Emacs will notice this stuff at the end of the file and automatically | ||
20 | * adjust the settings for this buffer only. This must remain at the end | ||
21 | * of the file. | ||
22 | * --------------------------------------------------------------------------- | ||
23 | * Local variables: | ||
24 | * c-file-style: "linux" | ||
25 | * End: | ||
26 | */ | ||
diff --git a/arch/um/include/shared/sysdep-ia64/sigcontext.h b/arch/um/include/shared/sysdep-ia64/sigcontext.h deleted file mode 100644 index f15fb25260ba..000000000000 --- a/arch/um/include/shared/sysdep-ia64/sigcontext.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_IA64_SIGCONTEXT_H | ||
7 | #define __SYSDEP_IA64_SIGCONTEXT_H | ||
8 | |||
9 | #endif | ||
10 | |||
11 | /* | ||
12 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
13 | * Emacs will notice this stuff at the end of the file and automatically | ||
14 | * adjust the settings for this buffer only. This must remain at the end | ||
15 | * of the file. | ||
16 | * --------------------------------------------------------------------------- | ||
17 | * Local variables: | ||
18 | * c-file-style: "linux" | ||
19 | * End: | ||
20 | */ | ||
diff --git a/arch/um/include/shared/sysdep-ia64/skas_ptrace.h b/arch/um/include/shared/sysdep-ia64/skas_ptrace.h deleted file mode 100644 index 25a38e715702..000000000000 --- a/arch/um/include/shared/sysdep-ia64/skas_ptrace.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_IA64_SKAS_PTRACE_H | ||
7 | #define __SYSDEP_IA64_SKAS_PTRACE_H | ||
8 | |||
9 | struct ptrace_faultinfo { | ||
10 | int is_write; | ||
11 | unsigned long addr; | ||
12 | }; | ||
13 | |||
14 | struct ptrace_ldt { | ||
15 | int func; | ||
16 | void *ptr; | ||
17 | unsigned long bytecount; | ||
18 | }; | ||
19 | |||
20 | #define PTRACE_LDT 54 | ||
21 | |||
22 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-ia64/syscalls.h b/arch/um/include/shared/sysdep-ia64/syscalls.h deleted file mode 100644 index 4a1f46ef1ebc..000000000000 --- a/arch/um/include/shared/sysdep-ia64/syscalls.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_IA64_SYSCALLS_H | ||
7 | #define __SYSDEP_IA64_SYSCALLS_H | ||
8 | |||
9 | #endif | ||
10 | |||
11 | /* | ||
12 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
13 | * Emacs will notice this stuff at the end of the file and automatically | ||
14 | * adjust the settings for this buffer only. This must remain at the end | ||
15 | * of the file. | ||
16 | * --------------------------------------------------------------------------- | ||
17 | * Local variables: | ||
18 | * c-file-style: "linux" | ||
19 | * End: | ||
20 | */ | ||
diff --git a/arch/um/include/shared/sysdep-ppc/ptrace.h b/arch/um/include/shared/sysdep-ppc/ptrace.h deleted file mode 100644 index df2397dba3e5..000000000000 --- a/arch/um/include/shared/sysdep-ppc/ptrace.h +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* | ||
2 | * Licensed under the GPL | ||
3 | */ | ||
4 | |||
5 | #ifndef __SYS_PTRACE_PPC_H | ||
6 | #define __SYS_PTRACE_PPC_H | ||
7 | |||
8 | #include "linux/types.h" | ||
9 | |||
10 | /* the following taken from <asm-ppc/ptrace.h> */ | ||
11 | |||
12 | #ifdef CONFIG_PPC64 | ||
13 | #define PPC_REG unsigned long /*long*/ | ||
14 | #else | ||
15 | #define PPC_REG unsigned long | ||
16 | #endif | ||
17 | struct sys_pt_regs_s { | ||
18 | PPC_REG gpr[32]; | ||
19 | PPC_REG nip; | ||
20 | PPC_REG msr; | ||
21 | PPC_REG orig_gpr3; /* Used for restarting system calls */ | ||
22 | PPC_REG ctr; | ||
23 | PPC_REG link; | ||
24 | PPC_REG xer; | ||
25 | PPC_REG ccr; | ||
26 | PPC_REG mq; /* 601 only (not used at present) */ | ||
27 | /* Used on APUS to hold IPL value. */ | ||
28 | PPC_REG trap; /* Reason for being here */ | ||
29 | PPC_REG dar; /* Fault registers */ | ||
30 | PPC_REG dsisr; | ||
31 | PPC_REG result; /* Result of a system call */ | ||
32 | }; | ||
33 | |||
34 | #define NUM_REGS (sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG)) | ||
35 | |||
36 | struct sys_pt_regs { | ||
37 | PPC_REG regs[sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG)]; | ||
38 | }; | ||
39 | |||
40 | #define UM_MAX_REG (PT_FPR0) | ||
41 | #define UM_MAX_REG_OFFSET (UM_MAX_REG * sizeof(PPC_REG)) | ||
42 | |||
43 | #define EMPTY_REGS { { [ 0 ... NUM_REGS - 1] = 0 } } | ||
44 | |||
45 | #define UM_REG(r, n) ((r)->regs[n]) | ||
46 | |||
47 | #define UM_SYSCALL_RET(r) UM_REG(r, PT_R3) | ||
48 | #define UM_SP(r) UM_REG(r, PT_R1) | ||
49 | #define UM_IP(r) UM_REG(r, PT_NIP) | ||
50 | #define UM_ELF_ZERO(r) UM_REG(r, PT_FPSCR) | ||
51 | #define UM_SYSCALL_NR(r) UM_REG(r, PT_R0) | ||
52 | #define UM_SYSCALL_ARG1(r) UM_REG(r, PT_ORIG_R3) | ||
53 | #define UM_SYSCALL_ARG2(r) UM_REG(r, PT_R4) | ||
54 | #define UM_SYSCALL_ARG3(r) UM_REG(r, PT_R5) | ||
55 | #define UM_SYSCALL_ARG4(r) UM_REG(r, PT_R6) | ||
56 | #define UM_SYSCALL_ARG5(r) UM_REG(r, PT_R7) | ||
57 | #define UM_SYSCALL_ARG6(r) UM_REG(r, PT_R8) | ||
58 | |||
59 | #define UM_SYSCALL_NR_OFFSET (PT_R0 * sizeof(PPC_REG)) | ||
60 | #define UM_SYSCALL_RET_OFFSET (PT_R3 * sizeof(PPC_REG)) | ||
61 | #define UM_SYSCALL_ARG1_OFFSET (PT_R3 * sizeof(PPC_REG)) | ||
62 | #define UM_SYSCALL_ARG2_OFFSET (PT_R4 * sizeof(PPC_REG)) | ||
63 | #define UM_SYSCALL_ARG3_OFFSET (PT_R5 * sizeof(PPC_REG)) | ||
64 | #define UM_SYSCALL_ARG4_OFFSET (PT_R6 * sizeof(PPC_REG)) | ||
65 | #define UM_SYSCALL_ARG5_OFFSET (PT_R7 * sizeof(PPC_REG)) | ||
66 | #define UM_SYSCALL_ARG6_OFFSET (PT_R8 * sizeof(PPC_REG)) | ||
67 | #define UM_SP_OFFSET (PT_R1 * sizeof(PPC_REG)) | ||
68 | #define UM_IP_OFFSET (PT_NIP * sizeof(PPC_REG)) | ||
69 | #define UM_ELF_ZERO_OFFSET (PT_R3 * sizeof(PPC_REG)) | ||
70 | |||
71 | #define UM_SET_SYSCALL_RETURN(_regs, result) \ | ||
72 | do { \ | ||
73 | if (result < 0) { \ | ||
74 | (_regs)->regs[PT_CCR] |= 0x10000000; \ | ||
75 | UM_SYSCALL_RET((_regs)) = -result; \ | ||
76 | } else { \ | ||
77 | UM_SYSCALL_RET((_regs)) = result; \ | ||
78 | } \ | ||
79 | } while(0) | ||
80 | |||
81 | extern void shove_aux_table(unsigned long sp); | ||
82 | #define UM_FIX_EXEC_STACK(sp) shove_aux_table(sp); | ||
83 | |||
84 | /* These aren't actually defined. The undefs are just to make sure | ||
85 | * everyone's clear on the concept. | ||
86 | */ | ||
87 | #undef UML_HAVE_GETREGS | ||
88 | #undef UML_HAVE_GETFPREGS | ||
89 | #undef UML_HAVE_SETREGS | ||
90 | #undef UML_HAVE_SETFPREGS | ||
91 | |||
92 | #endif | ||
93 | |||
94 | /* | ||
95 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
96 | * Emacs will notice this stuff at the end of the file and automatically | ||
97 | * adjust the settings for this buffer only. This must remain at the end | ||
98 | * of the file. | ||
99 | * --------------------------------------------------------------------------- | ||
100 | * Local variables: | ||
101 | * c-file-style: "linux" | ||
102 | * End: | ||
103 | */ | ||
diff --git a/arch/um/include/shared/sysdep-ppc/sigcontext.h b/arch/um/include/shared/sysdep-ppc/sigcontext.h deleted file mode 100644 index f20d965de9c7..000000000000 --- a/arch/um/include/shared/sysdep-ppc/sigcontext.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYS_SIGCONTEXT_PPC_H | ||
7 | #define __SYS_SIGCONTEXT_PPC_H | ||
8 | |||
9 | #define DSISR_WRITE 0x02000000 | ||
10 | |||
11 | #define SC_FAULT_ADDR(sc) ({ \ | ||
12 | struct sigcontext *_sc = (sc); \ | ||
13 | long retval = -1; \ | ||
14 | switch (_sc->regs->trap) { \ | ||
15 | case 0x300: \ | ||
16 | /* data exception */ \ | ||
17 | retval = _sc->regs->dar; \ | ||
18 | break; \ | ||
19 | case 0x400: \ | ||
20 | /* instruction exception */ \ | ||
21 | retval = _sc->regs->nip; \ | ||
22 | break; \ | ||
23 | default: \ | ||
24 | panic("SC_FAULT_ADDR: unhandled trap type\n"); \ | ||
25 | } \ | ||
26 | retval; \ | ||
27 | }) | ||
28 | |||
29 | #define SC_FAULT_WRITE(sc) ({ \ | ||
30 | struct sigcontext *_sc = (sc); \ | ||
31 | long retval = -1; \ | ||
32 | switch (_sc->regs->trap) { \ | ||
33 | case 0x300: \ | ||
34 | /* data exception */ \ | ||
35 | retval = !!(_sc->regs->dsisr & DSISR_WRITE); \ | ||
36 | break; \ | ||
37 | case 0x400: \ | ||
38 | /* instruction exception: not a write */ \ | ||
39 | retval = 0; \ | ||
40 | break; \ | ||
41 | default: \ | ||
42 | panic("SC_FAULT_ADDR: unhandled trap type\n"); \ | ||
43 | } \ | ||
44 | retval; \ | ||
45 | }) | ||
46 | |||
47 | #define SC_IP(sc) ((sc)->regs->nip) | ||
48 | #define SC_SP(sc) ((sc)->regs->gpr[1]) | ||
49 | #define SEGV_IS_FIXABLE(sc) (1) | ||
50 | |||
51 | #endif | ||
52 | |||
53 | /* | ||
54 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
55 | * Emacs will notice this stuff at the end of the file and automatically | ||
56 | * adjust the settings for this buffer only. This must remain at the end | ||
57 | * of the file. | ||
58 | * --------------------------------------------------------------------------- | ||
59 | * Local variables: | ||
60 | * c-file-style: "linux" | ||
61 | * End: | ||
62 | */ | ||
diff --git a/arch/um/include/shared/sysdep-ppc/skas_ptrace.h b/arch/um/include/shared/sysdep-ppc/skas_ptrace.h deleted file mode 100644 index d9fbbac10de0..000000000000 --- a/arch/um/include/shared/sysdep-ppc/skas_ptrace.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_PPC_SKAS_PTRACE_H | ||
7 | #define __SYSDEP_PPC_SKAS_PTRACE_H | ||
8 | |||
9 | struct ptrace_faultinfo { | ||
10 | int is_write; | ||
11 | unsigned long addr; | ||
12 | }; | ||
13 | |||
14 | struct ptrace_ldt { | ||
15 | int func; | ||
16 | void *ptr; | ||
17 | unsigned long bytecount; | ||
18 | }; | ||
19 | |||
20 | #define PTRACE_LDT 54 | ||
21 | |||
22 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-ppc/syscalls.h b/arch/um/include/shared/sysdep-ppc/syscalls.h deleted file mode 100644 index 679df351e19b..000000000000 --- a/arch/um/include/shared/sysdep-ppc/syscalls.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | typedef long syscall_handler_t(unsigned long arg1, unsigned long arg2, | ||
7 | unsigned long arg3, unsigned long arg4, | ||
8 | unsigned long arg5, unsigned long arg6); | ||
9 | |||
10 | #define EXECUTE_SYSCALL(syscall, regs) \ | ||
11 | (*sys_call_table[syscall])(UM_SYSCALL_ARG1(®s), \ | ||
12 | UM_SYSCALL_ARG2(®s), \ | ||
13 | UM_SYSCALL_ARG3(®s), \ | ||
14 | UM_SYSCALL_ARG4(®s), \ | ||
15 | UM_SYSCALL_ARG5(®s), \ | ||
16 | UM_SYSCALL_ARG6(®s)) | ||
17 | |||
18 | extern syscall_handler_t sys_mincore; | ||
19 | extern syscall_handler_t sys_madvise; | ||
20 | |||
21 | /* old_mmap needs the correct prototype since syscall_kern.c includes | ||
22 | * this file. | ||
23 | */ | ||
24 | int old_mmap(unsigned long addr, unsigned long len, | ||
25 | unsigned long prot, unsigned long flags, | ||
26 | unsigned long fd, unsigned long offset); | ||
27 | |||
28 | #define ARCH_SYSCALLS \ | ||
29 | [ __NR_modify_ldt ] = sys_ni_syscall, \ | ||
30 | [ __NR_pciconfig_read ] = sys_ni_syscall, \ | ||
31 | [ __NR_pciconfig_write ] = sys_ni_syscall, \ | ||
32 | [ __NR_pciconfig_iobase ] = sys_ni_syscall, \ | ||
33 | [ __NR_pivot_root ] = sys_ni_syscall, \ | ||
34 | [ __NR_multiplexer ] = sys_ni_syscall, \ | ||
35 | [ __NR_mmap ] = old_mmap, \ | ||
36 | [ __NR_madvise ] = sys_madvise, \ | ||
37 | [ __NR_mincore ] = sys_mincore, \ | ||
38 | [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \ | ||
39 | [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \ | ||
40 | [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, | ||
41 | |||
42 | #define LAST_ARCH_SYSCALL __NR_fadvise64 | ||
43 | |||
44 | /* | ||
45 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
46 | * Emacs will notice this stuff at the end of the file and automatically | ||
47 | * adjust the settings for this buffer only. This must remain at the end | ||
48 | * of the file. | ||
49 | * --------------------------------------------------------------------------- | ||
50 | * Local variables: | ||
51 | * c-file-style: "linux" | ||
52 | * End: | ||
53 | */ | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/archsetjmp.h b/arch/um/include/shared/sysdep-x86_64/archsetjmp.h deleted file mode 100644 index 2af8f12ca161..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/archsetjmp.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * arch/um/include/sysdep-x86_64/archsetjmp.h | ||
3 | */ | ||
4 | |||
5 | #ifndef _KLIBC_ARCHSETJMP_H | ||
6 | #define _KLIBC_ARCHSETJMP_H | ||
7 | |||
8 | struct __jmp_buf { | ||
9 | unsigned long __rbx; | ||
10 | unsigned long __rsp; | ||
11 | unsigned long __rbp; | ||
12 | unsigned long __r12; | ||
13 | unsigned long __r13; | ||
14 | unsigned long __r14; | ||
15 | unsigned long __r15; | ||
16 | unsigned long __rip; | ||
17 | }; | ||
18 | |||
19 | typedef struct __jmp_buf jmp_buf[1]; | ||
20 | |||
21 | #define JB_IP __rip | ||
22 | #define JB_SP __rsp | ||
23 | |||
24 | #endif /* _SETJMP_H */ | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/barrier.h b/arch/um/include/shared/sysdep-x86_64/barrier.h deleted file mode 100644 index 7b610befdc8f..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/barrier.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef __SYSDEP_X86_64_BARRIER_H | ||
2 | #define __SYSDEP_X86_64_BARRIER_H | ||
3 | |||
4 | /* Copied from include/asm-x86_64 for use by userspace. */ | ||
5 | #define mb() asm volatile("mfence":::"memory") | ||
6 | |||
7 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/checksum.h b/arch/um/include/shared/sysdep-x86_64/checksum.h deleted file mode 100644 index a5be9031ea85..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/checksum.h +++ /dev/null | |||
@@ -1,144 +0,0 @@ | |||
1 | /* | ||
2 | * Licensed under the GPL | ||
3 | */ | ||
4 | |||
5 | #ifndef __UM_SYSDEP_CHECKSUM_H | ||
6 | #define __UM_SYSDEP_CHECKSUM_H | ||
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) | ||
134 | { | ||
135 | asm("addl %2,%0\n\t" | ||
136 | "adcl $0,%0" | ||
137 | : "=r" (a) | ||
138 | : "0" (a), "r" (b)); | ||
139 | return a; | ||
140 | } | ||
141 | |||
142 | extern __sum16 ip_compute_csum(const void *buff, int len); | ||
143 | |||
144 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/faultinfo.h b/arch/um/include/shared/sysdep-x86_64/faultinfo.h deleted file mode 100644 index cb917b0d5660..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/faultinfo.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
3 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __FAULTINFO_X86_64_H | ||
8 | #define __FAULTINFO_X86_64_H | ||
9 | |||
10 | /* this structure contains the full arch-specific faultinfo | ||
11 | * from the traps. | ||
12 | * On i386, ptrace_faultinfo unfortunately doesn't provide | ||
13 | * all the info, since trap_no is missing. | ||
14 | * All common elements are defined at the same position in | ||
15 | * both structures, thus making it easy to copy the | ||
16 | * contents without knowledge about the structure elements. | ||
17 | */ | ||
18 | struct faultinfo { | ||
19 | int error_code; /* in ptrace_faultinfo misleadingly called is_write */ | ||
20 | unsigned long cr2; /* in ptrace_faultinfo called addr */ | ||
21 | int trap_no; /* missing in ptrace_faultinfo */ | ||
22 | }; | ||
23 | |||
24 | #define FAULT_WRITE(fi) ((fi).error_code & 2) | ||
25 | #define FAULT_ADDRESS(fi) ((fi).cr2) | ||
26 | |||
27 | #define PTRACE_FULL_FAULTINFO 1 | ||
28 | |||
29 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/host_ldt.h b/arch/um/include/shared/sysdep-x86_64/host_ldt.h deleted file mode 100644 index e8b1be1e154f..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/host_ldt.h +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #ifndef __ASM_HOST_LDT_X86_64_H | ||
2 | #define __ASM_HOST_LDT_X86_64_H | ||
3 | |||
4 | #include <asm/ldt.h> | ||
5 | |||
6 | /* | ||
7 | * macros stolen from include/asm-x86_64/desc.h | ||
8 | */ | ||
9 | #define LDT_entry_a(info) \ | ||
10 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
11 | |||
12 | /* Don't allow setting of the lm bit. It is useless anyways because | ||
13 | * 64bit system calls require __USER_CS. */ | ||
14 | #define LDT_entry_b(info) \ | ||
15 | (((info)->base_addr & 0xff000000) | \ | ||
16 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
17 | ((info)->limit & 0xf0000) | \ | ||
18 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
19 | ((info)->contents << 10) | \ | ||
20 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
21 | ((info)->seg_32bit << 22) | \ | ||
22 | ((info)->limit_in_pages << 23) | \ | ||
23 | ((info)->useable << 20) | \ | ||
24 | /* ((info)->lm << 21) | */ \ | ||
25 | 0x7000) | ||
26 | |||
27 | #define LDT_empty(info) (\ | ||
28 | (info)->base_addr == 0 && \ | ||
29 | (info)->limit == 0 && \ | ||
30 | (info)->contents == 0 && \ | ||
31 | (info)->read_exec_only == 1 && \ | ||
32 | (info)->seg_32bit == 0 && \ | ||
33 | (info)->limit_in_pages == 0 && \ | ||
34 | (info)->seg_not_present == 1 && \ | ||
35 | (info)->useable == 0 && \ | ||
36 | (info)->lm == 0) | ||
37 | |||
38 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/kernel-offsets.h b/arch/um/include/shared/sysdep-x86_64/kernel-offsets.h deleted file mode 100644 index a307237b7964..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/kernel-offsets.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include <linux/stddef.h> | ||
2 | #include <linux/sched.h> | ||
3 | #include <linux/time.h> | ||
4 | #include <linux/elf.h> | ||
5 | #include <linux/crypto.h> | ||
6 | #include <asm/page.h> | ||
7 | #include <asm/mman.h> | ||
8 | |||
9 | #define DEFINE(sym, val) \ | ||
10 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
11 | |||
12 | #define DEFINE_STR1(x) #x | ||
13 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : ) | ||
14 | |||
15 | #define BLANK() asm volatile("\n->" : : ) | ||
16 | |||
17 | #define OFFSET(sym, str, mem) \ | ||
18 | DEFINE(sym, offsetof(struct str, mem)); | ||
19 | |||
20 | void foo(void) | ||
21 | { | ||
22 | #include <common-offsets.h> | ||
23 | } | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/ptrace.h b/arch/um/include/shared/sysdep-x86_64/ptrace.h deleted file mode 100644 index 9ea44d111f33..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/ptrace.h +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
4 | * | ||
5 | * Licensed under the GPL | ||
6 | */ | ||
7 | |||
8 | #ifndef __SYSDEP_X86_64_PTRACE_H | ||
9 | #define __SYSDEP_X86_64_PTRACE_H | ||
10 | |||
11 | #include "uml-config.h" | ||
12 | #include "user_constants.h" | ||
13 | #include "sysdep/faultinfo.h" | ||
14 | |||
15 | #define MAX_REG_OFFSET (UM_FRAME_SIZE) | ||
16 | #define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long)) | ||
17 | |||
18 | #include "skas_ptregs.h" | ||
19 | |||
20 | #define REGS_IP(r) ((r)[HOST_IP]) | ||
21 | #define REGS_SP(r) ((r)[HOST_SP]) | ||
22 | |||
23 | #define REGS_RBX(r) ((r)[HOST_RBX]) | ||
24 | #define REGS_RCX(r) ((r)[HOST_RCX]) | ||
25 | #define REGS_RDX(r) ((r)[HOST_RDX]) | ||
26 | #define REGS_RSI(r) ((r)[HOST_RSI]) | ||
27 | #define REGS_RDI(r) ((r)[HOST_RDI]) | ||
28 | #define REGS_RBP(r) ((r)[HOST_RBP]) | ||
29 | #define REGS_RAX(r) ((r)[HOST_RAX]) | ||
30 | #define REGS_R8(r) ((r)[HOST_R8]) | ||
31 | #define REGS_R9(r) ((r)[HOST_R9]) | ||
32 | #define REGS_R10(r) ((r)[HOST_R10]) | ||
33 | #define REGS_R11(r) ((r)[HOST_R11]) | ||
34 | #define REGS_R12(r) ((r)[HOST_R12]) | ||
35 | #define REGS_R13(r) ((r)[HOST_R13]) | ||
36 | #define REGS_R14(r) ((r)[HOST_R14]) | ||
37 | #define REGS_R15(r) ((r)[HOST_R15]) | ||
38 | #define REGS_CS(r) ((r)[HOST_CS]) | ||
39 | #define REGS_EFLAGS(r) ((r)[HOST_EFLAGS]) | ||
40 | #define REGS_SS(r) ((r)[HOST_SS]) | ||
41 | |||
42 | #define HOST_FS_BASE 21 | ||
43 | #define HOST_GS_BASE 22 | ||
44 | #define HOST_DS 23 | ||
45 | #define HOST_ES 24 | ||
46 | #define HOST_FS 25 | ||
47 | #define HOST_GS 26 | ||
48 | |||
49 | /* Also defined in asm/ptrace-x86_64.h, but not in libc headers. So, these | ||
50 | * are already defined for kernel code, but not for userspace code. | ||
51 | */ | ||
52 | #ifndef FS_BASE | ||
53 | /* These aren't defined in ptrace.h, but exist in struct user_regs_struct, | ||
54 | * which is what x86_64 ptrace actually uses. | ||
55 | */ | ||
56 | #define FS_BASE (HOST_FS_BASE * sizeof(long)) | ||
57 | #define GS_BASE (HOST_GS_BASE * sizeof(long)) | ||
58 | #define DS (HOST_DS * sizeof(long)) | ||
59 | #define ES (HOST_ES * sizeof(long)) | ||
60 | #define FS (HOST_FS * sizeof(long)) | ||
61 | #define GS (HOST_GS * sizeof(long)) | ||
62 | #endif | ||
63 | |||
64 | #define REGS_FS_BASE(r) ((r)[HOST_FS_BASE]) | ||
65 | #define REGS_GS_BASE(r) ((r)[HOST_GS_BASE]) | ||
66 | #define REGS_DS(r) ((r)[HOST_DS]) | ||
67 | #define REGS_ES(r) ((r)[HOST_ES]) | ||
68 | #define REGS_FS(r) ((r)[HOST_FS]) | ||
69 | #define REGS_GS(r) ((r)[HOST_GS]) | ||
70 | |||
71 | #define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_RAX]) | ||
72 | |||
73 | #define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res) | ||
74 | |||
75 | #define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r)) | ||
76 | |||
77 | #define REGS_SEGV_IS_FIXABLE(r) SEGV_IS_FIXABLE((r)->trap_type) | ||
78 | |||
79 | #define REGS_FAULT_ADDR(r) ((r)->fault_addr) | ||
80 | |||
81 | #define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type) | ||
82 | |||
83 | #define REGS_TRAP(r) ((r)->trap_type) | ||
84 | |||
85 | #define REGS_ERR(r) ((r)->fault_type) | ||
86 | |||
87 | struct uml_pt_regs { | ||
88 | unsigned long gp[MAX_REG_NR]; | ||
89 | struct faultinfo faultinfo; | ||
90 | long syscall; | ||
91 | int is_user; | ||
92 | }; | ||
93 | |||
94 | #define EMPTY_UML_PT_REGS { } | ||
95 | |||
96 | #define UPT_RBX(r) REGS_RBX((r)->gp) | ||
97 | #define UPT_RCX(r) REGS_RCX((r)->gp) | ||
98 | #define UPT_RDX(r) REGS_RDX((r)->gp) | ||
99 | #define UPT_RSI(r) REGS_RSI((r)->gp) | ||
100 | #define UPT_RDI(r) REGS_RDI((r)->gp) | ||
101 | #define UPT_RBP(r) REGS_RBP((r)->gp) | ||
102 | #define UPT_RAX(r) REGS_RAX((r)->gp) | ||
103 | #define UPT_R8(r) REGS_R8((r)->gp) | ||
104 | #define UPT_R9(r) REGS_R9((r)->gp) | ||
105 | #define UPT_R10(r) REGS_R10((r)->gp) | ||
106 | #define UPT_R11(r) REGS_R11((r)->gp) | ||
107 | #define UPT_R12(r) REGS_R12((r)->gp) | ||
108 | #define UPT_R13(r) REGS_R13((r)->gp) | ||
109 | #define UPT_R14(r) REGS_R14((r)->gp) | ||
110 | #define UPT_R15(r) REGS_R15((r)->gp) | ||
111 | #define UPT_CS(r) REGS_CS((r)->gp) | ||
112 | #define UPT_FS_BASE(r) REGS_FS_BASE((r)->gp) | ||
113 | #define UPT_FS(r) REGS_FS((r)->gp) | ||
114 | #define UPT_GS_BASE(r) REGS_GS_BASE((r)->gp) | ||
115 | #define UPT_GS(r) REGS_GS((r)->gp) | ||
116 | #define UPT_DS(r) REGS_DS((r)->gp) | ||
117 | #define UPT_ES(r) REGS_ES((r)->gp) | ||
118 | #define UPT_CS(r) REGS_CS((r)->gp) | ||
119 | #define UPT_SS(r) REGS_SS((r)->gp) | ||
120 | #define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->gp) | ||
121 | |||
122 | #define UPT_IP(r) REGS_IP((r)->gp) | ||
123 | #define UPT_SP(r) REGS_SP((r)->gp) | ||
124 | |||
125 | #define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp) | ||
126 | #define UPT_SYSCALL_NR(r) ((r)->syscall) | ||
127 | #define UPT_SYSCALL_RET(r) UPT_RAX(r) | ||
128 | |||
129 | extern int user_context(unsigned long sp); | ||
130 | |||
131 | #define UPT_IS_USER(r) ((r)->is_user) | ||
132 | |||
133 | #define UPT_SYSCALL_ARG1(r) UPT_RDI(r) | ||
134 | #define UPT_SYSCALL_ARG2(r) UPT_RSI(r) | ||
135 | #define UPT_SYSCALL_ARG3(r) UPT_RDX(r) | ||
136 | #define UPT_SYSCALL_ARG4(r) UPT_R10(r) | ||
137 | #define UPT_SYSCALL_ARG5(r) UPT_R8(r) | ||
138 | #define UPT_SYSCALL_ARG6(r) UPT_R9(r) | ||
139 | |||
140 | struct syscall_args { | ||
141 | unsigned long args[6]; | ||
142 | }; | ||
143 | |||
144 | #define SYSCALL_ARGS(r) ((struct syscall_args) \ | ||
145 | { .args = { UPT_SYSCALL_ARG1(r), \ | ||
146 | UPT_SYSCALL_ARG2(r), \ | ||
147 | UPT_SYSCALL_ARG3(r), \ | ||
148 | UPT_SYSCALL_ARG4(r), \ | ||
149 | UPT_SYSCALL_ARG5(r), \ | ||
150 | UPT_SYSCALL_ARG6(r) } } ) | ||
151 | |||
152 | #define UPT_REG(regs, reg) \ | ||
153 | ({ unsigned long val; \ | ||
154 | switch(reg){ \ | ||
155 | case R8: val = UPT_R8(regs); break; \ | ||
156 | case R9: val = UPT_R9(regs); break; \ | ||
157 | case R10: val = UPT_R10(regs); break; \ | ||
158 | case R11: val = UPT_R11(regs); break; \ | ||
159 | case R12: val = UPT_R12(regs); break; \ | ||
160 | case R13: val = UPT_R13(regs); break; \ | ||
161 | case R14: val = UPT_R14(regs); break; \ | ||
162 | case R15: val = UPT_R15(regs); break; \ | ||
163 | case RIP: val = UPT_IP(regs); break; \ | ||
164 | case RSP: val = UPT_SP(regs); break; \ | ||
165 | case RAX: val = UPT_RAX(regs); break; \ | ||
166 | case RBX: val = UPT_RBX(regs); break; \ | ||
167 | case RCX: val = UPT_RCX(regs); break; \ | ||
168 | case RDX: val = UPT_RDX(regs); break; \ | ||
169 | case RSI: val = UPT_RSI(regs); break; \ | ||
170 | case RDI: val = UPT_RDI(regs); break; \ | ||
171 | case RBP: val = UPT_RBP(regs); break; \ | ||
172 | case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \ | ||
173 | case CS: val = UPT_CS(regs); break; \ | ||
174 | case SS: val = UPT_SS(regs); break; \ | ||
175 | case FS_BASE: val = UPT_FS_BASE(regs); break; \ | ||
176 | case GS_BASE: val = UPT_GS_BASE(regs); break; \ | ||
177 | case DS: val = UPT_DS(regs); break; \ | ||
178 | case ES: val = UPT_ES(regs); break; \ | ||
179 | case FS : val = UPT_FS (regs); break; \ | ||
180 | case GS: val = UPT_GS(regs); break; \ | ||
181 | case EFLAGS: val = UPT_EFLAGS(regs); break; \ | ||
182 | default : \ | ||
183 | panic("Bad register in UPT_REG : %d\n", reg); \ | ||
184 | val = -1; \ | ||
185 | } \ | ||
186 | val; \ | ||
187 | }) | ||
188 | |||
189 | |||
190 | #define UPT_SET(regs, reg, val) \ | ||
191 | ({ unsigned long __upt_val = val; \ | ||
192 | switch(reg){ \ | ||
193 | case R8: UPT_R8(regs) = __upt_val; break; \ | ||
194 | case R9: UPT_R9(regs) = __upt_val; break; \ | ||
195 | case R10: UPT_R10(regs) = __upt_val; break; \ | ||
196 | case R11: UPT_R11(regs) = __upt_val; break; \ | ||
197 | case R12: UPT_R12(regs) = __upt_val; break; \ | ||
198 | case R13: UPT_R13(regs) = __upt_val; break; \ | ||
199 | case R14: UPT_R14(regs) = __upt_val; break; \ | ||
200 | case R15: UPT_R15(regs) = __upt_val; break; \ | ||
201 | case RIP: UPT_IP(regs) = __upt_val; break; \ | ||
202 | case RSP: UPT_SP(regs) = __upt_val; break; \ | ||
203 | case RAX: UPT_RAX(regs) = __upt_val; break; \ | ||
204 | case RBX: UPT_RBX(regs) = __upt_val; break; \ | ||
205 | case RCX: UPT_RCX(regs) = __upt_val; break; \ | ||
206 | case RDX: UPT_RDX(regs) = __upt_val; break; \ | ||
207 | case RSI: UPT_RSI(regs) = __upt_val; break; \ | ||
208 | case RDI: UPT_RDI(regs) = __upt_val; break; \ | ||
209 | case RBP: UPT_RBP(regs) = __upt_val; break; \ | ||
210 | case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \ | ||
211 | case CS: UPT_CS(regs) = __upt_val; break; \ | ||
212 | case SS: UPT_SS(regs) = __upt_val; break; \ | ||
213 | case FS_BASE: UPT_FS_BASE(regs) = __upt_val; break; \ | ||
214 | case GS_BASE: UPT_GS_BASE(regs) = __upt_val; break; \ | ||
215 | case DS: UPT_DS(regs) = __upt_val; break; \ | ||
216 | case ES: UPT_ES(regs) = __upt_val; break; \ | ||
217 | case FS: UPT_FS(regs) = __upt_val; break; \ | ||
218 | case GS: UPT_GS(regs) = __upt_val; break; \ | ||
219 | case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \ | ||
220 | default : \ | ||
221 | panic("Bad register in UPT_SET : %d\n", reg); \ | ||
222 | break; \ | ||
223 | } \ | ||
224 | __upt_val; \ | ||
225 | }) | ||
226 | |||
227 | #define UPT_SET_SYSCALL_RETURN(r, res) \ | ||
228 | REGS_SET_SYSCALL_RETURN((r)->regs, (res)) | ||
229 | |||
230 | #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp) | ||
231 | |||
232 | #define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas) | ||
233 | |||
234 | #define UPT_FAULTINFO(r) (&(r)->faultinfo) | ||
235 | |||
236 | static inline void arch_init_registers(int pid) | ||
237 | { | ||
238 | } | ||
239 | |||
240 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/ptrace_user.h b/arch/um/include/shared/sysdep-x86_64/ptrace_user.h deleted file mode 100644 index 4dbccdb58f48..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/ptrace_user.h +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __SYSDEP_X86_64_PTRACE_USER_H__ | ||
8 | #define __SYSDEP_X86_64_PTRACE_USER_H__ | ||
9 | |||
10 | #define __FRAME_OFFSETS | ||
11 | #include <sys/ptrace.h> | ||
12 | #include <linux/ptrace.h> | ||
13 | #include <asm/ptrace.h> | ||
14 | #undef __FRAME_OFFSETS | ||
15 | #include "user_constants.h" | ||
16 | |||
17 | #define PT_INDEX(off) ((off) / sizeof(unsigned long)) | ||
18 | |||
19 | #define PT_SYSCALL_NR(regs) ((regs)[PT_INDEX(ORIG_RAX)]) | ||
20 | #define PT_SYSCALL_NR_OFFSET (ORIG_RAX) | ||
21 | |||
22 | #define PT_SYSCALL_ARG1(regs) (((unsigned long *) (regs))[PT_INDEX(RDI)]) | ||
23 | #define PT_SYSCALL_ARG1_OFFSET (RDI) | ||
24 | |||
25 | #define PT_SYSCALL_ARG2(regs) (((unsigned long *) (regs))[PT_INDEX(RSI)]) | ||
26 | #define PT_SYSCALL_ARG2_OFFSET (RSI) | ||
27 | |||
28 | #define PT_SYSCALL_ARG3(regs) (((unsigned long *) (regs))[PT_INDEX(RDX)]) | ||
29 | #define PT_SYSCALL_ARG3_OFFSET (RDX) | ||
30 | |||
31 | #define PT_SYSCALL_ARG4(regs) (((unsigned long *) (regs))[PT_INDEX(RCX)]) | ||
32 | #define PT_SYSCALL_ARG4_OFFSET (RCX) | ||
33 | |||
34 | #define PT_SYSCALL_ARG5(regs) (((unsigned long *) (regs))[PT_INDEX(R8)]) | ||
35 | #define PT_SYSCALL_ARG5_OFFSET (R8) | ||
36 | |||
37 | #define PT_SYSCALL_ARG6(regs) (((unsigned long *) (regs))[PT_INDEX(R9)]) | ||
38 | #define PT_SYSCALL_ARG6_OFFSET (R9) | ||
39 | |||
40 | #define PT_SYSCALL_RET_OFFSET (RAX) | ||
41 | |||
42 | #define PT_IP_OFFSET (RIP) | ||
43 | #define PT_IP(regs) ((regs)[PT_INDEX(RIP)]) | ||
44 | |||
45 | #define PT_SP_OFFSET (RSP) | ||
46 | #define PT_SP(regs) ((regs)[PT_INDEX(RSP)]) | ||
47 | |||
48 | #define PT_ORIG_RAX_OFFSET (ORIG_RAX) | ||
49 | #define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)]) | ||
50 | |||
51 | /* | ||
52 | * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though | ||
53 | * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the | ||
54 | * 2.4 name and value for 2.4 host compatibility. | ||
55 | */ | ||
56 | #ifndef PTRACE_OLDSETOPTIONS | ||
57 | #define PTRACE_OLDSETOPTIONS 21 | ||
58 | #endif | ||
59 | |||
60 | /* | ||
61 | * These are before the system call, so the system call number is RAX | ||
62 | * rather than ORIG_RAX, and arg4 is R10 rather than RCX | ||
63 | */ | ||
64 | #define REGS_SYSCALL_NR PT_INDEX(RAX) | ||
65 | #define REGS_SYSCALL_ARG1 PT_INDEX(RDI) | ||
66 | #define REGS_SYSCALL_ARG2 PT_INDEX(RSI) | ||
67 | #define REGS_SYSCALL_ARG3 PT_INDEX(RDX) | ||
68 | #define REGS_SYSCALL_ARG4 PT_INDEX(R10) | ||
69 | #define REGS_SYSCALL_ARG5 PT_INDEX(R8) | ||
70 | #define REGS_SYSCALL_ARG6 PT_INDEX(R9) | ||
71 | |||
72 | #define REGS_IP_INDEX PT_INDEX(RIP) | ||
73 | #define REGS_SP_INDEX PT_INDEX(RSP) | ||
74 | |||
75 | #define FP_SIZE (HOST_FP_SIZE) | ||
76 | |||
77 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/sc.h b/arch/um/include/shared/sysdep-x86_64/sc.h deleted file mode 100644 index 8aee45b07434..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/sc.h +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #ifndef __SYSDEP_X86_64_SC_H | ||
2 | #define __SYSDEP_X86_64_SC_H | ||
3 | |||
4 | /* Copyright (C) 2003 - 2004 PathScale, Inc | ||
5 | * Released under the GPL | ||
6 | */ | ||
7 | |||
8 | #include <user_constants.h> | ||
9 | |||
10 | #define SC_OFFSET(sc, field) \ | ||
11 | *((unsigned long *) &(((char *) (sc))[HOST_##field])) | ||
12 | |||
13 | #define SC_RBX(sc) SC_OFFSET(sc, SC_RBX) | ||
14 | #define SC_RCX(sc) SC_OFFSET(sc, SC_RCX) | ||
15 | #define SC_RDX(sc) SC_OFFSET(sc, SC_RDX) | ||
16 | #define SC_RSI(sc) SC_OFFSET(sc, SC_RSI) | ||
17 | #define SC_RDI(sc) SC_OFFSET(sc, SC_RDI) | ||
18 | #define SC_RBP(sc) SC_OFFSET(sc, SC_RBP) | ||
19 | #define SC_RAX(sc) SC_OFFSET(sc, SC_RAX) | ||
20 | #define SC_R8(sc) SC_OFFSET(sc, SC_R8) | ||
21 | #define SC_R9(sc) SC_OFFSET(sc, SC_R9) | ||
22 | #define SC_R10(sc) SC_OFFSET(sc, SC_R10) | ||
23 | #define SC_R11(sc) SC_OFFSET(sc, SC_R11) | ||
24 | #define SC_R12(sc) SC_OFFSET(sc, SC_R12) | ||
25 | #define SC_R13(sc) SC_OFFSET(sc, SC_R13) | ||
26 | #define SC_R14(sc) SC_OFFSET(sc, SC_R14) | ||
27 | #define SC_R15(sc) SC_OFFSET(sc, SC_R15) | ||
28 | #define SC_IP(sc) SC_OFFSET(sc, SC_IP) | ||
29 | #define SC_SP(sc) SC_OFFSET(sc, SC_SP) | ||
30 | #define SC_CR2(sc) SC_OFFSET(sc, SC_CR2) | ||
31 | #define SC_ERR(sc) SC_OFFSET(sc, SC_ERR) | ||
32 | #define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO) | ||
33 | #define SC_CS(sc) SC_OFFSET(sc, SC_CS) | ||
34 | #define SC_FS(sc) SC_OFFSET(sc, SC_FS) | ||
35 | #define SC_GS(sc) SC_OFFSET(sc, SC_GS) | ||
36 | #define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS) | ||
37 | #define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK) | ||
38 | #define SC_SS(sc) SC_OFFSET(sc, SC_SS) | ||
39 | #if 0 | ||
40 | #define SC_ORIG_RAX(sc) SC_OFFSET(sc, SC_ORIG_RAX) | ||
41 | #define SC_DS(sc) SC_OFFSET(sc, SC_DS) | ||
42 | #define SC_ES(sc) SC_OFFSET(sc, SC_ES) | ||
43 | #endif | ||
44 | |||
45 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/sigcontext.h b/arch/um/include/shared/sysdep-x86_64/sigcontext.h deleted file mode 100644 index 0155133b1458..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/sigcontext.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __SYSDEP_X86_64_SIGCONTEXT_H | ||
8 | #define __SYSDEP_X86_64_SIGCONTEXT_H | ||
9 | |||
10 | #include <sysdep/sc.h> | ||
11 | |||
12 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) | ||
13 | |||
14 | #define GET_FAULTINFO_FROM_SC(fi, sc) \ | ||
15 | { \ | ||
16 | (fi).cr2 = SC_CR2(sc); \ | ||
17 | (fi).error_code = SC_ERR(sc); \ | ||
18 | (fi).trap_no = SC_TRAPNO(sc); \ | ||
19 | } | ||
20 | |||
21 | /* This is Page Fault */ | ||
22 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) | ||
23 | |||
24 | /* No broken SKAS API, which doesn't pass trap_no, here. */ | ||
25 | #define SEGV_MAYBE_FIXABLE(fi) 0 | ||
26 | |||
27 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/skas_ptrace.h b/arch/um/include/shared/sysdep-x86_64/skas_ptrace.h deleted file mode 100644 index 95db4be786e4..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/skas_ptrace.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_X86_64_SKAS_PTRACE_H | ||
7 | #define __SYSDEP_X86_64_SKAS_PTRACE_H | ||
8 | |||
9 | struct ptrace_faultinfo { | ||
10 | int is_write; | ||
11 | unsigned long addr; | ||
12 | }; | ||
13 | |||
14 | struct ptrace_ldt { | ||
15 | int func; | ||
16 | void *ptr; | ||
17 | unsigned long bytecount; | ||
18 | }; | ||
19 | |||
20 | #define PTRACE_LDT 54 | ||
21 | |||
22 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/stub.h b/arch/um/include/shared/sysdep-x86_64/stub.h deleted file mode 100644 index 655f9c2de3ac..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/stub.h +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_STUB_H | ||
7 | #define __SYSDEP_STUB_H | ||
8 | |||
9 | #include <sys/mman.h> | ||
10 | #include <asm/unistd.h> | ||
11 | #include <sysdep/ptrace_user.h> | ||
12 | #include "as-layout.h" | ||
13 | #include "stub-data.h" | ||
14 | #include "kern_constants.h" | ||
15 | #include "uml-config.h" | ||
16 | |||
17 | extern void stub_segv_handler(int sig); | ||
18 | extern void stub_clone_handler(void); | ||
19 | |||
20 | #define STUB_SYSCALL_RET PT_INDEX(RAX) | ||
21 | #define STUB_MMAP_NR __NR_mmap | ||
22 | #define MMAP_OFFSET(o) (o) | ||
23 | |||
24 | #define __syscall_clobber "r11","rcx","memory" | ||
25 | #define __syscall "syscall" | ||
26 | |||
27 | static inline long stub_syscall0(long syscall) | ||
28 | { | ||
29 | long ret; | ||
30 | |||
31 | __asm__ volatile (__syscall | ||
32 | : "=a" (ret) | ||
33 | : "0" (syscall) : __syscall_clobber ); | ||
34 | |||
35 | return ret; | ||
36 | } | ||
37 | |||
38 | static inline long stub_syscall2(long syscall, long arg1, long arg2) | ||
39 | { | ||
40 | long ret; | ||
41 | |||
42 | __asm__ volatile (__syscall | ||
43 | : "=a" (ret) | ||
44 | : "0" (syscall), "D" (arg1), "S" (arg2) : __syscall_clobber ); | ||
45 | |||
46 | return ret; | ||
47 | } | ||
48 | |||
49 | static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) | ||
50 | { | ||
51 | long ret; | ||
52 | |||
53 | __asm__ volatile (__syscall | ||
54 | : "=a" (ret) | ||
55 | : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3) | ||
56 | : __syscall_clobber ); | ||
57 | |||
58 | return ret; | ||
59 | } | ||
60 | |||
61 | static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, | ||
62 | long arg4) | ||
63 | { | ||
64 | long ret; | ||
65 | |||
66 | __asm__ volatile ("movq %5,%%r10 ; " __syscall | ||
67 | : "=a" (ret) | ||
68 | : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3), | ||
69 | "g" (arg4) | ||
70 | : __syscall_clobber, "r10" ); | ||
71 | |||
72 | return ret; | ||
73 | } | ||
74 | |||
75 | static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3, | ||
76 | long arg4, long arg5) | ||
77 | { | ||
78 | long ret; | ||
79 | |||
80 | __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall | ||
81 | : "=a" (ret) | ||
82 | : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3), | ||
83 | "g" (arg4), "g" (arg5) | ||
84 | : __syscall_clobber, "r10", "r8" ); | ||
85 | |||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | static inline void trap_myself(void) | ||
90 | { | ||
91 | __asm("int3"); | ||
92 | } | ||
93 | |||
94 | static inline void remap_stack(long fd, unsigned long offset) | ||
95 | { | ||
96 | __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; " | ||
97 | "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; " | ||
98 | "movq %%rax, (%%rbx)": | ||
99 | : "a" (STUB_MMAP_NR), "D" (STUB_DATA), | ||
100 | "S" (UM_KERN_PAGE_SIZE), | ||
101 | "d" (PROT_READ | PROT_WRITE), | ||
102 | "g" (MAP_FIXED | MAP_SHARED), "g" (fd), | ||
103 | "g" (offset), | ||
104 | "i" (&((struct stub_data *) STUB_DATA)->err) | ||
105 | : __syscall_clobber, "r10", "r8", "r9" ); | ||
106 | } | ||
107 | |||
108 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/syscalls.h b/arch/um/include/shared/sysdep-x86_64/syscalls.h deleted file mode 100644 index 7cfb0b085655..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/syscalls.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __SYSDEP_X86_64_SYSCALLS_H__ | ||
8 | #define __SYSDEP_X86_64_SYSCALLS_H__ | ||
9 | |||
10 | #include <linux/msg.h> | ||
11 | #include <linux/shm.h> | ||
12 | #include <kern_constants.h> | ||
13 | |||
14 | typedef long syscall_handler_t(void); | ||
15 | |||
16 | extern syscall_handler_t *sys_call_table[]; | ||
17 | |||
18 | #define EXECUTE_SYSCALL(syscall, regs) \ | ||
19 | (((long (*)(long, long, long, long, long, long)) \ | ||
20 | (*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(®s->regs), \ | ||
21 | UPT_SYSCALL_ARG2(®s->regs), \ | ||
22 | UPT_SYSCALL_ARG3(®s->regs), \ | ||
23 | UPT_SYSCALL_ARG4(®s->regs), \ | ||
24 | UPT_SYSCALL_ARG5(®s->regs), \ | ||
25 | UPT_SYSCALL_ARG6(®s->regs))) | ||
26 | |||
27 | extern long old_mmap(unsigned long addr, unsigned long len, | ||
28 | unsigned long prot, unsigned long flags, | ||
29 | unsigned long fd, unsigned long pgoff); | ||
30 | extern syscall_handler_t sys_modify_ldt; | ||
31 | extern syscall_handler_t sys_arch_prctl; | ||
32 | |||
33 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/system.h b/arch/um/include/shared/sysdep-x86_64/system.h deleted file mode 100644 index d1b93c436200..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/system.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | #ifndef _ASM_X86_SYSTEM_H_ | ||
2 | #define _ASM_X86_SYSTEM_H_ | ||
3 | |||
4 | #include <asm/asm.h> | ||
5 | #include <asm/segment.h> | ||
6 | #include <asm/cpufeature.h> | ||
7 | #include <asm/cmpxchg.h> | ||
8 | #include <asm/nops.h> | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/irqflags.h> | ||
12 | |||
13 | /* entries in ARCH_DLINFO: */ | ||
14 | #ifdef CONFIG_IA32_EMULATION | ||
15 | # define AT_VECTOR_SIZE_ARCH 2 | ||
16 | #else | ||
17 | # define AT_VECTOR_SIZE_ARCH 1 | ||
18 | #endif | ||
19 | |||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | void default_idle(void); | ||
23 | |||
24 | /* | ||
25 | * Force strict CPU ordering. | ||
26 | * And yes, this is required on UP too when we're talking | ||
27 | * to devices. | ||
28 | */ | ||
29 | #ifdef CONFIG_X86_32 | ||
30 | /* | ||
31 | * Some non-Intel clones support out of order store. wmb() ceases to be a | ||
32 | * nop for these. | ||
33 | */ | ||
34 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | ||
35 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | ||
36 | #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | ||
37 | #else | ||
38 | #define mb() asm volatile("mfence":::"memory") | ||
39 | #define rmb() asm volatile("lfence":::"memory") | ||
40 | #define wmb() asm volatile("sfence" ::: "memory") | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * read_barrier_depends - Flush all pending reads that subsequents reads | ||
45 | * depend on. | ||
46 | * | ||
47 | * No data-dependent reads from memory-like regions are ever reordered | ||
48 | * over this barrier. All reads preceding this primitive are guaranteed | ||
49 | * to access memory (but not necessarily other CPUs' caches) before any | ||
50 | * reads following this primitive that depend on the data return by | ||
51 | * any of the preceding reads. This primitive is much lighter weight than | ||
52 | * rmb() on most CPUs, and is never heavier weight than is | ||
53 | * rmb(). | ||
54 | * | ||
55 | * These ordering constraints are respected by both the local CPU | ||
56 | * and the compiler. | ||
57 | * | ||
58 | * Ordering is not guaranteed by anything other than these primitives, | ||
59 | * not even by data dependencies. See the documentation for | ||
60 | * memory_barrier() for examples and URLs to more information. | ||
61 | * | ||
62 | * For example, the following code would force ordering (the initial | ||
63 | * value of "a" is zero, "b" is one, and "p" is "&a"): | ||
64 | * | ||
65 | * <programlisting> | ||
66 | * CPU 0 CPU 1 | ||
67 | * | ||
68 | * b = 2; | ||
69 | * memory_barrier(); | ||
70 | * p = &b; q = p; | ||
71 | * read_barrier_depends(); | ||
72 | * d = *q; | ||
73 | * </programlisting> | ||
74 | * | ||
75 | * because the read of "*q" depends on the read of "p" and these | ||
76 | * two reads are separated by a read_barrier_depends(). However, | ||
77 | * the following code, with the same initial values for "a" and "b": | ||
78 | * | ||
79 | * <programlisting> | ||
80 | * CPU 0 CPU 1 | ||
81 | * | ||
82 | * a = 2; | ||
83 | * memory_barrier(); | ||
84 | * b = 3; y = b; | ||
85 | * read_barrier_depends(); | ||
86 | * x = a; | ||
87 | * </programlisting> | ||
88 | * | ||
89 | * does not enforce ordering, since there is no data dependency between | ||
90 | * the read of "a" and the read of "b". Therefore, on some CPUs, such | ||
91 | * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() | ||
92 | * in cases like this where there are no data dependencies. | ||
93 | **/ | ||
94 | |||
95 | #define read_barrier_depends() do { } while (0) | ||
96 | |||
97 | #ifdef CONFIG_SMP | ||
98 | #define smp_mb() mb() | ||
99 | #ifdef CONFIG_X86_PPRO_FENCE | ||
100 | # define smp_rmb() rmb() | ||
101 | #else | ||
102 | # define smp_rmb() barrier() | ||
103 | #endif | ||
104 | #ifdef CONFIG_X86_OOSTORE | ||
105 | # define smp_wmb() wmb() | ||
106 | #else | ||
107 | # define smp_wmb() barrier() | ||
108 | #endif | ||
109 | #define smp_read_barrier_depends() read_barrier_depends() | ||
110 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
111 | #else | ||
112 | #define smp_mb() barrier() | ||
113 | #define smp_rmb() barrier() | ||
114 | #define smp_wmb() barrier() | ||
115 | #define smp_read_barrier_depends() do { } while (0) | ||
116 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
117 | #endif | ||
118 | |||
119 | /* | ||
120 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | ||
121 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | ||
122 | * code region. | ||
123 | * | ||
124 | * (Could use an alternative three way for this if there was one.) | ||
125 | */ | ||
126 | static inline void rdtsc_barrier(void) | ||
127 | { | ||
128 | alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); | ||
129 | alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); | ||
130 | } | ||
131 | |||
132 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/tls.h b/arch/um/include/shared/sysdep-x86_64/tls.h deleted file mode 100644 index 18c000d0357a..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/tls.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #ifndef _SYSDEP_TLS_H | ||
2 | #define _SYSDEP_TLS_H | ||
3 | |||
4 | # ifndef __KERNEL__ | ||
5 | |||
6 | /* Change name to avoid conflicts with the original one from <asm/ldt.h>, which | ||
7 | * may be named user_desc (but in 2.4 and in header matching its API was named | ||
8 | * modify_ldt_ldt_s). */ | ||
9 | |||
10 | typedef struct um_dup_user_desc { | ||
11 | unsigned int entry_number; | ||
12 | unsigned int base_addr; | ||
13 | unsigned int limit; | ||
14 | unsigned int seg_32bit:1; | ||
15 | unsigned int contents:2; | ||
16 | unsigned int read_exec_only:1; | ||
17 | unsigned int limit_in_pages:1; | ||
18 | unsigned int seg_not_present:1; | ||
19 | unsigned int useable:1; | ||
20 | unsigned int lm:1; | ||
21 | } user_desc_t; | ||
22 | |||
23 | # else /* __KERNEL__ */ | ||
24 | |||
25 | # include <ldt.h> | ||
26 | typedef struct user_desc user_desc_t; | ||
27 | |||
28 | # endif /* __KERNEL__ */ | ||
29 | #endif /* _SYSDEP_TLS_H */ | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/vm-flags.h b/arch/um/include/shared/sysdep-x86_64/vm-flags.h deleted file mode 100644 index 3213edfa7888..000000000000 --- a/arch/um/include/shared/sysdep-x86_64/vm-flags.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __VM_FLAGS_X86_64_H | ||
8 | #define __VM_FLAGS_X86_64_H | ||
9 | |||
10 | #define __VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
11 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
12 | #define __VM_STACK_FLAGS (VM_GROWSDOWN | VM_READ | VM_WRITE | \ | ||
13 | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | \ | ||
14 | VM_MAYEXEC) | ||
15 | |||
16 | extern unsigned long vm_stack_flags, vm_stack_flags32; | ||
17 | extern unsigned long vm_data_default_flags, vm_data_default_flags32; | ||
18 | extern unsigned long vm_force_exec32; | ||
19 | |||
20 | #ifdef TIF_IA32 | ||
21 | #define VM_DATA_DEFAULT_FLAGS \ | ||
22 | (test_thread_flag(TIF_IA32) ? vm_data_default_flags32 : \ | ||
23 | vm_data_default_flags) | ||
24 | |||
25 | #define VM_STACK_DEFAULT_FLAGS \ | ||
26 | (test_thread_flag(TIF_IA32) ? vm_stack_flags32 : vm_stack_flags) | ||
27 | #endif | ||
28 | |||
29 | #define VM_DATA_DEFAULT_FLAGS vm_data_default_flags | ||
30 | |||
31 | #define VM_STACK_DEFAULT_FLAGS vm_stack_flags | ||
32 | |||
33 | #endif | ||