Changeset 409 for trunk/kernel/libk/remote_spinlock.c
- Timestamp:
- Dec 20, 2017, 4:51:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_spinlock.c
r408 r409 38 38 39 39 hal_remote_sw ( XPTR( cxy , &ptr->taken ) , 0 ); 40 41 #if CONFIG_LOCKS_CONFIG 40 42 hal_remote_swd( XPTR( cxy , &ptr->owner ) , XPTR_NULL ); 41 43 xlist_entry_init( XPTR( cxy , &ptr->list ) ); 44 #endif 45 42 46 } 43 47 … … 52 56 cxy_t lock_cxy = GET_CXY( lock_xp ); 53 57 54 // get cluster and local pointer on local thread 55 cxy_t thread_cxy = local_cxy; 58 // get local pointer on local thread 56 59 thread_t * thread_ptr = CURRENT_THREAD; 57 60 … … 73 76 thread_ptr->remote_locks++; 74 77 78 #if CONFIG_LOCKS_DEBUG 75 79 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , 76 (uint64_t)XPTR( thread_cxy , thread_ptr) );77 78 xlist_add_first( XPTR( thread_cxy , &thread_ptr->xlocks_root ) ,79 XPTR( lock_cxy , &lock_ptr->list ) ); 80 XPTR( thread_cxy , thread_ptr) ); 81 xlist_add_first( XPTR( local_cxy , &thread_ptr->xlocks_root ) , 82 XPTR( lock_cxy , &lock_ptr->list ) ); 83 #endif 80 84 81 85 hal_restore_irq(mode); … … 96 100 cxy_t lock_cxy = GET_CXY( lock_xp ); 97 101 98 // get cluster and local pointer on local thread 99 cxy_t thread_cxy = local_cxy; 102 // get local pointer on local thread 100 103 thread_t * thread_ptr = CURRENT_THREAD; 101 104 … … 118 121 thread_ptr->remote_locks++; 119 122 120 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , 121 (uint64_t)XPTR( thread_cxy , thread_ptr) ); 122 123 xlist_add_first( XPTR( thread_cxy , &thread_ptr->xlocks_root ) , 124 XPTR( lock_cxy , &lock_ptr->list ) ); 123 #if CONFIG_LOCKS_DEBUG 124 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , 125 XPTR( local_cxy , thread_ptr) ); 126 xlist_add_first( XPTR( local_cxy , &thread_ptr->xlocks_root ) , 127 XPTR( lock_cxy , &lock_ptr->list ) ); 128 #endif 125 129 126 130 // irq_state must be restored when lock is released … … 140 144 thread_t * thread_ptr = CURRENT_THREAD; 141 145 146 #if CONFIG_LOCKS_DEBUG 142 147 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , XPTR_NULL ); 148 xlist_unlink( XPTR( lock_cxy , &lock_ptr->list ) ); 149 #endif 150 143 151 hal_remote_sw ( XPTR( lock_cxy , &lock_ptr->taken ) , 0 ); 144 152 thread_ptr->remote_locks--; 145 xlist_unlink( XPTR( lock_cxy , &lock_ptr->list ) );146 153 147 154 // deschedule if pending request … … 163 170 cxy_t lock_cxy = GET_CXY( lock_xp ); 164 171 165 // get cluster and local pointer on calling thread 166 cxy_t thread_cxy = local_cxy; 172 // get local pointer on calling thread 167 173 thread_t * thread_ptr = CURRENT_THREAD; 168 174 … … 191 197 thread_ptr->remote_locks++; 192 198 193 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , 194 (uint64_t)XPTR( thread_cxy , thread_ptr) ); 195 196 xlist_add_first( XPTR( thread_cxy , &thread_ptr->xlocks_root ) , 197 XPTR( lock_cxy , &lock_ptr->list ) ); 199 #if CONFIG_LOCKS_DEBUG 200 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , 201 XPTR( local_cxy , thread_ptr) ); 202 xlist_add_first( XPTR( local_cxy , &thread_ptr->xlocks_root ) , 203 XPTR( lock_cxy , &lock_ptr->list ) ); 204 #endif 198 205 199 206 // enable interrupts … … 211 218 thread_t * thread_ptr = CURRENT_THREAD; 212 219 220 #if CONFIG_LOCKS_DEBUG 213 221 hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , XPTR_NULL ); 222 xlist_unlink( XPTR( lock_cxy , &lock_ptr->list ) ); 223 #endif 224 214 225 hal_remote_sw ( XPTR( lock_cxy , &lock_ptr->taken ) , 0 ); 215 226 thread_ptr->remote_locks--; 216 xlist_unlink( XPTR( lock_cxy , &lock_ptr->list ) );217 227 218 228 // deschedule if pending request … … 220 230 } 221 231 222 //////////////////////////////////////////////223 xptr_t remote_spinlock_owner( xptr_t lock_xp )224 {225 // get cluster and local pointer on remote_spinlock226 remote_spinlock_t * lock_ptr = (remote_spinlock_t *)GET_PTR( lock_xp );227 cxy_t lock_cxy = GET_CXY( lock_xp );228 229 return hal_remote_lw( XPTR( lock_cxy , &lock_ptr->owner ) );230 }
Note: See TracChangeset
for help on using the changeset viewer.