diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-i386/processor.h | 16 | ||||
-rw-r--r-- | include/asm-i386/system.h | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 992224bff549..37bef8ed7bed 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -455,6 +455,7 @@ struct thread_struct { | |||
455 | unsigned int saved_fs, saved_gs; | 455 | unsigned int saved_fs, saved_gs; |
456 | /* IO permissions */ | 456 | /* IO permissions */ |
457 | unsigned long *io_bitmap_ptr; | 457 | unsigned long *io_bitmap_ptr; |
458 | unsigned long iopl; | ||
458 | /* max allowed port in the bitmap, in bytes: */ | 459 | /* max allowed port in the bitmap, in bytes: */ |
459 | unsigned long io_bitmap_max; | 460 | unsigned long io_bitmap_max; |
460 | }; | 461 | }; |
@@ -511,6 +512,21 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa | |||
511 | : /* no output */ \ | 512 | : /* no output */ \ |
512 | :"r" (value)) | 513 | :"r" (value)) |
513 | 514 | ||
515 | /* | ||
516 | * Set IOPL bits in EFLAGS from given mask | ||
517 | */ | ||
518 | static inline void set_iopl_mask(unsigned mask) | ||
519 | { | ||
520 | unsigned int reg; | ||
521 | __asm__ __volatile__ ("pushfl;" | ||
522 | "popl %0;" | ||
523 | "andl %1, %0;" | ||
524 | "orl %2, %0;" | ||
525 | "pushl %0;" | ||
526 | "popfl" | ||
527 | : "=&r" (reg) | ||
528 | : "i" (~X86_EFLAGS_IOPL), "r" (mask)); | ||
529 | } | ||
514 | 530 | ||
515 | /* Forward declaration, a strange C thing */ | 531 | /* Forward declaration, a strange C thing */ |
516 | struct task_struct; | 532 | struct task_struct; |
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 37fd2f8c7196..acd5c26b69ba 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h | |||
@@ -14,8 +14,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc | |||
14 | 14 | ||
15 | #define switch_to(prev,next,last) do { \ | 15 | #define switch_to(prev,next,last) do { \ |
16 | unsigned long esi,edi; \ | 16 | unsigned long esi,edi; \ |
17 | asm volatile("pushfl\n\t" \ | 17 | asm volatile("pushl %%ebp\n\t" \ |
18 | "pushl %%ebp\n\t" \ | ||
19 | "movl %%esp,%0\n\t" /* save ESP */ \ | 18 | "movl %%esp,%0\n\t" /* save ESP */ \ |
20 | "movl %5,%%esp\n\t" /* restore ESP */ \ | 19 | "movl %5,%%esp\n\t" /* restore ESP */ \ |
21 | "movl $1f,%1\n\t" /* save EIP */ \ | 20 | "movl $1f,%1\n\t" /* save EIP */ \ |
@@ -23,7 +22,6 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc | |||
23 | "jmp __switch_to\n" \ | 22 | "jmp __switch_to\n" \ |
24 | "1:\t" \ | 23 | "1:\t" \ |
25 | "popl %%ebp\n\t" \ | 24 | "popl %%ebp\n\t" \ |
26 | "popfl" \ | ||
27 | :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ | 25 | :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ |
28 | "=a" (last),"=S" (esi),"=D" (edi) \ | 26 | "=a" (last),"=S" (esi),"=D" (edi) \ |
29 | :"m" (next->thread.esp),"m" (next->thread.eip), \ | 27 | :"m" (next->thread.esp),"m" (next->thread.eip), \ |