Changeset 432 for trunk/hal/tsar_mips32/core
- Timestamp:
- Feb 14, 2018, 3:39:35 PM (7 years ago)
- Location:
- trunk/hal/tsar_mips32/core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_context.c
r408 r432 41 41 #define SR_USR_MODE 0x0000FF13 42 42 #define SR_USR_MODE_FPU 0x2000FF13 43 #define SR_SYS_MODE 0x0000FF0 043 #define SR_SYS_MODE 0x0000FF01 44 44 45 45 ///////////////////////////////////////////////////////////////////////////////////////// … … 174 174 } 175 175 176 context_dmsg("\n[DBG] %s : thread %x in process %x\n"177 " - a0 = %x\n"178 " - sp = %x\n"179 " - ra = %x\n"180 " - sr = %x\n"181 " - th = %x\n"182 " - epc = %x\n"183 " - ptpr = %x\n"184 " - mode = %x\n",185 __FUNCTION__ , thread->trdid , thread->process->pid,186 context->a0_04, context->sp_29, context->ra_31,187 context->c0_sr, context->c0_th, context->c0_epc,188 context->c2_ptpr, context->c2_mode );189 176 return 0; 190 177 … … 284 271 " c0_sr = %X c0_epc = %X c0_th = %X\n" 285 272 " c2_ptpr = %X c2_mode = %X\n", 286 ptr ->trdid, ptr->process->pid, hal_time_stamp(),273 ptr, ptr->process->pid, (uint32_t)hal_get_cycles(), 287 274 sp_29 , ra_31, 288 275 c0_sr , c0_epc , c0_th, -
trunk/hal/tsar_mips32/core/hal_exception.c
r425 r432 201 201 } 202 202 203 excp_dmsg("\n[DBG] %s : core[%x,%d] / is_ins %d / %s / vaddr %x\n", 204 __FUNCTION__ , local_cxy , this->core->lid , is_ins, 205 hal_mmu_exception_str(excp_code) , bad_vaddr ); 203 #if CONFIG_DEBUG_HAL_EXCEPTIONS 204 uint32_t cycle = (uint32_t)hal_get_cycles(); 205 if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle ) 206 printk("\n[DBG] %s : thread %x enter / is_ins %d / %s / vaddr %x / cycle %d\n", 207 __FUNCTION__, this, is_ins, hal_mmu_exception_str(excp_code), bad_vaddr, cycle ); 208 #endif 206 209 207 210 // analyse exception code … … 226 229 { 227 230 228 excp_dmsg("\n[DBG] %s : core[%x,%d] / page-fault handled for vaddr = %x\n", 229 __FUNCTION__ , local_cxy , this->core->lid , bad_vaddr ); 231 #if CONFIG_DEBUG_HAL_EXCEPTIONS 232 cycle = (uint32_t)hal_get_cycles(); 233 if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle ) 234 printk("\n[DBG] %s : thread %x exit / page-fault handled for vaddr = %x\n", 235 __FUNCTION__ , this , bad_vaddr ); 236 #endif 230 237 231 238 return EXCP_NON_FATAL; … … 261 268 { 262 269 263 excp_dmsg("\n[DBG] %s : core[%x,%d] / copy-on-write handled for vaddr = %x\n", 264 __FUNCTION__ , local_cxy , this->core->lid , bad_vaddr ); 270 #if CONFIG_DEBUG_HAL_EXCEPTIONS 271 cycle = (uint32_t)hal_get_cycles(); 272 if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle ) 273 printk("\n[DBG] %s : thread %x exit / copy-on-write handled for vaddr = %x\n", 274 __FUNCTION__ , this , bad_vaddr ); 275 #endif 265 276 266 277 return EXCP_NON_FATAL; … … 377 388 excCode = (uzone[UZ_CR] >> 2) & 0xF; 378 389 379 excp_dmsg("\n[DBG] %s : core[%x,%d] / thread %x in process %x / xcode %x / cycle %d\n", 380 __FUNCTION__, local_cxy, this->core->lid, this->trdid, 381 this->process->pid, excCode, (uint32_t)hal_get_cycles() ); 390 #if CONFIG_DEBUG_HAL_EXCEPTIONS 391 uint32_t cycle = (uint32_t)hal_get_cycles(); 392 if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle ) 393 printk("\n[DBG] %s : thread %x on core[%x,%d] enter / process %x / xcode %x / cycle %d\n", 394 __FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excCode, cycle ); 395 #endif 382 396 383 397 switch(excCode) … … 434 448 } 435 449 436 excp_dmsg("\n[DBG] %s : core[%x,%d] exit / thread %x in process %x / cycle %d\n", 437 __FUNCTION__, local_cxy, this->core->lid, this->trdid, this->process->pid, 438 (uint32_t)hal_get_cycles() ); 450 #if CONFIG_DEBUG_HAL_EXCEPTIONS 451 cycle = (uint32_t)hal_get_cycles(); 452 if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle ) 453 printk("\n[DBG] %s : thread %x on core[%x,%d] exit / process %x / xcode %x / cycle %d\n", 454 __FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excCode, cycle ); 455 #endif 439 456 440 457 } // end hal_do_exception() -
trunk/hal/tsar_mips32/core/hal_gpt.c
r420 r432 132 132 xptr_t page_xp; 133 133 134 gpt_dmsg("\n[DBG] %s : core[%x,%d] enter\n", 135 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid ); 134 #if CONFIG_DEBUG_GPT_ACCESS 135 uint32_t cycle = (uint32_t)hal_get_cycles; 136 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 137 printk("\n[DBG] %s : thread %x enter / cycle %d\n", 138 __FUNCTION__, CURRENT_THREAD, cycle ); 139 #endif 136 140 137 141 // check page size … … 157 161 gpt->ppn = ppm_page2ppn( page_xp ); 158 162 159 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit\n", 160 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid ); 163 #if CONFIG_DEBUG_GPT_ACCESS 164 cycle = (uint32_t)hal_get_cycles; 165 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 166 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 167 __FUNCTION__, CURRENT_THREAD, cycle ); 168 #endif 161 169 162 170 return 0; … … 332 340 uint32_t tsar_attr; // PTE attributes for TSAR MMU 333 341 334 gpt_dmsg("\n[DBG] %s : core[%x,%d] enter for vpn = %x / ppn = %x / gpt_attr = %x\n", 335 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn , ppn , attr ); 336 342 #if CONFIG_DEBUG_GPT_ACCESS 343 uint32_t cycle = (uint32_t)hal_get_cycles; 344 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 345 printk("\n[DBG] %s : thread %x enter / vpn %x / attr %x / ppn %x / cycle %d\n", 346 __FUNCTION__, CURRENT_THREAD, vpn, attr, ppn, cycle ); 347 #endif 348 337 349 // compute indexes in PT1 and PT2 338 350 ix1 = TSAR_MMU_IX1_FROM_VPN( vpn ); … … 342 354 small = attr & GPT_SMALL; 343 355 344 // compute tsar _attrfrom generic attributes356 // compute tsar attributes from generic attributes 345 357 tsar_attr = gpt2tsar( attr ); 346 358 347 gpt_dmsg("\n[DBG] %s : core[%x,%d] / vpn = %x / &pt1 = %x / tsar_attr = %x\n", 348 __FUNCTION__, local_cxy , CURRENT_THREAD->core->lid , vpn , pt1 , tsar_attr ); 359 #if (CONFIG_DEBUG_GPT_ACCESS & 1) 360 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 361 printk("\n[DBG] %s : thread %x / vpn %x / &pt1 %x / tsar_attr %x\n", 362 __FUNCTION__, CURRENT_THREAD, vpn, pt1, tsar_attr ); 363 #endif 349 364 350 365 // get pointer on PT1[ix1] … … 377 392 pte1 = *pte1_ptr; 378 393 379 gpt_dmsg("\n[DBG] %s : core[%x,%d] / vpn = %x / current_pte1 = %x\n", 380 __FUNCTION__, local_cxy , CURRENT_THREAD->core->lid , vpn , pte1 ); 394 #if (CONFIG_DEBUG_GPT_ACCESS & 1) 395 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 396 printk("\n[DBG] %s : thread %x / vpn %x / current_pte1 %x\n", 397 __FUNCTION__, CURRENT_THREAD, vpn, pte1 ); 398 #endif 381 399 382 400 // allocate a PT2 if PT1 entry not valid … … 419 437 pt2 = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) ); 420 438 421 gpt_dmsg("\n[DBG] %s : core[%x,%d] / vpn = %x / pte1 = %x / &pt2 = %x\n", 422 __FUNCTION__, local_cxy , CURRENT_THREAD->core->lid , vpn , pte1 , pt2 ); 439 #if (CONFIG_DEBUG_GPT_ACCESS & 1) 440 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 441 printk("\n[DBG] %s : thread %x / vpn %x / pte1 %x / &pt2 %x\n", 442 __FUNCTION__, CURRENT_THREAD, vpn, pte1, pt2 ); 443 #endif 423 444 424 445 } … … 431 452 hal_fence(); 432 453 433 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit / vpn = %x / pte2_attr = %x / pte2_ppn = %x\n", 434 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn , 435 pt2[2 * ix2] , pt2[2 * ix2 + 1] ); 436 454 #if CONFIG_DEBUG_GPT_ACCESS 455 cycle = (uint32_t)hal_get_cycles; 456 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 457 printk("\n[DBG] %s : thread %x exit / vpn %x / pte2_attr %x / pte2_ppn %x / cycle %d\n", 458 __FUNCTION__, CURRENT_THREAD, vpn, pt2[2 * ix2], pt2[2 * ix2 + 1], cycle ); 459 #endif 460 437 461 return 0; 438 462 … … 738 762 ppn_t dst_pt2_ppn; 739 763 740 gpt_dmsg("\n[DBG] %s : core[%x,%d] enter for vpn %x\n", 741 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn ); 764 #if CONFIG_DEBUG_GPT_ACCESS 765 uint32_t cycle = (uint32_t)hal_get_cycles; 766 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 767 printk("\n[DBG] %s : thread %x enter / vpn %x / cycle %d\n", 768 __FUNCTION__, CURRENT_THREAD, vpn, cycle ); 769 #endif 742 770 743 771 // get remote src_gpt cluster and local pointer … … 825 853 *ppn = src_pte2_ppn; 826 854 827 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit for vpn %x / copy done\n", 828 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn ); 855 #if CONFIG_DEBUG_GPT_ACCESS 856 cycle = (uint32_t)hal_get_cycles; 857 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 858 printk("\n[DBG] %s : thread %x exit / copy done for vpn %x / cycle %d\n", 859 __FUNCTION__, CURRENT_THREAD, vpn, cycle ); 860 #endif 829 861 830 862 hal_fence(); … … 837 869 *mapped = false; 838 870 *ppn = 0; 839 840 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit for vpn %x / nothing done\n", 841 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn ); 871 872 #if CONFIG_DEBUG_GPT_ACCESS 873 cycle = (uint32_t)hal_get_cycles; 874 if( CONFIG_DEBUG_GPT_ACCESS < cycle ) 875 printk("\n[DBG] %s : thread %x exit / nothing done for vpn %x / cycle %d\n", 876 __FUNCTION__, CURRENT_THREAD, vpn, cycle ); 877 #endif 842 878 843 879 hal_fence(); … … 918 954 919 955 ///////////////////////////////////////// 920 void hal_gpt_flip_cow( bool_t set_cow, 921 xptr_t gpt_xp, 922 vpn_t vpn_base, 923 vpn_t vpn_size ) 956 void hal_gpt_set_cow( xptr_t gpt_xp, 957 vpn_t vpn_base, 958 vpn_t vpn_size ) 924 959 { 925 960 cxy_t gpt_cxy; … … 936 971 uint32_t * pt2; 937 972 ppn_t pt2_ppn; 938 939 uint32_t old_attr; 940 uint32_t new_attr; 973 uint32_t attr; 941 974 942 975 // get GPT cluster and local pointer … … 967 1000 968 1001 // get current PTE2 attributes 969 old_attr = hal_remote_lw( XPTR( gpt_cxy , &pt2[2*ix2] ) );1002 attr = hal_remote_lw( XPTR( gpt_cxy , &pt2[2*ix2] ) ); 970 1003 971 1004 // only MAPPED PTEs are modified 972 if( old_attr & TSAR_MMU_MAPPED )1005 if( attr & TSAR_MMU_MAPPED ) 973 1006 { 974 if( (set_cow != 0) && (old_attr & TSAR_MMU_WRITABLE) ) 975 { 976 new_attr = (old_attr | TSAR_MMU_COW) & (~TSAR_MMU_WRITABLE); 977 hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , new_attr ); 978 } 979 if( (set_cow == 0) && (old_attr & TSAR_MMU_COW ) ) 980 { 981 new_attr = (old_attr | TSAR_MMU_WRITABLE) & (~TSAR_MMU_COW); 982 hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , new_attr ); 983 } 984 } // end if PTE2 mapped 985 } // end if PTE1 mapped 1007 attr = (attr | TSAR_MMU_COW) & (~TSAR_MMU_WRITABLE); 1008 hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , attr ); 1009 } 1010 } 986 1011 } // end loop on pages 987 1012 988 } // end hal_gpt_ flip_cow()1013 } // end hal_gpt_set_cow() 989 1014 990 1015 ////////////////////////////////////////// -
trunk/hal/tsar_mips32/core/hal_interrupt.c
r408 r432 34 34 35 35 irq_dmsg("\n[DBG] %s : core[%x,%d] enter at cycle %d\n", 36 __FUNCTION__ , local_cxy , this->core->lid , hal_time_stamp() );36 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 37 37 38 38 // As ALMOS-MKH does not define a generic interrupt handler, … … 41 41 42 42 irq_dmsg("\n[DBG] %s : core[%x,%d] exit at cycle %d\n", 43 __FUNCTION__ , local_cxy , this->core->lid , hal_time_stamp() );43 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 44 44 45 45 } -
trunk/hal/tsar_mips32/core/hal_kentry.S
r425 r432 200 200 mtc0 $3, $12 # set new c0_sr 201 201 202 #----------------------- 203 #if CONFIG_ KENTRY_DEBUG202 #-------------------------- 203 #if CONFIG_DEBUG_HAL_KENTRY 204 204 205 205 # display "enter" message … … 349 349 sw $5, 8($4) # current uzone pointer <= previous 350 350 351 #---------------------- 352 #if CONFIG_ KENTRY_DEBUG351 #-------------------------- 352 #if CONFIG_DEBUG_HAL_KENTRY 353 353 354 354 # display "exit" message -
trunk/hal/tsar_mips32/core/hal_ppm.c
r409 r432 43 43 // This hal_ppm_init() function initializes the pages_tbl[] array used by the generic 44 44 // kmem memory allocator in the local cluster. This array starts in first free page 45 // after kernel code, as defined by the ' offset' field in boot_info.45 // after kernel code, as defined by the 'pages_offset' field in boot_info. 46 46 ////////////////////////////////////////////////////////////////////////////////////////// 47 47 … … 101 101 } 102 102 103 // printk("\n@@@ in %s : reserved = %d / total = %d\n", __FUNCTION__, reserved_pages, pages_nr ); 104 103 105 // - set PG_RESERVED flag for reserved pages (kernel code & pages_tbl[]) 104 106 // - release all other pages to populate the free lists … … 112 114 113 115 // TODO optimisation : decompose this enormous set of small pages 114 // to several sets of big pages with various order values 116 // to several sets of big pages with various order values [AG] 117 118 // if( (i < (reserved_pages+10)) || (i > (pages_nr-5)) ) ppm_print(); 119 115 120 } 116 121 122 // assert( false , __FUNCTION__ , "PMM init completed\n"); 123 117 124 // check consistency 118 125 return ppm_assert_order( ppm );
Note: See TracChangeset
for help on using the changeset viewer.