diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:26:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:05 -0400 |
commit | 77bf4400319db9d2a8af6b00c2be6faa0f3d07cb (patch) | |
tree | ddc8fd48349b8d4dd2c0b26bce7f52f79b4e4077 /arch/um/os-Linux | |
parent | ae2587e41254e48e670346aefa332d7469d86352 (diff) |
uml: remove code made redundant by CHOOSE_MODE removal
This patch makes a number of simplifications enabled by the removal of
CHOOSE_MODE. There were lots of functions that looked like
int foo(args){
foo_skas(args);
}
The bodies of foo_skas are now folded into foo, and their declarations (and
sometimes entire header files) are deleted.
In addition, the union uml_pt_regs, which was a union between the tt and skas
register formats, is now a struct, with the tt-mode arm of the union being
removed.
It turns out that usr2_handler was unused, so it is gone.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r-- | arch/um/os-Linux/aio.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/main.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/process.c | 3 | ||||
-rw-r--r-- | arch/um/os-Linux/registers.c | 12 | ||||
-rw-r--r-- | arch/um/os-Linux/signal.c | 5 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/mem.c | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 24 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/trap.c | 14 | ||||
-rw-r--r-- | arch/um/os-Linux/start_up.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/trap.c | 8 | ||||
-rw-r--r-- | arch/um/os-Linux/umid.c | 1 |
11 files changed, 28 insertions, 46 deletions
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c index c8f5b7a2c1c6..11c2b01a92bd 100644 --- a/arch/um/os-Linux/aio.c +++ b/arch/um/os-Linux/aio.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include "aio.h" | 13 | #include "aio.h" |
14 | #include "init.h" | 14 | #include "init.h" |
15 | #include "user.h" | 15 | #include "user.h" |
16 | #include "mode.h" | ||
17 | #include "kern_constants.h" | 16 | #include "kern_constants.h" |
18 | 17 | ||
19 | struct aio_thread_req { | 18 | struct aio_thread_req { |
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index bfabb883daae..aeeecc634733 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "irq_user.h" | 18 | #include "irq_user.h" |
19 | #include "user.h" | 19 | #include "user.h" |
20 | #include "init.h" | 20 | #include "init.h" |
21 | #include "mode.h" | ||
22 | #include "uml-config.h" | 21 | #include "uml-config.h" |
23 | #include "os.h" | 22 | #include "os.h" |
24 | #include "um_malloc.h" | 23 | #include "um_malloc.h" |
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index d5fef4ce0112..a955e9bcd04d 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -244,9 +244,6 @@ void init_new_thread_signals(void) | |||
244 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); | 244 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); |
245 | set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK, | 245 | set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK, |
246 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); | 246 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); |
247 | set_handler(SIGUSR2, (__sighandler_t) sig_handler, | ||
248 | SA_ONSTACK, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, | ||
249 | -1); | ||
250 | signal(SIGHUP, SIG_IGN); | 247 | signal(SIGHUP, SIG_IGN); |
251 | 248 | ||
252 | init_irq_signals(1); | 249 | init_irq_signals(1); |
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 9dc3fad9ea29..ce0b791160e6 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c | |||
@@ -13,26 +13,26 @@ | |||
13 | 13 | ||
14 | static unsigned long exec_regs[MAX_REG_NR]; | 14 | static unsigned long exec_regs[MAX_REG_NR]; |
15 | 15 | ||
16 | void init_thread_registers(union uml_pt_regs *to) | 16 | void init_thread_registers(struct uml_pt_regs *to) |
17 | { | 17 | { |
18 | memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs)); | 18 | memcpy(to->regs, exec_regs, sizeof(to->regs)); |
19 | } | 19 | } |
20 | 20 | ||
21 | void save_registers(int pid, union uml_pt_regs *regs) | 21 | void save_registers(int pid, struct uml_pt_regs *regs) |
22 | { | 22 | { |
23 | int err; | 23 | int err; |
24 | 24 | ||
25 | err = ptrace(PTRACE_GETREGS, pid, 0, regs->skas.regs); | 25 | err = ptrace(PTRACE_GETREGS, pid, 0, regs->regs); |
26 | if(err < 0) | 26 | if(err < 0) |
27 | panic("save_registers - saving registers failed, errno = %d\n", | 27 | panic("save_registers - saving registers failed, errno = %d\n", |
28 | errno); | 28 | errno); |
29 | } | 29 | } |
30 | 30 | ||
31 | void restore_registers(int pid, union uml_pt_regs *regs) | 31 | void restore_registers(int pid, struct uml_pt_regs *regs) |
32 | { | 32 | { |
33 | int err; | 33 | int err; |
34 | 34 | ||
35 | err = ptrace(PTRACE_SETREGS, pid, 0, regs->skas.regs); | 35 | err = ptrace(PTRACE_SETREGS, pid, 0, regs->regs); |
36 | if(err < 0) | 36 | if(err < 0) |
37 | panic("restore_registers - saving registers failed, " | 37 | panic("restore_registers - saving registers failed, " |
38 | "errno = %d\n", errno); | 38 | "errno = %d\n", errno); |
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 0d6122adb8a7..583424b9797d 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "sysdep/sigcontext.h" | 16 | #include "sysdep/sigcontext.h" |
17 | #include "sysdep/barrier.h" | 17 | #include "sysdep/barrier.h" |
18 | #include "sigcontext.h" | 18 | #include "sigcontext.h" |
19 | #include "mode.h" | ||
20 | #include "os.h" | 19 | #include "os.h" |
21 | 20 | ||
22 | /* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled | 21 | /* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled |
@@ -60,14 +59,14 @@ void sig_handler(int sig, struct sigcontext *sc) | |||
60 | 59 | ||
61 | static void real_alarm_handler(int sig, struct sigcontext *sc) | 60 | static void real_alarm_handler(int sig, struct sigcontext *sc) |
62 | { | 61 | { |
63 | union uml_pt_regs regs; | 62 | struct uml_pt_regs regs; |
64 | 63 | ||
65 | if(sig == SIGALRM) | 64 | if(sig == SIGALRM) |
66 | switch_timers(0); | 65 | switch_timers(0); |
67 | 66 | ||
68 | if(sc != NULL) | 67 | if(sc != NULL) |
69 | copy_sc(®s, sc); | 68 | copy_sc(®s, sc); |
70 | regs.skas.is_user = 0; | 69 | regs.is_user = 0; |
71 | unblock_signals(); | 70 | unblock_signals(); |
72 | timer_handler(sig, ®s); | 71 | timer_handler(sig, ®s); |
73 | 72 | ||
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 383052baa166..ae7685710c46 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -294,7 +294,3 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len, | |||
294 | 294 | ||
295 | return ret; | 295 | return ret; |
296 | } | 296 | } |
297 | |||
298 | void before_mem_skas(unsigned long unused) | ||
299 | { | ||
300 | } | ||
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index db020d21f132..eb027673f357 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -131,19 +131,19 @@ void get_skas_faultinfo(int pid, struct faultinfo * fi) | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | static void handle_segv(int pid, union uml_pt_regs * regs) | 134 | static void handle_segv(int pid, struct uml_pt_regs * regs) |
135 | { | 135 | { |
136 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | 136 | get_skas_faultinfo(pid, ®s->faultinfo); |
137 | segv(regs->skas.faultinfo, 0, 1, NULL); | 137 | segv(regs->faultinfo, 0, 1, NULL); |
138 | } | 138 | } |
139 | 139 | ||
140 | /*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ | 140 | /*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ |
141 | static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu) | 141 | static void handle_trap(int pid, struct uml_pt_regs *regs, int local_using_sysemu) |
142 | { | 142 | { |
143 | int err, status; | 143 | int err, status; |
144 | 144 | ||
145 | /* Mark this as a syscall */ | 145 | /* Mark this as a syscall */ |
146 | UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs); | 146 | UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->regs); |
147 | 147 | ||
148 | if (!local_using_sysemu) | 148 | if (!local_using_sysemu) |
149 | { | 149 | { |
@@ -286,7 +286,7 @@ int start_userspace(unsigned long stub_stack) | |||
286 | return(pid); | 286 | return(pid); |
287 | } | 287 | } |
288 | 288 | ||
289 | void userspace(union uml_pt_regs *regs) | 289 | void userspace(struct uml_pt_regs *regs) |
290 | { | 290 | { |
291 | int err, status, op, pid = userspace_pid[0]; | 291 | int err, status, op, pid = userspace_pid[0]; |
292 | /* To prevent races if using_sysemu changes under us.*/ | 292 | /* To prevent races if using_sysemu changes under us.*/ |
@@ -312,7 +312,7 @@ void userspace(union uml_pt_regs *regs) | |||
312 | panic("userspace - waitpid failed, errno = %d\n", | 312 | panic("userspace - waitpid failed, errno = %d\n", |
313 | errno); | 313 | errno); |
314 | 314 | ||
315 | regs->skas.is_user = 1; | 315 | regs->is_user = 1; |
316 | save_registers(pid, regs); | 316 | save_registers(pid, regs); |
317 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ | 317 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ |
318 | 318 | ||
@@ -321,7 +321,7 @@ void userspace(union uml_pt_regs *regs) | |||
321 | switch(sig){ | 321 | switch(sig){ |
322 | case SIGSEGV: | 322 | case SIGSEGV: |
323 | if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo){ | 323 | if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo){ |
324 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | 324 | get_skas_faultinfo(pid, ®s->faultinfo); |
325 | (*sig_info[SIGSEGV])(SIGSEGV, regs); | 325 | (*sig_info[SIGSEGV])(SIGSEGV, regs); |
326 | } | 326 | } |
327 | else handle_segv(pid, regs); | 327 | else handle_segv(pid, regs); |
@@ -351,7 +351,7 @@ void userspace(union uml_pt_regs *regs) | |||
351 | 351 | ||
352 | /* Avoid -ERESTARTSYS handling in host */ | 352 | /* Avoid -ERESTARTSYS handling in host */ |
353 | if(PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET) | 353 | if(PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET) |
354 | PT_SYSCALL_NR(regs->skas.regs) = -1; | 354 | PT_SYSCALL_NR(regs->regs) = -1; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | } | 357 | } |
@@ -578,16 +578,16 @@ void reboot_skas(void) | |||
578 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); | 578 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); |
579 | } | 579 | } |
580 | 580 | ||
581 | void switch_mm_skas(struct mm_id *mm_idp) | 581 | void __switch_mm(struct mm_id *mm_idp) |
582 | { | 582 | { |
583 | int err; | 583 | int err; |
584 | 584 | ||
585 | /* FIXME: need cpu pid in switch_mm_skas */ | 585 | /* FIXME: need cpu pid in __switch_mm */ |
586 | if(proc_mm){ | 586 | if(proc_mm){ |
587 | err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, | 587 | err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, |
588 | mm_idp->u.mm_fd); | 588 | mm_idp->u.mm_fd); |
589 | if(err) | 589 | if(err) |
590 | panic("switch_mm_skas - PTRACE_SWITCH_MM failed, " | 590 | panic("__switch_mm - PTRACE_SWITCH_MM failed, " |
591 | "errno = %d\n", errno); | 591 | "errno = %d\n", errno); |
592 | } | 592 | } |
593 | else userspace_pid[0] = mm_idp->u.pid; | 593 | else userspace_pid[0] = mm_idp->u.pid; |
diff --git a/arch/um/os-Linux/skas/trap.c b/arch/um/os-Linux/skas/trap.c index 3b600c2e63b8..d43e470227de 100644 --- a/arch/um/os-Linux/skas/trap.c +++ b/arch/um/os-Linux/skas/trap.c | |||
@@ -15,13 +15,13 @@ | |||
15 | #include "sysdep/ptrace_user.h" | 15 | #include "sysdep/ptrace_user.h" |
16 | #include "os.h" | 16 | #include "os.h" |
17 | 17 | ||
18 | static union uml_pt_regs ksig_regs[UM_NR_CPUS]; | 18 | static struct uml_pt_regs ksig_regs[UM_NR_CPUS]; |
19 | 19 | ||
20 | void sig_handler_common_skas(int sig, void *sc_ptr) | 20 | void sig_handler_common_skas(int sig, void *sc_ptr) |
21 | { | 21 | { |
22 | struct sigcontext *sc = sc_ptr; | 22 | struct sigcontext *sc = sc_ptr; |
23 | union uml_pt_regs *r; | 23 | struct uml_pt_regs *r; |
24 | void (*handler)(int, union uml_pt_regs *); | 24 | void (*handler)(int, struct uml_pt_regs *); |
25 | int save_user, save_errno = errno; | 25 | int save_user, save_errno = errno; |
26 | 26 | ||
27 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV | 27 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV |
@@ -42,12 +42,12 @@ void sig_handler_common_skas(int sig, void *sc_ptr) | |||
42 | } | 42 | } |
43 | else r = TASK_REGS(get_current()); | 43 | else r = TASK_REGS(get_current()); |
44 | 44 | ||
45 | save_user = r->skas.is_user; | 45 | save_user = r->is_user; |
46 | r->skas.is_user = 0; | 46 | r->is_user = 0; |
47 | if ( sig == SIGFPE || sig == SIGSEGV || | 47 | if ( sig == SIGFPE || sig == SIGSEGV || |
48 | sig == SIGBUS || sig == SIGILL || | 48 | sig == SIGBUS || sig == SIGILL || |
49 | sig == SIGTRAP ) { | 49 | sig == SIGTRAP ) { |
50 | GET_FAULTINFO_FROM_SC(r->skas.faultinfo, sc); | 50 | GET_FAULTINFO_FROM_SC(r->faultinfo, sc); |
51 | } | 51 | } |
52 | 52 | ||
53 | change_sig(SIGUSR1, 1); | 53 | change_sig(SIGUSR1, 1); |
@@ -62,5 +62,5 @@ void sig_handler_common_skas(int sig, void *sc_ptr) | |||
62 | handler(sig, r); | 62 | handler(sig, r); |
63 | 63 | ||
64 | errno = save_errno; | 64 | errno = save_errno; |
65 | r->skas.is_user = save_user; | 65 | r->is_user = save_user; |
66 | } | 66 | } |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index da5c90df5c9e..abfc094c3c49 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "init.h" | 31 | #include "init.h" |
32 | #include "os.h" | 32 | #include "os.h" |
33 | #include "uml-config.h" | 33 | #include "uml-config.h" |
34 | #include "mode.h" | ||
35 | #include "tempfile.h" | 34 | #include "tempfile.h" |
36 | #include "kern_constants.h" | 35 | #include "kern_constants.h" |
37 | #include "skas.h" | 36 | #include "skas.h" |
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c index b17f546c3655..e87fb5362f44 100644 --- a/arch/um/os-Linux/trap.c +++ b/arch/um/os-Linux/trap.c | |||
@@ -7,15 +7,10 @@ | |||
7 | #include <signal.h> | 7 | #include <signal.h> |
8 | #include "kern_util.h" | 8 | #include "kern_util.h" |
9 | #include "os.h" | 9 | #include "os.h" |
10 | #include "mode.h" | ||
11 | #include "longjmp.h" | 10 | #include "longjmp.h" |
12 | 11 | ||
13 | void usr2_handler(int sig, union uml_pt_regs *regs) | ||
14 | { | ||
15 | } | ||
16 | |||
17 | /* Initialized from linux_main() */ | 12 | /* Initialized from linux_main() */ |
18 | void (*sig_info[NSIG])(int, union uml_pt_regs *); | 13 | void (*sig_info[NSIG])(int, struct uml_pt_regs *); |
19 | 14 | ||
20 | void os_fill_handlinfo(struct kern_handlers h) | 15 | void os_fill_handlinfo(struct kern_handlers h) |
21 | { | 16 | { |
@@ -28,7 +23,6 @@ void os_fill_handlinfo(struct kern_handlers h) | |||
28 | sig_info[SIGIO] = h.sigio_handler; | 23 | sig_info[SIGIO] = h.sigio_handler; |
29 | sig_info[SIGVTALRM] = h.timer_handler; | 24 | sig_info[SIGVTALRM] = h.timer_handler; |
30 | sig_info[SIGALRM] = h.timer_handler; | 25 | sig_info[SIGALRM] = h.timer_handler; |
31 | sig_info[SIGUSR2] = usr2_handler; | ||
32 | } | 26 | } |
33 | 27 | ||
34 | void do_longjmp(void *b, int val) | 28 | void do_longjmp(void *b, int val) |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index b462863f7172..e36541e5ec00 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "init.h" | 11 | #include "init.h" |
12 | #include "os.h" | 12 | #include "os.h" |
13 | #include "user.h" | 13 | #include "user.h" |
14 | #include "mode.h" | ||
15 | 14 | ||
16 | #define UML_DIR "~/.uml/" | 15 | #define UML_DIR "~/.uml/" |
17 | 16 | ||