#244 compile issue: cmpxchg8b and >2.6.30

closed
nobody
None
5
2012-10-06
2009-06-17
Rafi
No

As of a git checkout today cmpxchg8b in ntoskernel.h (line 888) conflicts with a version of the function in the kernel arch/x86/include/asm/atomic_32.h

I don't know if the released version of 2.6.30 contains cmpxchg8b.

But I can confirm the functions look quite similar and the kernel version works fine.

Discussion

  • Jan Engelhardt
    Jan Engelhardt
    2009-07-19

    cmpxchg8b's first appearance is 2.6.31-rc1. The ndis code is correct, though unfortunately, things like the 2.6.29.5-rt22 patch already contain this, so these users have to manually weed the ndis copy out before compiling.

     
  • Octavian
    Octavian
    2009-08-02

    In order to get a correct compilation of ndiswrapper on 2.6.31-rc4 I had to add again the cmpxchg8b in ntoskernel.h.
    See the patch bellow.

    --- driver/ntoskernel.h (revision 2701)
    +++ driver/ntoskernel.h (working copy)
    @@ -875,7 +875,7 @@
    #define u64_low_32(x) ((u32)x)
    #define u64_high_32(x) ((u32)(x >> 32))

    -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
    +//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
    static inline u64 cmpxchg8b(volatile u64 *ptr, u64 old, u64 new)
    {
    u64 prev;
    @@ -887,7 +887,7 @@
    : "A" (old), "b" (u64_low_32(new)), "c" (u64_high_32(new)));
    return prev;
    }
    -#endif
    +//#endif

    / slist routines below update slist atomically - no need for
    * spinlocks
    /

     
  • Jan Engelhardt
    Jan Engelhardt
    2009-09-13

    In 2.6.31, atomic64_cmpxchg is probably the candidate function to use, though it takes slightly different types.

     
  • Fixed by Pavel in 1.56