diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-04-29 21:13:14 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1997-04-29 21:13:14 +0000 |
commit | 19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch) | |
tree | 40b1cb534496a7f1ca0f5c314a523c69f1fee464 /include/asm-i386/system.h | |
parent | 7206675c40394c78a90e74812bbdbf8cf3cca1be (diff) |
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'include/asm-i386/system.h')
-rw-r--r-- | include/asm-i386/system.h | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index cef63f6fe..a3daf450d 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -67,25 +67,14 @@ __asm__("str %%ax\n\t" \ */ #define switch_to(prev,next) do { \ - cli();\ if(prev->flags&PF_USEDFPU) \ { \ __asm__ __volatile__("fnsave %0":"=m" (prev->tss.i387.hard)); \ __asm__ __volatile__("fwait"); \ prev->flags&=~PF_USEDFPU; \ } \ - prev->lock_depth=syscall_count; \ - kernel_counter+=next->lock_depth-prev->lock_depth; \ - syscall_count=next->lock_depth; \ -__asm__("pushl %%edx\n\t" \ - "movl "SYMBOL_NAME_STR(apic_reg)",%%edx\n\t" \ - "movl 0x20(%%edx), %%edx\n\t" \ - "shrl $22,%%edx\n\t" \ - "and $0x3C,%%edx\n\t" \ - "movl %%ecx,"SYMBOL_NAME_STR(current_set)"(,%%edx)\n\t" \ - "popl %%edx\n\t" \ - "ljmp %0\n\t" \ - "sti\n\t" \ + current_set[this_cpu] = next; \ +__asm__("ljmp %0\n\t" \ : /* no output */ \ :"m" (*(((char *)&next->tss.tr)-4)), \ "c" (next)); \ @@ -197,6 +186,9 @@ __asm__ __volatile__ ( \ struct __xchg_dummy { unsigned long a[100]; }; #define __xg(x) ((struct __xchg_dummy *)(x)) +/* + * Note: no "lock" prefix even on SMP: xchg always implies lock anyway + */ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) { switch (size) { @@ -223,16 +215,35 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) } #define mb() __asm__ __volatile__ ("" : : :"memory") -#define sti() __asm__ __volatile__ ("sti": : :"memory") -#define cli() __asm__ __volatile__ ("cli": : :"memory") -#define save_flags(x) \ +/* interrupt control.. */ +#define __sti() __asm__ __volatile__ ("sti": : :"memory") +#define __cli() __asm__ __volatile__ ("cli": : :"memory") +#define __save_flags(x) \ __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory") - -#define restore_flags(x) \ +#define __restore_flags(x) \ __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory") -#define iret() __asm__ __volatile__ ("iret": : :"memory") + +#ifdef __SMP__ + +extern void __global_cli(void); +extern void __global_sti(void); +extern unsigned long __global_save_flags(void); +extern void __global_restore_flags(unsigned long); +#define cli() __global_cli() +#define sti() __global_sti() +#define save_flags(x) ((x)=__global_save_flags()) +#define restore_flags(x) __global_restore_flags(x) + +#else + +#define cli() __cli() +#define sti() __sti() +#define save_flags(x) __save_flags(x) +#define restore_flags(x) __restore_flags(x) + +#endif #define _set_gate(gate_addr,type,dpl,addr) \ __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ |