Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33979
b: refs/heads/master
c: 47a5c6f
h: refs/heads/master
i:
  33977: bf524b4
  33975: 7384516
v: v3
  • Loading branch information
Linus Torvalds committed Sep 18, 2006
1 parent def3cac commit b8043c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1d19f176a2884d31c4fe2c7018349ff884a819b1
refs/heads/master: 47a5c6fa0e204a2b63309c648bb2fde36836c826
4 changes: 4 additions & 0 deletions trunk/arch/i386/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ ENTRY(ret_from_fork)
GET_THREAD_INFO(%ebp)
popl %eax
CFI_ADJUST_CFA_OFFSET -4
pushl $0x0202 # Reset kernel eflags
CFI_ADJUST_CFA_OFFSET 4
popfl
CFI_ADJUST_CFA_OFFSET -4
jmp syscall_exit
CFI_ENDPROC

Expand Down
8 changes: 7 additions & 1 deletion trunk/include/asm-i386/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@
struct task_struct; /* one of the stranger aspects of C forward declarations.. */
extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));

/*
* Saving eflags is important. It switches not only IOPL between tasks,
* it also protects other tasks from NT leaking through sysenter etc.
*/
#define switch_to(prev,next,last) do { \
unsigned long esi,edi; \
asm volatile("pushl %%ebp\n\t" \
asm volatile("pushfl\n\t" /* Save flags */ \
"pushl %%ebp\n\t" \
"movl %%esp,%0\n\t" /* save ESP */ \
"movl %5,%%esp\n\t" /* restore ESP */ \
"movl $1f,%1\n\t" /* save EIP */ \
"pushl %6\n\t" /* restore EIP */ \
"jmp __switch_to\n" \
"1:\t" \
"popl %%ebp\n\t" \
"popfl" \
:"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
"=a" (last),"=S" (esi),"=D" (edi) \
:"m" (next->thread.esp),"m" (next->thread.eip), \
Expand Down

0 comments on commit b8043c4

Please sign in to comment.