aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:26:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:05 -0400
commit42fda66387daa53538ae13a2c858396aaf037158 (patch)
tree77955a91a958fde7be47cb0ff23ac9e1248217db /arch/um/os-Linux
parenta1ff5878d2628bbe1e42821c024c96f48318f683 (diff)
uml: throw out CONFIG_MODE_TT
This patchset throws out tt mode, which has been non-functional for a while. This is done in phases, interspersed with code cleanups on the affected files. The removal is done as follows: remove all code, config options, and files which depend on CONFIG_MODE_TT get rid of the CHOOSE_MODE macro, which decided whether to call tt-mode or skas-mode code, and replace invocations with their skas portions replace all now-trivial procedures with their skas equivalents There are now a bunch of now-redundant pieces of data structures, including mode-specific pieces of the thread structure, pt_regs, and mm_context. These are all replaced with their skas-specific contents. As part of the ongoing style compliance project, I made a style pass over all files that were changed. There are three such patches, one for each phase, covering the files affected by that phase but no later ones. I noticed that we weren't freeing the LDT state associated with a process when it exited, so that's fixed in one of the later patches. The last patch is a tidying patch which I've had for a while, but which caused inexplicable crashes under tt mode. Since that is no longer a problem, this can now go in. This patch: Start getting rid of tt mode support. This patch throws out CONFIG_MODE_TT and all config options, code, and files which depend on it. CONFIG_MODE_SKAS is gone and everything that depends on it is included unconditionally. The few changed lines are in re-written Kconfig help, lines which needed something skas-related removed from them, and a few more which weren't strictly deletions. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/Makefile7
-rw-r--r--arch/um/os-Linux/main.c32
-rw-r--r--arch/um/os-Linux/process.c31
-rw-r--r--arch/um/os-Linux/start_up.c10
-rw-r--r--arch/um/os-Linux/sys-i386/Makefile2
-rw-r--r--arch/um/os-Linux/sys-x86_64/Makefile2
-rw-r--r--arch/um/os-Linux/time.c19
-rw-r--r--arch/um/os-Linux/tls.c36
8 files changed, 3 insertions, 136 deletions
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index f1bb58fe3207..1dbb45dfc49b 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -5,12 +5,7 @@
5 5
6obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 6obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
7 registers.o sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o \ 7 registers.o sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o \
8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ 8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/
9
10obj-$(CONFIG_MODE_SKAS) += skas/
11
12obj-$(CONFIG_MODE_TT) += tt.o
13user-objs-$(CONFIG_MODE_TT) += tt.o
14 9
15obj-$(CONFIG_TTY_LOG) += tty_log.o 10obj-$(CONFIG_TTY_LOG) += tty_log.o
16user-objs-$(CONFIG_TTY_LOG) += tty_log.o 11user-objs-$(CONFIG_TTY_LOG) += tty_log.o
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 919c25be254a..425aa8960649 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -25,9 +25,6 @@
25#include "um_malloc.h" 25#include "um_malloc.h"
26#include "kern_constants.h" 26#include "kern_constants.h"
27 27
28/* Set in main, unchanged thereafter */
29char *linux_prog;
30
31#define PGD_BOUND (4 * 1024 * 1024) 28#define PGD_BOUND (4 * 1024 * 1024)
32#define STACKSIZE (8 * 1024 * 1024) 29#define STACKSIZE (8 * 1024 * 1024)
33#define THREAD_NAME_LEN (256) 30#define THREAD_NAME_LEN (256)
@@ -125,35 +122,6 @@ int __init main(int argc, char **argv, char **envp)
125 char **new_argv; 122 char **new_argv;
126 int ret, i, err; 123 int ret, i, err;
127 124
128#ifdef UML_CONFIG_CMDLINE_ON_HOST
129 /* Allocate memory for thread command lines */
130 if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){
131
132 char padding[THREAD_NAME_LEN] = {
133 [ 0 ... THREAD_NAME_LEN - 2] = ' ', '\0'
134 };
135
136 new_argv = malloc((argc + 2) * sizeof(char*));
137 if(!new_argv) {
138 perror("Allocating extended argv");
139 exit(1);
140 }
141
142 new_argv[0] = argv[0];
143 new_argv[1] = padding;
144
145 for(i = 2; i <= argc; i++)
146 new_argv[i] = argv[i - 1];
147 new_argv[argc + 1] = NULL;
148
149 execvp(new_argv[0], new_argv);
150 perror("execing with extended args");
151 exit(1);
152 }
153#endif
154
155 linux_prog = argv[0];
156
157 set_stklim(); 125 set_stklim();
158 126
159 setup_env_path(); 127 setup_env_path();
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index e9c143297512..d5fef4ce0112 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -133,13 +133,6 @@ void os_kill_ptraced_process(int pid, int reap_child)
133 CATCH_EINTR(waitpid(pid, NULL, 0)); 133 CATCH_EINTR(waitpid(pid, NULL, 0));
134} 134}
135 135
136#ifdef UML_CONFIG_MODE_TT
137void os_usr1_process(int pid)
138{
139 kill(pid, SIGUSR1);
140}
141#endif
142
143/* Don't use the glibc version, which caches the result in TLS. It misses some 136/* Don't use the glibc version, which caches the result in TLS. It misses some
144 * syscalls, and also breaks with clone(), which does not unshare the TLS. 137 * syscalls, and also breaks with clone(), which does not unshare the TLS.
145 */ 138 */
@@ -239,30 +232,6 @@ out:
239 return ok; 232 return ok;
240} 233}
241 234
242#ifdef UML_CONFIG_MODE_TT
243void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int))
244{
245 int flags = 0, pages;
246
247 if(sig_stack != NULL){
248 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER);
249 set_sigstack(sig_stack, pages * UM_KERN_PAGE_SIZE);
250 flags = SA_ONSTACK;
251 }
252 if(usr1_handler){
253 struct sigaction sa;
254
255 sa.sa_handler = usr1_handler;
256 sigemptyset(&sa.sa_mask);
257 sa.sa_flags = flags;
258 sa.sa_restorer = NULL;
259 if(sigaction(SIGUSR1, &sa, NULL) < 0)
260 panic("init_new_thread_stack - sigaction failed - "
261 "errno = %d\n", errno);
262 }
263}
264#endif
265
266void init_new_thread_signals(void) 235void init_new_thread_signals(void)
267{ 236{
268 set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK, 237 set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK,
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index f4f2981f74b9..acf52ea4ff52 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -35,12 +35,9 @@
35#include "mode.h" 35#include "mode.h"
36#include "tempfile.h" 36#include "tempfile.h"
37#include "kern_constants.h" 37#include "kern_constants.h"
38
39#ifdef UML_CONFIG_MODE_SKAS
40#include "skas.h" 38#include "skas.h"
41#include "skas_ptrace.h" 39#include "skas_ptrace.h"
42#include "registers.h" 40#include "registers.h"
43#endif
44 41
45static int ptrace_child(void *arg) 42static int ptrace_child(void *arg)
46{ 43{
@@ -407,7 +404,6 @@ __uml_setup("noptraceldt", noptraceldt_cmd_param,
407" To support PTRACE_LDT, the host needs to be patched using\n" 404" To support PTRACE_LDT, the host needs to be patched using\n"
408" the current skas3 patch.\n\n"); 405" the current skas3 patch.\n\n");
409 406
410#ifdef UML_CONFIG_MODE_SKAS
411static inline void check_skas3_ptrace_faultinfo(void) 407static inline void check_skas3_ptrace_faultinfo(void)
412{ 408{
413 struct ptrace_faultinfo fi; 409 struct ptrace_faultinfo fi;
@@ -504,12 +500,6 @@ int can_do_skas(void)
504 500
505 return 1; 501 return 1;
506} 502}
507#else
508int can_do_skas(void)
509{
510 return 0;
511}
512#endif
513 503
514int __init parse_iomem(char *str, int *add) 504int __init parse_iomem(char *str, int *add)
515{ 505{
diff --git a/arch/um/os-Linux/sys-i386/Makefile b/arch/um/os-Linux/sys-i386/Makefile
index 37806621b25d..dc7208f0b741 100644
--- a/arch/um/os-Linux/sys-i386/Makefile
+++ b/arch/um/os-Linux/sys-i386/Makefile
@@ -3,7 +3,7 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-$(CONFIG_MODE_SKAS) = registers.o signal.o tls.o 6obj-y = registers.o signal.o tls.o
7 7
8USER_OBJS := $(obj-y) 8USER_OBJS := $(obj-y)
9 9
diff --git a/arch/um/os-Linux/sys-x86_64/Makefile b/arch/um/os-Linux/sys-x86_64/Makefile
index eac8c0db3001..a42a4ef02e1e 100644
--- a/arch/um/os-Linux/sys-x86_64/Makefile
+++ b/arch/um/os-Linux/sys-x86_64/Makefile
@@ -3,7 +3,7 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-$(CONFIG_MODE_SKAS) = registers.o prctl.o signal.o 6obj-y = registers.o prctl.o signal.o
7 7
8USER_OBJS := $(obj-y) 8USER_OBJS := $(obj-y)
9 9
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 5de169b168f6..5eb32d24ba58 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -30,13 +30,6 @@ int set_interval(int is_virtual)
30 return 0; 30 return 0;
31} 31}
32 32
33#ifdef UML_CONFIG_MODE_TT
34void enable_timer(void)
35{
36 set_interval(1);
37}
38#endif
39
40void disable_timer(void) 33void disable_timer(void)
41{ 34{
42 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); 35 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
@@ -71,18 +64,6 @@ void switch_timers(int to_real)
71 errno); 64 errno);
72} 65}
73 66
74#ifdef UML_CONFIG_MODE_TT
75void uml_idle_timer(void)
76{
77 if(signal(SIGVTALRM, SIG_IGN) == SIG_ERR)
78 panic("Couldn't unset SIGVTALRM handler");
79
80 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
81 SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
82 set_interval(0);
83}
84#endif
85
86unsigned long long os_nsecs(void) 67unsigned long long os_nsecs(void)
87{ 68{
88 struct timeval tv; 69 struct timeval tv;
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
index 16215b990804..282bd25e19ef 100644
--- a/arch/um/os-Linux/tls.c
+++ b/arch/um/os-Linux/tls.c
@@ -8,11 +8,6 @@
8 8
9/* TLS support - we basically rely on the host's one.*/ 9/* TLS support - we basically rely on the host's one.*/
10 10
11/* In TT mode, this should be called only by the tracing thread, and makes sense
12 * only for PTRACE_SET_THREAD_AREA. In SKAS mode, it's used normally.
13 *
14 */
15
16#ifndef PTRACE_GET_THREAD_AREA 11#ifndef PTRACE_GET_THREAD_AREA
17#define PTRACE_GET_THREAD_AREA 25 12#define PTRACE_GET_THREAD_AREA 25
18#endif 13#endif
@@ -32,8 +27,6 @@ int os_set_thread_area(user_desc_t *info, int pid)
32 return ret; 27 return ret;
33} 28}
34 29
35#ifdef UML_CONFIG_MODE_SKAS
36
37int os_get_thread_area(user_desc_t *info, int pid) 30int os_get_thread_area(user_desc_t *info, int pid)
38{ 31{
39 int ret; 32 int ret;
@@ -44,32 +37,3 @@ int os_get_thread_area(user_desc_t *info, int pid)
44 ret = -errno; 37 ret = -errno;
45 return ret; 38 return ret;
46} 39}
47
48#endif
49
50#ifdef UML_CONFIG_MODE_TT
51#include "linux/unistd.h"
52
53int do_set_thread_area_tt(user_desc_t *info)
54{
55 int ret;
56
57 ret = syscall(__NR_set_thread_area,info);
58 if (ret < 0) {
59 ret = -errno;
60 }
61 return ret;
62}
63
64int do_get_thread_area_tt(user_desc_t *info)
65{
66 int ret;
67
68 ret = syscall(__NR_get_thread_area,info);
69 if (ret < 0) {
70 ret = -errno;
71 }
72 return ret;
73}
74
75#endif /* UML_CONFIG_MODE_TT */