diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/um/os-Linux | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/um/os-Linux')
28 files changed, 226 insertions, 166 deletions
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index 08ff5094fcd..b33f4dfe7ae 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile | |||
@@ -4,14 +4,16 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ | 6 | obj-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 \ | 7 | registers.o sigio.o signal.o start_up.o time.o tty.o uaccess.o \ |
8 | umid.o user_syms.o util.o drivers/ skas/ | 8 | umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ |
9 | 9 | ||
10 | obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o | 10 | obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o |
11 | 11 | ||
12 | USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ | 12 | USER_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 umid.o util.o | 14 | tty.o tls.o uaccess.o umid.o util.o |
15 | |||
16 | CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) | ||
15 | 17 | ||
16 | HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \ | 18 | HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \ |
17 | echo -DHAVE_AIO_ABI ) | 19 | echo -DHAVE_AIO_ABI ) |
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c index 3a6bc2af096..57e3d46c989 100644 --- a/arch/um/os-Linux/aio.c +++ b/arch/um/os-Linux/aio.c | |||
@@ -9,10 +9,12 @@ | |||
9 | #include <errno.h> | 9 | #include <errno.h> |
10 | #include <sys/time.h> | 10 | #include <sys/time.h> |
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_util.h> | 14 | #include "kern_constants.h" |
15 | #include <os.h> | 15 | #include "kern_util.h" |
16 | #include "os.h" | ||
17 | #include "user.h" | ||
16 | 18 | ||
17 | struct aio_thread_req { | 19 | struct aio_thread_req { |
18 | enum aio_type type; | 20 | enum aio_type type; |
diff --git a/arch/um/os-Linux/drivers/etap.h b/arch/um/os-Linux/drivers/etap.h index 54183a679fd..ddffd41c3f3 100644 --- a/arch/um/os-Linux/drivers/etap.h +++ b/arch/um/os-Linux/drivers/etap.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #ifndef __DRIVERS_ETAP_H | 6 | #ifndef __DRIVERS_ETAP_H |
7 | #define __DRIVERS_ETAP_H | 7 | #define __DRIVERS_ETAP_H |
8 | 8 | ||
9 | #include <net_user.h> | 9 | #include "net_user.h" |
10 | 10 | ||
11 | struct ethertap_data { | 11 | struct ethertap_data { |
12 | char *dev_name; | 12 | char *dev_name; |
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c index f424600a583..7f6f9a71aae 100644 --- a/arch/um/os-Linux/drivers/ethertap_kern.c +++ b/arch/um/os-Linux/drivers/ethertap_kern.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
11 | #include "etap.h" | 11 | #include "etap.h" |
12 | #include <net_kern.h> | 12 | #include "net_kern.h" |
13 | 13 | ||
14 | struct ethertap_init { | 14 | struct ethertap_init { |
15 | char *dev_name; | 15 | char *dev_name; |
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c index b39b6696ac5..cc72cb2c1af 100644 --- a/arch/um/os-Linux/drivers/ethertap_user.c +++ b/arch/um/os-Linux/drivers/ethertap_user.c | |||
@@ -13,9 +13,11 @@ | |||
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 <os.h> | 16 | #include "kern_constants.h" |
17 | #include <net_user.h> | 17 | #include "os.h" |
18 | #include <um_malloc.h> | 18 | #include "net_user.h" |
19 | #include "um_malloc.h" | ||
20 | #include "user.h" | ||
19 | 21 | ||
20 | #define MAX_PACKET ETH_MAX_PACKET | 22 | #define MAX_PACKET ETH_MAX_PACKET |
21 | 23 | ||
diff --git a/arch/um/os-Linux/drivers/tuntap.h b/arch/um/os-Linux/drivers/tuntap.h index 7367354ac8d..f17c31586c8 100644 --- a/arch/um/os-Linux/drivers/tuntap.h +++ b/arch/um/os-Linux/drivers/tuntap.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #ifndef __UM_TUNTAP_H | 6 | #ifndef __UM_TUNTAP_H |
7 | #define __UM_TUNTAP_H | 7 | #define __UM_TUNTAP_H |
8 | 8 | ||
9 | #include <net_user.h> | 9 | #include "net_user.h" |
10 | 10 | ||
11 | struct tuntap_data { | 11 | struct tuntap_data { |
12 | char *dev_name; | 12 | char *dev_name; |
diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/drivers/tuntap_kern.c index d9d56e5810f..4048800e469 100644 --- a/arch/um/os-Linux/drivers/tuntap_kern.c +++ b/arch/um/os-Linux/drivers/tuntap_kern.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/skbuff.h> | 8 | #include <linux/skbuff.h> |
9 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
10 | #include <net_kern.h> | 10 | #include "net_kern.h" |
11 | #include "tuntap.h" | 11 | #include "tuntap.h" |
12 | 12 | ||
13 | struct tuntap_init { | 13 | struct tuntap_init { |
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c index 14126d9176a..2448be03fd7 100644 --- a/arch/um/os-Linux/drivers/tuntap_user.c +++ b/arch/um/os-Linux/drivers/tuntap_user.c | |||
@@ -13,9 +13,11 @@ | |||
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_util.h> | 16 | #include "kern_constants.h" |
17 | #include <os.h> | 17 | #include "kern_util.h" |
18 | #include "os.h" | ||
18 | #include "tuntap.h" | 19 | #include "tuntap.h" |
20 | #include "user.h" | ||
19 | 21 | ||
20 | static int tuntap_user_init(void *data, void *dev) | 22 | static int tuntap_user_init(void *data, void *dev) |
21 | { | 23 | { |
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c index 1a365ddc4d0..95332379938 100644 --- a/arch/um/os-Linux/elf_aux.c +++ b/arch/um/os-Linux/elf_aux.c | |||
@@ -9,9 +9,10 @@ | |||
9 | */ | 9 | */ |
10 | #include <elf.h> | 10 | #include <elf.h> |
11 | #include <stddef.h> | 11 | #include <stddef.h> |
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> | ||
15 | 16 | ||
16 | typedef Elf32_auxv_t elf_auxv_t; | 17 | typedef Elf32_auxv_t elf_auxv_t; |
17 | 18 | ||
diff --git a/arch/um/os-Linux/execvp.c b/arch/um/os-Linux/execvp.c index 8fb25ca07c4..66e583a4031 100644 --- a/arch/um/os-Linux/execvp.c +++ b/arch/um/os-Linux/execvp.c | |||
@@ -27,12 +27,12 @@ | |||
27 | #include <limits.h> | 27 | #include <limits.h> |
28 | 28 | ||
29 | #ifndef TEST | 29 | #ifndef TEST |
30 | #include <um_malloc.h> | 30 | #include "um_malloc.h" |
31 | #else | 31 | #else |
32 | #include <stdio.h> | 32 | #include <stdio.h> |
33 | #define um_kmalloc malloc | 33 | #define um_kmalloc malloc |
34 | #endif | 34 | #endif |
35 | #include <os.h> | 35 | #include "os.h" |
36 | 36 | ||
37 | /* Execute FILE, searching in the `PATH' environment variable if it contains | 37 | /* Execute FILE, searching in the `PATH' environment variable if it contains |
38 | no slashes, with arguments ARGV and environment from `environ'. */ | 38 | no slashes, with arguments ARGV and environment from `environ'. */ |
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index c17bd6f7d67..140e587bc0a 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c | |||
@@ -13,7 +13,9 @@ | |||
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 <os.h> | 16 | #include "kern_constants.h" |
17 | #include "os.h" | ||
18 | #include "user.h" | ||
17 | 19 | ||
18 | static void copy_stat(struct uml_stat *dst, const struct stat64 *src) | 20 | static void copy_stat(struct uml_stat *dst, const struct stat64 *src) |
19 | { | 21 | { |
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index e3ee4a51ef6..feff22d6467 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -10,9 +10,11 @@ | |||
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_util.h> | 13 | #include "kern_constants.h" |
14 | #include <os.h> | 14 | #include "kern_util.h" |
15 | #include <um_malloc.h> | 15 | #include "os.h" |
16 | #include "um_malloc.h" | ||
17 | #include "user.h" | ||
16 | 18 | ||
17 | struct helper_data { | 19 | struct helper_data { |
18 | void (*pre_exec)(void*); | 20 | void (*pre_exec)(void*); |
diff --git a/arch/um/os-Linux/internal.h b/arch/um/os-Linux/internal.h deleted file mode 100644 index 0dc2c9f135f..00000000000 --- a/arch/um/os-Linux/internal.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | void alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc); | ||
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c index b9afb74b79a..0348b975e81 100644 --- a/arch/um/os-Linux/irq.c +++ b/arch/um/os-Linux/irq.c | |||
@@ -8,9 +8,12 @@ | |||
8 | #include <poll.h> | 8 | #include <poll.h> |
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 <os.h> | 12 | #include "kern_constants.h" |
13 | #include <um_malloc.h> | 13 | #include "os.h" |
14 | #include "process.h" | ||
15 | #include "um_malloc.h" | ||
16 | #include "user.h" | ||
14 | 17 | ||
15 | /* | 18 | /* |
16 | * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd | 19 | * 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 749c96da7b9..8471b817d94 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -10,11 +10,12 @@ | |||
10 | #include <signal.h> | 10 | #include <signal.h> |
11 | #include <string.h> | 11 | #include <string.h> |
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_util.h> | 15 | #include "kern_constants.h" |
16 | #include <os.h> | 16 | #include "kern_util.h" |
17 | #include <um_malloc.h> | 17 | #include "os.h" |
18 | #include "um_malloc.h" | ||
18 | 19 | ||
19 | #define PGD_BOUND (4 * 1024 * 1024) | 20 | #define PGD_BOUND (4 * 1024 * 1024) |
20 | #define STACKSIZE (8 * 1024 * 1024) | 21 | #define STACKSIZE (8 * 1024 * 1024) |
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index ba4398056fe..62878cf1d33 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c | |||
@@ -13,8 +13,10 @@ | |||
13 | #include <sys/stat.h> | 13 | #include <sys/stat.h> |
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 <os.h> | 17 | #include "kern_constants.h" |
18 | #include "os.h" | ||
19 | #include "user.h" | ||
18 | 20 | ||
19 | /* Modified by which_tmpdir, which is called during early boot */ | 21 | /* Modified by which_tmpdir, which is called during early boot */ |
20 | static char *default_tmpdir = "/tmp"; | 22 | static char *default_tmpdir = "/tmp"; |
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index b8f34c9e53a..0c45dc8efb0 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -12,10 +12,13 @@ | |||
12 | #include <sys/ptrace.h> | 12 | #include <sys/ptrace.h> |
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 <longjmp.h> | 16 | #include "kern_constants.h" |
17 | #include <os.h> | 17 | #include "longjmp.h" |
18 | #include <skas_ptrace.h> | 18 | #include "os.h" |
19 | #include "process.h" | ||
20 | #include "skas_ptrace.h" | ||
21 | #include "user.h" | ||
19 | 22 | ||
20 | #define ARBITRARY_ADDR -1 | 23 | #define ARBITRARY_ADDR -1 |
21 | #define FAILURE_PID -1 | 24 | #define FAILURE_PID -1 |
@@ -234,13 +237,34 @@ out: | |||
234 | 237 | ||
235 | void init_new_thread_signals(void) | 238 | void init_new_thread_signals(void) |
236 | { | 239 | { |
237 | set_handler(SIGSEGV); | 240 | set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK, |
238 | set_handler(SIGTRAP); | 241 | SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1); |
239 | set_handler(SIGFPE); | 242 | set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK, |
240 | set_handler(SIGILL); | 243 | SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1); |
241 | set_handler(SIGBUS); | 244 | set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK, |
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); | ||
242 | signal(SIGHUP, SIG_IGN); | 250 | signal(SIGHUP, SIG_IGN); |
243 | set_handler(SIGIO); | 251 | |
252 | set_handler(SIGIO, (__sighandler_t) sig_handler, | ||
253 | SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, | ||
254 | SIGVTALRM, -1); | ||
244 | signal(SIGWINCH, SIG_IGN); | 255 | signal(SIGWINCH, SIG_IGN); |
245 | signal(SIGTERM, SIG_DFL); | 256 | signal(SIGTERM, SIG_DFL); |
246 | } | 257 | } |
258 | |||
259 | int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr) | ||
260 | { | ||
261 | jmp_buf buf; | ||
262 | int n; | ||
263 | |||
264 | *jmp_ptr = &buf; | ||
265 | n = UML_SETJMP(&buf); | ||
266 | if (n != 0) | ||
267 | return n; | ||
268 | (*fn)(arg); | ||
269 | return 0; | ||
270 | } | ||
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 2ff8d4fe83c..b866b9e3bef 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c | |||
@@ -7,9 +7,9 @@ | |||
7 | #include <errno.h> | 7 | #include <errno.h> |
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <sys/ptrace.h> | 9 | #include <sys/ptrace.h> |
10 | #include <sysdep/ptrace.h> | 10 | #include "sysdep/ptrace.h" |
11 | #include <sysdep/ptrace_user.h> | 11 | #include "sysdep/ptrace_user.h" |
12 | #include <registers.h> | 12 | #include "registers.h" |
13 | 13 | ||
14 | int save_registers(int pid, struct uml_pt_regs *regs) | 14 | int save_registers(int pid, struct uml_pt_regs *regs) |
15 | { | 15 | { |
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 8b61cc0e82c..63d299df152 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
@@ -11,11 +11,14 @@ | |||
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_util.h> | 14 | #include "kern_constants.h" |
15 | #include <init.h> | 15 | #include "kern_util.h" |
16 | #include <os.h> | 16 | #include "init.h" |
17 | #include <sigio.h> | 17 | #include "os.h" |
18 | #include <um_malloc.h> | 18 | #include "process.h" |
19 | #include "sigio.h" | ||
20 | #include "um_malloc.h" | ||
21 | #include "user.h" | ||
19 | 22 | ||
20 | /* | 23 | /* |
21 | * Protected by sigio_lock(), also used by sigio_cleanup, which is an | 24 | * 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 b1469fe9329..6ae180703a6 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -9,13 +9,18 @@ | |||
9 | #include <errno.h> | 9 | #include <errno.h> |
10 | #include <signal.h> | 10 | #include <signal.h> |
11 | #include <strings.h> | 11 | #include <strings.h> |
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 <sysdep/mcontext.h> | 15 | #include "process.h" |
16 | #include "internal.h" | 16 | #include "sysdep/barrier.h" |
17 | 17 | #include "sysdep/sigcontext.h" | |
18 | void (*sig_info[NSIG])(int, siginfo_t *, struct uml_pt_regs *) = { | 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 | |||
23 | void (*sig_info[NSIG])(int, struct uml_pt_regs *) = { | ||
19 | [SIGTRAP] = relay_signal, | 24 | [SIGTRAP] = relay_signal, |
20 | [SIGFPE] = relay_signal, | 25 | [SIGFPE] = relay_signal, |
21 | [SIGILL] = relay_signal, | 26 | [SIGILL] = relay_signal, |
@@ -25,7 +30,7 @@ void (*sig_info[NSIG])(int, siginfo_t *, struct uml_pt_regs *) = { | |||
25 | [SIGIO] = sigio_handler, | 30 | [SIGIO] = sigio_handler, |
26 | [SIGVTALRM] = timer_handler }; | 31 | [SIGVTALRM] = timer_handler }; |
27 | 32 | ||
28 | static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc) | 33 | static void sig_handler_common(int sig, struct sigcontext *sc) |
29 | { | 34 | { |
30 | struct uml_pt_regs r; | 35 | struct uml_pt_regs r; |
31 | int save_errno = errno; | 36 | int save_errno = errno; |
@@ -33,15 +38,15 @@ static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc) | |||
33 | r.is_user = 0; | 38 | r.is_user = 0; |
34 | if (sig == SIGSEGV) { | 39 | if (sig == SIGSEGV) { |
35 | /* For segfaults, we want the data from the sigcontext. */ | 40 | /* For segfaults, we want the data from the sigcontext. */ |
36 | get_regs_from_mc(&r, mc); | 41 | copy_sc(&r, sc); |
37 | GET_FAULTINFO_FROM_MC(r.faultinfo, mc); | 42 | GET_FAULTINFO_FROM_SC(r.faultinfo, sc); |
38 | } | 43 | } |
39 | 44 | ||
40 | /* enable signals if sig isn't IRQ signal */ | 45 | /* enable signals if sig isn't IRQ signal */ |
41 | if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM)) | 46 | if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM)) |
42 | unblock_signals(); | 47 | unblock_signals(); |
43 | 48 | ||
44 | (*sig_info[sig])(sig, si, &r); | 49 | (*sig_info[sig])(sig, &r); |
45 | 50 | ||
46 | errno = save_errno; | 51 | errno = save_errno; |
47 | } | 52 | } |
@@ -61,7 +66,7 @@ static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc) | |||
61 | static int signals_enabled; | 66 | static int signals_enabled; |
62 | static unsigned int signals_pending; | 67 | static unsigned int signals_pending; |
63 | 68 | ||
64 | void sig_handler(int sig, siginfo_t *si, mcontext_t *mc) | 69 | void sig_handler(int sig, struct sigcontext *sc) |
65 | { | 70 | { |
66 | int enabled; | 71 | int enabled; |
67 | 72 | ||
@@ -73,23 +78,23 @@ void sig_handler(int sig, siginfo_t *si, mcontext_t *mc) | |||
73 | 78 | ||
74 | block_signals(); | 79 | block_signals(); |
75 | 80 | ||
76 | sig_handler_common(sig, si, mc); | 81 | sig_handler_common(sig, sc); |
77 | 82 | ||
78 | set_signals(enabled); | 83 | set_signals(enabled); |
79 | } | 84 | } |
80 | 85 | ||
81 | static void real_alarm_handler(mcontext_t *mc) | 86 | static void real_alarm_handler(struct sigcontext *sc) |
82 | { | 87 | { |
83 | struct uml_pt_regs regs; | 88 | struct uml_pt_regs regs; |
84 | 89 | ||
85 | if (mc != NULL) | 90 | if (sc != NULL) |
86 | get_regs_from_mc(®s, mc); | 91 | copy_sc(®s, sc); |
87 | regs.is_user = 0; | 92 | regs.is_user = 0; |
88 | unblock_signals(); | 93 | unblock_signals(); |
89 | timer_handler(SIGVTALRM, NULL, ®s); | 94 | timer_handler(SIGVTALRM, ®s); |
90 | } | 95 | } |
91 | 96 | ||
92 | void alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc) | 97 | void alarm_handler(int sig, struct sigcontext *sc) |
93 | { | 98 | { |
94 | int enabled; | 99 | int enabled; |
95 | 100 | ||
@@ -101,13 +106,14 @@ void alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc) | |||
101 | 106 | ||
102 | block_signals(); | 107 | block_signals(); |
103 | 108 | ||
104 | real_alarm_handler(mc); | 109 | real_alarm_handler(sc); |
105 | set_signals(enabled); | 110 | set_signals(enabled); |
106 | } | 111 | } |
107 | 112 | ||
108 | void timer_init(void) | 113 | void timer_init(void) |
109 | { | 114 | { |
110 | set_handler(SIGVTALRM); | 115 | set_handler(SIGVTALRM, (__sighandler_t) alarm_handler, |
116 | SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, -1); | ||
111 | } | 117 | } |
112 | 118 | ||
113 | void set_sigstack(void *sig_stack, int size) | 119 | void set_sigstack(void *sig_stack, int size) |
@@ -120,23 +126,10 @@ void set_sigstack(void *sig_stack, int size) | |||
120 | panic("enabling signal stack failed, errno = %d\n", errno); | 126 | panic("enabling signal stack failed, errno = %d\n", errno); |
121 | } | 127 | } |
122 | 128 | ||
123 | static void (*handlers[_NSIG])(int sig, siginfo_t *si, mcontext_t *mc) = { | 129 | static void (*handlers[_NSIG])(int sig, struct sigcontext *sc); |
124 | [SIGSEGV] = sig_handler, | ||
125 | [SIGBUS] = sig_handler, | ||
126 | [SIGILL] = sig_handler, | ||
127 | [SIGFPE] = sig_handler, | ||
128 | [SIGTRAP] = sig_handler, | ||
129 | |||
130 | [SIGIO] = sig_handler, | ||
131 | [SIGWINCH] = sig_handler, | ||
132 | [SIGVTALRM] = alarm_handler | ||
133 | }; | ||
134 | |||
135 | 130 | ||
136 | static void hard_handler(int sig, siginfo_t *si, void *p) | 131 | void handle_signal(int sig, struct sigcontext *sc) |
137 | { | 132 | { |
138 | struct ucontext *uc = p; | ||
139 | mcontext_t *mc = &uc->uc_mcontext; | ||
140 | unsigned long pending = 1UL << sig; | 133 | unsigned long pending = 1UL << sig; |
141 | 134 | ||
142 | do { | 135 | do { |
@@ -162,7 +155,7 @@ static void hard_handler(int sig, siginfo_t *si, void *p) | |||
162 | while ((sig = ffs(pending)) != 0){ | 155 | while ((sig = ffs(pending)) != 0){ |
163 | sig--; | 156 | sig--; |
164 | pending &= ~(1 << sig); | 157 | pending &= ~(1 << sig); |
165 | (*handlers[sig])(sig, si, mc); | 158 | (*handlers[sig])(sig, sc); |
166 | } | 159 | } |
167 | 160 | ||
168 | /* | 161 | /* |
@@ -176,26 +169,28 @@ static void hard_handler(int sig, siginfo_t *si, void *p) | |||
176 | } while (pending); | 169 | } while (pending); |
177 | } | 170 | } |
178 | 171 | ||
179 | void set_handler(int sig) | 172 | extern void hard_handler(int sig); |
173 | |||
174 | void set_handler(int sig, void (*handler)(int), int flags, ...) | ||
180 | { | 175 | { |
181 | struct sigaction action; | 176 | struct sigaction action; |
182 | int flags = SA_SIGINFO | SA_ONSTACK; | 177 | va_list ap; |
183 | sigset_t sig_mask; | 178 | sigset_t sig_mask; |
179 | int mask; | ||
184 | 180 | ||
185 | action.sa_sigaction = hard_handler; | 181 | handlers[sig] = (void (*)(int, struct sigcontext *)) handler; |
182 | action.sa_handler = hard_handler; | ||
186 | 183 | ||
187 | /* block irq ones */ | ||
188 | sigemptyset(&action.sa_mask); | 184 | sigemptyset(&action.sa_mask); |
189 | sigaddset(&action.sa_mask, SIGVTALRM); | 185 | |
190 | sigaddset(&action.sa_mask, SIGIO); | 186 | va_start(ap, flags); |
191 | sigaddset(&action.sa_mask, SIGWINCH); | 187 | while ((mask = va_arg(ap, int)) != -1) |
188 | sigaddset(&action.sa_mask, mask); | ||
189 | va_end(ap); | ||
192 | 190 | ||
193 | if (sig == SIGSEGV) | 191 | if (sig == SIGSEGV) |
194 | flags |= SA_NODEFER; | 192 | flags |= SA_NODEFER; |
195 | 193 | ||
196 | if (sigismember(&action.sa_mask, sig)) | ||
197 | flags |= SA_RESTART; /* if it's an irq signal */ | ||
198 | |||
199 | action.sa_flags = flags; | 194 | action.sa_flags = flags; |
200 | action.sa_restorer = NULL; | 195 | action.sa_restorer = NULL; |
201 | if (sigaction(sig, &action, NULL) < 0) | 196 | if (sigaction(sig, &action, NULL) < 0) |
@@ -274,12 +269,9 @@ void unblock_signals(void) | |||
274 | * Deal with SIGIO first because the alarm handler might | 269 | * Deal with SIGIO first because the alarm handler might |
275 | * schedule, leaving the pending SIGIO stranded until we come | 270 | * schedule, leaving the pending SIGIO stranded until we come |
276 | * back here. | 271 | * back here. |
277 | * | ||
278 | * SIGIO's handler doesn't use siginfo or mcontext, | ||
279 | * so they can be NULL. | ||
280 | */ | 272 | */ |
281 | if (save_pending & SIGIO_MASK) | 273 | if (save_pending & SIGIO_MASK) |
282 | sig_handler_common(SIGIO, NULL, NULL); | 274 | sig_handler_common(SIGIO, NULL); |
283 | 275 | ||
284 | if (save_pending & SIGVTALRM_MASK) | 276 | if (save_pending & SIGVTALRM_MASK) |
285 | real_alarm_handler(NULL); | 277 | real_alarm_handler(NULL); |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 689b18db798..e771398be5f 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -8,16 +8,18 @@ | |||
8 | #include <errno.h> | 8 | #include <errno.h> |
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 <as-layout.h> | 12 | #include "kern_constants.h" |
13 | #include <mm_id.h> | 13 | #include "as-layout.h" |
14 | #include <os.h> | 14 | #include "mm_id.h" |
15 | #include <proc_mm.h> | 15 | #include "os.h" |
16 | #include <ptrace_user.h> | 16 | #include "proc_mm.h" |
17 | #include <registers.h> | 17 | #include "ptrace_user.h" |
18 | #include <skas.h> | 18 | #include "registers.h" |
19 | #include <sysdep/ptrace.h> | 19 | #include "skas.h" |
20 | #include <sysdep/stub.h> | 20 | #include "user.h" |
21 | #include "sysdep/ptrace.h" | ||
22 | #include "sysdep/stub.h" | ||
21 | 23 | ||
22 | extern unsigned long batch_syscall_stub, __syscall_stub_start; | 24 | extern unsigned long batch_syscall_stub, __syscall_stub_start; |
23 | 25 | ||
@@ -48,6 +50,10 @@ __initcall(init_syscall_regs); | |||
48 | 50 | ||
49 | extern int proc_mm; | 51 | extern int proc_mm; |
50 | 52 | ||
53 | int single_count = 0; | ||
54 | int multi_count = 0; | ||
55 | int multi_op_count = 0; | ||
56 | |||
51 | static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) | 57 | static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) |
52 | { | 58 | { |
53 | int n, i; | 59 | int n, i; |
@@ -60,6 +66,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) | |||
60 | /* FIXME: Need to look up userspace_pid by cpu */ | 66 | /* FIXME: Need to look up userspace_pid by cpu */ |
61 | pid = userspace_pid[0]; | 67 | pid = userspace_pid[0]; |
62 | 68 | ||
69 | multi_count++; | ||
70 | |||
63 | n = ptrace_setregs(pid, syscall_regs); | 71 | n = ptrace_setregs(pid, syscall_regs); |
64 | if (n < 0) { | 72 | if (n < 0) { |
65 | printk(UM_KERN_ERR "Registers - \n"); | 73 | printk(UM_KERN_ERR "Registers - \n"); |
@@ -120,6 +128,9 @@ long run_syscall_stub(struct mm_id * mm_idp, int syscall, | |||
120 | { | 128 | { |
121 | unsigned long *stack = check_init_stack(mm_idp, *addr); | 129 | unsigned long *stack = check_init_stack(mm_idp, *addr); |
122 | 130 | ||
131 | if (done && *addr == NULL) | ||
132 | single_count++; | ||
133 | |||
123 | *stack += sizeof(long); | 134 | *stack += sizeof(long); |
124 | stack += *stack / sizeof(long); | 135 | stack += *stack / sizeof(long); |
125 | 136 | ||
@@ -132,6 +143,7 @@ long run_syscall_stub(struct mm_id * mm_idp, int syscall, | |||
132 | *stack++ = args[5]; | 143 | *stack++ = args[5]; |
133 | *stack++ = expected; | 144 | *stack++ = expected; |
134 | *stack = 0; | 145 | *stack = 0; |
146 | multi_op_count++; | ||
135 | 147 | ||
136 | if (!done && ((((unsigned long) stack) & ~UM_KERN_PAGE_MASK) < | 148 | if (!done && ((((unsigned long) stack) & ~UM_KERN_PAGE_MASK) < |
137 | UM_KERN_PAGE_SIZE - 10 * sizeof(long))) { | 149 | UM_KERN_PAGE_SIZE - 10 * sizeof(long))) { |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 4625949bf1e..dee0e8cf8ad 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -9,23 +9,31 @@ | |||
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> | ||
12 | #include <sys/wait.h> | 13 | #include <sys/wait.h> |
13 | #include <asm/unistd.h> | 14 | #include <asm/unistd.h> |
14 | #include <as-layout.h> | 15 | #include "as-layout.h" |
15 | #include <init.h> | 16 | #include "chan_user.h" |
16 | #include <kern_util.h> | 17 | #include "kern_constants.h" |
17 | #include <mem.h> | 18 | #include "kern_util.h" |
18 | #include <os.h> | 19 | #include "mem.h" |
19 | #include <proc_mm.h> | 20 | #include "os.h" |
20 | #include <ptrace_user.h> | 21 | #include "process.h" |
21 | #include <registers.h> | 22 | #include "proc_mm.h" |
22 | #include <skas.h> | 23 | #include "ptrace_user.h" |
23 | #include <skas_ptrace.h> | 24 | #include "registers.h" |
24 | #include <sysdep/stub.h> | 25 | #include "skas.h" |
26 | #include "skas_ptrace.h" | ||
27 | #include "user.h" | ||
28 | #include "sysdep/stub.h" | ||
25 | 29 | ||
26 | int is_skas_winch(int pid, int fd, void *data) | 30 | int is_skas_winch(int pid, int fd, void *data) |
27 | { | 31 | { |
28 | return pid == getpgrp(); | 32 | if (pid != getpgrp()) |
33 | return 0; | ||
34 | |||
35 | register_winch_irq(-1, fd, -1, data, 0); | ||
36 | return 1; | ||
29 | } | 37 | } |
30 | 38 | ||
31 | static int ptrace_dump_regs(int pid) | 39 | static int ptrace_dump_regs(int pid) |
@@ -161,7 +169,7 @@ static void handle_trap(int pid, struct uml_pt_regs *regs, | |||
161 | 169 | ||
162 | if (!local_using_sysemu) | 170 | if (!local_using_sysemu) |
163 | { | 171 | { |
164 | err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, | 172 | err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, |
165 | __NR_getpid); | 173 | __NR_getpid); |
166 | if (err < 0) { | 174 | if (err < 0) { |
167 | printk(UM_KERN_ERR "handle_trap - nullifying syscall " | 175 | printk(UM_KERN_ERR "handle_trap - nullifying syscall " |
@@ -249,8 +257,8 @@ static int userspace_tramp(void *stack) | |||
249 | 257 | ||
250 | set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE); | 258 | set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE); |
251 | sigemptyset(&sa.sa_mask); | 259 | sigemptyset(&sa.sa_mask); |
252 | sa.sa_flags = SA_ONSTACK | SA_NODEFER | SA_SIGINFO; | 260 | sa.sa_flags = SA_ONSTACK | SA_NODEFER; |
253 | sa.sa_sigaction = (void *) v; | 261 | sa.sa_handler = (void *) v; |
254 | sa.sa_restorer = NULL; | 262 | sa.sa_restorer = NULL; |
255 | if (sigaction(SIGSEGV, &sa, NULL) < 0) { | 263 | if (sigaction(SIGSEGV, &sa, NULL) < 0) { |
256 | printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV " | 264 | printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV " |
@@ -346,10 +354,6 @@ void userspace(struct uml_pt_regs *regs) | |||
346 | int err, status, op, pid = userspace_pid[0]; | 354 | int err, status, op, pid = userspace_pid[0]; |
347 | /* To prevent races if using_sysemu changes under us.*/ | 355 | /* To prevent races if using_sysemu changes under us.*/ |
348 | int local_using_sysemu; | 356 | int local_using_sysemu; |
349 | siginfo_t si; | ||
350 | |||
351 | /* Handle any immediate reschedules or signals */ | ||
352 | interrupt_end(); | ||
353 | 357 | ||
354 | if (getitimer(ITIMER_VIRTUAL, &timer)) | 358 | if (getitimer(ITIMER_VIRTUAL, &timer)) |
355 | printk(UM_KERN_ERR "Failed to get itimer, errno = %d\n", errno); | 359 | printk(UM_KERN_ERR "Failed to get itimer, errno = %d\n", errno); |
@@ -408,17 +412,13 @@ void userspace(struct uml_pt_regs *regs) | |||
408 | 412 | ||
409 | if (WIFSTOPPED(status)) { | 413 | if (WIFSTOPPED(status)) { |
410 | int sig = WSTOPSIG(status); | 414 | int sig = WSTOPSIG(status); |
411 | |||
412 | ptrace(PTRACE_GETSIGINFO, pid, 0, &si); | ||
413 | |||
414 | switch (sig) { | 415 | switch (sig) { |
415 | case SIGSEGV: | 416 | case SIGSEGV: |
416 | if (PTRACE_FULL_FAULTINFO || | 417 | if (PTRACE_FULL_FAULTINFO || |
417 | !ptrace_faultinfo) { | 418 | !ptrace_faultinfo) { |
418 | get_skas_faultinfo(pid, | 419 | get_skas_faultinfo(pid, |
419 | ®s->faultinfo); | 420 | ®s->faultinfo); |
420 | (*sig_info[SIGSEGV])(SIGSEGV, &si, | 421 | (*sig_info[SIGSEGV])(SIGSEGV, regs); |
421 | regs); | ||
422 | } | 422 | } |
423 | else handle_segv(pid, regs); | 423 | else handle_segv(pid, regs); |
424 | break; | 424 | break; |
@@ -426,14 +426,14 @@ void userspace(struct uml_pt_regs *regs) | |||
426 | handle_trap(pid, regs, local_using_sysemu); | 426 | handle_trap(pid, regs, local_using_sysemu); |
427 | break; | 427 | break; |
428 | case SIGTRAP: | 428 | case SIGTRAP: |
429 | relay_signal(SIGTRAP, &si, regs); | 429 | relay_signal(SIGTRAP, regs); |
430 | break; | 430 | break; |
431 | case SIGVTALRM: | 431 | case SIGVTALRM: |
432 | now = os_nsecs(); | 432 | now = os_nsecs(); |
433 | if (now < nsecs) | 433 | if (now < nsecs) |
434 | break; | 434 | break; |
435 | block_signals(); | 435 | block_signals(); |
436 | (*sig_info[sig])(sig, &si, regs); | 436 | (*sig_info[sig])(sig, regs); |
437 | unblock_signals(); | 437 | unblock_signals(); |
438 | nsecs = timer.it_value.tv_sec * | 438 | nsecs = timer.it_value.tv_sec * |
439 | UM_NSEC_PER_SEC + | 439 | UM_NSEC_PER_SEC + |
@@ -447,7 +447,7 @@ void userspace(struct uml_pt_regs *regs) | |||
447 | case SIGFPE: | 447 | case SIGFPE: |
448 | case SIGWINCH: | 448 | case SIGWINCH: |
449 | block_signals(); | 449 | block_signals(); |
450 | (*sig_info[sig])(sig, &si, regs); | 450 | (*sig_info[sig])(sig, regs); |
451 | unblock_signals(); | 451 | unblock_signals(); |
452 | break; | 452 | break; |
453 | default: | 453 | default: |
@@ -661,7 +661,8 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) | |||
661 | { | 661 | { |
662 | int n; | 662 | int n; |
663 | 663 | ||
664 | set_handler(SIGWINCH); | 664 | set_handler(SIGWINCH, (__sighandler_t) sig_handler, |
665 | SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGVTALRM, -1); | ||
665 | 666 | ||
666 | /* | 667 | /* |
667 | * Can't use UML_SETJMP or UML_LONGJMP here because they save | 668 | * 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 da4b9e9999f..02ee9adff54 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -13,16 +13,18 @@ | |||
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> | ||
16 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
17 | #include <sys/wait.h> | 18 | #include <sys/wait.h> |
18 | #include <asm/unistd.h> | 19 | #include <asm/unistd.h> |
19 | #include <init.h> | 20 | #include "init.h" |
20 | #include <os.h> | 21 | #include "kern_constants.h" |
21 | #include <mem_user.h> | 22 | #include "os.h" |
22 | #include <ptrace_user.h> | 23 | #include "mem_user.h" |
23 | #include <registers.h> | 24 | #include "ptrace_user.h" |
24 | #include <skas.h> | 25 | #include "registers.h" |
25 | #include <skas_ptrace.h> | 26 | #include "skas.h" |
27 | #include "skas_ptrace.h" | ||
26 | 28 | ||
27 | static void ptrace_child(void) | 29 | static void ptrace_child(void) |
28 | { | 30 | { |
@@ -223,7 +225,7 @@ static void __init check_sysemu(void) | |||
223 | goto fail; | 225 | goto fail; |
224 | } | 226 | } |
225 | 227 | ||
226 | n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); | 228 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); |
227 | if (n < 0) { | 229 | if (n < 0) { |
228 | non_fatal("check_sysemu : failed to modify system call " | 230 | non_fatal("check_sysemu : failed to modify system call " |
229 | "return"); | 231 | "return"); |
@@ -259,7 +261,7 @@ static void __init check_sysemu(void) | |||
259 | "doesn't singlestep"); | 261 | "doesn't singlestep"); |
260 | goto fail; | 262 | goto fail; |
261 | } | 263 | } |
262 | n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, | 264 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, |
263 | os_getpid()); | 265 | os_getpid()); |
264 | if (n < 0) | 266 | if (n < 0) |
265 | fatal_perror("check_sysemu : failed to modify " | 267 | fatal_perror("check_sysemu : failed to modify " |
@@ -315,10 +317,10 @@ static void __init check_ptrace(void) | |||
315 | fatal("check_ptrace : expected (SIGTRAP|0x80), " | 317 | fatal("check_ptrace : expected (SIGTRAP|0x80), " |
316 | "got status = %d", status); | 318 | "got status = %d", status); |
317 | 319 | ||
318 | syscall = ptrace(PTRACE_PEEKUSER, pid, PT_SYSCALL_NR_OFFSET, | 320 | syscall = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET, |
319 | 0); | 321 | 0); |
320 | if (syscall == __NR_getpid) { | 322 | if (syscall == __NR_getpid) { |
321 | n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, | 323 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, |
322 | __NR_getppid); | 324 | __NR_getppid); |
323 | if (n < 0) | 325 | if (n < 0) |
324 | fatal_perror("check_ptrace : failed to modify " | 326 | fatal_perror("check_ptrace : failed to modify " |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index fac388cb464..6e3359d6a83 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -8,9 +8,11 @@ | |||
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_util.h> | 11 | #include "kern_constants.h" |
12 | #include <os.h> | 12 | #include "kern_util.h" |
13 | #include "internal.h" | 13 | #include "os.h" |
14 | #include "process.h" | ||
15 | #include "user.h" | ||
14 | 16 | ||
15 | int set_interval(void) | 17 | int set_interval(void) |
16 | { | 18 | { |
@@ -87,7 +89,7 @@ static int after_sleep_interval(struct timespec *ts) | |||
87 | 89 | ||
88 | static void deliver_alarm(void) | 90 | static void deliver_alarm(void) |
89 | { | 91 | { |
90 | alarm_handler(SIGVTALRM, NULL, NULL); | 92 | alarm_handler(SIGVTALRM, NULL); |
91 | } | 93 | } |
92 | 94 | ||
93 | static unsigned long long sleep_time(unsigned long long nsecs) | 95 | static unsigned long long sleep_time(unsigned long long nsecs) |
@@ -114,7 +116,7 @@ static void deliver_alarm(void) | |||
114 | skew += this_tick - last_tick; | 116 | skew += this_tick - last_tick; |
115 | 117 | ||
116 | while (skew >= one_tick) { | 118 | while (skew >= one_tick) { |
117 | alarm_handler(SIGVTALRM, NULL, NULL); | 119 | alarm_handler(SIGVTALRM, NULL); |
118 | skew -= one_tick; | 120 | skew -= one_tick; |
119 | } | 121 | } |
120 | 122 | ||
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c index 721d8afa329..b09ff66a77e 100644 --- a/arch/um/os-Linux/tty.c +++ b/arch/um/os-Linux/tty.c | |||
@@ -7,8 +7,10 @@ | |||
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_util.h> | 10 | #include "kern_constants.h" |
11 | #include <os.h> | 11 | #include "kern_util.h" |
12 | #include "os.h" | ||
13 | #include "user.h" | ||
12 | 14 | ||
13 | struct grantpt_info { | 15 | struct grantpt_info { |
14 | int fd; | 16 | int fd; |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index c1dc89261f6..a27defb8188 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -12,8 +12,10 @@ | |||
12 | #include <string.h> | 12 | #include <string.h> |
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 <os.h> | 16 | #include "kern_constants.h" |
17 | #include "os.h" | ||
18 | #include "user.h" | ||
17 | 19 | ||
18 | #define UML_DIR "~/.uml/" | 20 | #define UML_DIR "~/.uml/" |
19 | 21 | ||
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c index db4a034aeee..45ffe46871e 100644 --- a/arch/um/os-Linux/user_syms.c +++ b/arch/um/os-Linux/user_syms.c | |||
@@ -1,5 +1,5 @@ | |||
1 | #include <linux/types.h> | 1 | #include "linux/types.h" |
2 | #include <linux/module.h> | 2 | #include "linux/module.h" |
3 | 3 | ||
4 | /* Some of this are builtin function (some are not but could in the future), | 4 | /* Some of this are builtin function (some are not but could in the future), |
5 | * so I *must* declare good prototypes for them and then EXPORT them. | 5 | * so I *must* declare good prototypes for them and then EXPORT them. |
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(readdir64); | |||
45 | extern void truncate64(void) __attribute__((weak)); | 45 | extern void truncate64(void) __attribute__((weak)); |
46 | EXPORT_SYMBOL(truncate64); | 46 | EXPORT_SYMBOL(truncate64); |
47 | 47 | ||
48 | #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA | 48 | #ifdef SUBARCH_i386 |
49 | EXPORT_SYMBOL(vsyscall_ehdr); | 49 | EXPORT_SYMBOL(vsyscall_ehdr); |
50 | EXPORT_SYMBOL(vsyscall_end); | 50 | EXPORT_SYMBOL(vsyscall_end); |
51 | #endif | 51 | #endif |
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c index 492ef5e6e16..5803b188767 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c | |||
@@ -13,7 +13,9 @@ | |||
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 <os.h> | 16 | #include "kern_constants.h" |
17 | #include "os.h" | ||
18 | #include "user.h" | ||
17 | 19 | ||
18 | void stack_protections(unsigned long address) | 20 | void stack_protections(unsigned long address) |
19 | { | 21 | { |