- Timestamp:
- Aug 14, 2017, 2:40:49 PM (7 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/printk.c
r337 r372 412 412 } 413 413 414 ///////////////////////////////// 415 void _panic( char * format , ... ) 416 { 417 va_list args; 418 uint32_t save_sr; 419 420 // get pointers on TXT0 chdev 421 xptr_t txt0_xp = chdev_dir.txt[0]; 422 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 423 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 424 425 // get extended pointer on remote TXT0 chdev lock 426 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 427 428 // get TXT0 lock in busy waiting mode 429 remote_spinlock_lock_busy( lock_xp , &save_sr ); 430 431 // call kernel_printf on TXT0, in busy waiting mode 432 va_start( args , format ); 433 kernel_printf( 0 , 1 , format , &args ); 434 va_end( args ); 435 436 // release lock 437 remote_spinlock_unlock_busy( lock_xp , save_sr ); 438 439 hal_disable_irq( NULL ); 440 441 while (1) 442 { 443 hal_core_sleep(); 444 } 445 } 446 414 447 //////////////////////////////////// 415 448 void assert( bool_t condition, -
trunk/kernel/kern/printk.h
r367 r372 1 1 /* 2 2 * printk.h - Kernel Log & debug messages API definition. 3 * 3 * 4 4 * authors Alain Greiner (2016) 5 5 * … … 24 24 /////////////////////////////////////////////////////////////////////////////////// 25 25 // The printk.c and printk.h files define the functions used by the kernel 26 // to display messages on a text terminal. 26 // to display messages on a text terminal. 27 27 // Two access modes are supported: 28 28 // - The printk() function displays kernel messages on the kernel terminal TXT0, 29 // using a busy waiting policy: It calls directly the relevant TXT driver, 29 // using a busy waiting policy: It calls directly the relevant TXT driver, 30 30 // after taking the TXT0 chdev lock for exclusive access to the TXT0 terminal. 31 31 // - The user_printk() function displays messages on the calling thread private 32 32 // terminal, using a descheduling policy: it register the request in the selected 33 // TXT chdev waiting queue and deschedule. The calling thread is reactivated by 34 // the IRQ signal ing completion.33 // TXT chdev waiting queue and deschedule. The calling thread is reactivated by 34 // the IRQ signalling completion. 35 35 // Both functions use the generic TXT device to call the proper implementation 36 36 // dependant TXT driver. 37 // Finally these files define a set of condition nal trace <***_dmsg> for debug.37 // Finally these files define a set of conditional trace <***_dmsg> for debug. 38 38 /////////////////////////////////////////////////////////////////////////////////// 39 39 … … 46 46 47 47 /********************************************************************************** 48 * This function build a format ed string.48 * This function build a formatted string. 49 49 * The supported formats are defined below : 50 50 * %c : single character … … 65 65 66 66 /********************************************************************************** 67 * This function displays a format ed string on the kernel terminal TXT0,68 * using a busy waiting policy: It calls directly the relevant TXT driver, 67 * This function displays a formatted string on the kernel terminal TXT0, 68 * using a busy waiting policy: It calls directly the relevant TXT driver, 69 69 * after taking the TXT0 lock. 70 70 ********************************************************************************** 71 * @ format : format ed string.71 * @ format : formatted string. 72 72 *********************************************************************************/ 73 73 void printk( char* format, ... ); 74 74 75 75 /********************************************************************************** 76 * This function displays a format ed string on the kernel terminal TXT0,77 * using a busy waiting policy: It calls directly the relevant TXT driver, 76 * This function displays a formatted string on the kernel terminal TXT0, 77 * using a busy waiting policy: It calls directly the relevant TXT driver, 78 78 * without taking the TXT0 lock. 79 79 ********************************************************************************** 80 * @ format : format ed string.80 * @ format : formatted string. 81 81 *********************************************************************************/ 82 82 void nolock_printk( char* format, ... ); 83 83 84 84 /********************************************************************************** 85 * This function displays a "PANIC" message and force the calling core in 85 * This function displays a message and forces the calling core in sleeping mode. 86 ********************************************************************************** 87 * @ format : formatted string 88 *********************************************************************************/ 89 void _panic( char* format, ... ); 90 91 /********************************************************************************** 92 * This function displays a "PANIC" message and forces the calling core in 86 93 * sleeping mode if a Boolean condition is false. 87 94 * These functions are actually used to debug the kernel... … … 89 96 * @ condition : condition that must be true. 90 97 * @ function_name : name of the calling function. 91 * @ format : format ed string98 * @ format : formatted string 92 99 *********************************************************************************/ 93 100 void assert( bool_t condition, … … 95 102 char * format , ... ); 96 103 104 #define panic(fmt, ...) _panic("[PANIC] %s(): " fmt, __func__, ##__VA_ARGS__) 105 97 106 /////////////////////////////////////////////////////////////////////////////////// 98 // Condition nal debug macros107 // Conditional debug macros 99 108 /////////////////////////////////////////////////////////////////////////////////// 100 109 … … 250 259 251 260 #if CONFIG_RPC_DEBUG 252 #define rpc_dmsg(...) if(hal_time_stamp() > CONFIG_RPC_DEBUG) printk(__VA_ARGS__) 261 #define rpc_dmsg(...) if(hal_time_stamp() > CONFIG_RPC_DEBUG) printk(__VA_ARGS__) 253 262 #else 254 263 #define rpc_dmsg(...) … … 292 301 293 302 #if CONFIG_VFS_DEBUG 294 #define vfs_dmsg(...) if(hal_time_stamp() > CONFIG_VFS_DEBUG) printk(__VA_ARGS__) 303 #define vfs_dmsg(...) if(hal_time_stamp() > CONFIG_VFS_DEBUG) printk(__VA_ARGS__) 295 304 #else 296 305 #define vfs_dmsg(...)
Note: See TracChangeset
for help on using the changeset viewer.