aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/fd.c1
-rw-r--r--arch/um/include/os.h10
-rw-r--r--arch/um/include/user_util.h18
-rw-r--r--arch/um/kernel/Makefile5
-rw-r--r--arch/um/kernel/skas/uaccess.c2
-rw-r--r--arch/um/kernel/tt/gdb.c1
-rw-r--r--arch/um/kernel/tt/ptproxy/ptrace.c1
-rw-r--r--arch/um/kernel/tt/ptproxy/sysdep.c1
-rw-r--r--arch/um/os-Linux/Makefile4
-rw-r--r--arch/um/os-Linux/tt.c48
-rw-r--r--arch/um/os-Linux/util.c (renamed from arch/um/kernel/user_util.c)68
11 files changed, 72 insertions, 87 deletions
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 3296e86a03a5..c41f75e4acb5 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -11,6 +11,7 @@
11#include "user.h" 11#include "user.h"
12#include "user_util.h" 12#include "user_util.h"
13#include "chan_user.h" 13#include "chan_user.h"
14#include "os.h"
14 15
15struct fd_chan { 16struct fd_chan {
16 int fd; 17 int fd;
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index dd72d66cf0ed..7f27dfe0ecac 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -195,6 +195,8 @@ extern unsigned long long os_usecs(void);
195/* tt.c 195/* tt.c
196 * for tt mode only (will be deleted in future...) 196 * for tt mode only (will be deleted in future...)
197 */ 197 */
198extern void stop(void);
199extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
198extern int protect_memory(unsigned long addr, unsigned long len, 200extern int protect_memory(unsigned long addr, unsigned long len,
199 int r, int w, int x, int must_succeed); 201 int r, int w, int x, int must_succeed);
200extern void forward_pending_sigio(int target); 202extern void forward_pending_sigio(int target);
@@ -235,4 +237,12 @@ extern int set_signals(int enable);
235extern void os_fill_handlinfo(struct kern_handlers h); 237extern void os_fill_handlinfo(struct kern_handlers h);
236extern void do_longjmp(void *p, int val); 238extern void do_longjmp(void *p, int val);
237 239
240/* util.c */
241extern void stack_protections(unsigned long address);
242extern void task_protections(unsigned long address);
243extern int raw(int fd);
244extern void setup_machinename(char *machine_out);
245extern void setup_hostinfo(void);
246extern int setjmp_wrapper(void (*proc)(void *, void *), ...);
247
238#endif 248#endif
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index c1dbd77b073f..a6f1f176cf84 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -44,10 +44,6 @@ extern unsigned long brk_start;
44extern int pty_output_sigio; 44extern int pty_output_sigio;
45extern int pty_close_sigio; 45extern int pty_close_sigio;
46 46
47extern void stop(void);
48extern void stack_protections(unsigned long address);
49extern void task_protections(unsigned long address);
50extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
51extern void *add_signal_handler(int sig, void (*handler)(int)); 47extern void *add_signal_handler(int sig, void (*handler)(int));
52extern int linux_main(int argc, char **argv); 48extern int linux_main(int argc, char **argv);
53extern void set_cmdline(char *cmd); 49extern void set_cmdline(char *cmd);
@@ -55,8 +51,6 @@ extern void input_cb(void (*proc)(void *), void *arg, int arg_len);
55extern int get_pty(void); 51extern int get_pty(void);
56extern void *um_kmalloc(int size); 52extern void *um_kmalloc(int size);
57extern int switcheroo(int fd, int prot, void *from, void *to, int size); 53extern int switcheroo(int fd, int prot, void *from, void *to, int size);
58extern void setup_machinename(char *machine_out);
59extern void setup_hostinfo(void);
60extern void do_exec(int old_pid, int new_pid); 54extern void do_exec(int old_pid, int new_pid);
61extern void tracer_panic(char *msg, ...); 55extern void tracer_panic(char *msg, ...);
62extern int detach(int pid, int sig); 56extern int detach(int pid, int sig);
@@ -70,18 +64,6 @@ extern int cpu_feature(char *what, char *buf, int len);
70extern int arch_handle_signal(int sig, union uml_pt_regs *regs); 64extern int arch_handle_signal(int sig, union uml_pt_regs *regs);
71extern int arch_fixup(unsigned long address, void *sc_ptr); 65extern int arch_fixup(unsigned long address, void *sc_ptr);
72extern void arch_init_thread(void); 66extern void arch_init_thread(void);
73extern int setjmp_wrapper(void (*proc)(void *, void *), ...);
74extern int raw(int fd); 67extern int raw(int fd);
75 68
76#endif 69#endif
77
78/*
79 * Overrides for Emacs so that we follow Linus's tabbing style.
80 * Emacs will notice this stuff at the end of the file and automatically
81 * adjust the settings for this buffer only. This must remain at the end
82 * of the file.
83 * ---------------------------------------------------------------------------
84 * Local variables:
85 * c-file-style: "linux"
86 * End:
87 */
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 193cc2b7448d..165c8639c9f6 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -10,8 +10,7 @@ obj-y = config.o exec_kern.o exitcode.o \
10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \ 10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \
11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ 11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \
12 signal_kern.o smp.o syscall_kern.o sysrq.o time.o \ 12 signal_kern.o smp.o syscall_kern.o sysrq.o time.o \
13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o \ 13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
14 user_util.o
15 14
16obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 15obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
17obj-$(CONFIG_GPROF) += gprof_syms.o 16obj-$(CONFIG_GPROF) += gprof_syms.o
@@ -24,7 +23,7 @@ obj-$(CONFIG_MODE_SKAS) += skas/
24 23
25user-objs-$(CONFIG_TTY_LOG) += tty_log.o 24user-objs-$(CONFIG_TTY_LOG) += tty_log.o
26 25
27USER_OBJS := $(user-objs-y) config.o time.o tty_log.o user_util.o 26USER_OBJS := $(user-objs-y) config.o time.o tty_log.o
28 27
29include arch/um/scripts/Makefile.rules 28include arch/um/scripts/Makefile.rules
30 29
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index a5a47528dec7..5992c3257167 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -13,7 +13,7 @@
13#include "asm/pgtable.h" 13#include "asm/pgtable.h"
14#include "asm/uaccess.h" 14#include "asm/uaccess.h"
15#include "kern_util.h" 15#include "kern_util.h"
16#include "user_util.h" 16#include "os.h"
17 17
18extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 18extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
19 pte_t *pte_out); 19 pte_t *pte_out);
diff --git a/arch/um/kernel/tt/gdb.c b/arch/um/kernel/tt/gdb.c
index 37e22d71a0d9..786e4edd86c5 100644
--- a/arch/um/kernel/tt/gdb.c
+++ b/arch/um/kernel/tt/gdb.c
@@ -20,6 +20,7 @@
20#include "user_util.h" 20#include "user_util.h"
21#include "tt.h" 21#include "tt.h"
22#include "sysdep/thread.h" 22#include "sysdep/thread.h"
23#include "os.h"
23 24
24extern int debugger_pid; 25extern int debugger_pid;
25extern int debugger_fd; 26extern int debugger_fd;
diff --git a/arch/um/kernel/tt/ptproxy/ptrace.c b/arch/um/kernel/tt/ptproxy/ptrace.c
index 528a5fc8d887..03774427d468 100644
--- a/arch/um/kernel/tt/ptproxy/ptrace.c
+++ b/arch/um/kernel/tt/ptproxy/ptrace.c
@@ -20,6 +20,7 @@ Jeff Dike (jdike@karaya.com) : Modified for integration into uml
20#include "kern_util.h" 20#include "kern_util.h"
21#include "ptrace_user.h" 21#include "ptrace_user.h"
22#include "tt.h" 22#include "tt.h"
23#include "os.h"
23 24
24long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, 25long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,
25 long arg3, long arg4, pid_t child, int *ret) 26 long arg3, long arg4, pid_t child, int *ret)
diff --git a/arch/um/kernel/tt/ptproxy/sysdep.c b/arch/um/kernel/tt/ptproxy/sysdep.c
index a5f0e01e214e..99f178319d03 100644
--- a/arch/um/kernel/tt/ptproxy/sysdep.c
+++ b/arch/um/kernel/tt/ptproxy/sysdep.c
@@ -15,6 +15,7 @@ terms and conditions.
15#include "ptrace_user.h" 15#include "ptrace_user.h"
16#include "user_util.h" 16#include "user_util.h"
17#include "user.h" 17#include "user.h"
18#include "os.h"
18 19
19int get_syscall(pid_t pid, long *arg1, long *arg2, long *arg3, long *arg4, 20int get_syscall(pid_t pid, long *arg1, long *arg2, long *arg3, long *arg4,
20 long *arg5) 21 long *arg5)
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 40c7d6b1df68..08a4e628b24c 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -5,12 +5,12 @@
5 5
6obj-y = aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 6obj-y = aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \
7 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \ 7 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \
8 drivers/ sys-$(SUBARCH)/ 8 util.o drivers/ sys-$(SUBARCH)/
9 9
10obj-$(CONFIG_MODE_SKAS) += skas/ 10obj-$(CONFIG_MODE_SKAS) += skas/
11 11
12USER_OBJS := aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 12USER_OBJS := aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \
13 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o 13 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o util.o
14 14
15elf_aux.o: $(ARCH_DIR)/kernel-offsets.h 15elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
16CFLAGS_elf_aux.o += -I$(objtree)/arch/um 16CFLAGS_elf_aux.o += -I$(objtree)/arch/um
diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c
index cb2648b79d0f..404bb63a74a9 100644
--- a/arch/um/os-Linux/tt.c
+++ b/arch/um/os-Linux/tt.c
@@ -63,6 +63,54 @@ void kill_child_dead(int pid)
63 } while(1); 63 } while(1);
64} 64}
65 65
66void stop(void)
67{
68 while(1) sleep(1000000);
69}
70
71int wait_for_stop(int pid, int sig, int cont_type, void *relay)
72{
73 sigset_t *relay_signals = relay;
74 int status, ret;
75
76 while(1){
77 CATCH_EINTR(ret = waitpid(pid, &status, WUNTRACED));
78 if((ret < 0) ||
79 !WIFSTOPPED(status) || (WSTOPSIG(status) != sig)){
80 if(ret < 0){
81 printk("wait failed, errno = %d\n",
82 errno);
83 }
84 else if(WIFEXITED(status))
85 printk("process %d exited with status %d\n",
86 pid, WEXITSTATUS(status));
87 else if(WIFSIGNALED(status))
88 printk("process %d exited with signal %d\n",
89 pid, WTERMSIG(status));
90 else if((WSTOPSIG(status) == SIGVTALRM) ||
91 (WSTOPSIG(status) == SIGALRM) ||
92 (WSTOPSIG(status) == SIGIO) ||
93 (WSTOPSIG(status) == SIGPROF) ||
94 (WSTOPSIG(status) == SIGCHLD) ||
95 (WSTOPSIG(status) == SIGWINCH) ||
96 (WSTOPSIG(status) == SIGINT)){
97 ptrace(cont_type, pid, 0, WSTOPSIG(status));
98 continue;
99 }
100 else if((relay_signals != NULL) &&
101 sigismember(relay_signals, WSTOPSIG(status))){
102 ptrace(cont_type, pid, 0, WSTOPSIG(status));
103 continue;
104 }
105 else printk("process %d stopped with signal %d\n",
106 pid, WSTOPSIG(status));
107 panic("wait_for_stop failed to wait for %d to stop "
108 "with %d\n", pid, sig);
109 }
110 return(status);
111 }
112}
113
66/* 114/*
67 *------------------------- 115 *-------------------------
68 * only for tt mode (will be deleted in future...) 116 * only for tt mode (will be deleted in future...)
diff --git a/arch/um/kernel/user_util.c b/arch/um/os-Linux/util.c
index 4c231161f257..d224434d5610 100644
--- a/arch/um/kernel/user_util.c
+++ b/arch/um/os-Linux/util.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -29,17 +29,13 @@
29#include "init.h" 29#include "init.h"
30#include "ptrace_user.h" 30#include "ptrace_user.h"
31#include "uml-config.h" 31#include "uml-config.h"
32 32#include "os.h"
33void stop(void)
34{
35 while(1) sleep(1000000);
36}
37 33
38void stack_protections(unsigned long address) 34void stack_protections(unsigned long address)
39{ 35{
40 int prot = PROT_READ | PROT_WRITE | PROT_EXEC; 36 int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
41 37
42 if(mprotect((void *) address, page_size(), prot) < 0) 38 if(mprotect((void *) address, page_size(), prot) < 0)
43 panic("protecting stack failed, errno = %d", errno); 39 panic("protecting stack failed, errno = %d", errno);
44} 40}
45 41
@@ -59,49 +55,6 @@ void task_protections(unsigned long address)
59 panic("protecting stack failed, errno = %d", errno); 55 panic("protecting stack failed, errno = %d", errno);
60} 56}
61 57
62int wait_for_stop(int pid, int sig, int cont_type, void *relay)
63{
64 sigset_t *relay_signals = relay;
65 int status, ret;
66
67 while(1){
68 CATCH_EINTR(ret = waitpid(pid, &status, WUNTRACED));
69 if((ret < 0) ||
70 !WIFSTOPPED(status) || (WSTOPSIG(status) != sig)){
71 if(ret < 0){
72 printk("wait failed, errno = %d\n",
73 errno);
74 }
75 else if(WIFEXITED(status))
76 printk("process %d exited with status %d\n",
77 pid, WEXITSTATUS(status));
78 else if(WIFSIGNALED(status))
79 printk("process %d exited with signal %d\n",
80 pid, WTERMSIG(status));
81 else if((WSTOPSIG(status) == SIGVTALRM) ||
82 (WSTOPSIG(status) == SIGALRM) ||
83 (WSTOPSIG(status) == SIGIO) ||
84 (WSTOPSIG(status) == SIGPROF) ||
85 (WSTOPSIG(status) == SIGCHLD) ||
86 (WSTOPSIG(status) == SIGWINCH) ||
87 (WSTOPSIG(status) == SIGINT)){
88 ptrace(cont_type, pid, 0, WSTOPSIG(status));
89 continue;
90 }
91 else if((relay_signals != NULL) &&
92 sigismember(relay_signals, WSTOPSIG(status))){
93 ptrace(cont_type, pid, 0, WSTOPSIG(status));
94 continue;
95 }
96 else printk("process %d stopped with signal %d\n",
97 pid, WSTOPSIG(status));
98 panic("wait_for_stop failed to wait for %d to stop "
99 "with %d\n", pid, sig);
100 }
101 return(status);
102 }
103}
104
105int raw(int fd) 58int raw(int fd)
106{ 59{
107 struct termios tt; 60 struct termios tt;
@@ -113,7 +66,7 @@ int raw(int fd)
113 66
114 cfmakeraw(&tt); 67 cfmakeraw(&tt);
115 68
116 CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt)); 69 CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt));
117 if(err < 0) 70 if(err < 0)
118 return -errno; 71 return -errno;
119 72
@@ -149,7 +102,7 @@ void setup_hostinfo(void)
149 102
150int setjmp_wrapper(void (*proc)(void *, void *), ...) 103int setjmp_wrapper(void (*proc)(void *, void *), ...)
151{ 104{
152 va_list args; 105 va_list args;
153 sigjmp_buf buf; 106 sigjmp_buf buf;
154 int n; 107 int n;
155 108
@@ -161,14 +114,3 @@ int setjmp_wrapper(void (*proc)(void *, void *), ...)
161 va_end(args); 114 va_end(args);
162 return(n); 115 return(n);
163} 116}
164
165/*
166 * Overrides for Emacs so that we follow Linus's tabbing style.
167 * Emacs will notice this stuff at the end of the file and automatically
168 * adjust the settings for this buffer only. This must remain at the end
169 * of the file.
170 * ---------------------------------------------------------------------------
171 * Local variables:
172 * c-file-style: "linux"
173 * End:
174 */