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

TOMOYO Linux Cross Reference
Linux/arch/sh/include/asm/atomic-grb.h

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __ASM_SH_ATOMIC_GRB_H
  2 #define __ASM_SH_ATOMIC_GRB_H
  3 
  4 static inline void atomic_add(int i, atomic_t *v)
  5 {
  6         int tmp;
  7 
  8         __asm__ __volatile__ (
  9                 "   .align 2              \n\t"
 10                 "   mova    1f,   r0      \n\t" /* r0 = end point */
 11                 "   mov    r15,   r1      \n\t" /* r1 = saved sp */
 12                 "   mov    #-6,   r15     \n\t" /* LOGIN: r15 = size */
 13                 "   mov.l  @%1,   %0      \n\t" /* load  old value */
 14                 "   add     %2,   %0      \n\t" /* add */
 15                 "   mov.l   %0,   @%1     \n\t" /* store new value */
 16                 "1: mov     r1,   r15     \n\t" /* LOGOUT */
 17                 : "=&r" (tmp),
 18                   "+r"  (v)
 19                 : "r"   (i)
 20                 : "memory" , "r0", "r1");
 21 }
 22 
 23 static inline void atomic_sub(int i, atomic_t *v)
 24 {
 25         int tmp;
 26 
 27         __asm__ __volatile__ (
 28                 "   .align 2              \n\t"
 29                 "   mova    1f,   r0      \n\t" /* r0 = end point */
 30                 "   mov     r15,  r1      \n\t" /* r1 = saved sp */
 31                 "   mov    #-6,   r15     \n\t" /* LOGIN: r15 = size */
 32                 "   mov.l  @%1,   %0      \n\t" /* load  old value */
 33                 "   sub     %2,   %0      \n\t" /* sub */
 34                 "   mov.l   %0,   @%1     \n\t" /* store new value */
 35                 "1: mov     r1,   r15     \n\t" /* LOGOUT */
 36                 : "=&r" (tmp),
 37                   "+r"  (v)
 38                 : "r"   (i)
 39                 : "memory" , "r0", "r1");
 40 }
 41 
 42 static inline int atomic_add_return(int i, atomic_t *v)
 43 {
 44         int tmp;
 45 
 46         __asm__ __volatile__ (
 47                 "   .align 2              \n\t"
 48                 "   mova    1f,   r0      \n\t" /* r0 = end point */
 49                 "   mov    r15,   r1      \n\t" /* r1 = saved sp */
 50                 "   mov    #-6,   r15     \n\t" /* LOGIN: r15 = size */
 51                 "   mov.l  @%1,   %0      \n\t" /* load  old value */
 52                 "   add     %2,   %0      \n\t" /* add */
 53                 "   mov.l   %0,   @%1     \n\t" /* store new value */
 54                 "1: mov     r1,   r15     \n\t" /* LOGOUT */
 55                 : "=&r" (tmp),
 56                   "+r"  (v)
 57                 : "r"   (i)
 58                 : "memory" , "r0", "r1");
 59 
 60         return tmp;
 61 }
 62 
 63 static inline int atomic_sub_return(int i, atomic_t *v)
 64 {
 65         int tmp;
 66 
 67         __asm__ __volatile__ (
 68                 "   .align 2              \n\t"
 69                 "   mova    1f,   r0      \n\t" /* r0 = end point */
 70                 "   mov    r15,   r1      \n\t" /* r1 = saved sp */
 71                 "   mov    #-6,   r15     \n\t" /* LOGIN: r15 = size */
 72                 "   mov.l  @%1,   %0      \n\t" /* load  old value */
 73                 "   sub     %2,   %0      \n\t" /* sub */
 74                 "   mov.l   %0,   @%1     \n\t" /* store new value */
 75                 "1: mov     r1,   r15     \n\t" /* LOGOUT */
 76                 : "=&r" (tmp),
 77                   "+r"  (v)
 78                 : "r"   (i)
 79                 : "memory", "r0", "r1");
 80 
 81         return tmp;
 82 }
 83 
 84 static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
 85 {
 86         int tmp;
 87         unsigned int _mask = ~mask;
 88 
 89         __asm__ __volatile__ (
 90                 "   .align 2              \n\t"
 91                 "   mova    1f,   r0      \n\t" /* r0 = end point */
 92                 "   mov    r15,   r1      \n\t" /* r1 = saved sp */
 93                 "   mov    #-6,   r15     \n\t" /* LOGIN: r15 = size */
 94                 "   mov.l  @%1,   %0      \n\t" /* load  old value */
 95                 "   and     %2,   %0      \n\t" /* add */
 96                 "   mov.l   %0,   @%1     \n\t" /* store new value */
 97                 "1: mov     r1,   r15     \n\t" /* LOGOUT */
 98                 : "=&r" (tmp),
 99                   "+r"  (v)
100                 : "r"   (_mask)
101                 : "memory" , "r0", "r1");
102 }
103 
104 static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
105 {
106         int tmp;
107 
108         __asm__ __volatile__ (
109                 "   .align 2              \n\t"
110                 "   mova    1f,   r0      \n\t" /* r0 = end point */
111                 "   mov    r15,   r1      \n\t" /* r1 = saved sp */
112                 "   mov    #-6,   r15     \n\t" /* LOGIN: r15 = size */
113                 "   mov.l  @%1,   %0      \n\t" /* load  old value */
114                 "   or      %2,   %0      \n\t" /* or */
115                 "   mov.l   %0,   @%1     \n\t" /* store new value */
116                 "1: mov     r1,   r15     \n\t" /* LOGOUT */
117                 : "=&r" (tmp),
118                   "+r"  (v)
119                 : "r"   (mask)
120                 : "memory" , "r0", "r1");
121 }
122 
123 #endif /* __ASM_SH_ATOMIC_GRB_H */
124 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp