x86: unify smp parts of system.h
[powerpc.git] / include / asm-x86 / system_32.h
1 #ifndef __ASM_SYSTEM_H
2 #define __ASM_SYSTEM_H
3
4 #include <asm/segment.h>
5 #include <asm/cpufeature.h>
6 #include <asm/cmpxchg.h>
7
8 #ifdef __KERNEL__
9 #define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
10
11 struct task_struct;     /* one of the stranger aspects of C forward declarations.. */
12 extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
13
14 /*
15  * Saving eflags is important. It switches not only IOPL between tasks,
16  * it also protects other tasks from NT leaking through sysenter etc.
17  */
18 #define switch_to(prev,next,last) do {                                  \
19         unsigned long esi,edi;                                          \
20         asm volatile("pushfl\n\t"               /* Save flags */        \
21                      "pushl %%ebp\n\t"                                  \
22                      "movl %%esp,%0\n\t"        /* save ESP */          \
23                      "movl %5,%%esp\n\t"        /* restore ESP */       \
24                      "movl $1f,%1\n\t"          /* save EIP */          \
25                      "pushl %6\n\t"             /* restore EIP */       \
26                      "jmp __switch_to\n"                                \
27                      "1:\t"                                             \
28                      "popl %%ebp\n\t"                                   \
29                      "popfl"                                            \
30                      :"=m" (prev->thread.sp),"=m" (prev->thread.ip),    \
31                       "=a" (last),"=S" (esi),"=D" (edi)                 \
32                      :"m" (next->thread.sp),"m" (next->thread.ip),      \
33                       "2" (prev), "d" (next));                          \
34 } while (0)
35
36 #endif  /* __KERNEL__ */
37
38
39 #include <linux/irqflags.h>
40
41 /*
42  * disable hlt during certain critical i/o operations
43  */
44 #define HAVE_DISABLE_HLT
45
46 #endif