Changeset 603 for trunk/kernel/libk/xlist.h
- Timestamp:
- Dec 3, 2018, 12:17:35 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/xlist.h
r563 r603 25 25 */ 26 26 27 #ifndef _ ALMOS_XLIST_H_28 #define _ ALMOS_XLIST_H_27 #ifndef _XLIST_H_ 28 #define _XLIST_H_ 29 29 30 30 #include <kernel_config.h> … … 81 81 **************************************************************************/ 82 82 83 #define XLIST_FIRST( root_xp , type , member ) \84 ({ xptr_t __first = hal_remote_l64( root_xp ); 83 #define XLIST_FIRST( root_xp , type , member ) \ 84 ({ xptr_t __first = hal_remote_l64( root_xp ); \ 85 85 XLIST_ELEMENT( __first , type , member ); }) 86 86 … … 95 95 **************************************************************************/ 96 96 97 #define XLIST_LAST( root_xp , type , member ) \98 ({ xptr_t __last = hal_remote_l64( root_xp + 8); \97 #define XLIST_LAST( root_xp , type , member ) \ 98 ({ xptr_t __last = hal_remote_l64( root_xp + sizeof(xptr_t) ); \ 99 99 XLIST_ELEMENT( __last , type , member ); }) 100 100 … … 118 118 **************************************************************************/ 119 119 120 #define XLIST_FOREACH_BACKWARD( root_xp , iter_xp ) \121 for( (iter_xp) = hal_remote_l64( (root_xp) + 8 ) ;\122 (iter_xp) != (root_xp) ; \123 (iter_xp) = hal_remote_l64( (iter_xp) + 8) )120 #define XLIST_FOREACH_BACKWARD( root_xp , iter_xp ) \ 121 for( (iter_xp) = hal_remote_l64( (root_xp) + sizeof(xptr_t) ) ; \ 122 (iter_xp) != (root_xp) ; \ 123 (iter_xp) = hal_remote_l64( (iter_xp) + sizeof(xptr_t) ) ) 124 124 125 125 /*************************************************************************** … … 156 156 157 157 // get ref->pred 158 xptr_t ref_pred = (xptr_t)hal_remote_l64( ref + 8);158 xptr_t ref_pred = (xptr_t)hal_remote_l64( ref + sizeof(xptr_t) ); 159 159 160 160 // test if list is empty or ref is the first element … … 171 171 static inline void xlist_root_init( xptr_t root_xp ) 172 172 { 173 hal_remote_s64( root_xp, root_xp );174 hal_remote_s64( root_xp+8, root_xp );173 hal_remote_s64( root_xp , root_xp ); 174 hal_remote_s64( root_xp + sizeof(xptr_t) , root_xp ); 175 175 } 176 176 … … 182 182 static inline void xlist_entry_init( xptr_t entry_xp ) 183 183 { 184 hal_remote_s64( entry_xp, 0 );185 hal_remote_s64( entry_xp+8, 0 );184 hal_remote_s64( entry_xp , 0 ); 185 hal_remote_s64( entry_xp + sizeof(xptr_t) , 0 ); 186 186 } 187 187 … … 206 206 207 207 // entry.pred <= root 208 hal_remote_s64( entry + 8, (uint64_t)root );208 hal_remote_s64( entry + sizeof(xptr_t) , (uint64_t)root ); 209 209 210 210 // first.pred <= new 211 hal_remote_s64( first + 8, (uint64_t)entry );211 hal_remote_s64( first + sizeof(xptr_t) , (uint64_t)entry ); 212 212 } 213 213 … … 223 223 { 224 224 // get the extended pointer on the last element in list 225 xptr_t last = (xptr_t)hal_remote_l64( root + 8);225 xptr_t last = (xptr_t)hal_remote_l64( root + sizeof(xptr_t) ); 226 226 227 227 // update root.pred <= entry 228 hal_remote_s64( root + 8, (uint64_t)entry );228 hal_remote_s64( root + sizeof(xptr_t) , (uint64_t)entry ); 229 229 230 230 // update entry.pred <= last 231 hal_remote_s64( entry + 8, (uint64_t)last );231 hal_remote_s64( entry + sizeof(xptr_t) , (uint64_t)last ); 232 232 233 233 // entry.next <= root … … 262 262 xlist_entry_t entry; 263 263 hal_remote_memcpy( XPTR( local_cxy , &entry ) , 264 265 264 xp , 265 sizeof(xlist_entry_t) ); 266 266 267 267 xptr_t next = entry.next; … … 272 272 273 273 // update next.pred <= pred 274 hal_remote_s64( next + 8, (uint64_t)pred );274 hal_remote_s64( next + sizeof(xptr_t) , (uint64_t)pred ); 275 275 } 276 276 … … 298 298 299 299 // update new.pred <= pred 300 hal_remote_s64( new + 8, (uint64_t)pred );300 hal_remote_s64( new + sizeof(xptr_t) , (uint64_t)pred ); 301 301 302 302 // update pred.next <= new … … 304 304 305 305 // update next.pred <= new 306 hal_remote_s64( next + 8, (uint64_t)new );307 } 308 309 #endif /* _ ALMOS_LIST_H_ */306 hal_remote_s64( next + sizeof(xptr_t) , (uint64_t)new ); 307 } 308 309 #endif /* _XLIST_H_ */
Note: See TracChangeset
for help on using the changeset viewer.