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

TOMOYO Linux Cross Reference
Linux/arch/mips/include/asm/futex.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/mips/include/asm/futex.h (Architecture ppc) and /arch/m68k/include/asm-m68k/futex.h (Architecture m68k)


  1 /*                                                  1 
  2  * This file is subject to the terms and condi    
  3  * License.  See the file "COPYING" in the mai    
  4  * for more details.                              
  5  *                                                
  6  * Copyright (c) 2006  Ralf Baechle (ralf@linu    
  7  */                                               
  8 #ifndef _ASM_FUTEX_H                              
  9 #define _ASM_FUTEX_H                              
 10                                                   
 11 #ifdef __KERNEL__                                 
 12                                                   
 13 #include <linux/futex.h>                          
 14 #include <linux/uaccess.h>                        
 15 #include <asm/asm-eva.h>                          
 16 #include <asm/barrier.h>                          
 17 #include <asm/compiler.h>                         
 18 #include <asm/errno.h>                            
 19 #include <asm/sync.h>                             
 20                                                   
 21 #define arch_futex_atomic_op_inuser arch_futex    
 22 #define futex_atomic_cmpxchg_inatomic futex_at    
 23 #include <asm-generic/futex.h>                    
 24                                                   
 25 #define __futex_atomic_op(op, insn, ret, oldva    
 26 {                                                 
 27         if (cpu_has_llsc && IS_ENABLED(CONFIG_    
 28                 __asm__ __volatile__(             
 29                 "       .set    push              
 30                 "       .set    noat              
 31                 "       .set    push              
 32                 "       .set    arch=r4000        
 33                 "1:     ll      %1, %4  # __fu    
 34                 "       .set    pop               
 35                 "       " insn  "                 
 36                 "       .set    arch=r4000        
 37                 "2:     sc      $1, %2            
 38                 "       beqzl   $1, 1b            
 39                 __stringify(__WEAK_LLSC_MB) "     
 40                 "3:                               
 41                 "       .insn                     
 42                 "       .set    pop               
 43                 "       .section .fixup,\"ax\"    
 44                 "4:     li      %0, %6            
 45                 "       j       3b                
 46                 "       .previous                 
 47                 "       .section __ex_table,\"    
 48                 "       "__UA_ADDR "\t1b, 4b      
 49                 "       "__UA_ADDR "\t2b, 4b      
 50                 "       .previous                 
 51                 : "=r" (ret), "=&r" (oldval),     
 52                   "=" GCC_OFF_SMALL_ASM() (*ua    
 53                 : "" (0), GCC_OFF_SMALL_ASM()     
 54                   "i" (-EFAULT)                   
 55                 : "memory");                      
 56         } else if (cpu_has_llsc) {                
 57                 __asm__ __volatile__(             
 58                 "       .set    push              
 59                 "       .set    noat              
 60                 "       .set    push              
 61                 "       .set    "MIPS_ISA_ARCH    
 62                 "       " __SYNC(full, loongso    
 63                 "1:     "user_ll("%1", "%4")"     
 64                 "       .set    pop               
 65                 "       " insn  "                 
 66                 "       .set    "MIPS_ISA_ARCH    
 67                 "2:     "user_sc("$1", "%2")"     
 68                 "       beqz    $1, 1b            
 69                 __stringify(__WEAK_LLSC_MB) "     
 70                 "3:                               
 71                 "       .insn                     
 72                 "       .set    pop               
 73                 "       .section .fixup,\"ax\"    
 74                 "4:     li      %0, %6            
 75                 "       j       3b                
 76                 "       .previous                 
 77                 "       .section __ex_table,\"    
 78                 "       "__UA_ADDR "\t1b, 4b      
 79                 "       "__UA_ADDR "\t2b, 4b      
 80                 "       .previous                 
 81                 : "=r" (ret), "=&r" (oldval),     
 82                   "=" GCC_OFF_SMALL_ASM() (*ua    
 83                 : "" (0), GCC_OFF_SMALL_ASM()     
 84                   "i" (-EFAULT)                   
 85                 : "memory");                      
 86         } else {                                  
 87                 /* fallback for non-SMP */        
 88                 ret = futex_atomic_op_inuser_l    
 89         }                                         
 90 }                                                 
 91                                                   
 92 static inline int                                 
 93 arch_futex_atomic_op_inuser(int op, int oparg,    
 94 {                                                 
 95         int oldval = 0, ret;                      
 96                                                   
 97         if (!access_ok(uaddr, sizeof(u32)))       
 98                 return -EFAULT;                   
 99                                                   
100         switch (op) {                             
101         case FUTEX_OP_SET:                        
102                 __futex_atomic_op(op, "move $1    
103                 break;                            
104                                                   
105         case FUTEX_OP_ADD:                        
106                 __futex_atomic_op(op, "addu $1    
107                                   ret, oldval,    
108                 break;                            
109         case FUTEX_OP_OR:                         
110                 __futex_atomic_op(op, "or         
111                                   ret, oldval,    
112                 break;                            
113         case FUTEX_OP_ANDN:                       
114                 __futex_atomic_op(op, "and        
115                                   ret, oldval,    
116                 break;                            
117         case FUTEX_OP_XOR:                        
118                 __futex_atomic_op(op, "xor        
119                                   ret, oldval,    
120                 break;                            
121         default:                                  
122                 ret = -ENOSYS;                    
123         }                                         
124                                                   
125         if (!ret)                                 
126                 *oval = oldval;                   
127                                                   
128         return ret;                               
129 }                                                 
130                                                   
131 static inline int                                 
132 futex_atomic_cmpxchg_inatomic(u32 *uval, u32 _    
133                               u32 oldval, u32     
134 {                                                 
135         int ret = 0;                              
136         u32 val;                                  
137                                                   
138         if (!access_ok(uaddr, sizeof(u32)))       
139                 return -EFAULT;                   
140                                                   
141         if (cpu_has_llsc && IS_ENABLED(CONFIG_    
142                 __asm__ __volatile__(             
143                 "# futex_atomic_cmpxchg_inatom    
144                 "       .set    push              
145                 "       .set    noat              
146                 "       .set    push              
147                 "       .set    arch=r4000        
148                 "1:     ll      %1, %3            
149                 "       bne     %1, %z4, 3f       
150                 "       .set    pop               
151                 "       move    $1, %z5           
152                 "       .set    arch=r4000        
153                 "2:     sc      $1, %2            
154                 "       beqzl   $1, 1b            
155                 __stringify(__WEAK_LLSC_MB) "     
156                 "3:                               
157                 "       .insn                     
158                 "       .set    pop               
159                 "       .section .fixup,\"ax\"    
160                 "4:     li      %0, %6            
161                 "       j       3b                
162                 "       .previous                 
163                 "       .section __ex_table,\"    
164                 "       "__UA_ADDR "\t1b, 4b      
165                 "       "__UA_ADDR "\t2b, 4b      
166                 "       .previous                 
167                 : "+r" (ret), "=&r" (val), "="    
168                 : GCC_OFF_SMALL_ASM() (*uaddr)    
169                   "i" (-EFAULT)                   
170                 : "memory");                      
171         } else if (cpu_has_llsc) {                
172                 __asm__ __volatile__(             
173                 "# futex_atomic_cmpxchg_inatom    
174                 "       .set    push              
175                 "       .set    noat              
176                 "       .set    push              
177                 "       .set    "MIPS_ISA_ARCH    
178                 "       " __SYNC(full, loongso    
179                 "1:     "user_ll("%1", "%3")"     
180                 "       bne     %1, %z4, 3f       
181                 "       .set    pop               
182                 "       move    $1, %z5           
183                 "       .set    "MIPS_ISA_ARCH    
184                 "2:     "user_sc("$1", "%2")"     
185                 "       beqz    $1, 1b            
186                 "3:     " __SYNC_ELSE(full, lo    
187                 "       .insn                     
188                 "       .set    pop               
189                 "       .section .fixup,\"ax\"    
190                 "4:     li      %0, %6            
191                 "       j       3b                
192                 "       .previous                 
193                 "       .section __ex_table,\"    
194                 "       "__UA_ADDR "\t1b, 4b      
195                 "       "__UA_ADDR "\t2b, 4b      
196                 "       .previous                 
197                 : "+r" (ret), "=&r" (val), "="    
198                 : GCC_OFF_SMALL_ASM() (*uaddr)    
199                   "i" (-EFAULT)                   
200                 : "memory");                      
201         } else {                                  
202                 return futex_atomic_cmpxchg_in    
203         }                                         
204                                                   
205         *uval = val;                              
206         return ret;                               
207 }                                                 
208                                                   
209 #endif                                            
210 #endif /* _ASM_FUTEX_H */                         
211                                                   

~ [ 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