]> git.hungrycats.org Git - linux/commitdiff
optimization, cleanup: switch_to(3 parameter) => switch_to(2 parameter).
authorIngo Molnar <mingo@elte.hu>
Tue, 12 Feb 2002 18:53:21 +0000 (19:53 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 12 Feb 2002 18:53:21 +0000 (19:53 +0100)
include/asm-i386/system.h
kernel/sched.c

index e2fbc2817b3ea79a4734a953b439702cf3346005..5b08a294655a1881ed821fe6ec104fb4728a9691 100644 (file)
@@ -13,24 +13,23 @@ struct task_struct; /* one of the stranger aspects of C forward declarations.. *
 extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
 
 #define prepare_to_switch()    do { } while(0)
-#define switch_to(prev,next,last) do {                                 \
+
+#define switch_to(prev,next) do {                                      \
        asm volatile("pushl %%esi\n\t"                                  \
                     "pushl %%edi\n\t"                                  \
                     "pushl %%ebp\n\t"                                  \
                     "movl %%esp,%0\n\t"        /* save ESP */          \
-                    "movl %3,%%esp\n\t"        /* restore ESP */       \
+                    "movl %2,%%esp\n\t"        /* restore ESP */       \
                     "movl $1f,%1\n\t"          /* save EIP */          \
-                    "pushl %4\n\t"             /* restore EIP */       \
+                    "pushl %3\n\t"             /* restore EIP */       \
                     "jmp __switch_to\n"                                \
                     "1:\t"                                             \
                     "popl %%ebp\n\t"                                   \
                     "popl %%edi\n\t"                                   \
                     "popl %%esi\n\t"                                   \
-                    :"=m" (prev->thread.esp),"=m" (prev->thread.eip),  \
-                     "=b" (last)                                       \
+                    :"=m" (prev->thread.esp),"=m" (prev->thread.eip)   \
                     :"m" (next->thread.esp),"m" (next->thread.eip),    \
-                     "a" (prev), "d" (next),                           \
-                     "b" (prev));                                      \
+                     "a" (prev), "d" (next));                          \
 } while (0)
 
 #define _set_base(addr,base) do { unsigned long __pr; \
index 08e1293ab92a8f7c20e2b42887594ab5ee23a083..12c21878cd0ac100c39dd72d2d2c19d89d88e24a 100644 (file)
@@ -435,17 +435,8 @@ static inline void context_switch(task_t *prev, task_t *next)
                mmdrop(oldmm);
        }
 
-       /*
-        * Here we just switch the register state and the stack. There are
-        * 3 processes affected by a context switch:
-        *
-        * prev ==> .... ==> (last => next)
-        *
-        * It's the 'much more previous' 'prev' that is on next's stack,
-        * but prev is set to (the just run) 'last' process by switch_to().
-        * This might sound slightly confusing but makes tons of sense.
-        */
-       switch_to(prev, next, prev);
+       /* Here we just switch the register state and the stack. */
+       switch_to(prev, next);
 }
 
 unsigned long nr_running(void)