patch-1.3.71 linux/include/asm-i386/system.h
Next file: linux/include/asm-sparc/asi.h
Previous file: linux/include/asm-i386/smp.h
Back to the patch index
Back to the overall index
- Lines: 103
- Date:
Sun Mar 3 13:14:50 1996
- Orig file:
v1.3.70/linux/include/asm-i386/system.h
- Orig date:
Wed Nov 8 07:11:41 1995
diff -u --recursive --new-file v1.3.70/linux/include/asm-i386/system.h linux/include/asm-i386/system.h
@@ -31,11 +31,11 @@
/* This special macro can be used to load a debugging register */
-#define loaddebug(register) \
+#define loaddebug(tsk,register) \
__asm__("movl %0,%%edx\n\t" \
"movl %%edx,%%db" #register "\n\t" \
: /* no output */ \
- :"m" (current->debugreg[register]) \
+ :"m" (tsk->debugreg[register]) \
:"dx");
@@ -65,61 +65,57 @@
* the wrong process.
*/
-#define switch_to(tsk) do { \
+#define switch_to(prev,next) do { \
cli();\
- if(current->flags&PF_USEDFPU) \
+ if(prev->flags&PF_USEDFPU) \
{ \
- __asm__ __volatile__("fnsave %0":"=m" (current->tss.i387.hard)); \
+ __asm__ __volatile__("fnsave %0":"=m" (prev->tss.i387.hard)); \
__asm__ __volatile__("fwait"); \
- current->flags&=~PF_USEDFPU; \
+ prev->flags&=~PF_USEDFPU; \
} \
- current->lock_depth=syscall_count; \
- kernel_counter+=next->lock_depth-current->lock_depth; \
+ prev->lock_depth=syscall_count; \
+ kernel_counter+=next->lock_depth-prev->lock_depth; \
syscall_count=next->lock_depth; \
__asm__("pushl %%edx\n\t" \
"movl "SYMBOL_NAME_STR(apic_reg)",%%edx\n\t" \
"movl 0x20(%%edx), %%edx\n\t" \
"shrl $22,%%edx\n\t" \
"and $0x3C,%%edx\n\t" \
- "xchgl %%ecx,"SYMBOL_NAME_STR(current_set)"(,%%edx)\n\t" \
+ "movl %%ecx,"SYMBOL_NAME_STR(current_set)"(,%%edx)\n\t" \
"popl %%edx\n\t" \
"ljmp %0\n\t" \
"sti\n\t" \
: /* no output */ \
- :"m" (*(((char *)&tsk->tss.tr)-4)), \
- "c" (tsk) \
- :"cx"); \
+ :"m" (*(((char *)&next->tss.tr)-4)), \
+ "c" (next)); \
/* Now maybe reload the debug registers */ \
- if(current->debugreg[7]){ \
- loaddebug(0); \
- loaddebug(1); \
- loaddebug(2); \
- loaddebug(3); \
- loaddebug(6); \
+ if(prev->debugreg[7]){ \
+ loaddebug(prev,0); \
+ loaddebug(prev,1); \
+ loaddebug(prev,2); \
+ loaddebug(prev,3); \
+ loaddebug(prev,6); \
} \
} while (0)
#else
-#define switch_to(tsk) do { \
-__asm__("cli\n\t" \
- "xchgl %%ecx,"SYMBOL_NAME_STR(current_set)"\n\t" \
+#define switch_to(prev,next) do { \
+__asm__("movl %2,"SYMBOL_NAME_STR(current_set)"\n\t" \
"ljmp %0\n\t" \
- "sti\n\t" \
- "cmpl %%ecx,"SYMBOL_NAME_STR(last_task_used_math)"\n\t" \
+ "cmpl %1,"SYMBOL_NAME_STR(last_task_used_math)"\n\t" \
"jne 1f\n\t" \
"clts\n" \
"1:" \
- : /* no output */ \
- :"m" (*(((char *)&tsk->tss.tr)-4)), \
- "c" (tsk) \
- :"cx"); \
+ : /* no outputs */ \
+ :"m" (*(((char *)&next->tss.tr)-4)), \
+ "r" (prev), "r" (next)); \
/* Now maybe reload the debug registers */ \
- if(current->debugreg[7]){ \
- loaddebug(0); \
- loaddebug(1); \
- loaddebug(2); \
- loaddebug(3); \
- loaddebug(6); \
+ if(prev->debugreg[7]){ \
+ loaddebug(prev,0); \
+ loaddebug(prev,1); \
+ loaddebug(prev,2); \
+ loaddebug(prev,3); \
+ loaddebug(prev,6); \
} \
} while (0)
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this