Ignore:
Timestamp:
Aug 14, 2017, 2:40:49 PM (7 years ago)
Author:
max@…
Message:

Add a panic function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/printk.c

    r337 r372  
    412412}
    413413
     414/////////////////////////////////
     415void _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
    414447////////////////////////////////////
    415448void assert( bool_t       condition,
Note: See TracChangeset for help on using the changeset viewer.