Changeset 625 for trunk/kernel/mm/mapper.c
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/mapper.c
r624 r625 153 153 154 154 #if DEBUG_MAPPER_GET_PAGE 155 uint32_t cycle = (uint32_t)hal_get_cycles(); 155 vfs_inode_t * inode = hal_remote_lpt( XPTR( mapper_cxy , &mapper_ptr->inode ) ); 156 uint32_t cycle = (uint32_t)hal_get_cycles(); 156 157 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 157 vfs_inode_t * inode = hal_remote_lpt( XPTR( mapper_cxy , &mapper_ptr->inode ) ); 158 vfs_inode_get_name( XPTR( mapper_cxy , inode ) , name ); 159 if( DEBUG_MAPPER_GET_PAGE < cycle ) 160 printk("\n[%s] thread [%x,%x] enter for page %d of <%s> / cycle %d\n", 161 __FUNCTION__, this->process->pid, this->trdid, page_id, name, cycle ); 158 if( (DEBUG_MAPPER_GET_PAGE < cycle) && (inode == NULL) ) // FAT mapper 159 { 160 printk("\n[%s] thread[%x,%x] enter for page %d of FAT mapper / cycle %d\n", 161 __FUNCTION__, this->process->pid, this->trdid, page_id, cycle ); 162 } 163 if( (DEBUG_MAPPER_GET_PAGE < cycle) && (inode != NULL) ) // file mapper 164 { 165 vfs_inode_get_name( XPTR( mapper_cxy , inode ) , name ); 166 printk("\n[%s] thread[%x,%x] enter for page %d of <%s> mapper / cycle %d\n", 167 __FUNCTION__, this->process->pid, this->trdid, page_id, name, cycle ); 168 } 162 169 #endif 163 170 … … 235 242 #if DEBUG_MAPPER_GET_PAGE 236 243 cycle = (uint32_t)hal_get_cycles(); 237 if( DEBUG_MAPPER_GET_PAGE < cycle ) 238 printk("\n[%s] thread[%x,%x] exit for page %d of <%s> / ppn %x / cycle %d\n", 239 __FUNCTION__, this->process->pid, this->trdid, 240 page_id, name, ppm_page2ppn( page_xp ), cycle ); 244 if( (DEBUG_MAPPER_GET_PAGE < cycle) && (inode != NULL) ) 245 { 246 printk("\n[%s] thread[%x,%x] exit for page %d of <%s> mapper / ppn %x / cycle %d\n", 247 __FUNCTION__, this->process->pid, this->trdid, page_id, 248 name, ppm_page2ppn(page_xp), cycle ); 249 } 250 if( (DEBUG_MAPPER_GET_PAGE < cycle) && (inode == NULL) ) 251 { 252 printk("\n[%s] thread[%x,%x] exit for page %d of FAT mapper / ppn %x / cycle %d\n", 253 __FUNCTION__, this->process->pid, this->trdid, page_id, 254 ppm_page2ppn(page_xp), cycle ); 255 } 241 256 #endif 242 257 … … 257 272 258 273 #if DEBUG_MAPPER_HANDLE_MISS 259 uint32_t cycle = (uint32_t)hal_get_cycles();274 uint32_t cycle = (uint32_t)hal_get_cycles(); 260 275 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 261 276 vfs_inode_t * inode = mapper->inode; 262 vfs_inode_get_name( XPTR( local_cxy , inode ) , name ); 263 if( DEBUG_MAPPER_HANDLE_MISS < cycle ) 264 printk("\n[%s] enter for page %d in <%s> / cycle %d", 265 __FUNCTION__, page_id, name, cycle ); 266 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) 267 grdxt_display( XPTR( local_cxy , &mapper->rt ) , name ); 277 if( (DEBUG_MAPPER_HANDLE_MISS < cycle) && (inode != NULL) ) 278 { 279 vfs_inode_get_name( XPTR( local_cxy , inode ) , name ); 280 printk("\n[%s] thread[%x,%x] enter for page %d in <%s> / cycle %d", 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 ); 283 } 284 if( (DEBUG_MAPPER_HANDLE_MISS < cycle) && (inode == NULL) ) 285 { 286 printk("\n[%s] thread[%x,%x] enter for page %d in FAT / cycle %d", 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" ); 289 } 268 290 #endif 269 291 … … 321 343 #if DEBUG_MAPPER_HANDLE_MISS 322 344 cycle = (uint32_t)hal_get_cycles(); 323 if( DEBUG_MAPPER_HANDLE_MISS < cycle ) 324 printk("\n[%s] exit for page %d in <%s> / ppn %x / cycle %d", 325 __FUNCTION__, page_id, name, ppm_page2ppn( *page_xp ), cycle ); 326 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) 327 grdxt_display( XPTR( local_cxy , &mapper->rt ) , name ); 345 if( (DEBUG_MAPPER_HANDLE_MISS < cycle) && (inode != NULL) ) 346 { 347 printk("\n[%s] thread[%x,%x] exit for page %d in <%s> / ppn %x / cycle %d", 348 __FUNCTION__, this->process->pid, this->trdid, 349 page_id, name, ppm_page2ppn( *page_xp ), cycle ); 350 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt) , name ); 351 } 352 if( (DEBUG_MAPPER_HANDLE_MISS < cycle) && (inode == NULL) ) 353 { 354 printk("\n[%s] thread[%x,%x] exit for page %d in FAT / ppn %x / cycle %d", 355 __FUNCTION__, this->process->pid, this->trdid, 356 page_id, ppm_page2ppn( *page_xp ), cycle ); 357 if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt ), "FAT" ); 358 } 328 359 #endif 329 360 … … 482 513 483 514 #if DEBUG_MAPPER_MOVE_KERNEL 484 uint32_t cycle = (uint32_t)hal_get_cycles(); 485 thread_t * this = CURRENT_THREAD; 515 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 516 uint32_t cycle = (uint32_t)hal_get_cycles(); 517 thread_t * this = CURRENT_THREAD; 518 mapper_t * mapper = GET_PTR( mapper_xp ); 519 vfs_inode_t * inode = hal_remote_lpt( XPTR( mapper_cxy , &mapper->inode ) ); 520 vfs_inode_get_name( XPTR( mapper_cxy , inode ) , name ); 486 521 if( DEBUG_MAPPER_MOVE_KERNEL < cycle ) 487 printk("\n[%s] thread[%x,%x] enter / to_buf %d / buf_cxy %x / buf_ptr %x/ cycle %d\n",488 __FUNCTION__, this->process->pid, this->trdid, to_buffer, buffer_cxy, buffer_ptr, cycle );522 printk("\n[%s] thread[%x,%x] enter / %d bytes / offset %d / mapper <%s> / cycle %d\n", 523 __FUNCTION__, this->process->pid, this->trdid, size, file_offset, name, cycle ); 489 524 #endif 490 525 … … 496 531 uint32_t first = min_byte >> CONFIG_PPM_PAGE_SHIFT; 497 532 uint32_t last = max_byte >> CONFIG_PPM_PAGE_SHIFT; 498 499 #if (DEBUG_MAPPER_MOVE_KERNEL & 1)500 if( DEBUG_MAPPER_MOVE_KERNEL < cycle )501 printk("\n[%s] first_page %d / last_page %d\n", __FUNCTION__, first, last );502 #endif503 533 504 534 // compute source and destination clusters … … 528 558 else if ( page_id == last ) page_count = (max_byte & CONFIG_PPM_PAGE_MASK) + 1; 529 559 else page_count = CONFIG_PPM_PAGE_SIZE; 530 531 #if (DEBUG_MAPPER_MOVE_KERNEL & 1)532 if( DEBUG_MAPPER_MOVE_KERNEL < cycle )533 printk("\n[%s] page_id = %d / offset = %d / bytes = %d\n",534 __FUNCTION__ , page_id , page_offset , page_count );535 #endif536 560 537 561 // get extended pointer on page descriptor … … 560 584 #if (DEBUG_MAPPER_MOVE_KERNEL & 1) 561 585 if( DEBUG_MAPPER_MOVE_KERNEL < cycle ) 562 printk("\n[%s] src_cxy %x / src_ptr %x / dst_cxy %x / dst_ptr %x\n", 563 __FUNCTION__, src_cxy, src_ptr, dst_cxy, dst_ptr ); 586 { 587 if( to_buffer ) 588 printk("\n[%s] mapper <%s> page %d => buffer(%x,%x) / %d bytes\n", 589 __FUNCTION__, name, page_id, dst_cxy, dst_ptr, page_count ); 590 else 591 printk("\n[%s] buffer(%x,%x) => mapper <%s> page %d / %d bytes\n", 592 __FUNCTION__, src_cxy, src_ptr, name, page_id, page_count ); 593 } 564 594 #endif 565 595 … … 571 601 572 602 #if DEBUG_MAPPER_MOVE_KERNEL 573 cycle = (uint32_t)hal_get_cycles();603 cycle = (uint32_t)hal_get_cycles(); 574 604 if( DEBUG_MAPPER_MOVE_KERNEL < cycle ) 575 printk("\n[%s] thread[%x,%x] exit / to_buf %d / buf_cxy %x / buf_ptr %x /cycle %d\n",576 __FUNCTION__, this->process->pid, this->trdid, to_buffer, buffer_cxy, buffer_ptr,cycle );605 printk("\n[%s] thread[%x,%x] exit / cycle %d\n", 606 __FUNCTION__, this->process->pid, this->trdid, cycle ); 577 607 #endif 578 608 … … 662 692 663 693 // get pointer on radix tree 664 rt 694 rt = &mapper->rt; 665 695 666 696 // initialise loop variable … … 675 705 if( page == NULL ) break; 676 706 677 assert( (page->index == found_key ), __FUNCTION__,"wrong page descriptor index" );678 assert( (page->order == 0), __FUNCTION__,"mapper page order must be 0" );707 assert( (page->index == found_key ), "wrong page descriptor index" ); 708 assert( (page->order == 0), "mapper page order must be 0" ); 679 709 680 710 // build extended pointer on page descriptor … … 730 760 char buffer[4096]; // local buffer 731 761 uint32_t * tabi; // pointer on uint32_t to scan buffer 732 char * tabc; // pointer on char to scan buffer733 762 uint32_t line; // line index 734 763 uint32_t word; // word index 735 uint32_t n; // char index736 764 cxy_t mapper_cxy; // mapper cluster identifier 737 765 mapper_t * mapper_ptr; // mapper local pointer … … 776 804 // display 8 words per line 777 805 tabi = (uint32_t *)buffer; 778 tabc = (char *)buffer;779 806 printk("\n***** <%s> first %d bytes of page %d *****\n", name, nbytes, page_id ); 780 807 for( line = 0 ; line < (nbytes >> 5) ; line++ ) 781 808 { 782 printk("%X : ", line );809 printk("%X : ", line << 5 ); 783 810 for( word = 0 ; word < 8 ; word++ ) printk("%X ", tabi[(line<<3) + word] ); 784 printk(" | ");785 for( n = 0 ; n < 32 ; n++ ) printk("%c", tabc[(line<<5) + n] );786 811 printk("\n"); 787 812 }
Note: See TracChangeset
for help on using the changeset viewer.