summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLuca Barbieri <ldb@ldb.ods.org>2003-01-04 03:29:21 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2003-01-04 03:29:21 -0800
commitdae700f9b950550e547f72182987d54cfcba12d0 (patch)
tree86fc50b04759b6e868ea80bb0fe3129b1c174ae8 /include
parent1d0619c5bcec6ce9f7ce577899bffcbf83d2aa44 (diff)
[PATCH] Fix sysenter iopl
This patch fixes the handling of IOPL when sysenter is used. Currently when entering kernel mode, IOPL is not changed and it is not presserved across context switches: thus, in the kernel, the IOPL value is random. This is not a problem when using iret, because it restores eflags, but the sysexit code currently doesn't, which means that that IOPL becomes random in user mode too which is of course not good. This patch fixes the problem by saving eflags across context switches.
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/system.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index bdc4da98612c..3494d709cd9a 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -12,7 +12,8 @@ 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 switch_to(prev,next,last) do { \
- asm volatile("pushl %%esi\n\t" \
+ asm volatile("pushfl\n\t" \
+ "pushl %%esi\n\t" \
"pushl %%edi\n\t" \
"pushl %%ebp\n\t" \
"movl %%esp,%0\n\t" /* save ESP */ \
@@ -24,6 +25,7 @@ extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *n
"popl %%ebp\n\t" \
"popl %%edi\n\t" \
"popl %%esi\n\t" \
+ "popfl\n\t" \
:"=m" (prev->thread.esp),"=m" (prev->thread.eip) \
:"m" (next->thread.esp),"m" (next->thread.eip), \
"a" (prev), "d" (next)); \