]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] uml: _switch_to code consolidation
authorJeff Dike <jdike@addtoit.com>
Sat, 17 Sep 2005 02:27:43 +0000 (19:27 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 17 Sep 2005 18:49:59 +0000 (11:49 -0700)
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>
arch/um/kernel/process_kern.c
arch/um/kernel/skas/include/mode_kern-skas.h
arch/um/kernel/skas/process_kern.c
arch/um/kernel/tt/include/mode_kern-tt.h
arch/um/kernel/tt/process_kern.c

index c23d8a08d0ff5403df391fbdd04ca86baa89a391..1143f5e522b2ce68c9c4d8a62b55b841b2e11de2 100644 (file)
@@ -113,8 +113,16 @@ void set_current(void *t)
 
 void *_switch_to(void *prev, void *next, void *last)
 {
-       return(CHOOSE_MODE(switch_to_tt(prev, next), 
-                          switch_to_skas(prev, next)));
+        struct task_struct *from = prev;
+        struct task_struct *to= next;
+
+        to->thread.prev_sched = from;
+        set_current(to);
+
+       CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next);
+
+        return(current->thread.prev_sched);
+
 }
 
 void interrupt_end(void)
index e48490028111ba7d260707c273242e4579cac349..c97a80dfe37052bb5bf8f51378ae0f809d29b15e 100644 (file)
@@ -11,7 +11,7 @@
 #include "asm/ptrace.h"
 
 extern void flush_thread_skas(void);
-extern void *switch_to_skas(void *prev, void *next);
+extern void switch_to_skas(void *prev, void *next);
 extern void start_thread_skas(struct pt_regs *regs, unsigned long eip,
                              unsigned long esp);
 extern int copy_thread_skas(int nr, unsigned long clone_flags,
index 3d1b227226e653d6ded1b4b8005c6d20a388530d..efe92e8aa2a9e37ffba7974d1dd6ee842928e131 100644 (file)
@@ -24,7 +24,7 @@
 #include "proc_mm.h"
 #include "registers.h"
 
-void *switch_to_skas(void *prev, void *next)
+void switch_to_skas(void *prev, void *next)
 {
        struct task_struct *from, *to;
 
@@ -35,16 +35,11 @@ void *switch_to_skas(void *prev, void *next)
        if(current->pid == 0)
                switch_timers(0);
 
-       to->thread.prev_sched = from;
-       set_current(to);
-
        switch_threads(&from->thread.mode.skas.switch_buf, 
                       to->thread.mode.skas.switch_buf);
 
        if(current->pid == 0)
                switch_timers(1);
-
-       return(current->thread.prev_sched);
 }
 
 extern void schedule_tail(struct task_struct *prev);
index e0ca0e0b251644f9a9fd30af8d2a5f7299077e9e..2a35b15c5fef4f19633f76d1af397d56f4c93beb 100644 (file)
@@ -11,7 +11,7 @@
 #include "asm/ptrace.h"
 #include "asm/uaccess.h"
 
-extern void *switch_to_tt(void *prev, void *next);
+extern void switch_to_tt(void *prev, void *next);
 extern void flush_thread_tt(void);
 extern void start_thread_tt(struct pt_regs *regs, unsigned long eip,
                           unsigned long esp);
index a189a2b92935973123f8a855ca75832e4651e78c..0de05a268b22e7c5366b81e04c5c4e89392188b6 100644 (file)
@@ -26,7 +26,7 @@
 #include "init.h"
 #include "tt.h"
 
-void *switch_to_tt(void *prev, void *next, void *last)
+int switch_to_tt(void *prev, void *next, void *last)
 {
        struct task_struct *from, *to, *prev_sched;
        unsigned long flags;
@@ -36,8 +36,6 @@ void *switch_to_tt(void *prev, void *next, void *last)
        from = prev;
        to = next;
 
-       to->thread.prev_sched = from;
-
        cpu = from->thread_info->cpu;
        if(cpu == 0)
                forward_interrupts(to->thread.mode.tt.extern_pid);
@@ -53,7 +51,6 @@ void *switch_to_tt(void *prev, void *next, void *last)
        forward_pending_sigio(to->thread.mode.tt.extern_pid);
 
        c = 0;
-       set_current(to);
 
        err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c));
        if(err != sizeof(c))
@@ -85,8 +82,6 @@ void *switch_to_tt(void *prev, void *next, void *last)
 
        flush_tlb_all();
        local_irq_restore(flags);
-
-       return(current->thread.prev_sched);
 }
 
 void release_thread_tt(struct task_struct *task)