Merge master.kernel.org:/home/rmk/linux-2.6-arm
[powerpc.git] / include / asm-x86_64 / pda.h
index 9e3aaf7..5642634 100644 (file)
@@ -25,7 +25,8 @@ struct x8664_pda {
        int nodenumber;             /* number of current node */
        unsigned int __softirq_pending;
        unsigned int __nmi_count;       /* number of NMI on this CPUs */
-       int mmu_state;     
+       short mmu_state;
+       short isidle;
        struct mm_struct *active_mm;
        unsigned apic_timer_irqs;
 } ____cacheline_aligned_in_smp;
@@ -39,7 +40,7 @@ extern struct x8664_pda boot_cpu_pda[];
  * There is no fast way to get the base address of the PDA, all the accesses
  * have to mention %fs/%gs.  So it needs to be done this Torvaldian way.
  */ 
-extern void __bad_pda_field(void);
+extern void __bad_pda_field(void) __attribute__((noreturn));
 
 /*
  * proxy_pda doesn't actually exist, but tell gcc it is accessed for
@@ -108,6 +109,15 @@ extern struct x8664_pda _proxy_pda;
 #define sub_pda(field,val) pda_to_op("sub",field,val)
 #define or_pda(field,val) pda_to_op("or",field,val)
 
+/* This is not atomic against other CPUs -- CPU preemption needs to be off */
+#define test_and_clear_bit_pda(bit,field) ({           \
+       int old__;                                              \
+       asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0"            \
+           : "=r" (old__), "+m" (_proxy_pda.field)             \
+           : "dIr" (bit), "i" (pda_offset(field)) : "memory"); \
+       old__;                                                  \
+})
+
 #endif
 
 #define PDA_STACKOFFSET (5*8)