aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/chan_user.c3
-rw-r--r--arch/um/drivers/harddog_user.c3
-rw-r--r--arch/um/drivers/mconsole_kern.c1
-rw-r--r--arch/um/include/choose-mode.h20
-rw-r--r--arch/um/include/skas/uaccess-skas.h21
-rw-r--r--arch/um/include/sysdep-i386/ptrace.h67
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h83
-rw-r--r--arch/um/include/um_mmu.h1
-rw-r--r--arch/um/include/um_uaccess.h39
-rw-r--r--arch/um/kernel/exec.c5
-rw-r--r--arch/um/kernel/ksyms.c10
-rw-r--r--arch/um/kernel/physmem.c2
-rw-r--r--arch/um/kernel/process.c19
-rw-r--r--arch/um/kernel/reboot.c7
-rw-r--r--arch/um/kernel/skas/uaccess.c12
-rw-r--r--arch/um/kernel/syscall.c1
-rw-r--r--arch/um/kernel/time.c4
-rw-r--r--arch/um/kernel/tlb.c17
-rw-r--r--arch/um/kernel/um_arch.c13
-rw-r--r--arch/um/os-Linux/aio.c5
-rw-r--r--arch/um/os-Linux/main.c10
-rw-r--r--arch/um/os-Linux/signal.c6
-rw-r--r--arch/um/os-Linux/start_up.c1
-rw-r--r--arch/um/os-Linux/trap.c1
-rw-r--r--arch/um/sys-i386/ldt.c4
-rw-r--r--arch/um/sys-i386/ptrace.c17
-rw-r--r--arch/um/sys-i386/signal.c12
-rw-r--r--arch/um/sys-i386/tls.c7
-rw-r--r--arch/um/sys-x86_64/signal.c9
-rw-r--r--arch/um/sys-x86_64/syscalls.c4
30 files changed, 122 insertions, 282 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index d29e56d8ced4..74f22d27327d 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -264,8 +264,7 @@ void register_winch(int fd, struct tty_struct *tty)
264 return; 264 return;
265 265
266 pid = tcgetpgrp(fd); 266 pid = tcgetpgrp(fd);
267 if (!CHOOSE_MODE_PROC(is_tracer_winch, is_skas_winch, pid, fd, tty) && 267 if (!is_skas_winch(pid, fd, tty) && (pid == -1)) {
268 (pid == -1)) {
269 thread = winch_tramp(fd, tty, &thread_fd, &stack); 268 thread = winch_tramp(fd, tty, &thread_fd, &stack);
270 if (thread < 0) 269 if (thread < 0)
271 return; 270 return;
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index 1171790f742c..b050e267befe 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -9,7 +9,6 @@
9#include "user.h" 9#include "user.h"
10#include "mconsole.h" 10#include "mconsole.h"
11#include "os.h" 11#include "os.h"
12#include "choose-mode.h"
13#include "mode.h" 12#include "mode.h"
14 13
15struct dog_data { 14struct dog_data {
@@ -64,7 +63,7 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
64 } 63 }
65 else { 64 else {
66 /* XXX The os_getpid() is not SMP correct */ 65 /* XXX The os_getpid() is not SMP correct */
67 sprintf(pid_buf, "%d", CHOOSE_MODE(tracing_pid, os_getpid())); 66 sprintf(pid_buf, "%d", os_getpid());
68 args = pid_args; 67 args = pid_args;
69 } 68 }
70 69
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 4d563b9dde56..3591c3806670 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -33,7 +33,6 @@
33#include "init.h" 33#include "init.h"
34#include "os.h" 34#include "os.h"
35#include "irq_kern.h" 35#include "irq_kern.h"
36#include "choose-mode.h"
37 36
38static int do_unlink_socket(struct notifier_block *notifier, 37static int do_unlink_socket(struct notifier_block *notifier,
39 unsigned long what, void *data) 38 unsigned long what, void *data)
diff --git a/arch/um/include/choose-mode.h b/arch/um/include/choose-mode.h
deleted file mode 100644
index 51a387626da2..000000000000
--- a/arch/um/include/choose-mode.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __CHOOSE_MODE_H__
7#define __CHOOSE_MODE_H__
8
9#include "uml-config.h"
10
11#define CHOOSE_MODE(tt, skas) (skas)
12
13#define CHOOSE_MODE_PROC(tt, skas, args...) \
14 CHOOSE_MODE(tt(args), skas(args))
15
16#ifndef __CHOOSE_MODE
17#define __CHOOSE_MODE(tt, skas) CHOOSE_MODE(tt, skas)
18#endif
19
20#endif
diff --git a/arch/um/include/skas/uaccess-skas.h b/arch/um/include/skas/uaccess-skas.h
deleted file mode 100644
index 224a75f4c025..000000000000
--- a/arch/um/include/skas/uaccess-skas.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SKAS_UACCESS_H
7#define __SKAS_UACCESS_H
8
9#include "asm/errno.h"
10
11/* No SKAS-specific checking. */
12#define access_ok_skas(type, addr, size) 0
13
14extern int copy_from_user_skas(void *to, const void __user *from, int n);
15extern int copy_to_user_skas(void __user *to, const void *from, int n);
16extern int strncpy_from_user_skas(char *dst, const char __user *src, int count);
17extern int __clear_user_skas(void __user *mem, int len);
18extern int clear_user_skas(void __user *mem, int len);
19extern int strnlen_user_skas(const void __user *str, int len);
20
21#endif
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/include/sysdep-i386/ptrace.h
index c0ea4dbd042b..45573088864c 100644
--- a/arch/um/include/sysdep-i386/ptrace.h
+++ b/arch/um/include/sysdep-i386/ptrace.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -9,7 +9,6 @@
9#include "uml-config.h" 9#include "uml-config.h"
10#include "user_constants.h" 10#include "user_constants.h"
11#include "sysdep/faultinfo.h" 11#include "sysdep/faultinfo.h"
12#include "choose-mode.h"
13 12
14#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long)) 13#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
15#define MAX_REG_OFFSET (UM_FRAME_SIZE) 14#define MAX_REG_OFFSET (UM_FRAME_SIZE)
@@ -67,40 +66,23 @@ union uml_pt_regs {
67#define EMPTY_UML_PT_REGS { } 66#define EMPTY_UML_PT_REGS { }
68 67
69#define UPT_SC(r) ((r)->tt.sc) 68#define UPT_SC(r) ((r)->tt.sc)
70#define UPT_IP(r) \ 69#define UPT_IP(r) REGS_IP((r)->skas.regs)
71 __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs)) 70#define UPT_SP(r) REGS_SP((r)->skas.regs)
72#define UPT_SP(r) \ 71#define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs)
73 __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs)) 72#define UPT_EAX(r) REGS_EAX((r)->skas.regs)
74#define UPT_EFLAGS(r) \ 73#define UPT_EBX(r) REGS_EBX((r)->skas.regs)
75 __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs)) 74#define UPT_ECX(r) REGS_ECX((r)->skas.regs)
76#define UPT_EAX(r) \ 75#define UPT_EDX(r) REGS_EDX((r)->skas.regs)
77 __CHOOSE_MODE(SC_EAX(UPT_SC(r)), REGS_EAX((r)->skas.regs)) 76#define UPT_ESI(r) REGS_ESI((r)->skas.regs)
78#define UPT_EBX(r) \ 77#define UPT_EDI(r) REGS_EDI((r)->skas.regs)
79 __CHOOSE_MODE(SC_EBX(UPT_SC(r)), REGS_EBX((r)->skas.regs)) 78#define UPT_EBP(r) REGS_EBP((r)->skas.regs)
80#define UPT_ECX(r) \ 79#define UPT_ORIG_EAX(r) ((r)->skas.syscall)
81 __CHOOSE_MODE(SC_ECX(UPT_SC(r)), REGS_ECX((r)->skas.regs)) 80#define UPT_CS(r) REGS_CS((r)->skas.regs)
82#define UPT_EDX(r) \ 81#define UPT_SS(r) REGS_SS((r)->skas.regs)
83 __CHOOSE_MODE(SC_EDX(UPT_SC(r)), REGS_EDX((r)->skas.regs)) 82#define UPT_DS(r) REGS_DS((r)->skas.regs)
84#define UPT_ESI(r) \ 83#define UPT_ES(r) REGS_ES((r)->skas.regs)
85 __CHOOSE_MODE(SC_ESI(UPT_SC(r)), REGS_ESI((r)->skas.regs)) 84#define UPT_FS(r) REGS_FS((r)->skas.regs)
86#define UPT_EDI(r) \ 85#define UPT_GS(r) REGS_GS((r)->skas.regs)
87 __CHOOSE_MODE(SC_EDI(UPT_SC(r)), REGS_EDI((r)->skas.regs))
88#define UPT_EBP(r) \
89 __CHOOSE_MODE(SC_EBP(UPT_SC(r)), REGS_EBP((r)->skas.regs))
90#define UPT_ORIG_EAX(r) \
91 __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
92#define UPT_CS(r) \
93 __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
94#define UPT_SS(r) \
95 __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs))
96#define UPT_DS(r) \
97 __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs))
98#define UPT_ES(r) \
99 __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs))
100#define UPT_FS(r) \
101 __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs))
102#define UPT_GS(r) \
103 __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs))
104 86
105#define UPT_SYSCALL_ARG1(r) UPT_EBX(r) 87#define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
106#define UPT_SYSCALL_ARG2(r) UPT_ECX(r) 88#define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
@@ -111,8 +93,7 @@ union uml_pt_regs {
111 93
112extern int user_context(unsigned long sp); 94extern int user_context(unsigned long sp);
113 95
114#define UPT_IS_USER(r) \ 96#define UPT_IS_USER(r) ((r)->skas.is_user)
115 CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
116 97
117struct syscall_args { 98struct syscall_args {
118 unsigned long args[6]; 99 unsigned long args[6];
@@ -181,18 +162,14 @@ struct syscall_args {
181 } while (0) 162 } while (0)
182 163
183#define UPT_SET_SYSCALL_RETURN(r, res) \ 164#define UPT_SET_SYSCALL_RETURN(r, res) \
184 CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \ 165 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res))
185 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
186 166
187#define UPT_RESTART_SYSCALL(r) \ 167#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs)
188 CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
189 REGS_RESTART_SYSCALL((r)->skas.regs))
190 168
191#define UPT_ORIG_SYSCALL(r) UPT_EAX(r) 169#define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
192#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) 170#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
193#define UPT_SYSCALL_RET(r) UPT_EAX(r) 171#define UPT_SYSCALL_RET(r) UPT_EAX(r)
194 172
195#define UPT_FAULTINFO(r) \ 173#define UPT_FAULTINFO(r) (&(r)->skas.faultinfo)
196 CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
197 174
198#endif 175#endif
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
index ff525bda4c11..b3412b64cbea 100644
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -84,8 +84,6 @@
84 84
85#define REGS_ERR(r) ((r)->fault_type) 85#define REGS_ERR(r) ((r)->fault_type)
86 86
87#include "choose-mode.h"
88
89/* XXX */ 87/* XXX */
90union uml_pt_regs { 88union uml_pt_regs {
91 struct skas_regs { 89 struct skas_regs {
@@ -99,48 +97,45 @@ union uml_pt_regs {
99 97
100#define EMPTY_UML_PT_REGS { } 98#define EMPTY_UML_PT_REGS { }
101 99
102#define UPT_RBX(r) __CHOOSE_MODE(SC_RBX(UPT_SC(r)), REGS_RBX((r)->skas.regs)) 100#define UPT_RBX(r) REGS_RBX((r)->skas.regs)
103#define UPT_RCX(r) __CHOOSE_MODE(SC_RCX(UPT_SC(r)), REGS_RCX((r)->skas.regs)) 101#define UPT_RCX(r) REGS_RCX((r)->skas.regs)
104#define UPT_RDX(r) __CHOOSE_MODE(SC_RDX(UPT_SC(r)), REGS_RDX((r)->skas.regs)) 102#define UPT_RDX(r) REGS_RDX((r)->skas.regs)
105#define UPT_RSI(r) __CHOOSE_MODE(SC_RSI(UPT_SC(r)), REGS_RSI((r)->skas.regs)) 103#define UPT_RSI(r) REGS_RSI((r)->skas.regs)
106#define UPT_RDI(r) __CHOOSE_MODE(SC_RDI(UPT_SC(r)), REGS_RDI((r)->skas.regs)) 104#define UPT_RDI(r) REGS_RDI((r)->skas.regs)
107#define UPT_RBP(r) __CHOOSE_MODE(SC_RBP(UPT_SC(r)), REGS_RBP((r)->skas.regs)) 105#define UPT_RBP(r) REGS_RBP((r)->skas.regs)
108#define UPT_RAX(r) __CHOOSE_MODE(SC_RAX(UPT_SC(r)), REGS_RAX((r)->skas.regs)) 106#define UPT_RAX(r) REGS_RAX((r)->skas.regs)
109#define UPT_R8(r) __CHOOSE_MODE(SC_R8(UPT_SC(r)), REGS_R8((r)->skas.regs)) 107#define UPT_R8(r) REGS_R8((r)->skas.regs)
110#define UPT_R9(r) __CHOOSE_MODE(SC_R9(UPT_SC(r)), REGS_R9((r)->skas.regs)) 108#define UPT_R9(r) REGS_R9((r)->skas.regs)
111#define UPT_R10(r) __CHOOSE_MODE(SC_R10(UPT_SC(r)), REGS_R10((r)->skas.regs)) 109#define UPT_R10(r) REGS_R10((r)->skas.regs)
112#define UPT_R11(r) __CHOOSE_MODE(SC_R11(UPT_SC(r)), REGS_R11((r)->skas.regs)) 110#define UPT_R11(r) REGS_R11((r)->skas.regs)
113#define UPT_R12(r) __CHOOSE_MODE(SC_R12(UPT_SC(r)), REGS_R12((r)->skas.regs)) 111#define UPT_R12(r) REGS_R12((r)->skas.regs)
114#define UPT_R13(r) __CHOOSE_MODE(SC_R13(UPT_SC(r)), REGS_R13((r)->skas.regs)) 112#define UPT_R13(r) REGS_R13((r)->skas.regs)
115#define UPT_R14(r) __CHOOSE_MODE(SC_R14(UPT_SC(r)), REGS_R14((r)->skas.regs)) 113#define UPT_R14(r) REGS_R14((r)->skas.regs)
116#define UPT_R15(r) __CHOOSE_MODE(SC_R15(UPT_SC(r)), REGS_R15((r)->skas.regs)) 114#define UPT_R15(r) REGS_R15((r)->skas.regs)
117#define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs)) 115#define UPT_CS(r) REGS_CS((r)->skas.regs)
118#define UPT_FS_BASE(r) \ 116#define UPT_FS_BASE(r) \
119 __CHOOSE_MODE(SC_FS_BASE(UPT_SC(r)), REGS_FS_BASE((r)->skas.regs)) 117 REGS_FS_BASE((r)->skas.regs)
120#define UPT_FS(r) __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs)) 118#define UPT_FS(r) REGS_FS((r)->skas.regs)
121#define UPT_GS_BASE(r) \ 119#define UPT_GS_BASE(r) \
122 __CHOOSE_MODE(SC_GS_BASE(UPT_SC(r)), REGS_GS_BASE((r)->skas.regs)) 120 REGS_GS_BASE((r)->skas.regs)
123#define UPT_GS(r) __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs)) 121#define UPT_GS(r) REGS_GS((r)->skas.regs)
124#define UPT_DS(r) __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs)) 122#define UPT_DS(r) REGS_DS((r)->skas.regs)
125#define UPT_ES(r) __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs)) 123#define UPT_ES(r) REGS_ES((r)->skas.regs)
126#define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs)) 124#define UPT_CS(r) REGS_CS((r)->skas.regs)
127#define UPT_SS(r) __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs)) 125#define UPT_SS(r) REGS_SS((r)->skas.regs)
128#define UPT_ORIG_RAX(r) \ 126#define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->skas.regs)
129 __CHOOSE_MODE((r)->tt.orig_rax, REGS_ORIG_RAX((r)->skas.regs)) 127
130 128#define UPT_IP(r) REGS_IP((r)->skas.regs)
131#define UPT_IP(r) __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs)) 129#define UPT_SP(r) REGS_SP((r)->skas.regs)
132#define UPT_SP(r) __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs)) 130
133 131#define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs)
134#define UPT_EFLAGS(r) \
135 __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs))
136#define UPT_SC(r) ((r)->tt.sc) 132#define UPT_SC(r) ((r)->tt.sc)
137#define UPT_SYSCALL_NR(r) __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall) 133#define UPT_SYSCALL_NR(r) ((r)->skas.syscall)
138#define UPT_SYSCALL_RET(r) UPT_RAX(r) 134#define UPT_SYSCALL_RET(r) UPT_RAX(r)
139 135
140extern int user_context(unsigned long sp); 136extern int user_context(unsigned long sp);
141 137
142#define UPT_IS_USER(r) \ 138#define UPT_IS_USER(r) ((r)->skas.is_user)
143 CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
144 139
145#define UPT_SYSCALL_ARG1(r) UPT_RDI(r) 140#define UPT_SYSCALL_ARG1(r) UPT_RDI(r)
146#define UPT_SYSCALL_ARG2(r) UPT_RSI(r) 141#define UPT_SYSCALL_ARG2(r) UPT_RSI(r)
@@ -237,18 +232,12 @@ struct syscall_args {
237 }) 232 })
238 233
239#define UPT_SET_SYSCALL_RETURN(r, res) \ 234#define UPT_SET_SYSCALL_RETURN(r, res) \
240 CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \ 235 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res))
241 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
242 236
243#define UPT_RESTART_SYSCALL(r) \ 237#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs)
244 CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
245 REGS_RESTART_SYSCALL((r)->skas.regs))
246 238
247#define UPT_SEGV_IS_FIXABLE(r) \ 239#define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas)
248 CHOOSE_MODE(SC_SEGV_IS_FIXABLE(UPT_SC(r)), \
249 REGS_SEGV_IS_FIXABLE(&r->skas))
250 240
251#define UPT_FAULTINFO(r) \ 241#define UPT_FAULTINFO(r) (&(r)->skas.faultinfo)
252 CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
253 242
254#endif 243#endif
diff --git a/arch/um/include/um_mmu.h b/arch/um/include/um_mmu.h
index 2461be6b0a60..03bd4b949c04 100644
--- a/arch/um/include/um_mmu.h
+++ b/arch/um/include/um_mmu.h
@@ -7,7 +7,6 @@
7#define __ARCH_UM_MMU_H 7#define __ARCH_UM_MMU_H
8 8
9#include "uml-config.h" 9#include "uml-config.h"
10#include "choose-mode.h"
11#include "mmu-skas.h" 10#include "mmu-skas.h"
12 11
13typedef union mm_context { 12typedef union mm_context {
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index 6757ee768ccb..b1629b1e1423 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -6,8 +6,6 @@
6#ifndef __ARCH_UM_UACCESS_H 6#ifndef __ARCH_UM_UACCESS_H
7#define __ARCH_UM_UACCESS_H 7#define __ARCH_UM_UACCESS_H
8 8
9#include "choose-mode.h"
10#include "uaccess-skas.h"
11#include "asm/fixmap.h" 9#include "asm/fixmap.h"
12 10
13#define __under_task_size(addr, size) \ 11#define __under_task_size(addr, size) \
@@ -27,20 +25,10 @@
27 (__addr_range_nowrap(addr, size) && \ 25 (__addr_range_nowrap(addr, size) && \
28 (__under_task_size(addr, size) || \ 26 (__under_task_size(addr, size) || \
29 __access_ok_vsyscall(type, addr, size) || \ 27 __access_ok_vsyscall(type, addr, size) || \
30 segment_eq(get_fs(), KERNEL_DS) || \ 28 segment_eq(get_fs(), KERNEL_DS)))
31 CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)))
32 29
33static inline int copy_from_user(void *to, const void __user *from, int n) 30extern int copy_from_user(void *to, const void __user *from, int n);
34{ 31extern int copy_to_user(void __user *to, const void *from, int n);
35 return(CHOOSE_MODE_PROC(copy_from_user_tt, copy_from_user_skas, to,
36 from, n));
37}
38
39static inline int copy_to_user(void __user *to, const void *from, int n)
40{
41 return(CHOOSE_MODE_PROC(copy_to_user_tt, copy_to_user_skas, to,
42 from, n));
43}
44 32
45/* 33/*
46 * strncpy_from_user: - Copy a NUL terminated string from userspace. 34 * strncpy_from_user: - Copy a NUL terminated string from userspace.
@@ -61,11 +49,7 @@ static inline int copy_to_user(void __user *to, const void *from, int n)
61 * and returns @count. 49 * and returns @count.
62 */ 50 */
63 51
64static inline int strncpy_from_user(char *dst, const char __user *src, int count) 52extern int strncpy_from_user(char *dst, const char __user *src, int count);
65{
66 return(CHOOSE_MODE_PROC(strncpy_from_user_tt, strncpy_from_user_skas,
67 dst, src, count));
68}
69 53
70/* 54/*
71 * __clear_user: - Zero a block of memory in user space, with less checking. 55 * __clear_user: - Zero a block of memory in user space, with less checking.
@@ -78,10 +62,7 @@ static inline int strncpy_from_user(char *dst, const char __user *src, int count
78 * Returns number of bytes that could not be cleared. 62 * Returns number of bytes that could not be cleared.
79 * On success, this will be zero. 63 * On success, this will be zero.
80 */ 64 */
81static inline int __clear_user(void *mem, int len) 65extern int __clear_user(void __user *mem, int len);
82{
83 return(CHOOSE_MODE_PROC(__clear_user_tt, __clear_user_skas, mem, len));
84}
85 66
86/* 67/*
87 * clear_user: - Zero a block of memory in user space. 68 * clear_user: - Zero a block of memory in user space.
@@ -93,10 +74,7 @@ static inline int __clear_user(void *mem, int len)
93 * Returns number of bytes that could not be cleared. 74 * Returns number of bytes that could not be cleared.
94 * On success, this will be zero. 75 * On success, this will be zero.
95 */ 76 */
96static inline int clear_user(void __user *mem, int len) 77extern int clear_user(void __user *mem, int len);
97{
98 return(CHOOSE_MODE_PROC(clear_user_tt, clear_user_skas, mem, len));
99}
100 78
101/* 79/*
102 * strlen_user: - Get the size of a string in user space. 80 * strlen_user: - Get the size of a string in user space.
@@ -109,10 +87,7 @@ static inline int clear_user(void __user *mem, int len)
109 * On exception, returns 0. 87 * On exception, returns 0.
110 * If the string is too long, returns a value greater than @n. 88 * If the string is too long, returns a value greater than @n.
111 */ 89 */
112static inline int strnlen_user(const void __user *str, long len) 90extern int strnlen_user(const void __user *str, int len);
113{
114 return(CHOOSE_MODE_PROC(strnlen_user_tt, strnlen_user_skas, str, len));
115}
116 91
117#endif 92#endif
118 93
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 84d77a0d138c..8f774c25b765 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -18,18 +18,17 @@
18#include "irq_user.h" 18#include "irq_user.h"
19#include "tlb.h" 19#include "tlb.h"
20#include "os.h" 20#include "os.h"
21#include "choose-mode.h"
22#include "mode_kern.h" 21#include "mode_kern.h"
23 22
24void flush_thread(void) 23void flush_thread(void)
25{ 24{
26 arch_flush_thread(&current->thread.arch); 25 arch_flush_thread(&current->thread.arch);
27 CHOOSE_MODE(flush_thread_tt(), flush_thread_skas()); 26 flush_thread_skas();
28} 27}
29 28
30void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) 29void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
31{ 30{
32 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); 31 start_thread_skas(regs, eip, esp);
33} 32}
34 33
35#ifdef CONFIG_TTY_LOG 34#ifdef CONFIG_TTY_LOG
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 59e22d27b239..996412c0bb47 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -37,11 +37,11 @@ EXPORT_SYMBOL(um_virt_to_phys);
37EXPORT_SYMBOL(handle_page_fault); 37EXPORT_SYMBOL(handle_page_fault);
38EXPORT_SYMBOL(find_iomem); 38EXPORT_SYMBOL(find_iomem);
39 39
40EXPORT_SYMBOL(strnlen_user_skas); 40EXPORT_SYMBOL(strnlen_user);
41EXPORT_SYMBOL(strncpy_from_user_skas); 41EXPORT_SYMBOL(strncpy_from_user);
42EXPORT_SYMBOL(copy_to_user_skas); 42EXPORT_SYMBOL(copy_to_user);
43EXPORT_SYMBOL(copy_from_user_skas); 43EXPORT_SYMBOL(copy_from_user);
44EXPORT_SYMBOL(clear_user_skas); 44EXPORT_SYMBOL(clear_user);
45EXPORT_SYMBOL(uml_strdup); 45EXPORT_SYMBOL(uml_strdup);
46 46
47EXPORT_SYMBOL(os_stat_fd); 47EXPORT_SYMBOL(os_stat_fd);
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index fb695e48fad7..f7b2f3594793 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -61,7 +61,7 @@ static unsigned long kmem_top = 0;
61unsigned long get_kmem_end(void) 61unsigned long get_kmem_end(void)
62{ 62{
63 if (kmem_top == 0) 63 if (kmem_top == 0)
64 kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); 64 kmem_top = kmem_end_skas;
65 return kmem_top; 65 return kmem_top;
66} 66}
67 67
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 005ed44d4a8e..22ad46fd2c08 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -45,7 +45,6 @@
45#include "os.h" 45#include "os.h"
46#include "mode.h" 46#include "mode.h"
47#include "mode_kern.h" 47#include "mode_kern.h"
48#include "choose-mode.h"
49 48
50/* This is a per-cpu array. A processor only modifies its entry and it only 49/* This is a per-cpu array. A processor only modifies its entry and it only
51 * cares about its entry, so it's OK if another processor is modifying its 50 * cares about its entry, so it's OK if another processor is modifying its
@@ -55,7 +54,7 @@ struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
55 54
56static inline int external_pid(struct task_struct *task) 55static inline int external_pid(struct task_struct *task)
57{ 56{
58 return CHOOSE_MODE_PROC(external_pid_tt, external_pid_skas, task); 57 return external_pid_skas(task);
59} 58}
60 59
61int pid_to_processor_id(int pid) 60int pid_to_processor_id(int pid)
@@ -114,8 +113,8 @@ void *_switch_to(void *prev, void *next, void *last)
114 set_current(to); 113 set_current(to);
115 114
116 do { 115 do {
117 current->thread.saved_task = NULL ; 116 current->thread.saved_task = NULL;
118 CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next); 117 switch_to_skas(prev, next);
119 if(current->thread.saved_task) 118 if(current->thread.saved_task)
120 show_regs(&(current->thread.regs)); 119 show_regs(&(current->thread.regs));
121 next= current->thread.saved_task; 120 next= current->thread.saved_task;
@@ -136,7 +135,7 @@ void interrupt_end(void)
136 135
137void release_thread(struct task_struct *task) 136void release_thread(struct task_struct *task)
138{ 137{
139 CHOOSE_MODE(release_thread_tt(task), release_thread_skas(task)); 138 release_thread_skas(task);
140} 139}
141 140
142void exit_thread(void) 141void exit_thread(void)
@@ -155,8 +154,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
155 int ret; 154 int ret;
156 155
157 p->thread = (struct thread_struct) INIT_THREAD; 156 p->thread = (struct thread_struct) INIT_THREAD;
158 ret = CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, 157 ret = copy_thread_skas(nr, clone_flags, sp, stack_top, p, regs);
159 clone_flags, sp, stack_top, p, regs);
160 158
161 if (ret || !current->thread.forking) 159 if (ret || !current->thread.forking)
162 goto out; 160 goto out;
@@ -178,15 +176,12 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
178 int save_kmalloc_ok = kmalloc_ok; 176 int save_kmalloc_ok = kmalloc_ok;
179 177
180 kmalloc_ok = 0; 178 kmalloc_ok = 0;
181 CHOOSE_MODE_PROC(initial_thread_cb_tt, initial_thread_cb_skas, proc, 179 initial_thread_cb_skas(proc, arg);
182 arg);
183 kmalloc_ok = save_kmalloc_ok; 180 kmalloc_ok = save_kmalloc_ok;
184} 181}
185 182
186void default_idle(void) 183void default_idle(void)
187{ 184{
188 CHOOSE_MODE(uml_idle_timer(), (void) 0);
189
190 while(1){ 185 while(1){
191 /* endless idle loop with no priority at all */ 186 /* endless idle loop with no priority at all */
192 187
@@ -203,7 +198,7 @@ void default_idle(void)
203 198
204void cpu_idle(void) 199void cpu_idle(void)
205{ 200{
206 CHOOSE_MODE(init_idle_tt(), init_idle_skas()); 201 init_idle_skas();
207} 202}
208 203
209void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 204void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 93df0672d022..4a0def32e323 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -10,13 +10,12 @@
10#include "kern.h" 10#include "kern.h"
11#include "os.h" 11#include "os.h"
12#include "mode.h" 12#include "mode.h"
13#include "choose-mode.h"
14 13
15void (*pm_power_off)(void); 14void (*pm_power_off)(void);
16 15
17static void kill_off_processes(void) 16static void kill_off_processes(void)
18{ 17{
19 CHOOSE_MODE(kill_off_processes_tt(), kill_off_processes_skas()); 18 kill_off_processes_skas();
20} 19}
21 20
22void uml_cleanup(void) 21void uml_cleanup(void)
@@ -29,13 +28,13 @@ void uml_cleanup(void)
29void machine_restart(char * __unused) 28void machine_restart(char * __unused)
30{ 29{
31 uml_cleanup(); 30 uml_cleanup();
32 CHOOSE_MODE(reboot_tt(), reboot_skas()); 31 reboot_skas();
33} 32}
34 33
35void machine_power_off(void) 34void machine_power_off(void)
36{ 35{
37 uml_cleanup(); 36 uml_cleanup();
38 CHOOSE_MODE(halt_tt(), halt_skas()); 37 halt_skas();
39} 38}
40 39
41void machine_halt(void) 40void machine_halt(void)
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 8912cec0fe43..b14422e2c07c 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -139,7 +139,7 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg)
139 return(0); 139 return(0);
140} 140}
141 141
142int copy_from_user_skas(void *to, const void __user *from, int n) 142int copy_from_user(void *to, const void __user *from, int n)
143{ 143{
144 if(segment_eq(get_fs(), KERNEL_DS)){ 144 if(segment_eq(get_fs(), KERNEL_DS)){
145 memcpy(to, (__force void*)from, n); 145 memcpy(to, (__force void*)from, n);
@@ -160,7 +160,7 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg)
160 return(0); 160 return(0);
161} 161}
162 162
163int copy_to_user_skas(void __user *to, const void *from, int n) 163int copy_to_user(void __user *to, const void *from, int n)
164{ 164{
165 if(segment_eq(get_fs(), KERNEL_DS)){ 165 if(segment_eq(get_fs(), KERNEL_DS)){
166 memcpy((__force void*)to, from, n); 166 memcpy((__force void*)to, from, n);
@@ -186,7 +186,7 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
186 return(0); 186 return(0);
187} 187}
188 188
189int strncpy_from_user_skas(char *dst, const char __user *src, int count) 189int strncpy_from_user(char *dst, const char __user *src, int count)
190{ 190{
191 int n; 191 int n;
192 char *ptr = dst; 192 char *ptr = dst;
@@ -212,12 +212,12 @@ static int clear_chunk(unsigned long addr, int len, void *unused)
212 return(0); 212 return(0);
213} 213}
214 214
215int __clear_user_skas(void __user *mem, int len) 215int __clear_user(void __user *mem, int len)
216{ 216{
217 return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL)); 217 return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL));
218} 218}
219 219
220int clear_user_skas(void __user *mem, int len) 220int clear_user(void __user *mem, int len)
221{ 221{
222 if(segment_eq(get_fs(), KERNEL_DS)){ 222 if(segment_eq(get_fs(), KERNEL_DS)){
223 memset((__force void*)mem, 0, len); 223 memset((__force void*)mem, 0, len);
@@ -240,7 +240,7 @@ static int strnlen_chunk(unsigned long str, int len, void *arg)
240 return(0); 240 return(0);
241} 241}
242 242
243int strnlen_user_skas(const void __user *str, int len) 243int strnlen_user(const void __user *str, int len)
244{ 244{
245 int count = 0, n; 245 int count = 0, n;
246 246
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 7b3b67333ff3..138bcb43b997 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -21,7 +21,6 @@
21#include "kern_util.h" 21#include "kern_util.h"
22#include "sysdep/syscalls.h" 22#include "sysdep/syscalls.h"
23#include "mode_kern.h" 23#include "mode_kern.h"
24#include "choose-mode.h"
25 24
26/* Unlocked, I don't care if this is a bit off */ 25/* Unlocked, I don't care if this is a bit off */
27int nsyscalls = 0; 26int nsyscalls = 0;
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 259c49da7ff5..3571703a7cb4 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -181,9 +181,7 @@ void timer_handler(int sig, union uml_pt_regs *regs)
181 timer_irq(regs); 181 timer_irq(regs);
182 local_irq_disable(); 182 local_irq_disable();
183 irq_enter(); 183 irq_enter();
184 update_process_times(CHOOSE_MODE( 184 update_process_times((regs)->skas.is_user);
185 (UPT_SC(regs) && user_context(UPT_SP(regs))),
186 (regs)->skas.is_user));
187 irq_exit(); 185 irq_exit();
188 local_irq_enable(); 186 local_irq_enable();
189} 187}
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 8a8d52851443..312e8ba30cd3 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -8,7 +8,6 @@
8#include "asm/pgalloc.h" 8#include "asm/pgalloc.h"
9#include "asm/pgtable.h" 9#include "asm/pgtable.h"
10#include "asm/tlbflush.h" 10#include "asm/tlbflush.h"
11#include "choose-mode.h"
12#include "mode_kern.h" 11#include "mode_kern.h"
13#include "as-layout.h" 12#include "as-layout.h"
14#include "tlb.h" 13#include "tlb.h"
@@ -378,35 +377,31 @@ void flush_tlb_all(void)
378 377
379void flush_tlb_kernel_range(unsigned long start, unsigned long end) 378void flush_tlb_kernel_range(unsigned long start, unsigned long end)
380{ 379{
381 CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt, 380 flush_tlb_kernel_range_common(start, end);
382 flush_tlb_kernel_range_common, start, end);
383} 381}
384 382
385void flush_tlb_kernel_vm(void) 383void flush_tlb_kernel_vm(void)
386{ 384{
387 CHOOSE_MODE(flush_tlb_kernel_vm_tt(), 385 flush_tlb_kernel_range_common(start_vm, end_vm);
388 flush_tlb_kernel_range_common(start_vm, end_vm));
389} 386}
390 387
391void __flush_tlb_one(unsigned long addr) 388void __flush_tlb_one(unsigned long addr)
392{ 389{
393 CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr); 390 __flush_tlb_one_skas(addr);
394} 391}
395 392
396void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 393void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
397 unsigned long end) 394 unsigned long end)
398{ 395{
399 CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start, 396 flush_tlb_range_skas(vma, start, end);
400 end);
401} 397}
402 398
403void flush_tlb_mm(struct mm_struct *mm) 399void flush_tlb_mm(struct mm_struct *mm)
404{ 400{
405 CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm); 401 flush_tlb_mm_skas(mm);
406} 402}
407 403
408void force_flush_all(void) 404void force_flush_all(void)
409{ 405{
410 CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas()); 406 force_flush_all_skas();
411} 407}
412
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index aa7b067565d9..9f3a207eb81f 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -35,7 +35,6 @@
35#include "initrd.h" 35#include "initrd.h"
36#include "init.h" 36#include "init.h"
37#include "os.h" 37#include "os.h"
38#include "choose-mode.h"
39#include "mode_kern.h" 38#include "mode_kern.h"
40#include "mode.h" 39#include "mode.h"
41#include "skas.h" 40#include "skas.h"
@@ -68,8 +67,7 @@ struct cpuinfo_um boot_cpu_data = {
68 67
69unsigned long thread_saved_pc(struct task_struct *task) 68unsigned long thread_saved_pc(struct task_struct *task)
70{ 69{
71 return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas, 70 return os_process_pc(thread_pid_skas(task));
72 task));
73} 71}
74 72
75/* Changed in setup_arch, which is called in early boot */ 73/* Changed in setup_arch, which is called in early boot */
@@ -88,7 +86,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
88 seq_printf(m, "processor\t: %d\n", index); 86 seq_printf(m, "processor\t: %d\n", index);
89 seq_printf(m, "vendor_id\t: User Mode Linux\n"); 87 seq_printf(m, "vendor_id\t: User Mode Linux\n");
90 seq_printf(m, "model name\t: UML\n"); 88 seq_printf(m, "model name\t: UML\n");
91 seq_printf(m, "mode\t\t: %s\n", CHOOSE_MODE("tt", "skas")); 89 seq_printf(m, "mode\t\t: skas\n");
92 seq_printf(m, "host\t\t: %s\n", host_info); 90 seq_printf(m, "host\t\t: %s\n", host_info);
93 seq_printf(m, "bogomips\t: %lu.%02lu\n\n", 91 seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
94 loops_per_jiffy/(500000/HZ), 92 loops_per_jiffy/(500000/HZ),
@@ -283,8 +281,7 @@ int __init linux_main(int argc, char **argv)
283 281
284 printf("UML running in %s mode\n", mode); 282 printf("UML running in %s mode\n", mode);
285 283
286 host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt, 284 host_task_size = set_task_sizes_skas(&task_size);
287 set_task_sizes_skas, &task_size);
288 285
289 /* 286 /*
290 * Setting up handlers to 'sig_info' struct 287 * Setting up handlers to 'sig_info' struct
@@ -292,7 +289,7 @@ int __init linux_main(int argc, char **argv)
292 os_fill_handlinfo(handlinfo_kern); 289 os_fill_handlinfo(handlinfo_kern);
293 290
294 brk_start = (unsigned long) sbrk(0); 291 brk_start = (unsigned long) sbrk(0);
295 CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); 292 before_mem_skas(brk_start);
296 /* Increase physical memory size for exec-shield users 293 /* Increase physical memory size for exec-shield users
297 so they actually get what they asked for. This should 294 so they actually get what they asked for. This should
298 add zero for non-exec shield users */ 295 add zero for non-exec shield users */
@@ -357,7 +354,7 @@ int __init linux_main(int argc, char **argv)
357 stack_protections((unsigned long) &init_thread_info); 354 stack_protections((unsigned long) &init_thread_info);
358 os_flush_stdout(); 355 os_flush_stdout();
359 356
360 return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); 357 return start_uml_skas();
361} 358}
362 359
363extern int uml_exitcode; 360extern int uml_exitcode;
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 59348359f9ab..c8f5b7a2c1c6 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -320,11 +320,6 @@ static int init_aio(void)
320{ 320{
321 int err; 321 int err;
322 322
323 CHOOSE_MODE(({ if(!aio_24){
324 printk("Disabling 2.6 AIO in tt mode\n");
325 aio_24 = 1;
326 } }), (void) 0);
327
328 if(!aio_24){ 323 if(!aio_24){
329 err = init_aio_26(); 324 err = init_aio_26();
330 if(err && (errno == ENOSYS)){ 325 if(err && (errno == ENOSYS)){
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 425aa8960649..bfabb883daae 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -19,7 +19,6 @@
19#include "user.h" 19#include "user.h"
20#include "init.h" 20#include "init.h"
21#include "mode.h" 21#include "mode.h"
22#include "choose-mode.h"
23#include "uml-config.h" 22#include "uml-config.h"
24#include "os.h" 23#include "os.h"
25#include "um_malloc.h" 24#include "um_malloc.h"
@@ -189,16 +188,13 @@ int __init main(int argc, char **argv, char **envp)
189 return uml_exitcode; 188 return uml_exitcode;
190} 189}
191 190
192#define CAN_KMALLOC() \
193 (kmalloc_ok && CHOOSE_MODE((os_getpid() != tracing_pid), 1))
194
195extern void *__real_malloc(int); 191extern void *__real_malloc(int);
196 192
197void *__wrap_malloc(int size) 193void *__wrap_malloc(int size)
198{ 194{
199 void *ret; 195 void *ret;
200 196
201 if(!CAN_KMALLOC()) 197 if(!kmalloc_ok)
202 return __real_malloc(size); 198 return __real_malloc(size);
203 else if(size <= UM_KERN_PAGE_SIZE) 199 else if(size <= UM_KERN_PAGE_SIZE)
204 /* finding contiguous pages can be hard*/ 200 /* finding contiguous pages can be hard*/
@@ -251,11 +247,11 @@ void __wrap_free(void *ptr)
251 */ 247 */
252 248
253 if((addr >= uml_physmem) && (addr < high_physmem)){ 249 if((addr >= uml_physmem) && (addr < high_physmem)){
254 if(CAN_KMALLOC()) 250 if(kmalloc_ok)
255 kfree(ptr); 251 kfree(ptr);
256 } 252 }
257 else if((addr >= start_vm) && (addr < end_vm)){ 253 else if((addr >= start_vm) && (addr < end_vm)){
258 if(CAN_KMALLOC()) 254 if(kmalloc_ok)
259 vfree(ptr); 255 vfree(ptr);
260 } 256 }
261 else __real_free(ptr); 257 else __real_free(ptr);
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index b98f7ea2d2f6..0d6122adb8a7 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -53,8 +53,7 @@ void sig_handler(int sig, struct sigcontext *sc)
53 53
54 block_signals(); 54 block_signals();
55 55
56 CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas, 56 sig_handler_common_skas(sig, sc);
57 sig, sc);
58 57
59 set_signals(enabled); 58 set_signals(enabled);
60} 59}
@@ -257,8 +256,7 @@ void unblock_signals(void)
257 * back here. 256 * back here.
258 */ 257 */
259 if(save_pending & SIGIO_MASK) 258 if(save_pending & SIGIO_MASK)
260 CHOOSE_MODE_PROC(sig_handler_common_tt, 259 sig_handler_common_skas(SIGIO, NULL);
261 sig_handler_common_skas, SIGIO, NULL);
262 260
263 if(save_pending & SIGALRM_MASK) 261 if(save_pending & SIGALRM_MASK)
264 real_alarm_handler(SIGALRM, NULL); 262 real_alarm_handler(SIGALRM, NULL);
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index acf52ea4ff52..da5c90df5c9e 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -31,7 +31,6 @@
31#include "init.h" 31#include "init.h"
32#include "os.h" 32#include "os.h"
33#include "uml-config.h" 33#include "uml-config.h"
34#include "choose-mode.h"
35#include "mode.h" 34#include "mode.h"
36#include "tempfile.h" 35#include "tempfile.h"
37#include "kern_constants.h" 36#include "kern_constants.h"
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
index 295da657931a..b17f546c3655 100644
--- a/arch/um/os-Linux/trap.c
+++ b/arch/um/os-Linux/trap.c
@@ -12,7 +12,6 @@
12 12
13void usr2_handler(int sig, union uml_pt_regs *regs) 13void usr2_handler(int sig, union uml_pt_regs *regs)
14{ 14{
15 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
16} 15}
17 16
18/* Initialized from linux_main() */ 17/* Initialized from linux_main() */
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 762a12aec757..2683d302395d 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -12,7 +12,6 @@
12#include "asm/smp.h" 12#include "asm/smp.h"
13#include "asm/ldt.h" 13#include "asm/ldt.h"
14#include "asm/unistd.h" 14#include "asm/unistd.h"
15#include "choose-mode.h"
16#include "kern.h" 15#include "kern.h"
17#include "mode_kern.h" 16#include "mode_kern.h"
18#include "os.h" 17#include "os.h"
@@ -506,6 +505,5 @@ void free_ldt(struct mmu_context_skas * mm)
506 505
507int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) 506int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
508{ 507{
509 return CHOOSE_MODE_PROC(do_modify_ldt_tt, do_modify_ldt_skas, func, 508 return do_modify_ldt_skas(func, ptr, bytecount);
510 ptr, bytecount);
511} 509}
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 572fd504b94b..7792365827a2 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -230,13 +230,13 @@ static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave
230static inline int convert_fxsr_to_user(struct _fpstate __user *buf, 230static inline int convert_fxsr_to_user(struct _fpstate __user *buf,
231 struct pt_regs *regs) 231 struct pt_regs *regs)
232{ 232{
233 return(CHOOSE_MODE(convert_fxsr_to_user_tt(buf, regs), 0)); 233 return 0;
234} 234}
235 235
236static inline int convert_fxsr_from_user(struct pt_regs *regs, 236static inline int convert_fxsr_from_user(struct pt_regs *regs,
237 struct _fpstate __user *buf) 237 struct _fpstate __user *buf)
238{ 238{
239 return(CHOOSE_MODE(convert_fxsr_from_user_tt(regs, buf), 0)); 239 return 0;
240} 240}
241 241
242int get_fpregs(unsigned long buf, struct task_struct *child) 242int get_fpregs(unsigned long buf, struct task_struct *child)
@@ -261,12 +261,12 @@ int set_fpregs(unsigned long buf, struct task_struct *child)
261 261
262int get_fpxregs(unsigned long buf, struct task_struct *tsk) 262int get_fpxregs(unsigned long buf, struct task_struct *tsk)
263{ 263{
264 return(CHOOSE_MODE(get_fpxregs_tt(buf, tsk), 0)); 264 return 0;
265} 265}
266 266
267int set_fpxregs(unsigned long buf, struct task_struct *tsk) 267int set_fpxregs(unsigned long buf, struct task_struct *tsk)
268{ 268{
269 return(CHOOSE_MODE(set_fpxregs_tt(buf, tsk), 0)); 269 return 0;
270} 270}
271 271
272#ifdef notdef 272#ifdef notdef
@@ -286,16 +286,9 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
286} 286}
287#endif 287#endif
288 288
289static inline void copy_fpu_fxsave(struct pt_regs *regs,
290 struct user_i387_struct *buf)
291{
292 (void) CHOOSE_MODE(copy_fpu_fxsave_tt(regs, buf), 0);
293}
294
295int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu ) 289int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
296{ 290{
297 copy_fpu_fxsave(regs, (struct user_i387_struct *) fpu); 291 return 1;
298 return(1);
299} 292}
300 293
301/* 294/*
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 187ea27536bd..a9fe8d6f72c3 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -12,7 +12,6 @@
12#include "frame_kern.h" 12#include "frame_kern.h"
13#include "sigcontext.h" 13#include "sigcontext.h"
14#include "registers.h" 14#include "registers.h"
15#include "mode.h"
16#include "skas.h" 15#include "skas.h"
17 16
18void copy_sc(union uml_pt_regs *regs, void *from) 17void copy_sc(union uml_pt_regs *regs, void *from)
@@ -108,20 +107,13 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *t
108 107
109static int copy_sc_from_user(struct pt_regs *to, void __user *from) 108static int copy_sc_from_user(struct pt_regs *to, void __user *from)
110{ 109{
111 int ret; 110 return copy_sc_from_user_skas(to, from);
112
113 ret = CHOOSE_MODE(copy_sc_from_user_tt(UPT_SC(&to->regs), from,
114 sizeof(struct _fpstate)),
115 copy_sc_from_user_skas(to, from));
116 return ret;
117} 111}
118 112
119static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, 113static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp,
120 struct pt_regs *from, unsigned long sp) 114 struct pt_regs *from, unsigned long sp)
121{ 115{
122 return CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 116 return copy_sc_to_user_skas(to, fp, from, sp);
123 sizeof(*fp), sp),
124 copy_sc_to_user_skas(to, fp, from, sp));
125} 117}
126 118
127static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, 119static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp,
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c
index 0340b96d101b..bb4d0e23aa81 100644
--- a/arch/um/sys-i386/tls.c
+++ b/arch/um/sys-i386/tls.c
@@ -12,7 +12,6 @@
12#include "asm/segment.h" 12#include "asm/segment.h"
13#include "asm/smp.h" 13#include "asm/smp.h"
14#include "asm/desc.h" 14#include "asm/desc.h"
15#include "choose-mode.h"
16#include "kern.h" 15#include "kern.h"
17#include "kern_util.h" 16#include "kern_util.h"
18#include "mode_kern.h" 17#include "mode_kern.h"
@@ -28,7 +27,7 @@
28static int host_supports_tls = -1; 27static int host_supports_tls = -1;
29int host_gdt_entry_tls_min; 28int host_gdt_entry_tls_min;
30 29
31int do_set_thread_area_skas(struct user_desc *info) 30int do_set_thread_area(struct user_desc *info)
32{ 31{
33 int ret; 32 int ret;
34 u32 cpu; 33 u32 cpu;
@@ -39,7 +38,7 @@ int do_set_thread_area_skas(struct user_desc *info)
39 return ret; 38 return ret;
40} 39}
41 40
42int do_get_thread_area_skas(struct user_desc *info) 41int do_get_thread_area(struct user_desc *info)
43{ 42{
44 int ret; 43 int ret;
45 u32 cpu; 44 u32 cpu;
@@ -277,7 +276,7 @@ asmlinkage int sys_set_thread_area(struct user_desc __user *user_desc)
277 return -EFAULT; 276 return -EFAULT;
278 } 277 }
279 278
280 ret = CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, &info); 279 ret = do_set_thread_area(&info);
281 if (ret) 280 if (ret)
282 return ret; 281 return ret;
283 return set_tls_entry(current, &info, idx, 1); 282 return set_tls_entry(current, &info, idx, 1);
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index c18d929e69bc..2d6cdd260c26 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -12,7 +12,6 @@
12#include "asm/sigcontext.h" 12#include "asm/sigcontext.h"
13#include "asm/ptrace.h" 13#include "asm/ptrace.h"
14#include "asm/arch/ucontext.h" 14#include "asm/arch/ucontext.h"
15#include "choose-mode.h"
16#include "sysdep/ptrace.h" 15#include "sysdep/ptrace.h"
17#include "frame_kern.h" 16#include "frame_kern.h"
18#include "skas.h" 17#include "skas.h"
@@ -135,9 +134,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
135{ 134{
136 int ret; 135 int ret;
137 136
138 ret = CHOOSE_MODE(copy_sc_from_user_tt(UPT_SC(&to->regs), from, 137 ret = copy_sc_from_user_skas(to, from);
139 sizeof(struct _fpstate)),
140 copy_sc_from_user_skas(to, from));
141 return(ret); 138 return(ret);
142} 139}
143 140
@@ -146,9 +143,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
146 struct pt_regs *from, unsigned long mask, 143 struct pt_regs *from, unsigned long mask,
147 unsigned long sp) 144 unsigned long sp)
148{ 145{
149 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 146 return copy_sc_to_user_skas(to, fp, from, mask, sp);
150 sizeof(*fp), sp),
151 copy_sc_to_user_skas(to, fp, from, mask, sp)));
152} 147}
153 148
154struct rt_sigframe 149struct rt_sigframe
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index d0ff832c9eaf..d44398c9d27a 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -14,7 +14,6 @@
14#include "asm/ptrace.h" 14#include "asm/ptrace.h"
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"
18#include "kern.h" 17#include "kern.h"
19#include "os.h" 18#include "os.h"
20 19
@@ -92,8 +91,7 @@ long arch_prctl_skas(struct task_struct *task, int code,
92 91
93long sys_arch_prctl(int code, unsigned long addr) 92long sys_arch_prctl(int code, unsigned long addr)
94{ 93{
95 return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, current, code, 94 return arch_prctl_skas(current, code, (unsigned long __user *) addr);
96 (unsigned long __user *) addr);
97} 95}
98 96
99long sys_clone(unsigned long clone_flags, unsigned long newsp, 97long sys_clone(unsigned long clone_flags, unsigned long newsp,