Changeset 408 for trunk/kernel/devices


Ignore:
Timestamp:
Dec 5, 2017, 4:20:07 PM (6 years ago)
Author:
alain
Message:

Fix several bugs in the fork() syscall.

Location:
trunk/kernel/devices
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_dma.c

    r407 r408  
    4747
    4848    // set dma name
    49     snprintf( dma->name , 16 , "dma_%d_%x" , channel , local_cxy );
     49    snprintf( dma->name , 16 , "dma%d_%x" , channel , local_cxy );
    5050
    5151    // call driver init function
     
    7272    }
    7373
    74     // initialises server field in DMA chdev descriptor
     74    // initialises server field in chdev descriptor
    7575    dma->server = new_thread;
     76
     77    // initializes chdev field in thread descriptor
     78    new_thread->chdev = dma;
    7679   
    77     // start server thread
    78     thread_block( new_thread , THREAD_BLOCKED_DEV_QUEUE );
     80    // unblock server thread
    7981    thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    8082
  • trunk/kernel/devices/dev_fbf.c

    r407 r408  
    4040{
    4141    // set FBF chdev extension fields
    42     // TODO this should be done in the impementation
     42    // TODO this should be done in the implementation
    4343    // TODO specific part, as these parameters must be obtained from the hardware.
    4444    chdev->ext.fbf.width  = CONFIG_FBF_WIDTH;
  • trunk/kernel/devices/dev_ioc.c

    r407 r408  
    7777    assert( (error == 0) , __FUNCTION__ , "cannot create server thread" );
    7878
    79     // set "server" field in ioc descriptor
     79    // set "server" field in chdev descriptor
    8080    ioc->server = new_thread;
    8181
    82     // start server thread
    83     thread_block( new_thread , THREAD_BLOCKED_DEV_QUEUE );
     82    // set "chdev field in thread descriptor
     83    new_thread->chdev = ioc;
     84
     85    // unblock server thread
    8486    thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    8587
  • trunk/kernel/devices/dev_nic.c

    r407 r408  
    7979    nic->server = new_thread;
    8080   
    81     // start server thread
    82     thread_block( new_thread , THREAD_BLOCKED_DEV_QUEUE );
     81    // set "chdev" field in thread descriptor
     82    new_thread->chdev = nic;
     83
     84    // unblock server thread
    8385    thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    8486
     
    101103
    102104    // get pointer on NIC-RX chdev descriptor
    103     uint32_t   channel = thread_ptr->dev_channel;
     105    uint32_t   channel = thread_ptr->chdev->channel;
    104106    xptr_t     dev_xp  = chdev_dir.nic_rx[channel];
    105107    cxy_t      dev_cxy = GET_CXY( dev_xp );
     
    129131        // block on THREAD_BLOCKED_IO condition and deschedule
    130132        thread_block( thread_ptr , THREAD_BLOCKED_IO );
    131         sched_yield();
     133        sched_yield("client blocked on I/O");
    132134
    133135        // disable NIC-RX IRQ
     
    171173
    172174    // get pointer on NIC-TX chdev descriptor
    173     uint32_t   channel = thread_ptr->dev_channel;
     175    uint32_t   channel = thread_ptr->chdev->channel;
    174176    xptr_t     dev_xp  = chdev_dir.nic_tx[channel];
    175177    cxy_t      dev_cxy = GET_CXY( dev_xp );
     
    199201        // block on THREAD_BLOCKED I/O condition and deschedule
    200202        thread_block( thread_ptr , THREAD_BLOCKED_IO );
    201         sched_yield();
     203        sched_yield("client blocked on I/O");
    202204
    203205        // disable NIC-TX IRQ
  • trunk/kernel/devices/dev_txt.c

    r407 r408  
    9393        txt->server = new_thread;
    9494
    95         // start server thread
    96         thread_block( new_thread , THREAD_BLOCKED_DEV_QUEUE );
     95        // set "chdev" field in thread descriptor
     96        new_thread->chdev = txt;
     97
     98        // unblock server thread
    9799        thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    98100    }
Note: See TracChangeset for help on using the changeset viewer.