diff options
author | Jeff Dike <jdike@addtoit.com> | 2005-05-20 16:59:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-20 18:48:17 -0400 |
commit | ba9950c820e556e39cd26581826b5581a64fb641 (patch) | |
tree | 4ba37ce6b1852e95619ad3e6bd97a2032dd4c1fc /arch/um | |
parent | 46f4e1b7d5fa3ddf2486bf69716c404147e38ebf (diff) |
[PATCH] uml: small fixes left over from rc4
Some changes that I sent in didn't make 2.6.12-rc4 for some reason. This
adds them back. We have
an x86_64 definition of TOP_ADDR
a reimplementation of the x86_64 csum_partial_copy_from_user
some syntax fixes in arch/um/kernel/ptrace.c
removal of a CFLAGS definition in the x86_64 Makefile
some include changes in the x86_64 ptrace.c and user-offsets.h
a syntax fix in elf-x86_64.h
Also moved an include in the i386 and x86_64 Makefiles to make the symlinks
work, and some small fixes from Al Viro.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig_x86_64 | 4 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/ptrace.h | 2 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/checksum.h | 26 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/ptrace.h | 62 | ||||
-rw-r--r-- | arch/um/kernel/ptrace.c | 6 | ||||
-rw-r--r-- | arch/um/kernel/uml.lds.S | 2 | ||||
-rw-r--r-- | arch/um/sys-i386/Makefile | 4 | ||||
-rw-r--r-- | arch/um/sys-x86_64/Makefile | 6 | ||||
-rw-r--r-- | arch/um/sys-x86_64/ksyms.c | 3 | ||||
-rw-r--r-- | arch/um/sys-x86_64/ptrace.c | 9 | ||||
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 1 | ||||
-rw-r--r-- | arch/um/sys-x86_64/user-offsets.c | 8 |
12 files changed, 65 insertions, 68 deletions
diff --git a/arch/um/Kconfig_x86_64 b/arch/um/Kconfig_x86_64 index fd8d7e8982b1..f162f50f0b17 100644 --- a/arch/um/Kconfig_x86_64 +++ b/arch/um/Kconfig_x86_64 | |||
@@ -6,6 +6,10 @@ config 64BIT | |||
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | 8 | ||
9 | config TOP_ADDR | ||
10 | hex | ||
11 | default 0x80000000 | ||
12 | |||
9 | config 3_LEVEL_PGTABLES | 13 | config 3_LEVEL_PGTABLES |
10 | bool | 14 | bool |
11 | default y | 15 | default y |
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/include/sysdep-i386/ptrace.h index 84ec7ff5cf8c..6eaeb9919983 100644 --- a/arch/um/include/sysdep-i386/ptrace.h +++ b/arch/um/include/sysdep-i386/ptrace.h | |||
@@ -31,7 +31,6 @@ extern int sysemu_supported; | |||
31 | #ifdef UML_CONFIG_MODE_SKAS | 31 | #ifdef UML_CONFIG_MODE_SKAS |
32 | 32 | ||
33 | #include "skas_ptregs.h" | 33 | #include "skas_ptregs.h" |
34 | #include "sysdep/faultinfo.h" | ||
35 | 34 | ||
36 | #define REGS_IP(r) ((r)[HOST_IP]) | 35 | #define REGS_IP(r) ((r)[HOST_IP]) |
37 | #define REGS_SP(r) ((r)[HOST_SP]) | 36 | #define REGS_SP(r) ((r)[HOST_SP]) |
@@ -59,6 +58,7 @@ extern int sysemu_supported; | |||
59 | #define PTRACE_SYSEMU_SINGLESTEP 32 | 58 | #define PTRACE_SYSEMU_SINGLESTEP 32 |
60 | #endif | 59 | #endif |
61 | 60 | ||
61 | #include "sysdep/faultinfo.h" | ||
62 | #include "choose-mode.h" | 62 | #include "choose-mode.h" |
63 | 63 | ||
64 | union uml_pt_regs { | 64 | union uml_pt_regs { |
diff --git a/arch/um/include/sysdep-x86_64/checksum.h b/arch/um/include/sysdep-x86_64/checksum.h index 572c6c19be33..ea97005af694 100644 --- a/arch/um/include/sysdep-x86_64/checksum.h +++ b/arch/um/include/sysdep-x86_64/checksum.h | |||
@@ -9,8 +9,6 @@ | |||
9 | #include "linux/in6.h" | 9 | #include "linux/in6.h" |
10 | #include "asm/uaccess.h" | 10 | #include "asm/uaccess.h" |
11 | 11 | ||
12 | extern unsigned int csum_partial_copy_from(const unsigned char *src, unsigned char *dst, int len, | ||
13 | int sum, int *err_ptr); | ||
14 | extern unsigned csum_partial(const unsigned char *buff, unsigned len, | 12 | extern unsigned csum_partial(const unsigned char *buff, unsigned len, |
15 | unsigned sum); | 13 | unsigned sum); |
16 | 14 | ||
@@ -31,10 +29,15 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char * | |||
31 | } | 29 | } |
32 | 30 | ||
33 | static __inline__ | 31 | static __inline__ |
34 | unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, | 32 | unsigned int csum_partial_copy_from_user(const unsigned char *src, |
35 | int len, int sum, int *err_ptr) | 33 | unsigned char *dst, int len, int sum, |
34 | int *err_ptr) | ||
36 | { | 35 | { |
37 | return csum_partial_copy_from(src, dst, len, sum, err_ptr); | 36 | if(copy_from_user(dst, src, len)){ |
37 | *err_ptr = -EFAULT; | ||
38 | return(-1); | ||
39 | } | ||
40 | return csum_partial(dst, len, sum); | ||
38 | } | 41 | } |
39 | 42 | ||
40 | /** | 43 | /** |
@@ -137,15 +140,6 @@ static inline unsigned add32_with_carry(unsigned a, unsigned b) | |||
137 | return a; | 140 | return a; |
138 | } | 141 | } |
139 | 142 | ||
140 | #endif | 143 | extern unsigned short ip_compute_csum(unsigned char * buff, int len); |
141 | 144 | ||
142 | /* | 145 | #endif |
143 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
144 | * Emacs will notice this stuff at the end of the file and automatically | ||
145 | * adjust the settings for this buffer only. This must remain at the end | ||
146 | * of the file. | ||
147 | * --------------------------------------------------------------------------- | ||
148 | * Local variables: | ||
149 | * c-file-style: "linux" | ||
150 | * End: | ||
151 | */ | ||
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h index 348e8fcd513f..be8acd5efd97 100644 --- a/arch/um/include/sysdep-x86_64/ptrace.h +++ b/arch/um/include/sysdep-x86_64/ptrace.h | |||
@@ -135,6 +135,7 @@ extern int mode_tt; | |||
135 | __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs)) | 135 | __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs)) |
136 | #define UPT_SC(r) ((r)->tt.sc) | 136 | #define UPT_SC(r) ((r)->tt.sc) |
137 | #define UPT_SYSCALL_NR(r) __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall) | 137 | #define UPT_SYSCALL_NR(r) __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall) |
138 | #define UPT_SYSCALL_RET(r) UPT_RAX(r) | ||
138 | 139 | ||
139 | extern int user_context(unsigned long sp); | 140 | extern int user_context(unsigned long sp); |
140 | 141 | ||
@@ -196,32 +197,32 @@ struct syscall_args { | |||
196 | 197 | ||
197 | 198 | ||
198 | #define UPT_SET(regs, reg, val) \ | 199 | #define UPT_SET(regs, reg, val) \ |
199 | ({ unsigned long val; \ | 200 | ({ unsigned long __upt_val = val; \ |
200 | switch(reg){ \ | 201 | switch(reg){ \ |
201 | case R8: UPT_R8(regs) = val; break; \ | 202 | case R8: UPT_R8(regs) = __upt_val; break; \ |
202 | case R9: UPT_R9(regs) = val; break; \ | 203 | case R9: UPT_R9(regs) = __upt_val; break; \ |
203 | case R10: UPT_R10(regs) = val; break; \ | 204 | case R10: UPT_R10(regs) = __upt_val; break; \ |
204 | case R11: UPT_R11(regs) = val; break; \ | 205 | case R11: UPT_R11(regs) = __upt_val; break; \ |
205 | case R12: UPT_R12(regs) = val; break; \ | 206 | case R12: UPT_R12(regs) = __upt_val; break; \ |
206 | case R13: UPT_R13(regs) = val; break; \ | 207 | case R13: UPT_R13(regs) = __upt_val; break; \ |
207 | case R14: UPT_R14(regs) = val; break; \ | 208 | case R14: UPT_R14(regs) = __upt_val; break; \ |
208 | case R15: UPT_R15(regs) = val; break; \ | 209 | case R15: UPT_R15(regs) = __upt_val; break; \ |
209 | case RIP: UPT_IP(regs) = val; break; \ | 210 | case RIP: UPT_IP(regs) = __upt_val; break; \ |
210 | case RSP: UPT_SP(regs) = val; break; \ | 211 | case RSP: UPT_SP(regs) = __upt_val; break; \ |
211 | case RAX: UPT_RAX(regs) = val; break; \ | 212 | case RAX: UPT_RAX(regs) = __upt_val; break; \ |
212 | case RBX: UPT_RBX(regs) = val; break; \ | 213 | case RBX: UPT_RBX(regs) = __upt_val; break; \ |
213 | case RCX: UPT_RCX(regs) = val; break; \ | 214 | case RCX: UPT_RCX(regs) = __upt_val; break; \ |
214 | case RDX: UPT_RDX(regs) = val; break; \ | 215 | case RDX: UPT_RDX(regs) = __upt_val; break; \ |
215 | case RSI: UPT_RSI(regs) = val; break; \ | 216 | case RSI: UPT_RSI(regs) = __upt_val; break; \ |
216 | case RDI: UPT_RDI(regs) = val; break; \ | 217 | case RDI: UPT_RDI(regs) = __upt_val; break; \ |
217 | case RBP: UPT_RBP(regs) = val; break; \ | 218 | case RBP: UPT_RBP(regs) = __upt_val; break; \ |
218 | case ORIG_RAX: UPT_ORIG_RAX(regs) = val; break; \ | 219 | case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \ |
219 | case CS: UPT_CS(regs) = val; break; \ | 220 | case CS: UPT_CS(regs) = __upt_val; break; \ |
220 | case DS: UPT_DS(regs) = val; break; \ | 221 | case DS: UPT_DS(regs) = __upt_val; break; \ |
221 | case ES: UPT_ES(regs) = val; break; \ | 222 | case ES: UPT_ES(regs) = __upt_val; break; \ |
222 | case FS: UPT_FS(regs) = val; break; \ | 223 | case FS: UPT_FS(regs) = __upt_val; break; \ |
223 | case GS: UPT_GS(regs) = val; break; \ | 224 | case GS: UPT_GS(regs) = __upt_val; break; \ |
224 | case EFLAGS: UPT_EFLAGS(regs) = val; break; \ | 225 | case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \ |
225 | default : \ | 226 | default : \ |
226 | panic("Bad register in UPT_SET : %d\n", reg); \ | 227 | panic("Bad register in UPT_SET : %d\n", reg); \ |
227 | break; \ | 228 | break; \ |
@@ -245,14 +246,3 @@ struct syscall_args { | |||
245 | CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo)) | 246 | CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo)) |
246 | 247 | ||
247 | #endif | 248 | #endif |
248 | |||
249 | /* | ||
250 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
251 | * Emacs will notice this stuff at the end of the file and automatically | ||
252 | * adjust the settings for this buffer only. This must remain at the end | ||
253 | * of the file. | ||
254 | * --------------------------------------------------------------------------- | ||
255 | * Local variables: | ||
256 | * c-file-style: "linux" | ||
257 | * End: | ||
258 | */ | ||
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 2b75d8d9ba73..2925e15324de 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -28,9 +28,9 @@ static inline void set_singlestepping(struct task_struct *child, int on) | |||
28 | child->thread.singlestep_syscall = 0; | 28 | child->thread.singlestep_syscall = 0; |
29 | 29 | ||
30 | #ifdef SUBARCH_SET_SINGLESTEPPING | 30 | #ifdef SUBARCH_SET_SINGLESTEPPING |
31 | SUBARCH_SET_SINGLESTEPPING(child, on) | 31 | SUBARCH_SET_SINGLESTEPPING(child, on); |
32 | #endif | 32 | #endif |
33 | } | 33 | } |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Called by kernel/ptrace.c when detaching.. | 36 | * Called by kernel/ptrace.c when detaching.. |
@@ -83,7 +83,7 @@ long sys_ptrace(long request, long pid, long addr, long data) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | #ifdef SUBACH_PTRACE_SPECIAL | 85 | #ifdef SUBACH_PTRACE_SPECIAL |
86 | SUBARCH_PTRACE_SPECIAL(child,request,addr,data) | 86 | SUBARCH_PTRACE_SPECIAL(child,request,addr,data); |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | 89 | ret = ptrace_check_attach(child, request == PTRACE_KILL); |
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 76eadb309189..dd5355500bdc 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S | |||
@@ -73,6 +73,8 @@ SECTIONS | |||
73 | 73 | ||
74 | .got : { *(.got.plt) *(.got) } | 74 | .got : { *(.got.plt) *(.got) } |
75 | .dynamic : { *(.dynamic) } | 75 | .dynamic : { *(.dynamic) } |
76 | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } | ||
77 | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } | ||
76 | /* We want the small data sections together, so single-instruction offsets | 78 | /* We want the small data sections together, so single-instruction offsets |
77 | can access them all, and initialized data all before uninitialized, so | 79 | can access them all, and initialized data all before uninitialized, so |
78 | we can shorten the on-disk segment size. */ | 80 | we can shorten the on-disk segment size. */ |
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index fcd67c3414e4..4351e5605506 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile | |||
@@ -9,11 +9,11 @@ USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o | |||
9 | 9 | ||
10 | SYMLINKS = bitops.c semaphore.c highmem.c module.c | 10 | SYMLINKS = bitops.c semaphore.c highmem.c module.c |
11 | 11 | ||
12 | include arch/um/scripts/Makefile.rules | ||
13 | |||
12 | bitops.c-dir = lib | 14 | bitops.c-dir = lib |
13 | semaphore.c-dir = kernel | 15 | semaphore.c-dir = kernel |
14 | highmem.c-dir = mm | 16 | highmem.c-dir = mm |
15 | module.c-dir = kernel | 17 | module.c-dir = kernel |
16 | 18 | ||
17 | subdir- := util | 19 | subdir- := util |
18 | |||
19 | include arch/um/scripts/Makefile.rules | ||
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 3d7da911cc8c..608466ad6b22 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile | |||
@@ -14,11 +14,11 @@ obj-$(CONFIG_MODULES) += module.o um_module.o | |||
14 | 14 | ||
15 | USER_OBJS := ptrace_user.o sigcontext.o | 15 | USER_OBJS := ptrace_user.o sigcontext.o |
16 | 16 | ||
17 | include arch/um/scripts/Makefile.rules | ||
18 | |||
19 | SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ | 17 | SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ |
20 | semaphore.c thunk.S module.c | 18 | semaphore.c thunk.S module.c |
21 | 19 | ||
20 | include arch/um/scripts/Makefile.rules | ||
21 | |||
22 | bitops.c-dir = lib | 22 | bitops.c-dir = lib |
23 | csum-copy.S-dir = lib | 23 | csum-copy.S-dir = lib |
24 | csum-partial.c-dir = lib | 24 | csum-partial.c-dir = lib |
@@ -28,6 +28,4 @@ semaphore.c-dir = kernel | |||
28 | thunk.S-dir = lib | 28 | thunk.S-dir = lib |
29 | module.c-dir = kernel | 29 | module.c-dir = kernel |
30 | 30 | ||
31 | CFLAGS_csum-partial.o := -Dcsum_partial=arch_csum_partial | ||
32 | |||
33 | subdir- := util | 31 | subdir- := util |
diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c index a27f0ee6a4f6..859273808203 100644 --- a/arch/um/sys-x86_64/ksyms.c +++ b/arch/um/sys-x86_64/ksyms.c | |||
@@ -16,5 +16,4 @@ EXPORT_SYMBOL(__up_wakeup); | |||
16 | EXPORT_SYMBOL(__memcpy); | 16 | EXPORT_SYMBOL(__memcpy); |
17 | 17 | ||
18 | /* Networking helper routines. */ | 18 | /* Networking helper routines. */ |
19 | /*EXPORT_SYMBOL(csum_partial_copy_from); | 19 | EXPORT_SYMBOL(ip_compute_csum); |
20 | EXPORT_SYMBOL(csum_partial_copy_to);*/ | ||
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index b593bb256f2c..74eee5c7c6dd 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c | |||
@@ -5,10 +5,11 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #define __FRAME_OFFSETS | 7 | #define __FRAME_OFFSETS |
8 | #include "asm/ptrace.h" | 8 | #include <asm/ptrace.h> |
9 | #include "linux/sched.h" | 9 | #include <linux/sched.h> |
10 | #include "linux/errno.h" | 10 | #include <linux/errno.h> |
11 | #include "asm/elf.h" | 11 | #include <asm/uaccess.h> |
12 | #include <asm/elf.h> | ||
12 | 13 | ||
13 | /* XXX x86_64 */ | 14 | /* XXX x86_64 */ |
14 | unsigned long not_ss; | 15 | unsigned long not_ss; |
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index dd9914642b8e..d4a59657fb99 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "asm/unistd.h" | 15 | #include "asm/unistd.h" |
16 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ | 16 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ |
17 | #include "choose-mode.h" | 17 | #include "choose-mode.h" |
18 | #include "kern.h" | ||
18 | 19 | ||
19 | asmlinkage long sys_uname64(struct new_utsname __user * name) | 20 | asmlinkage long sys_uname64(struct new_utsname __user * name) |
20 | { | 21 | { |
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c index 5e14792e4838..513d17ceafd4 100644 --- a/arch/um/sys-x86_64/user-offsets.c +++ b/arch/um/sys-x86_64/user-offsets.c | |||
@@ -3,6 +3,14 @@ | |||
3 | #include <signal.h> | 3 | #include <signal.h> |
4 | #define __FRAME_OFFSETS | 4 | #define __FRAME_OFFSETS |
5 | #include <asm/ptrace.h> | 5 | #include <asm/ptrace.h> |
6 | #include <asm/types.h> | ||
7 | /* For some reason, x86_64 defines u64 and u32 only in <pci/types.h>, which I | ||
8 | * refuse to include here, even though they're used throughout the headers. | ||
9 | * These are used in asm/user.h, and that include can't be avoided because of | ||
10 | * the sizeof(struct user_regs_struct) below. | ||
11 | */ | ||
12 | typedef __u64 u64; | ||
13 | typedef __u32 u32; | ||
6 | #include <asm/user.h> | 14 | #include <asm/user.h> |
7 | 15 | ||
8 | #define DEFINE(sym, val) \ | 16 | #define DEFINE(sym, val) \ |