Changeset 204 for trunk/kernel/mm/mapper.c
- Timestamp:
- Jul 17, 2017, 8:42:59 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/mapper.c
r183 r204 88 88 89 89 return mapper; 90 } 90 91 } // end mapper_create() 91 92 92 93 /////////////////////////////////////////// … … 127 128 128 129 return 0; 129 } 130 131 } // end mapper_destroy() 130 132 131 133 //////////////////////////////////////////// … … 137 139 error_t error; 138 140 141 mapper_dmsg("\n[INFO] %s : enter for page %d / mapper = %x\n", 142 __FUNCTION__ , index , mapper ); 143 139 144 thread_t * this = CURRENT_THREAD; 140 145 … … 148 153 if( ( page == NULL) || page_is_flag( page , PG_INLOAD ) ) // page not available 149 154 { 155 150 156 // release the lock in READ_MODE and take it in WRITE_MODE 151 157 rwlock_rd_unlock( &mapper->lock ); … … 160 166 if ( page == NULL ) // missing page => load it from file system 161 167 { 168 mapper_dmsg("\n[INFO] %s : missing page => load from FS\n", __FUNCTION__ ); 169 162 170 // allocate one page from PPM 163 171 req.type = KMEM_PAGE; … … 237 245 sched_yield(); 238 246 } 239 240 } 241 242 return page; 243 } 244 else 245 { 246 // release lock from READ_MODE 247 rwlock_rd_unlock( &mapper->lock ); 248 249 return page; 250 } 251 } 247 } 248 } 249 else // page available in mapper 250 { 251 252 rwlock_rd_unlock( &mapper->lock ); 253 } 254 255 mapper_dmsg("\n[INFO] %s : exit for page %d / page desc = %x\n", 256 __FUNCTION__ , index , page ); 257 258 return page; 259 260 } // end mapper_get_page() 252 261 253 262 /////////////////////////////////////////////// … … 282 291 283 292 return 0; 284 } 293 294 } // end mapper_release_page() 285 295 286 296 ///////////////////////////////////////// … … 298 308 uint8_t * map_ptr; // current mapper address 299 309 uint8_t * buf_ptr; // current buffer address 310 311 mapper_dmsg("\n[INFO] %s : enter / to_buf = %d / buffer = %x\n", 312 __FUNCTION__ , to_buffer , buffer ); 300 313 301 314 // compute offsets of first and last bytes in file … … 347 360 } 348 361 362 mapper_dmsg("\n[INFO] %s : exit for buffer %x\n", 363 __FUNCTION__, buffer ); 364 349 365 return 0; 350 } 351 366 367 } // end mapper_move() 368
Note: See TracChangeset
for help on using the changeset viewer.