Changeset 491 for trunk/kernel/kern/printk.c
- Timestamp:
- Aug 22, 2018, 11:55:11 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/printk.c
r469 r491 386 386 387 387 //////////////////////////////////// 388 void assert( bool_t condition, 389 const char * function_name, 390 char * format, ... ) 391 { 392 va_list args; 393 uint32_t save_sr; 394 395 if( condition == false ) 388 void __panic( const char * file_name, 389 const char * function_name, 390 uint32_t line, 391 cycle_t cycle, 392 char * format, 393 ... ) 394 { 395 // get pointers on TXT0 chdev 396 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 397 cxy_t txt0_cxy = GET_CXY(txt0_xp); 398 chdev_t * txt0_ptr = GET_PTR(txt0_xp); 399 400 // get extended pointer on remote TXT0 lock 401 xptr_t lock_txt0_xp = XPTR(txt0_cxy, &txt0_ptr->wait_lock); 402 403 // get TXT0 lock in busy waiting mode 396 404 { 397 // get pointers on TXT0 chdev 398 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 399 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 400 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 401 402 // get extended pointer on remote TXT0 lock 403 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 404 405 // get TXT0 lock in busy waiting mode 406 remote_spinlock_lock_busy( lock_xp , &save_sr ); 407 408 // call nolock_printk to print core, function_name, and cycle 409 nolock_printk("\n[PANIC] in %s => core[%x,%d] blocked at cycle %d : " , 410 function_name, local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() ); 405 uint32_t save_sr; 406 remote_spinlock_lock_busy(lock_txt0_xp, &save_sr); 407 408 thread_t *current = CURRENT_THREAD; 409 nolock_printk( 410 "\n[PANIC] in %s: line %d | funct %s | cycle %d\n" 411 "core[%x,%d] | thread %x in process %x\n" 412 " | thread_ptr %x | procress_ptr %x\n", 413 file_name, line, function_name, (uint32_t) cycle, 414 local_cxy, current->core->lid, current->trdid, current->process->pid, 415 current, current->process); 411 416 412 417 // call kernel_printf on TXT0, in busy waiting to print format 413 va_start( args , format ); 414 kernel_printf( format , &args ); 415 va_end( args ); 418 va_list args; 419 va_start(args, format); 420 kernel_printf(format, &args); 421 va_end(args); 416 422 417 423 // release TXT0 lock 418 remote_spinlock_unlock_busy( lock_xp , save_sr);419 420 // suicide 421 while( 1 ) asm volatile ("nop");422 }424 remote_spinlock_unlock_busy(lock_txt0_xp, save_sr); 425 } 426 427 // suicide 428 hal_core_sleep(); 423 429 } 424 430
Note: See TracChangeset
for help on using the changeset viewer.