aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/Makefile6
-rw-r--r--arch/um/os-Linux/aio.c2
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c2
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c2
-rw-r--r--arch/um/os-Linux/elf_aux.c1
-rw-r--r--arch/um/os-Linux/file.c2
-rw-r--r--arch/um/os-Linux/helper.c2
-rw-r--r--arch/um/os-Linux/internal.h1
-rw-r--r--arch/um/os-Linux/irq.c3
-rw-r--r--arch/um/os-Linux/main.c1
-rw-r--r--arch/um/os-Linux/mem.c2
-rw-r--r--arch/um/os-Linux/process.c23
-rw-r--r--arch/um/os-Linux/sigio.c3
-rw-r--r--arch/um/os-Linux/signal.c72
-rw-r--r--arch/um/os-Linux/skas/mem.c2
-rw-r--r--arch/um/os-Linux/skas/process.c21
-rw-r--r--arch/um/os-Linux/start_up.c10
-rw-r--r--arch/um/os-Linux/sys-i386/Makefile10
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c91
-rw-r--r--arch/um/os-Linux/sys-i386/signal.c13
-rw-r--r--arch/um/os-Linux/sys-i386/task_size.c139
-rw-r--r--arch/um/os-Linux/sys-i386/tls.c36
-rw-r--r--arch/um/os-Linux/sys-x86_64/Makefile10
-rw-r--r--arch/um/os-Linux/sys-x86_64/prctl.c12
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c52
-rw-r--r--arch/um/os-Linux/sys-x86_64/signal.c16
-rw-r--r--arch/um/os-Linux/sys-x86_64/task_size.c5
-rw-r--r--arch/um/os-Linux/time.c4
-rw-r--r--arch/um/os-Linux/tls.c35
-rw-r--r--arch/um/os-Linux/tty.c2
-rw-r--r--arch/um/os-Linux/uaccess.c32
-rw-r--r--arch/um/os-Linux/umid.c2
-rw-r--r--arch/um/os-Linux/util.c2
33 files changed, 59 insertions, 557 deletions
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index b33f4dfe7ae..dd764101e48 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -4,14 +4,14 @@
4# 4#
5 5
6obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 6obj-y = aio.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 tty.o uaccess.o \ 7 registers.o sigio.o signal.o start_up.o time.o tty.o \
8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ 8 umid.o user_syms.o util.o drivers/ skas/
9 9
10obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o 10obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o
11 11
12USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ 12USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
13 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ 13 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
14 tty.o tls.o uaccess.o umid.o util.o 14 tty.o umid.o util.o
15 15
16CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) 16CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
17 17
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 57e3d46c989..c5d039e1ff3 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -11,10 +11,8 @@
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include "aio.h" 12#include "aio.h"
13#include "init.h" 13#include "init.h"
14#include "kern_constants.h"
15#include "kern_util.h" 14#include "kern_util.h"
16#include "os.h" 15#include "os.h"
17#include "user.h"
18 16
19struct aio_thread_req { 17struct aio_thread_req {
20 enum aio_type type; 18 enum aio_type type;
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index cc72cb2c1af..db3d6481375 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -13,11 +13,9 @@
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/wait.h> 14#include <sys/wait.h>
15#include "etap.h" 15#include "etap.h"
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "net_user.h" 17#include "net_user.h"
19#include "um_malloc.h" 18#include "um_malloc.h"
20#include "user.h"
21 19
22#define MAX_PACKET ETH_MAX_PACKET 20#define MAX_PACKET ETH_MAX_PACKET
23 21
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 2448be03fd7..a2aacffdd90 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -13,11 +13,9 @@
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/wait.h> 14#include <sys/wait.h>
15#include <sys/uio.h> 15#include <sys/uio.h>
16#include "kern_constants.h"
17#include "kern_util.h" 16#include "kern_util.h"
18#include "os.h" 17#include "os.h"
19#include "tuntap.h" 18#include "tuntap.h"
20#include "user.h"
21 19
22static int tuntap_user_init(void *data, void *dev) 20static int tuntap_user_init(void *data, void *dev)
23{ 21{
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index 95332379938..d895271ad6f 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -12,7 +12,6 @@
12#include "init.h" 12#include "init.h"
13#include "elf_user.h" 13#include "elf_user.h"
14#include "mem_user.h" 14#include "mem_user.h"
15#include <kern_constants.h>
16 15
17typedef Elf32_auxv_t elf_auxv_t; 16typedef Elf32_auxv_t elf_auxv_t;
18 17
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 140e587bc0a..b049a63bb74 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -13,9 +13,7 @@
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/stat.h> 14#include <sys/stat.h>
15#include <sys/un.h> 15#include <sys/un.h>
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "user.h"
19 17
20static void copy_stat(struct uml_stat *dst, const struct stat64 *src) 18static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
21{ 19{
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index feff22d6467..cf26c4a9a43 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -10,11 +10,9 @@
10#include <linux/limits.h> 10#include <linux/limits.h>
11#include <sys/socket.h> 11#include <sys/socket.h>
12#include <sys/wait.h> 12#include <sys/wait.h>
13#include "kern_constants.h"
14#include "kern_util.h" 13#include "kern_util.h"
15#include "os.h" 14#include "os.h"
16#include "um_malloc.h" 15#include "um_malloc.h"
17#include "user.h"
18 16
19struct helper_data { 17struct helper_data {
20 void (*pre_exec)(void*); 18 void (*pre_exec)(void*);
diff --git a/arch/um/os-Linux/internal.h b/arch/um/os-Linux/internal.h
new file mode 100644
index 00000000000..2c3c3ecd8c0
--- /dev/null
+++ b/arch/um/os-Linux/internal.h
@@ -0,0 +1 @@
void alarm_handler(int, mcontext_t *);
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index 0348b975e81..9a49908b576 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -9,11 +9,8 @@
9#include <signal.h> 9#include <signal.h>
10#include <string.h> 10#include <string.h>
11#include "irq_user.h" 11#include "irq_user.h"
12#include "kern_constants.h"
13#include "os.h" 12#include "os.h"
14#include "process.h"
15#include "um_malloc.h" 13#include "um_malloc.h"
16#include "user.h"
17 14
18/* 15/*
19 * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd 16 * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 8471b817d94..7a86dd516eb 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -12,7 +12,6 @@
12#include <sys/resource.h> 12#include <sys/resource.h>
13#include "as-layout.h" 13#include "as-layout.h"
14#include "init.h" 14#include "init.h"
15#include "kern_constants.h"
16#include "kern_util.h" 15#include "kern_util.h"
17#include "os.h" 16#include "os.h"
18#include "um_malloc.h" 17#include "um_malloc.h"
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 62878cf1d33..8e421e1d6d3 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -14,9 +14,7 @@
14#include <sys/mman.h> 14#include <sys/mman.h>
15#include <sys/param.h> 15#include <sys/param.h>
16#include "init.h" 16#include "init.h"
17#include "kern_constants.h"
18#include "os.h" 17#include "os.h"
19#include "user.h"
20 18
21/* Modified by which_tmpdir, which is called during early boot */ 19/* Modified by which_tmpdir, which is called during early boot */
22static char *default_tmpdir = "/tmp"; 20static char *default_tmpdir = "/tmp";
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 0c45dc8efb0..307f173e7f8 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -13,12 +13,9 @@
13#include <sys/wait.h> 13#include <sys/wait.h>
14#include <asm/unistd.h> 14#include <asm/unistd.h>
15#include "init.h" 15#include "init.h"
16#include "kern_constants.h"
17#include "longjmp.h" 16#include "longjmp.h"
18#include "os.h" 17#include "os.h"
19#include "process.h"
20#include "skas_ptrace.h" 18#include "skas_ptrace.h"
21#include "user.h"
22 19
23#define ARBITRARY_ADDR -1 20#define ARBITRARY_ADDR -1
24#define FAILURE_PID -1 21#define FAILURE_PID -1
@@ -237,21 +234,13 @@ out:
237 234
238void init_new_thread_signals(void) 235void init_new_thread_signals(void)
239{ 236{
240 set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK, 237 set_handler(SIGSEGV);
241 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1); 238 set_handler(SIGTRAP);
242 set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK, 239 set_handler(SIGFPE);
243 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1); 240 set_handler(SIGILL);
244 set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK, 241 set_handler(SIGBUS);
245 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
246 set_handler(SIGILL, (__sighandler_t) sig_handler, SA_ONSTACK,
247 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
248 set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK,
249 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
250 signal(SIGHUP, SIG_IGN); 242 signal(SIGHUP, SIG_IGN);
251 243 set_handler(SIGIO);
252 set_handler(SIGIO, (__sighandler_t) sig_handler,
253 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM,
254 SIGVTALRM, -1);
255 signal(SIGWINCH, SIG_IGN); 244 signal(SIGWINCH, SIG_IGN);
256 signal(SIGTERM, SIG_DFL); 245 signal(SIGTERM, SIG_DFL);
257} 246}
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 63d299df152..3c161218c67 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -11,14 +11,11 @@
11#include <sched.h> 11#include <sched.h>
12#include <signal.h> 12#include <signal.h>
13#include <string.h> 13#include <string.h>
14#include "kern_constants.h"
15#include "kern_util.h" 14#include "kern_util.h"
16#include "init.h" 15#include "init.h"
17#include "os.h" 16#include "os.h"
18#include "process.h"
19#include "sigio.h" 17#include "sigio.h"
20#include "um_malloc.h" 18#include "um_malloc.h"
21#include "user.h"
22 19
23/* 20/*
24 * Protected by sigio_lock(), also used by sigio_cleanup, which is an 21 * Protected by sigio_lock(), also used by sigio_cleanup, which is an
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 6ae180703a6..2d22f1fcd8e 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -12,13 +12,7 @@
12#include "as-layout.h" 12#include "as-layout.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "os.h" 14#include "os.h"
15#include "process.h" 15#include "sysdep/mcontext.h"
16#include "sysdep/barrier.h"
17#include "sysdep/sigcontext.h"
18#include "user.h"
19
20/* Copied from linux/compiler-gcc.h since we can't include it directly */
21#define barrier() __asm__ __volatile__("": : :"memory")
22 16
23void (*sig_info[NSIG])(int, struct uml_pt_regs *) = { 17void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
24 [SIGTRAP] = relay_signal, 18 [SIGTRAP] = relay_signal,
@@ -30,7 +24,7 @@ void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
30 [SIGIO] = sigio_handler, 24 [SIGIO] = sigio_handler,
31 [SIGVTALRM] = timer_handler }; 25 [SIGVTALRM] = timer_handler };
32 26
33static void sig_handler_common(int sig, struct sigcontext *sc) 27static void sig_handler_common(int sig, mcontext_t *mc)
34{ 28{
35 struct uml_pt_regs r; 29 struct uml_pt_regs r;
36 int save_errno = errno; 30 int save_errno = errno;
@@ -38,8 +32,8 @@ static void sig_handler_common(int sig, struct sigcontext *sc)
38 r.is_user = 0; 32 r.is_user = 0;
39 if (sig == SIGSEGV) { 33 if (sig == SIGSEGV) {
40 /* For segfaults, we want the data from the sigcontext. */ 34 /* For segfaults, we want the data from the sigcontext. */
41 copy_sc(&r, sc); 35 get_regs_from_mc(&r, mc);
42 GET_FAULTINFO_FROM_SC(r.faultinfo, sc); 36 GET_FAULTINFO_FROM_MC(r.faultinfo, mc);
43 } 37 }
44 38
45 /* enable signals if sig isn't IRQ signal */ 39 /* enable signals if sig isn't IRQ signal */
@@ -66,7 +60,7 @@ static void sig_handler_common(int sig, struct sigcontext *sc)
66static int signals_enabled; 60static int signals_enabled;
67static unsigned int signals_pending; 61static unsigned int signals_pending;
68 62
69void sig_handler(int sig, struct sigcontext *sc) 63void sig_handler(int sig, mcontext_t *mc)
70{ 64{
71 int enabled; 65 int enabled;
72 66
@@ -78,23 +72,23 @@ void sig_handler(int sig, struct sigcontext *sc)
78 72
79 block_signals(); 73 block_signals();
80 74
81 sig_handler_common(sig, sc); 75 sig_handler_common(sig, mc);
82 76
83 set_signals(enabled); 77 set_signals(enabled);
84} 78}
85 79
86static void real_alarm_handler(struct sigcontext *sc) 80static void real_alarm_handler(mcontext_t *mc)
87{ 81{
88 struct uml_pt_regs regs; 82 struct uml_pt_regs regs;
89 83
90 if (sc != NULL) 84 if (mc != NULL)
91 copy_sc(&regs, sc); 85 get_regs_from_mc(&regs, mc);
92 regs.is_user = 0; 86 regs.is_user = 0;
93 unblock_signals(); 87 unblock_signals();
94 timer_handler(SIGVTALRM, &regs); 88 timer_handler(SIGVTALRM, &regs);
95} 89}
96 90
97void alarm_handler(int sig, struct sigcontext *sc) 91void alarm_handler(int sig, mcontext_t *mc)
98{ 92{
99 int enabled; 93 int enabled;
100 94
@@ -106,14 +100,13 @@ void alarm_handler(int sig, struct sigcontext *sc)
106 100
107 block_signals(); 101 block_signals();
108 102
109 real_alarm_handler(sc); 103 real_alarm_handler(mc);
110 set_signals(enabled); 104 set_signals(enabled);
111} 105}
112 106
113void timer_init(void) 107void timer_init(void)
114{ 108{
115 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler, 109 set_handler(SIGVTALRM);
116 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, -1);
117} 110}
118 111
119void set_sigstack(void *sig_stack, int size) 112void set_sigstack(void *sig_stack, int size)
@@ -126,10 +119,23 @@ void set_sigstack(void *sig_stack, int size)
126 panic("enabling signal stack failed, errno = %d\n", errno); 119 panic("enabling signal stack failed, errno = %d\n", errno);
127} 120}
128 121
129static void (*handlers[_NSIG])(int sig, struct sigcontext *sc); 122static void (*handlers[_NSIG])(int sig, mcontext_t *mc) = {
123 [SIGSEGV] = sig_handler,
124 [SIGBUS] = sig_handler,
125 [SIGILL] = sig_handler,
126 [SIGFPE] = sig_handler,
127 [SIGTRAP] = sig_handler,
128
129 [SIGIO] = sig_handler,
130 [SIGWINCH] = sig_handler,
131 [SIGVTALRM] = alarm_handler
132};
133
130 134
131void handle_signal(int sig, struct sigcontext *sc) 135static void hard_handler(int sig, siginfo_t *info, void *p)
132{ 136{
137 struct ucontext *uc = p;
138 mcontext_t *mc = &uc->uc_mcontext;
133 unsigned long pending = 1UL << sig; 139 unsigned long pending = 1UL << sig;
134 140
135 do { 141 do {
@@ -155,7 +161,7 @@ void handle_signal(int sig, struct sigcontext *sc)
155 while ((sig = ffs(pending)) != 0){ 161 while ((sig = ffs(pending)) != 0){
156 sig--; 162 sig--;
157 pending &= ~(1 << sig); 163 pending &= ~(1 << sig);
158 (*handlers[sig])(sig, sc); 164 (*handlers[sig])(sig, mc);
159 } 165 }
160 166
161 /* 167 /*
@@ -169,28 +175,26 @@ void handle_signal(int sig, struct sigcontext *sc)
169 } while (pending); 175 } while (pending);
170} 176}
171 177
172extern void hard_handler(int sig); 178void set_handler(int sig)
173
174void set_handler(int sig, void (*handler)(int), int flags, ...)
175{ 179{
176 struct sigaction action; 180 struct sigaction action;
177 va_list ap; 181 int flags = SA_SIGINFO | SA_ONSTACK;
178 sigset_t sig_mask; 182 sigset_t sig_mask;
179 int mask;
180 183
181 handlers[sig] = (void (*)(int, struct sigcontext *)) handler; 184 action.sa_sigaction = hard_handler;
182 action.sa_handler = hard_handler;
183 185
186 /* block irq ones */
184 sigemptyset(&action.sa_mask); 187 sigemptyset(&action.sa_mask);
185 188 sigaddset(&action.sa_mask, SIGVTALRM);
186 va_start(ap, flags); 189 sigaddset(&action.sa_mask, SIGIO);
187 while ((mask = va_arg(ap, int)) != -1) 190 sigaddset(&action.sa_mask, SIGWINCH);
188 sigaddset(&action.sa_mask, mask);
189 va_end(ap);
190 191
191 if (sig == SIGSEGV) 192 if (sig == SIGSEGV)
192 flags |= SA_NODEFER; 193 flags |= SA_NODEFER;
193 194
195 if (sigismember(&action.sa_mask, sig))
196 flags |= SA_RESTART; /* if it's an irq signal */
197
194 action.sa_flags = flags; 198 action.sa_flags = flags;
195 action.sa_restorer = NULL; 199 action.sa_restorer = NULL;
196 if (sigaction(sig, &action, NULL) < 0) 200 if (sigaction(sig, &action, NULL) < 0)
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index e771398be5f..c0afff7af4b 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -9,7 +9,6 @@
9#include <string.h> 9#include <string.h>
10#include <sys/mman.h> 10#include <sys/mman.h>
11#include "init.h" 11#include "init.h"
12#include "kern_constants.h"
13#include "as-layout.h" 12#include "as-layout.h"
14#include "mm_id.h" 13#include "mm_id.h"
15#include "os.h" 14#include "os.h"
@@ -17,7 +16,6 @@
17#include "ptrace_user.h" 16#include "ptrace_user.h"
18#include "registers.h" 17#include "registers.h"
19#include "skas.h" 18#include "skas.h"
20#include "user.h"
21#include "sysdep/ptrace.h" 19#include "sysdep/ptrace.h"
22#include "sysdep/stub.h" 20#include "sysdep/stub.h"
23 21
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index dee0e8cf8ad..cd65727854e 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -9,31 +9,23 @@
9#include <errno.h> 9#include <errno.h>
10#include <string.h> 10#include <string.h>
11#include <sys/mman.h> 11#include <sys/mman.h>
12#include <sys/ptrace.h>
13#include <sys/wait.h> 12#include <sys/wait.h>
14#include <asm/unistd.h> 13#include <asm/unistd.h>
15#include "as-layout.h" 14#include "as-layout.h"
16#include "chan_user.h" 15#include "init.h"
17#include "kern_constants.h"
18#include "kern_util.h" 16#include "kern_util.h"
19#include "mem.h" 17#include "mem.h"
20#include "os.h" 18#include "os.h"
21#include "process.h"
22#include "proc_mm.h" 19#include "proc_mm.h"
23#include "ptrace_user.h" 20#include "ptrace_user.h"
24#include "registers.h" 21#include "registers.h"
25#include "skas.h" 22#include "skas.h"
26#include "skas_ptrace.h" 23#include "skas_ptrace.h"
27#include "user.h"
28#include "sysdep/stub.h" 24#include "sysdep/stub.h"
29 25
30int is_skas_winch(int pid, int fd, void *data) 26int is_skas_winch(int pid, int fd, void *data)
31{ 27{
32 if (pid != getpgrp()) 28 return pid == getpgrp();
33 return 0;
34
35 register_winch_irq(-1, fd, -1, data, 0);
36 return 1;
37} 29}
38 30
39static int ptrace_dump_regs(int pid) 31static int ptrace_dump_regs(int pid)
@@ -169,7 +161,7 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
169 161
170 if (!local_using_sysemu) 162 if (!local_using_sysemu)
171 { 163 {
172 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, 164 err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
173 __NR_getpid); 165 __NR_getpid);
174 if (err < 0) { 166 if (err < 0) {
175 printk(UM_KERN_ERR "handle_trap - nullifying syscall " 167 printk(UM_KERN_ERR "handle_trap - nullifying syscall "
@@ -257,8 +249,8 @@ static int userspace_tramp(void *stack)
257 249
258 set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE); 250 set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE);
259 sigemptyset(&sa.sa_mask); 251 sigemptyset(&sa.sa_mask);
260 sa.sa_flags = SA_ONSTACK | SA_NODEFER; 252 sa.sa_flags = SA_ONSTACK | SA_NODEFER | SA_SIGINFO;
261 sa.sa_handler = (void *) v; 253 sa.sa_sigaction = (void *) v;
262 sa.sa_restorer = NULL; 254 sa.sa_restorer = NULL;
263 if (sigaction(SIGSEGV, &sa, NULL) < 0) { 255 if (sigaction(SIGSEGV, &sa, NULL) < 0) {
264 printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV " 256 printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV "
@@ -661,8 +653,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
661{ 653{
662 int n; 654 int n;
663 655
664 set_handler(SIGWINCH, (__sighandler_t) sig_handler, 656 set_handler(SIGWINCH);
665 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGVTALRM, -1);
666 657
667 /* 658 /*
668 * Can't use UML_SETJMP or UML_LONGJMP here because they save 659 * Can't use UML_SETJMP or UML_LONGJMP here because they save
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 02ee9adff54..425162e22af 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -13,12 +13,10 @@
13#include <signal.h> 13#include <signal.h>
14#include <string.h> 14#include <string.h>
15#include <sys/mman.h> 15#include <sys/mman.h>
16#include <sys/ptrace.h>
17#include <sys/stat.h> 16#include <sys/stat.h>
18#include <sys/wait.h> 17#include <sys/wait.h>
19#include <asm/unistd.h> 18#include <asm/unistd.h>
20#include "init.h" 19#include "init.h"
21#include "kern_constants.h"
22#include "os.h" 20#include "os.h"
23#include "mem_user.h" 21#include "mem_user.h"
24#include "ptrace_user.h" 22#include "ptrace_user.h"
@@ -225,7 +223,7 @@ static void __init check_sysemu(void)
225 goto fail; 223 goto fail;
226 } 224 }
227 225
228 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); 226 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, os_getpid());
229 if (n < 0) { 227 if (n < 0) {
230 non_fatal("check_sysemu : failed to modify system call " 228 non_fatal("check_sysemu : failed to modify system call "
231 "return"); 229 "return");
@@ -261,7 +259,7 @@ static void __init check_sysemu(void)
261 "doesn't singlestep"); 259 "doesn't singlestep");
262 goto fail; 260 goto fail;
263 } 261 }
264 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, 262 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET,
265 os_getpid()); 263 os_getpid());
266 if (n < 0) 264 if (n < 0)
267 fatal_perror("check_sysemu : failed to modify " 265 fatal_perror("check_sysemu : failed to modify "
@@ -317,10 +315,10 @@ static void __init check_ptrace(void)
317 fatal("check_ptrace : expected (SIGTRAP|0x80), " 315 fatal("check_ptrace : expected (SIGTRAP|0x80), "
318 "got status = %d", status); 316 "got status = %d", status);
319 317
320 syscall = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET, 318 syscall = ptrace(PTRACE_PEEKUSER, pid, PT_SYSCALL_NR_OFFSET,
321 0); 319 0);
322 if (syscall == __NR_getpid) { 320 if (syscall == __NR_getpid) {
323 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, 321 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
324 __NR_getppid); 322 __NR_getppid);
325 if (n < 0) 323 if (n < 0)
326 fatal_perror("check_ptrace : failed to modify " 324 fatal_perror("check_ptrace : failed to modify "
diff --git a/arch/um/os-Linux/sys-i386/Makefile b/arch/um/os-Linux/sys-i386/Makefile
deleted file mode 100644
index b4bc6ac4f30..00000000000
--- a/arch/um/os-Linux/sys-i386/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL
4#
5
6obj-y = registers.o signal.o task_size.o tls.o
7
8USER_OBJS := $(obj-y)
9
10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
deleted file mode 100644
index 229f7a53d8d..00000000000
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Copyright (C) 2004 PathScale, Inc
3 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7#include <errno.h>
8#include <sys/ptrace.h>
9#include <sys/user.h>
10#include "kern_constants.h"
11#include "longjmp.h"
12#include "user.h"
13#include "sysdep/ptrace_user.h"
14
15int save_fp_registers(int pid, unsigned long *fp_regs)
16{
17 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
18 return -errno;
19 return 0;
20}
21
22int restore_fp_registers(int pid, unsigned long *fp_regs)
23{
24 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
25 return -errno;
26 return 0;
27}
28
29int save_fpx_registers(int pid, unsigned long *fp_regs)
30{
31 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0)
32 return -errno;
33 return 0;
34}
35
36int restore_fpx_registers(int pid, unsigned long *fp_regs)
37{
38 if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0)
39 return -errno;
40 return 0;
41}
42
43unsigned long get_thread_reg(int reg, jmp_buf *buf)
44{
45 switch (reg) {
46 case EIP:
47 return buf[0]->__eip;
48 case UESP:
49 return buf[0]->__esp;
50 case EBP:
51 return buf[0]->__ebp;
52 default:
53 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
54 reg);
55 return 0;
56 }
57}
58
59int have_fpx_regs = 1;
60
61int get_fp_registers(int pid, unsigned long *regs)
62{
63 if (have_fpx_regs)
64 return save_fpx_registers(pid, regs);
65 else
66 return save_fp_registers(pid, regs);
67}
68
69int put_fp_registers(int pid, unsigned long *regs)
70{
71 if (have_fpx_regs)
72 return restore_fpx_registers(pid, regs);
73 else
74 return restore_fp_registers(pid, regs);
75}
76
77void arch_init_registers(int pid)
78{
79 struct user_fpxregs_struct fpx_regs;
80 int err;
81
82 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs);
83 if (!err)
84 return;
85
86 if (errno != EIO)
87 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
88 errno);
89
90 have_fpx_regs = 0;
91}
diff --git a/arch/um/os-Linux/sys-i386/signal.c b/arch/um/os-Linux/sys-i386/signal.c
deleted file mode 100644
index f311609f93d..00000000000
--- a/arch/um/os-Linux/sys-i386/signal.c
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7
8extern void handle_signal(int sig, struct sigcontext *sc);
9
10void hard_handler(int sig)
11{
12 handle_signal(sig, (struct sigcontext *) (&sig + 1));
13}
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-i386/task_size.c
deleted file mode 100644
index be04c1e183b..00000000000
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ /dev/null
@@ -1,139 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4#include <sys/mman.h>
5#include "longjmp.h"
6#include "kern_constants.h"
7
8static jmp_buf buf;
9
10static void segfault(int sig)
11{
12 longjmp(buf, 1);
13}
14
15static int page_ok(unsigned long page)
16{
17 unsigned long *address = (unsigned long *) (page << UM_KERN_PAGE_SHIFT);
18 unsigned long n = ~0UL;
19 void *mapped = NULL;
20 int ok = 0;
21
22 /*
23 * First see if the page is readable. If it is, it may still
24 * be a VDSO, so we go on to see if it's writable. If not
25 * then try mapping memory there. If that fails, then we're
26 * still in the kernel area. As a sanity check, we'll fail if
27 * the mmap succeeds, but gives us an address different from
28 * what we wanted.
29 */
30 if (setjmp(buf) == 0)
31 n = *address;
32 else {
33 mapped = mmap(address, UM_KERN_PAGE_SIZE,
34 PROT_READ | PROT_WRITE,
35 MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
36 if (mapped == MAP_FAILED)
37 return 0;
38 if (mapped != address)
39 goto out;
40 }
41
42 /*
43 * Now, is it writeable? If so, then we're in user address
44 * space. If not, then try mprotecting it and try the write
45 * again.
46 */
47 if (setjmp(buf) == 0) {
48 *address = n;
49 ok = 1;
50 goto out;
51 } else if (mprotect(address, UM_KERN_PAGE_SIZE,
52 PROT_READ | PROT_WRITE) != 0)
53 goto out;
54
55 if (setjmp(buf) == 0) {
56 *address = n;
57 ok = 1;
58 }
59
60 out:
61 if (mapped != NULL)
62 munmap(mapped, UM_KERN_PAGE_SIZE);
63 return ok;
64}
65
66unsigned long os_get_top_address(void)
67{
68 struct sigaction sa, old;
69 unsigned long bottom = 0;
70 /*
71 * A 32-bit UML on a 64-bit host gets confused about the VDSO at
72 * 0xffffe000. It is mapped, is readable, can be reprotected writeable
73 * and written. However, exec discovers later that it can't be
74 * unmapped. So, just set the highest address to be checked to just
75 * below it. This might waste some address space on 4G/4G 32-bit
76 * hosts, but shouldn't hurt otherwise.
77 */
78 unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT;
79 unsigned long test, original;
80
81 printf("Locating the bottom of the address space ... ");
82 fflush(stdout);
83
84 /*
85 * We're going to be longjmping out of the signal handler, so
86 * SA_DEFER needs to be set.
87 */
88 sa.sa_handler = segfault;
89 sigemptyset(&sa.sa_mask);
90 sa.sa_flags = SA_NODEFER;
91 if (sigaction(SIGSEGV, &sa, &old)) {
92 perror("os_get_top_address");
93 exit(1);
94 }
95
96 /* Manually scan the address space, bottom-up, until we find
97 * the first valid page (or run out of them).
98 */
99 for (bottom = 0; bottom < top; bottom++) {
100 if (page_ok(bottom))
101 break;
102 }
103
104 /* If we've got this far, we ran out of pages. */
105 if (bottom == top) {
106 fprintf(stderr, "Unable to determine bottom of address "
107 "space.\n");
108 exit(1);
109 }
110
111 printf("0x%x\n", bottom << UM_KERN_PAGE_SHIFT);
112 printf("Locating the top of the address space ... ");
113 fflush(stdout);
114
115 original = bottom;
116
117 /* This could happen with a 4G/4G split */
118 if (page_ok(top))
119 goto out;
120
121 do {
122 test = bottom + (top - bottom) / 2;
123 if (page_ok(test))
124 bottom = test;
125 else
126 top = test;
127 } while (top - bottom > 1);
128
129out:
130 /* Restore the old SIGSEGV handling */
131 if (sigaction(SIGSEGV, &old, NULL)) {
132 perror("os_get_top_address");
133 exit(1);
134 }
135 top <<= UM_KERN_PAGE_SHIFT;
136 printf("0x%x\n", top);
137
138 return top;
139}
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c
deleted file mode 100644
index 32ed41ec1a3..00000000000
--- a/arch/um/os-Linux/sys-i386/tls.c
+++ /dev/null
@@ -1,36 +0,0 @@
1#include <errno.h>
2#include <linux/unistd.h>
3
4#include <sys/syscall.h>
5#include <unistd.h>
6
7#include "sysdep/tls.h"
8#include "user.h"
9
10/* Checks whether host supports TLS, and sets *tls_min according to the value
11 * valid on the host.
12 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */
13void check_host_supports_tls(int *supports_tls, int *tls_min) {
14 /* Values for x86 and x86_64.*/
15 int val[] = {GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64};
16 int i;
17
18 for (i = 0; i < ARRAY_SIZE(val); i++) {
19 user_desc_t info;
20 info.entry_number = val[i];
21
22 if (syscall(__NR_get_thread_area, &info) == 0) {
23 *tls_min = val[i];
24 *supports_tls = 1;
25 return;
26 } else {
27 if (errno == EINVAL)
28 continue;
29 else if (errno == ENOSYS)
30 *supports_tls = 0;
31 return;
32 }
33 }
34
35 *supports_tls = 0;
36}
diff --git a/arch/um/os-Linux/sys-x86_64/Makefile b/arch/um/os-Linux/sys-x86_64/Makefile
deleted file mode 100644
index a44a47f8f57..00000000000
--- a/arch/um/os-Linux/sys-x86_64/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL
4#
5
6obj-y = registers.o prctl.o signal.o task_size.o
7
8USER_OBJS := $(obj-y)
9
10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/os-Linux/sys-x86_64/prctl.c b/arch/um/os-Linux/sys-x86_64/prctl.c
deleted file mode 100644
index 9d34eddb517..00000000000
--- a/arch/um/os-Linux/sys-x86_64/prctl.c
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit.com,linux.intel.com})
3 * Licensed under the GPL
4 */
5
6#include <sys/ptrace.h>
7#include <linux/ptrace.h>
8
9int os_arch_prctl(int pid, int code, unsigned long *addr)
10{
11 return ptrace(PTRACE_ARCH_PRCTL, pid, (unsigned long) addr, code);
12}
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
deleted file mode 100644
index 594d97ad02b..00000000000
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <errno.h>
7#include <sys/ptrace.h>
8#define __FRAME_OFFSETS
9#include <asm/ptrace.h>
10#include "kern_constants.h"
11#include "longjmp.h"
12#include "user.h"
13
14int save_fp_registers(int pid, unsigned long *fp_regs)
15{
16 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
17 return -errno;
18 return 0;
19}
20
21int restore_fp_registers(int pid, unsigned long *fp_regs)
22{
23 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
24 return -errno;
25 return 0;
26}
27
28unsigned long get_thread_reg(int reg, jmp_buf *buf)
29{
30 switch (reg) {
31 case RIP:
32 return buf[0]->__rip;
33 case RSP:
34 return buf[0]->__rsp;
35 case RBP:
36 return buf[0]->__rbp;
37 default:
38 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
39 reg);
40 return 0;
41 }
42}
43
44int get_fp_registers(int pid, unsigned long *regs)
45{
46 return save_fp_registers(pid, regs);
47}
48
49int put_fp_registers(int pid, unsigned long *regs)
50{
51 return restore_fp_registers(pid, regs);
52}
diff --git a/arch/um/os-Linux/sys-x86_64/signal.c b/arch/um/os-Linux/sys-x86_64/signal.c
deleted file mode 100644
index 82a388822cd..00000000000
--- a/arch/um/os-Linux/sys-x86_64/signal.c
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7
8extern void handle_signal(int sig, struct sigcontext *sc);
9
10void hard_handler(int sig)
11{
12 struct ucontext *uc;
13 asm("movq %%rdx, %0" : "=r" (uc));
14
15 handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
16}
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c
deleted file mode 100644
index 26a0dd1f349..00000000000
--- a/arch/um/os-Linux/sys-x86_64/task_size.c
+++ /dev/null
@@ -1,5 +0,0 @@
1unsigned long os_get_top_address(unsigned long shift)
2{
3 /* The old value of CONFIG_TOP_ADDR */
4 return 0x7fc0000000;
5}
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 6e3359d6a83..910499d76a6 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -8,11 +8,9 @@
8#include <signal.h> 8#include <signal.h>
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include "kern_constants.h"
12#include "kern_util.h" 11#include "kern_util.h"
13#include "os.h" 12#include "os.h"
14#include "process.h" 13#include "internal.h"
15#include "user.h"
16 14
17int set_interval(void) 15int set_interval(void)
18{ 16{
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
deleted file mode 100644
index 73277801ef1..00000000000
--- a/arch/um/os-Linux/tls.c
+++ /dev/null
@@ -1,35 +0,0 @@
1#include <errno.h>
2#include <sys/ptrace.h>
3#include "sysdep/tls.h"
4
5/* TLS support - we basically rely on the host's one.*/
6
7#ifndef PTRACE_GET_THREAD_AREA
8#define PTRACE_GET_THREAD_AREA 25
9#endif
10
11#ifndef PTRACE_SET_THREAD_AREA
12#define PTRACE_SET_THREAD_AREA 26
13#endif
14
15int os_set_thread_area(user_desc_t *info, int pid)
16{
17 int ret;
18
19 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number,
20 (unsigned long) info);
21 if (ret < 0)
22 ret = -errno;
23 return ret;
24}
25
26int os_get_thread_area(user_desc_t *info, int pid)
27{
28 int ret;
29
30 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number,
31 (unsigned long) info);
32 if (ret < 0)
33 ret = -errno;
34 return ret;
35}
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c
index b09ff66a77e..dd12b99dcb5 100644
--- a/arch/um/os-Linux/tty.c
+++ b/arch/um/os-Linux/tty.c
@@ -7,10 +7,8 @@
7#include <unistd.h> 7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include <fcntl.h> 9#include <fcntl.h>
10#include "kern_constants.h"
11#include "kern_util.h" 10#include "kern_util.h"
12#include "os.h" 11#include "os.h"
13#include "user.h"
14 12
15struct grantpt_info { 13struct grantpt_info {
16 int fd; 14 int fd;
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
deleted file mode 100644
index 087ed74ffca..00000000000
--- a/arch/um/os-Linux/uaccess.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7#include <stddef.h>
8#include "longjmp.h"
9
10unsigned long __do_user_copy(void *to, const void *from, int n,
11 void **fault_addr, jmp_buf **fault_catcher,
12 void (*op)(void *to, const void *from,
13 int n), int *faulted_out)
14{
15 unsigned long *faddrp = (unsigned long *) fault_addr, ret;
16
17 jmp_buf jbuf;
18 *fault_catcher = &jbuf;
19 if (UML_SETJMP(&jbuf) == 0) {
20 (*op)(to, from, n);
21 ret = 0;
22 *faulted_out = 0;
23 }
24 else {
25 ret = *faddrp;
26 *faulted_out = 1;
27 }
28 *fault_addr = NULL;
29 *fault_catcher = NULL;
30 return ret;
31}
32
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index a27defb8188..4832eb519f8 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -13,9 +13,7 @@
13#include <unistd.h> 13#include <unistd.h>
14#include <sys/stat.h> 14#include <sys/stat.h>
15#include "init.h" 15#include "init.h"
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "user.h"
19 17
20#define UML_DIR "~/.uml/" 18#define UML_DIR "~/.uml/"
21 19
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 5803b188767..9e3b43bb84c 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -13,9 +13,7 @@
13#include <wait.h> 13#include <wait.h>
14#include <sys/mman.h> 14#include <sys/mman.h>
15#include <sys/utsname.h> 15#include <sys/utsname.h>
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "user.h"
19 17
20void stack_protections(unsigned long address) 18void stack_protections(unsigned long address)
21{ 19{