diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-02-20 04:33:56 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-02-20 04:33:56 -0800 |
| commit | e58d8e309fb22889a11a257cd8d01b04d0fc8373 (patch) | |
| tree | ce97fd0252c049bb08e79087765efb11d433e51c /include | |
| parent | 91e2be4638503d6a3d08cc2cc9e6a9eac9b37df9 (diff) | |
Fix x86 "switch_to()" to properly set the previous task information,
which is needed to keep track of process usage counts correctly and
efficiently.
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-i386/system.h | 18 | ||||
| -rw-r--r-- | include/linux/init_task.h | 1 |
2 files changed, 9 insertions, 10 deletions
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 3494d709cd9a..5aac11823981 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -9,26 +9,24 @@ #ifdef __KERNEL__ 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)); +extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); #define switch_to(prev,next,last) do { \ + unsigned long esi,edi; \ asm volatile("pushfl\n\t" \ - "pushl %%esi\n\t" \ - "pushl %%edi\n\t" \ "pushl %%ebp\n\t" \ "movl %%esp,%0\n\t" /* save ESP */ \ - "movl %2,%%esp\n\t" /* restore ESP */ \ + "movl %5,%%esp\n\t" /* restore ESP */ \ "movl $1f,%1\n\t" /* save EIP */ \ - "pushl %3\n\t" /* restore EIP */ \ + "pushl %6\n\t" /* restore EIP */ \ "jmp __switch_to\n" \ "1:\t" \ "popl %%ebp\n\t" \ - "popl %%edi\n\t" \ - "popl %%esi\n\t" \ - "popfl\n\t" \ - :"=m" (prev->thread.esp),"=m" (prev->thread.eip) \ + "popfl" \ + :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ + "=a" (last),"=S" (esi),"=D" (edi) \ :"m" (next->thread.esp),"m" (next->thread.eip), \ - "a" (prev), "d" (next)); \ + "2" (prev), "d" (next)); \ } while (0) #define _set_base(addr,base) do { unsigned long __pr; \ diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9fe117695748..6e749b6c5a7f 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -62,6 +62,7 @@ { \ .state = 0, \ .thread_info = &init_thread_info, \ + .usage = ATOMIC_INIT(2), \ .flags = 0, \ .lock_depth = -1, \ .prio = MAX_PRIO-20, \ |
