Changeset 563 for trunk/kernel/libk/xlist.h
- Timestamp:
- Oct 4, 2018, 11:16:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/xlist.h
r457 r563 1 1 /* 2 // check calling thread can yield 3 thread_assert_can_yield( this , __FUNCTION__ ); 4 2 5 * xlist.h - Double Circular Linked lists, using extended pointers. 3 6 * … … 78 81 **************************************************************************/ 79 82 80 #define XLIST_FIRST _ELEMENT( root_xp , type , member ) \81 ({ xptr_t __first = hal_remote_l wd( root_xp ); \83 #define XLIST_FIRST( root_xp , type , member ) \ 84 ({ xptr_t __first = hal_remote_l64( root_xp ); \ 82 85 XLIST_ELEMENT( __first , type , member ); }) 83 86 … … 92 95 **************************************************************************/ 93 96 94 #define XLIST_LAST _ELEMENT( root_xp , type , member ) \95 ({ xptr_t __last = hal_remote_l wd( root_xp + 8 ); \97 #define XLIST_LAST( root_xp , type , member ) \ 98 ({ xptr_t __last = hal_remote_l64( root_xp + 8 ); \ 96 99 XLIST_ELEMENT( __last , type , member ); }) 97 100 98 101 /*************************************************************************** 99 102 * This macro traverses an extended double linked list in forward order. 100 * The iter variable should NOT be deleted during traversal.103 * WARNING : the iter variable should NOT be deleted during traversal. 101 104 * @ root_xp : extended pointer on the root xlist_entry_t 102 105 * @ iter_xp : current extended pointer on a xlist_entry_t … … 104 107 105 108 #define XLIST_FOREACH( root_xp , iter_xp ) \ 106 for( (iter_xp) = hal_remote_l wd( root_xp ) ; \109 for( (iter_xp) = hal_remote_l64( root_xp ) ; \ 107 110 (iter_xp) != (root_xp) ; \ 108 (iter_xp) = hal_remote_l wd( iter_xp ) )111 (iter_xp) = hal_remote_l64( iter_xp ) ) 109 112 110 113 /*************************************************************************** 111 114 * This macro traverses an extended double linked list in backward order. 112 * The iter variable should NOT be deleted during traversal.115 * WARNING : the iter variable should NOT be deleted during traversal. 113 116 * @ root_xp : extended pointer on the root xlist_entry_t 114 117 * @ iter_xp : current extended pointer on a xlist_entry_t … … 116 119 117 120 #define XLIST_FOREACH_BACKWARD( root_xp , iter_xp ) \ 118 for( (iter_xp) = hal_remote_l wd( (root_xp) + 8 ) ; \121 for( (iter_xp) = hal_remote_l64( (root_xp) + 8 ) ; \ 119 122 (iter_xp) != (root_xp) ; \ 120 (iter_xp) = hal_remote_l wd( (iter_xp) + 8 ) )123 (iter_xp) = hal_remote_l64( (iter_xp) + 8 ) ) 121 124 122 125 /*************************************************************************** … … 130 133 { 131 134 // get root->next 132 xptr_t root_next = (xptr_t)hal_remote_l wd( root );135 xptr_t root_next = (xptr_t)hal_remote_l64( root ); 133 136 134 137 // get ref->next 135 xptr_t ref_next = (xptr_t)hal_remote_l wd( ref );138 xptr_t ref_next = (xptr_t)hal_remote_l64( ref ); 136 139 137 140 // test if list is empty or ref is the last element … … 150 153 { 151 154 // get root->next 152 xptr_t root_next = (xptr_t)hal_remote_l wd( root );155 xptr_t root_next = (xptr_t)hal_remote_l64( root ); 153 156 154 157 // get ref->pred 155 xptr_t ref_pred = (xptr_t)hal_remote_l wd( ref + 8 );158 xptr_t ref_pred = (xptr_t)hal_remote_l64( ref + 8 ); 156 159 157 160 // test if list is empty or ref is the first element … … 165 168 * The root can be located in any cluster. 166 169 * @ root_xp : extended pointer on the root xlist_entry_t 167 **************************************************************************/170 xixi **************************************************************************/ 168 171 static inline void xlist_root_init( xptr_t root_xp ) 169 172 { 170 hal_remote_s wd( root_xp , root_xp );171 hal_remote_s wd( root_xp+8 , root_xp );173 hal_remote_s64( root_xp , root_xp ); 174 hal_remote_s64( root_xp+8 , root_xp ); 172 175 } 173 176 … … 179 182 static inline void xlist_entry_init( xptr_t entry_xp ) 180 183 { 181 hal_remote_s wd( entry_xp , 0 );182 hal_remote_s wd( entry_xp+8 , 0 );184 hal_remote_s64( entry_xp , 0 ); 185 hal_remote_s64( entry_xp+8 , 0 ); 183 186 } 184 187 … … 194 197 { 195 198 // get the extended pointer on the first element in list 196 xptr_t first = (xptr_t)hal_remote_l wd( root );199 xptr_t first = (xptr_t)hal_remote_l64( root ); 197 200 198 201 // update root.next <= entry 199 hal_remote_s wd( root , (uint64_t)entry );202 hal_remote_s64( root , (uint64_t)entry ); 200 203 201 204 // update entry.next <= first 202 hal_remote_s wd( entry , (uint64_t)first );205 hal_remote_s64( entry , (uint64_t)first ); 203 206 204 207 // entry.pred <= root 205 hal_remote_s wd( entry + 8 , (uint64_t)root );208 hal_remote_s64( entry + 8 , (uint64_t)root ); 206 209 207 210 // first.pred <= new 208 hal_remote_s wd( first + 8 , (uint64_t)entry );211 hal_remote_s64( first + 8 , (uint64_t)entry ); 209 212 } 210 213 … … 220 223 { 221 224 // get the extended pointer on the last element in list 222 xptr_t last = (xptr_t)hal_remote_l wd( root + 8 );225 xptr_t last = (xptr_t)hal_remote_l64( root + 8 ); 223 226 224 227 // update root.pred <= entry 225 hal_remote_s wd( root + 8 , (uint64_t)entry );228 hal_remote_s64( root + 8 , (uint64_t)entry ); 226 229 227 230 // update entry.pred <= last 228 hal_remote_s wd( entry + 8 , (uint64_t)last );231 hal_remote_s64( entry + 8 , (uint64_t)last ); 229 232 230 233 // entry.next <= root 231 hal_remote_s wd( entry , (uint64_t)root );234 hal_remote_s64( entry , (uint64_t)root ); 232 235 233 236 // last.next <= entry 234 hal_remote_s wd( last , (uint64_t)entry );237 hal_remote_s64( last , (uint64_t)entry ); 235 238 } 236 239 … … 243 246 { 244 247 // get the extended pointer root.next value 245 xptr_t next = (xptr_t)hal_remote_l wd( root );248 xptr_t next = (xptr_t)hal_remote_l64( root ); 246 249 247 250 return ( root == next ); … … 266 269 267 270 // update pred.next <= next 268 hal_remote_s wd( pred , (uint64_t)next );271 hal_remote_s64( pred , (uint64_t)next ); 269 272 270 273 // update next.pred <= pred 271 hal_remote_s wd( next + 8 , (uint64_t)pred );274 hal_remote_s64( next + 8 , (uint64_t)pred ); 272 275 } 273 276 … … 292 295 293 296 // update new.next <= next 294 hal_remote_s wd( new , (uint64_t)next );297 hal_remote_s64( new , (uint64_t)next ); 295 298 296 299 // update new.pred <= pred 297 hal_remote_s wd( new + 8 , (uint64_t)pred );300 hal_remote_s64( new + 8 , (uint64_t)pred ); 298 301 299 302 // update pred.next <= new 300 hal_remote_s wd( pred , (uint64_t)new );303 hal_remote_s64( pred , (uint64_t)new ); 301 304 302 305 // update next.pred <= new 303 hal_remote_s wd( next + 8 , (uint64_t)new );306 hal_remote_s64( next + 8 , (uint64_t)new ); 304 307 } 305 308
Note: See TracChangeset
for help on using the changeset viewer.