Changeset 709 for soft/giet_vm/giet_common/kernel_locks.c
- Timestamp:
- Oct 1, 2015, 4:20:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_common/kernel_locks.c
r632 r709 70 70 : "r" (ptr), "r" (mask) 71 71 : "$10", "$11", "$12", "memory" ); 72 } 73 74 ///////////////////////////////////////////////////// 75 unsigned int _atomic_test_and_set( unsigned int* ptr, 76 unsigned int value ) 77 { 78 unsigned int ret = 1; 79 80 asm volatile ( 81 "ori %0, $0, 1 \n" /* default : ret <= 1 */ 82 "move $10, %1 \n" /* $10 <= ptr */ 83 "move $11, %2 \n" /* $11 <= value */ 84 "ll $12, 0($10) \n" /* $12 <= *ptr */ 85 "bne $12, $0, 1515f \n" /* return 1 if non zero */ 86 "sc $11, 0($10) \n" /* *ptr <= $12 */ 87 "beqz $11, 1515f \n" /* return 1 if failure */ 88 "ori %0, $0, 0 \n" /* success : ret <= 0 */ 89 "1515: \n" 90 : "=r" (ret) 91 : "r" (ptr), "r" (value) 92 : "$10", "$11", "$12", "memory" ); 93 94 return ret; 72 95 } 73 96
Note: See TracChangeset
for help on using the changeset viewer.