* Gets lock, spins until lock is taken * * @param lock pointer to lock structure */
| 158 | * @param lock pointer to lock structure |
| 159 | */ |
| 160 | static inline void cvmx_spinlock_lock(cvmx_spinlock_t *lock) |
| 161 | { |
| 162 | unsigned int tmp; |
| 163 | |
| 164 | __asm__ __volatile__( |
| 165 | ".set noreorder \n" |
| 166 | "1: ll %[tmp], %[val] \n" |
| 167 | " bnez %[tmp], 1b \n" |
| 168 | " li %[tmp], 1 \n" |
| 169 | " sc %[tmp], %[val] \n" |
| 170 | " beqz %[tmp], 1b \n" |
| 171 | " nop \n" |
| 172 | ".set reorder \n" |
| 173 | : [val] "+m" (lock->value), [tmp] "=&r" (tmp) |
| 174 | : |
| 175 | : "memory"); |
| 176 | |
| 177 | } |
| 178 | |
| 179 | |
| 180 |
no outgoing calls
no test coverage detected