Changeset 337 for trunk/kernel/kern/printk.c
- Timestamp:
- Aug 7, 2017, 12:50:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/printk.c
r296 r337 217 217 218 218 ////////////////////////////////////////////////////////////////////////////////////// 219 // This static function is called by printk() and user_printk() to build219 // This static function is called by printk(), assert() and nolock_printk() to build 220 220 // a formated string. 221 221 ////////////////////////////////////////////////////////////////////////////////////// … … 375 375 } // end kernel_printf() 376 376 377 ///////////////////////////////// 378 void printk( char * format , ... )377 ////////////////////////////////// 378 void printk( char * format , ... ) 379 379 { 380 380 va_list args; … … 401 401 } 402 402 403 //////////////////////////////////////// 404 void nolock_printk( char * format , ... )403 ///////////////////////////////////////// 404 void nolock_printk( char * format , ... ) 405 405 { 406 406 va_list args; … … 412 412 } 413 413 414 /////////////////////////////////////////// 415 inline void assert( bool_t condition, 416 const char * function_name, 417 char * string ) 418 { 414 //////////////////////////////////// 415 void assert( bool_t condition, 416 const char * function_name, 417 char * format, ... ) 418 { 419 va_list args; 420 uint32_t save_sr; 421 419 422 if( condition == false ) 420 423 { 421 printk("\n[PANIC] in %s : %s\n" , function_name , string ); 424 // get pointers on TXT0 chdev 425 xptr_t txt0_xp = chdev_dir.txt[0]; 426 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 427 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 428 429 // get extended pointer on remote TXT0 chdev lock 430 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 431 432 // get TXT0 lock in busy waiting mode 433 remote_spinlock_lock_busy( lock_xp , &save_sr ); 434 435 // call nolock_printk to print function_name 436 nolock_printk("\n[PANIC] in %s : " , function_name ); 437 438 // call kernel_printf on TXT0, in busy waiting to print format 439 va_start( args , format ); 440 kernel_printf( 0 , 1 , format , &args ); 441 va_end( args ); 442 443 // release TXT0 lock 444 remote_spinlock_unlock_busy( lock_xp , save_sr ); 445 446 // suicide 422 447 hal_core_sleep(); 423 448 }
Note: See TracChangeset
for help on using the changeset viewer.