Changeset 564 for trunk/kernel/kern/printk.c
- Timestamp:
- Oct 4, 2018, 11:47:36 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/printk.c
r502 r564 26 26 #include <hal_special.h> 27 27 #include <dev_txt.h> 28 #include <remote_ spinlock.h>28 #include <remote_busylock.h> 29 29 #include <cluster.h> 30 30 #include <thread.h> … … 201 201 // @ args : va_list of arguments. 202 202 ////////////////////////////////////////////////////////////////////////////////////// 203 static void kernel_printf( c har* format,204 va_list * args )203 static void kernel_printf( const char * format, 204 va_list * args ) 205 205 { 206 206 … … 352 352 { 353 353 va_list args; 354 reg_t save_sr;355 354 356 355 // get pointers on TXT0 chdev … … 359 358 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 360 359 361 // get extended pointer on remote TXT0 chdevlock360 // get extended pointer on remote TXT0 lock 362 361 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 363 362 364 // get TXT0 lock in busy waiting mode365 remote_ spinlock_lock_busy( lock_xp , &save_sr);366 367 // call kernel_printf on TXT0,in busy waiting mode363 // get TXT0 lock 364 remote_busylock_acquire( lock_xp ); 365 366 // display format on TXT0 in busy waiting mode 368 367 va_start( args , format ); 369 368 kernel_printf( format , &args ); 370 369 va_end( args ); 371 370 372 // release lock373 remote_ spinlock_unlock_busy( lock_xp , save_sr);371 // release TXT0 lock 372 remote_busylock_release( lock_xp ); 374 373 } 375 374 … … 386 385 387 386 //////////////////////////////////// 388 void __panic( const char * file_name,389 390 391 392 393 387 void panic( const char * file_name, 388 const char * function_name, 389 uint32_t line, 390 cycle_t cycle, 391 const char * format, 392 ... ) 394 393 { 395 394 // get pointers on TXT0 chdev … … 399 398 400 399 // 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 mode404 {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",400 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 401 402 // get TXT0 lock 403 remote_busylock_acquire( lock_xp ); 404 405 // get calling thread 406 thread_t * current = CURRENT_THREAD; 407 408 // print generic infos 409 nolock_printk( 410 "\n[PANIC] in %s: line %d | function %s | cycle %d\n" 411 "core[%x,%d] | thread %x (%x) in process %x (%x)\n", 413 412 file_name, line, function_name, (uint32_t) cycle, 414 local_cxy, current->core->lid, current->trdid, current->process->pid,415 current , current->process);416 417 // call kernel_printf on TXT0, in busy waiting to print format 418 va_list args;419 va_start(args, format);420 kernel_printf(format, &args);421 va_end(args);422 423 // release TXT0 lock 424 remote_spinlock_unlock_busy(lock_txt0_xp, save_sr);425 }413 local_cxy, current->core->lid, 414 current->trdid, current, 415 current->process->pid, current->process ); 416 417 // call kernel_printf to print format 418 va_list args; 419 va_start(args, format); 420 kernel_printf(format, &args); 421 va_end(args); 422 423 // release TXT0 lock 424 remote_busylock_release( lock_xp ); 426 425 427 426 // suicide … … 432 431 void puts( char * string ) 433 432 { 434 uint32_t save_sr;435 433 uint32_t n = 0; 436 434 … … 443 441 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 444 442 445 // get extended pointer on remote TXT0 chdevlock443 // get extended pointer on remote TXT0 lock 446 444 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 447 445 448 // get TXT0 lock in busy waiting mode449 remote_ spinlock_lock_busy( lock_xp , &save_sr);446 // get TXT0 lock 447 remote_busylock_acquire( lock_xp ); 450 448 451 449 // display string on TTY0 452 450 dev_txt_sync_write( string , n ); 453 451 454 // release TXT0 lock in busy waiting mode455 remote_ spinlock_unlock_busy( lock_xp , save_sr);452 // release TXT0 lock 453 remote_busylock_release( lock_xp ); 456 454 } 457 455 … … 464 462 char buf[10]; 465 463 uint32_t c; 466 uint32_t save_sr;467 464 468 465 buf[0] = '0'; … … 484 481 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 485 482 486 // get TXT0 lock in busy waiting mode487 remote_ spinlock_lock_busy( lock_xp , &save_sr);483 // get TXT0 lock 484 remote_busylock_acquire( lock_xp ); 488 485 489 486 // display string on TTY0 490 487 dev_txt_sync_write( buf , 10 ); 491 488 492 // release TXT0 lock in busy waiting mode493 remote_ spinlock_unlock_busy( lock_xp , save_sr);489 // release TXT0 lock 490 remote_busylock_release( lock_xp ); 494 491 } 495 492 … … 501 498 char buf[18]; 502 499 uint32_t c; 503 uint32_t save_sr;504 500 505 501 buf[0] = '0'; … … 521 517 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 522 518 523 // get TXT0 lock in busy waiting mode524 remote_ spinlock_lock_busy( lock_xp , &save_sr);519 // get TXT0 lock 520 remote_busylock_acquire( lock_xp ); 525 521 526 522 // display string on TTY0 527 523 dev_txt_sync_write( buf , 18 ); 528 524 529 // release TXT0 lock in busy waiting mode530 remote_ spinlock_unlock_busy( lock_xp , save_sr);525 // release TXT0 lock 526 remote_busylock_release( lock_xp ); 531 527 } 532 528
Note: See TracChangeset
for help on using the changeset viewer.