Changeset 626 for trunk/kernel/mm
- Timestamp:
- Apr 29, 2019, 7:25:09 PM (6 years ago)
- Location:
- trunk/kernel/mm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/mapper.c
r625 r626 280 280 printk("\n[%s] thread[%x,%x] enter for page %d in <%s> / cycle %d", 281 281 __FUNCTION__, this->process->pid, this->trdid, page_id, name, cycle ); 282 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), name );282 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), name ); 283 283 } 284 284 if( (DEBUG_MAPPER_HANDLE_MISS < cycle) && (inode == NULL) ) … … 286 286 printk("\n[%s] thread[%x,%x] enter for page %d in FAT / cycle %d", 287 287 __FUNCTION__, this->process->pid, this->trdid, page_id, cycle ); 288 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), "FAT" );288 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), "FAT" ); 289 289 } 290 290 #endif … … 324 324 } 325 325 326 // launch I/O operation to load page from device to mapper326 // launch I/O operation to load page from IOC device to mapper 327 327 error = vfs_fs_move_page( XPTR( local_cxy , page ) , IOC_SYNC_READ ); 328 328 … … 401 401 402 402 #if DEBUG_MAPPER_MOVE_USER 403 uint32_t cycle = (uint32_t)hal_get_cycles(); 404 thread_t * this = CURRENT_THREAD; 403 uint32_t cycle = (uint32_t)hal_get_cycles(); 404 thread_t * this = CURRENT_THREAD; 405 cxy_t mapper_cxy = GET_CXY( mapper_xp ); 406 mapper_t * mapper_ptr = GET_PTR( mapper_xp ); 407 vfs_inode_t * inode_ptr = hal_remote_lpt( XPTR( mapper_cxy , &mapper_ptr->inode ) ); 408 xptr_t inode_xp = XPTR( mapper_cxy , inode_ptr ); 409 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 410 vfs_inode_get_name( inode_xp , name ); 405 411 if( DEBUG_MAPPER_MOVE_USER < cycle ) 406 printk("\n[%s] thread[%x,%x] : to_buf %d / buffer %x / size %d / offset %d / cycle %d\n", 407 __FUNCTION__, this->process->pid, this->trdid, 408 to_buffer, buffer, size, file_offset, cycle ); 412 { 413 if( to_buffer ) 414 printk("\n[%s] thread[%x,%x] : mapper(%s) -> buffer(%x) / bytes %d / cycle %d\n", 415 __FUNCTION__, this->process->pid, this->trdid, name, buffer, size, cycle ); 416 else 417 printk("\n[%s] thread[%x,%x] : buffer(%x) -> mapper(%s) / bytes %d / cycle %d\n", 418 __FUNCTION__, this->process->pid, this->trdid, buffer, name, size, cycle ); 419 } 409 420 #endif 410 421 … … 419 430 #if (DEBUG_MAPPER_MOVE_USER & 1) 420 431 if( DEBUG_MAPPER_MOVE_USER < cycle ) 421 printk("\n[%s] thread[%x,%x] : first_page %d / last_page %d\n",422 __FUNCTION__, this->process->pid, this->trdid, first, last );432 printk("\n[%s] thread[%x,%x] : mapper(%x,%x) / first_page %d / last_page %d\n", 433 __FUNCTION__, this->process->pid, this->trdid, mapper_cxy, mapper_ptr, first, last ); 423 434 #endif 424 435 … … 440 451 #if (DEBUG_MAPPER_MOVE_USER & 1) 441 452 if( DEBUG_MAPPER_MOVE_USER < cycle ) 442 printk("\n[%s] thread[%x,%x] : page_id = %d / page_offset = %d / page_count =%d\n",453 printk("\n[%s] thread[%x,%x] : page_id %d / page_offset %d / bytes %d\n", 443 454 __FUNCTION__, this->process->pid, this->trdid, page_id , page_offset , page_count ); 444 455 #endif … … 449 460 if ( page_xp == XPTR_NULL ) return -1; 450 461 462 // compute cluster and pointers on page in mapper 463 xptr_t map_xp = ppm_page2base( page_xp ); 464 uint8_t * map_ptr = GET_PTR( map_xp ); 465 cxy_t map_cxy = GET_CXY( map_xp ); 466 451 467 #if (DEBUG_MAPPER_MOVE_USER & 1) 452 468 if( DEBUG_MAPPER_MOVE_USER < cycle ) 453 printk("\n[%s] thread[%x,%x] : get page (%x,%x) from mapper\n", 454 __FUNCTION__, this->process->pid, this->trdid, GET_CXY(page_xp), GET_PTR(page_xp) ); 455 #endif 456 457 // compute pointer in mapper 458 xptr_t base_xp = ppm_page2base( page_xp ); 459 uint8_t * map_ptr = (uint8_t *)GET_PTR( base_xp ) + page_offset; 460 461 // compute pointer in buffer 469 printk("\n[%s] thread[%x,%x] : get buffer(%x,%x) in mapper\n", 470 __FUNCTION__, this->process->pid, this->trdid, map_cxy, map_ptr ); 471 #endif 472 // compute pointer in user buffer 462 473 uint8_t * buf_ptr = (uint8_t *)buffer + done; 463 474 … … 465 476 if( to_buffer ) 466 477 { 467 hal_copy_to_uspace( buf_ptr , map_ptr , page_count ); 478 hal_copy_to_uspace( map_cxy , map_ptr , buf_ptr , page_count ); 479 480 #if DEBUG_MAPPER_MOVE_USER & 1 481 if( DEBUG_MAPPER_MOVE_USER < cycle ) 482 printk("\n[%s] thread[%x,%x] moved %d bytes / mapper %s (%x,%x) -> user buffer(%x,%x)\n", 483 __FUNCTION__, this->process->pid, this->trdid, page_count, 484 name, map_cxy, map_ptr, local_cxy, buf_ptr ); 485 #endif 486 468 487 } 469 488 else 470 489 { 471 490 ppm_page_do_dirty( page_xp ); 472 hal_copy_from_uspace( map_ptr , buf_ptr , page_count ); 491 hal_copy_from_uspace( map_cxy , map_ptr , buf_ptr , page_count ); 492 493 #if DEBUG_MAPPER_MOVE_USER & 1 494 if( DEBUG_MAPPER_MOVE_USER < cycle ) 495 printk("\n[%s] thread[%x,%x] moved %d bytes / user buffer(%x,%x) -> mapper %s (%x,%x)\n", 496 __FUNCTION__, this->process->pid, this->trdid, page_count, 497 local_cxy, buf_ptr, name, map_cxy, map_ptr ); 498 mapper_display_page( mapper_xp , page_id, 128 ); 499 #endif 500 473 501 } 474 502 … … 477 505 478 506 #if DEBUG_MAPPER_MOVE_USER 479 cycle = (uint32_t)hal_get_cycles();507 cycle = (uint32_t)hal_get_cycles(); 480 508 if( DEBUG_MAPPER_MOVE_USER < cycle ) 481 printk("\n[%s] thread[%x,%x] exit / cycle %d\n", 482 __FUNCTION__, this->process->pid, this->trdid, cycle ); 509 { 510 if( to_buffer ) 511 printk("\n[%s] thread[%x,%x] completed mapper(%s) -> buffer(%x) / cycle %d\n", 512 __FUNCTION__, this->process->pid, this->trdid, name, buffer, cycle ); 513 else 514 printk("\n[%s] thread[%x,%x] completed buffer(%x) -> mapper(%s) / cycle %d\n", 515 __FUNCTION__, this->process->pid, this->trdid, buffer, name, cycle ); 516 } 483 517 #endif 484 518 … … 717 751 #if DEBUG_MAPPER_SYNC 718 752 if( cycle > DEBUG_MAPPER_SYNC ) 719 printk("\n[%s] thread[%x,%x] synchonise page %d of <%s> to device\n",753 printk("\n[%s] thread[%x,%x] synchonise page %d of <%s> to IOC device\n", 720 754 __FUNCTION__, this->process->pid, this->trdid, page->index, name ); 721 755 #endif … … 804 838 // display 8 words per line 805 839 tabi = (uint32_t *)buffer; 806 printk("\n***** <%s> first %d bytes of page %d *****\n", name, nbytes, page_id ); 840 printk("\n***** mapper <%s> / %d bytes in page %d (%x,%x)\n", 841 name, nbytes, page_id, GET_CXY(base_xp), GET_PTR(base_xp) ); 807 842 for( line = 0 ; line < (nbytes >> 5) ; line++ ) 808 843 { -
trunk/kernel/mm/mapper.h
r625 r626 62 62 * and the allocated memory is only released when the mapper/inode is destroyed. 63 63 * 64 * TODO : the mapper being only used to implement the VFS cache(s), the mapper.c 65 * and mapper.h file should be trandfered to the fs directory. 64 * TODO (1) the mapper being only used to implement the VFS cache(s), the mapper.c 65 * and mapper.h file should be trandfered to the fs directory. 66 * TODO (2) the "type" field is probably unused... 66 67 ******************************************************************************************/ 67 68 … … 230 231 231 232 /******************************************************************************************* 232 * This scansall pages present in the mapper identified by the <mapper> argument,233 * This function scan all pages present in the mapper identified by the <mapper> argument, 233 234 * and synchronize all pages maked as dirty" on disk. 234 235 * These pages are unmarked and removed from the local PPM dirty_list.
Note: See TracChangeset
for help on using the changeset viewer.