aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2005-09-16 22:27:43 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-17 14:49:59 -0400
commitf6e34c6af6f18bd6c66bfb1c6a7c57068412aa73 (patch)
tree45aebccc135b870a5aff5dcf975325171c7bf891
parent6add9f7f529b124938d14ae9db5a952d1272075a (diff)
[PATCH] uml: _switch_to code consolidation
This patch moves code that is in both switch_to_tt and switch_to_skas to the top level _switch_to function, keeping us from duplicating code. It is required for the stack trace patch to work properly. Signed-off-by: Allan Graves <allan.graves@gmail.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/um/kernel/process_kern.c12
-rw-r--r--arch/um/kernel/skas/include/mode_kern-skas.h2
-rw-r--r--arch/um/kernel/skas/process_kern.c7
-rw-r--r--arch/um/kernel/tt/include/mode_kern-tt.h2
-rw-r--r--arch/um/kernel/tt/process_kern.c7
5 files changed, 14 insertions, 16 deletions
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index c23d8a08d0ff..1143f5e522b2 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -113,8 +113,16 @@ void set_current(void *t)
113 113
114void *_switch_to(void *prev, void *next, void *last) 114void *_switch_to(void *prev, void *next, void *last)
115{ 115{
116 return(CHOOSE_MODE(switch_to_tt(prev, next), 116 struct task_struct *from = prev;
117 switch_to_skas(prev, next))); 117 struct task_struct *to= next;
118
119 to->thread.prev_sched = from;
120 set_current(to);
121
122 CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next);
123
124 return(current->thread.prev_sched);
125
118} 126}
119 127
120void interrupt_end(void) 128void interrupt_end(void)
diff --git a/arch/um/kernel/skas/include/mode_kern-skas.h b/arch/um/kernel/skas/include/mode_kern-skas.h
index e48490028111..c97a80dfe370 100644
--- a/arch/um/kernel/skas/include/mode_kern-skas.h
+++ b/arch/um/kernel/skas/include/mode_kern-skas.h
@@ -11,7 +11,7 @@
11#include "asm/ptrace.h" 11#include "asm/ptrace.h"
12 12
13extern void flush_thread_skas(void); 13extern void flush_thread_skas(void);
14extern void *switch_to_skas(void *prev, void *next); 14extern void switch_to_skas(void *prev, void *next);
15extern void start_thread_skas(struct pt_regs *regs, unsigned long eip, 15extern void start_thread_skas(struct pt_regs *regs, unsigned long eip,
16 unsigned long esp); 16 unsigned long esp);
17extern int copy_thread_skas(int nr, unsigned long clone_flags, 17extern int copy_thread_skas(int nr, unsigned long clone_flags,
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c
index 3d1b227226e6..efe92e8aa2a9 100644
--- a/arch/um/kernel/skas/process_kern.c
+++ b/arch/um/kernel/skas/process_kern.c
@@ -24,7 +24,7 @@
24#include "proc_mm.h" 24#include "proc_mm.h"
25#include "registers.h" 25#include "registers.h"
26 26
27void *switch_to_skas(void *prev, void *next) 27void switch_to_skas(void *prev, void *next)
28{ 28{
29 struct task_struct *from, *to; 29 struct task_struct *from, *to;
30 30
@@ -35,16 +35,11 @@ void *switch_to_skas(void *prev, void *next)
35 if(current->pid == 0) 35 if(current->pid == 0)
36 switch_timers(0); 36 switch_timers(0);
37 37
38 to->thread.prev_sched = from;
39 set_current(to);
40
41 switch_threads(&from->thread.mode.skas.switch_buf, 38 switch_threads(&from->thread.mode.skas.switch_buf,
42 to->thread.mode.skas.switch_buf); 39 to->thread.mode.skas.switch_buf);
43 40
44 if(current->pid == 0) 41 if(current->pid == 0)
45 switch_timers(1); 42 switch_timers(1);
46
47 return(current->thread.prev_sched);
48} 43}
49 44
50extern void schedule_tail(struct task_struct *prev); 45extern void schedule_tail(struct task_struct *prev);
diff --git a/arch/um/kernel/tt/include/mode_kern-tt.h b/arch/um/kernel/tt/include/mode_kern-tt.h
index e0ca0e0b2516..2a35b15c5fef 100644
--- a/arch/um/kernel/tt/include/mode_kern-tt.h
+++ b/arch/um/kernel/tt/include/mode_kern-tt.h
@@ -11,7 +11,7 @@
11#include "asm/ptrace.h" 11#include "asm/ptrace.h"
12#include "asm/uaccess.h" 12#include "asm/uaccess.h"
13 13
14extern void *switch_to_tt(void *prev, void *next); 14extern void switch_to_tt(void *prev, void *next);
15extern void flush_thread_tt(void); 15extern void flush_thread_tt(void);
16extern void start_thread_tt(struct pt_regs *regs, unsigned long eip, 16extern void start_thread_tt(struct pt_regs *regs, unsigned long eip,
17 unsigned long esp); 17 unsigned long esp);
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c
index a189a2b92935..0de05a268b22 100644
--- a/arch/um/kernel/tt/process_kern.c
+++ b/arch/um/kernel/tt/process_kern.c
@@ -26,7 +26,7 @@
26#include "init.h" 26#include "init.h"
27#include "tt.h" 27#include "tt.h"
28 28
29void *switch_to_tt(void *prev, void *next, void *last) 29int switch_to_tt(void *prev, void *next, void *last)
30{ 30{
31 struct task_struct *from, *to, *prev_sched; 31 struct task_struct *from, *to, *prev_sched;
32 unsigned long flags; 32 unsigned long flags;
@@ -36,8 +36,6 @@ void *switch_to_tt(void *prev, void *next, void *last)
36 from = prev; 36 from = prev;
37 to = next; 37 to = next;
38 38
39 to->thread.prev_sched = from;
40
41 cpu = from->thread_info->cpu; 39 cpu = from->thread_info->cpu;
42 if(cpu == 0) 40 if(cpu == 0)
43 forward_interrupts(to->thread.mode.tt.extern_pid); 41 forward_interrupts(to->thread.mode.tt.extern_pid);
@@ -53,7 +51,6 @@ void *switch_to_tt(void *prev, void *next, void *last)
53 forward_pending_sigio(to->thread.mode.tt.extern_pid); 51 forward_pending_sigio(to->thread.mode.tt.extern_pid);
54 52
55 c = 0; 53 c = 0;
56 set_current(to);
57 54
58 err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c)); 55 err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c));
59 if(err != sizeof(c)) 56 if(err != sizeof(c))
@@ -85,8 +82,6 @@ void *switch_to_tt(void *prev, void *next, void *last)
85 82
86 flush_tlb_all(); 83 flush_tlb_all();
87 local_irq_restore(flags); 84 local_irq_restore(flags);
88
89 return(current->thread.prev_sched);
90} 85}
91 86
92void release_thread_tt(struct task_struct *task) 87void release_thread_tt(struct task_struct *task)