patch-2.2.8 linux/include/asm-i386/system.h

Next file: linux/include/asm-i386/timex.h
Previous file: linux/include/asm-i386/processor.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/include/asm-i386/system.h linux/include/asm-i386/system.h
@@ -9,30 +9,24 @@
 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));
 
-/*
- * We do most of the task switching in C, but we need
- * to do the EIP/ESP switch in assembly..
- */
-#define switch_to(prev,next) do {					\
-	unsigned long eax, edx, ecx;					\
-	asm volatile("pushl %%ebx\n\t"					\
-		     "pushl %%esi\n\t"					\
+#define switch_to(prev,next,last) do {					\
+	asm volatile("pushl %%esi\n\t"					\
 		     "pushl %%edi\n\t"					\
 		     "pushl %%ebp\n\t"					\
 		     "movl %%esp,%0\n\t"	/* save ESP */		\
-		     "movl %5,%%esp\n\t"	/* restore ESP */	\
+		     "movl %3,%%esp\n\t"	/* restore ESP */	\
 		     "movl $1f,%1\n\t"		/* save EIP */		\
-		     "pushl %6\n\t"		/* restore EIP */	\
+		     "pushl %4\n\t"		/* restore EIP */	\
 		     "jmp __switch_to\n"				\
 		     "1:\t"						\
 		     "popl %%ebp\n\t"					\
 		     "popl %%edi\n\t"					\
 		     "popl %%esi\n\t"					\
-		     "popl %%ebx"					\
 		     :"=m" (prev->tss.esp),"=m" (prev->tss.eip),	\
-		      "=a" (eax), "=d" (edx), "=c" (ecx)		\
+		      "=b" (last)					\
 		     :"m" (next->tss.esp),"m" (next->tss.eip),		\
-		      "a" (prev), "d" (next)); 				\
+		      "a" (prev), "d" (next),				\
+		      "b" (prev));					\
 } while (0)
 
 #define _set_base(addr,base) do { unsigned long __pr; \

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)