~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sparc/include/asm/cmpxchg_32.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/sparc/include/asm/cmpxchg_32.h (Version linux-6.11.5) and /arch/i386/include/asm-i386/cmpxchg_32.h (Version linux-4.17.19)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 /* 32-bit atomic xchg() and cmpxchg() definiti    
  3  *                                                
  4  * Copyright (C) 1996 David S. Miller (davem@d    
  5  * Copyright (C) 2000 Anton Blanchard (anton@l    
  6  * Copyright (C) 2007 Kyle McMartin (kyle@pari    
  7  *                                                
  8  * Additions by Keith M Wesolowski (wesolows@f    
  9  * on asm-parisc/atomic.h Copyright (C) 2000 P    
 10  */                                               
 11                                                   
 12 #ifndef __ARCH_SPARC_CMPXCHG__                    
 13 #define __ARCH_SPARC_CMPXCHG__                    
 14                                                   
 15 unsigned long __xchg_u32(volatile u32 *m, u32     
 16 void __xchg_called_with_bad_pointer(void);        
 17                                                   
 18 static __always_inline unsigned long __arch_xc    
 19 {                                                 
 20         switch (size) {                           
 21         case 4:                                   
 22                 return __xchg_u32(ptr, x);        
 23         }                                         
 24         __xchg_called_with_bad_pointer();         
 25         return x;                                 
 26 }                                                 
 27                                                   
 28 #define arch_xchg(ptr,x) ({(__typeof__(*(ptr))    
 29                                                   
 30 /* Emulate cmpxchg() the same way we emulate a    
 31  * by hashing the object address and indexing     
 32  * of spinlocks to get a bit of performance...    
 33  *                                                
 34  * See arch/sparc/lib/atomic32.c for implement    
 35  *                                                
 36  * Cribbed from <asm-parisc/atomic.h>             
 37  */                                               
 38                                                   
 39 /* bug catcher for when unsupported size is us    
 40 void __cmpxchg_called_with_bad_pointer(void);     
 41 u8 __cmpxchg_u8(volatile u8 *m, u8 old, u8 new    
 42 u16 __cmpxchg_u16(volatile u16 *m, u16 old, u1    
 43 u32 __cmpxchg_u32(volatile u32 *m, u32 old, u3    
 44                                                   
 45 /* don't worry...optimizer will get rid of mos    
 46 static inline unsigned long                       
 47 __cmpxchg(volatile void *ptr, unsigned long ol    
 48 {                                                 
 49         return                                    
 50                 size == 1 ? __cmpxchg_u8(ptr,     
 51                 size == 2 ? __cmpxchg_u16(ptr,    
 52                 size == 4 ? __cmpxchg_u32(ptr,    
 53                         (__cmpxchg_called_with    
 54 }                                                 
 55                                                   
 56 #define arch_cmpxchg(ptr, o, n)                   
 57 ({                                                
 58         __typeof__(*(ptr)) _o_ = (o);             
 59         __typeof__(*(ptr)) _n_ = (n);             
 60         (__typeof__(*(ptr))) __cmpxchg((ptr),     
 61                         (unsigned long)_n_, si    
 62 })                                                
 63                                                   
 64 u64 __cmpxchg_u64(volatile u64 *ptr, u64 old,     
 65 #define arch_cmpxchg64(ptr, old, new)   __cmpx    
 66                                                   
 67 #include <asm-generic/cmpxchg-local.h>            
 68                                                   
 69 /*                                                
 70  * cmpxchg_local and cmpxchg64_local are atomi    
 71  * them available.                                
 72  */                                               
 73 #define arch_cmpxchg_local(ptr, o, n)             
 74         ((__typeof__(*(ptr)))__generic_cmpxchg    
 75                         (unsigned long)(n), si    
 76 #define arch_cmpxchg64_local(ptr, o, n) __gene    
 77                                                   
 78 #endif /* __ARCH_SPARC_CMPXCHG__ */               
 79                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php