Changeset 440 for trunk/kernel/devices


Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (6 years ago)
Author:
alain
Message:

1/ Fix a bug in the Multithreaded "sort" applicationr:
The pthread_create() arguments must be declared as global variables.
2/ The exit syscall can be called by any thread of a process..

Location:
trunk/kernel/devices
Files:
4 edited

Legend:

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

    r438 r440  
    119119//////////////////////////////////////////////////////////////////////////////////
    120120// This static function is called by dev_fbf_read() & dev_fbf_write() functions.
    121 // It builds and registers the command in the calling thread descriptor, after
    122 // translation of buffer virtual address to physical address.
    123 // Then, it registers the calling thead in the relevant DMA chdev waiting queue.
     121// It builds and registers the command in the calling thread descriptor.
     122// Then, it registers the calling thread in the relevant DMA chdev waiting queue.
    124123// Finally it blocks on the THREAD_BLOCKED_DEV condition and deschedule.
    125124////////////////////////////////////i/////////////////////////////////////////////
     
    129128                               uint32_t  offset )
    130129{
    131     error_t     error;
    132     paddr_t     buf_paddr;
    133 
    134     thread_t * this = CURRENT_THREAD;              // pointer on client thread
    135 
    136     // Get buffer physical address
    137     error = vmm_v2p_translate( CONFIG_KERNEL_IDENTITY_MAP , buffer , &buf_paddr );
    138  
    139     // check buffer is mapped
    140     assert( (error == 0) , __FUNCTION__ ,
    141     "cannot translate vaddr = %p in process %x\n", buffer, this->process->pid );
    142130
    143131    // get extended pointer on FBF chdev descriptor
     
    160148
    161149    // compute extended pointers on frame buffer and memory buffer
    162     xptr_t  mem_buf_xp = XPTR( local_cxy , (void *)(intptr_t)buf_paddr );
     150    xptr_t  mem_buf_xp = XPTR( local_cxy , buffer );
    163151    xptr_t  fbf_buf_xp = base + offset;
    164152
  • trunk/kernel/devices/dev_ioc.c

    r438 r440  
    9191// This static function is called by dev_ioc_read() & dev_ioc_write() functions.
    9292// It builds and registers the command in the calling thread descriptor.
    93 // Then, it registers the calling thead in chdev waiting queue.
     93// Then, it registers the calling thead in IOCchdev waiting queue.
    9494// Finally it blocks on the THREAD_BLOCKED_IO condition and deschedule.
    9595////////////////////////////////////i/////////////////////////////////////////////
  • trunk/kernel/devices/dev_mmc.c

    r438 r440  
    5757
    5858/////////////////////////////////////////////////////////////////////////////
    59 // This static function is called by all MMC device functions.
     59// This static function is called by all MMC device access functions.
    6060// It makes some checking, takes the lock granting exclusive
    6161// access to MMC peripheral, call the driver to execute the command
     
    7171    // get MMC device cluster identifier & local pointer
    7272    cxy_t     dev_cxy = GET_CXY( dev_xp );
    73     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     73    chdev_t * dev_ptr = GET_PTR( dev_xp );
    7474
    7575    // get driver command function pointer from MMC device descriptor
     
    9797
    9898    // get calling thread local pointer
    99     thread_t * this = CURRENT_THREAD;
     99    thread_t  * this    = CURRENT_THREAD;
    100100
    101101#if DEBUG_DEV_MMC
     
    113113             "buffer not aligned on cache line" );
    114114
    115     // get buffer physical address
    116     paddr_t  buf_paddr;
    117     error = vmm_v2p_translate( CONFIG_KERNEL_IDENTITY_MAP , buf_ptr , &buf_paddr );
    118 
    119     assert( (error == 0) , __FUNCTION__ , "cannot get buffer paddr" );
    120 
    121115    // store command arguments in thread descriptor
    122116    this->mmc_cmd.dev_xp    = chdev_dir.mmc[buf_cxy];
    123117    this->mmc_cmd.type      = MMC_CC_INVAL;
    124     this->mmc_cmd.buf_paddr = buf_paddr;
     118    this->mmc_cmd.buf_ptr   = buf_ptr;
    125119    this->mmc_cmd.buf_size  = buf_size;
    126120
     
    144138    error_t error;
    145139
    146     // get calling thread local pointer
    147     thread_t * this = CURRENT_THREAD;
     140    thread_t  * this    = CURRENT_THREAD;
    148141
    149142#if DEBUG_DEV_MMC
     
    161154             "buffer not aligned on cache line" );
    162155
    163     // get  buffer physical address
    164     paddr_t  buf_paddr;
    165     error = vmm_v2p_translate( CONFIG_KERNEL_IDENTITY_MAP , buf_ptr , &buf_paddr );
    166 
    167     assert( (error == 0) , __FUNCTION__ , "cannot get buffer paddr" );
    168 
    169156    // store command arguments in thread descriptor
    170157    this->mmc_cmd.dev_xp    = chdev_dir.mmc[buf_cxy];
    171158    this->mmc_cmd.type      = MMC_CC_SYNC;
    172     this->mmc_cmd.buf_paddr = buf_paddr;
     159    this->mmc_cmd.buf_ptr   = buf_ptr;
    173160    this->mmc_cmd.buf_size  = buf_size;
    174161
  • trunk/kernel/devices/dev_mmc.h

    r437 r440  
    8383    xptr_t      dev_xp;     /*! extended pointer on target MMC device descriptor        */
    8484    uint32_t    type;       /*! CC_INVAL / CC_SYNC / GET_ERROR / SET_ERROR / GET_INSTRU */
    85     paddr_t     buf_paddr;  /*! physical address of memory buffer (used by INVAL/SYNC)  */
    86     uint32_t    buf_size;   /*! buffer size in bytes              (used by INVAL/SYNC)  */
     85    void      * buf_ptr;    /*! local pointer on memory buffer    (used by INVAL/SYNC)  */
     86    uint32_t    buf_size;   /*! memory buffer size (bytes)        (used by INVAL/SYNC)  */
    8787    uint32_t    reg_index;  /*! register index in MMC peripheral  (used by SET/GET)     */
    8888    uint32_t  * reg_ptr;    /*! local pointer on src/dst buffer   (used by SET/GET)     */
Note: See TracChangeset for help on using the changeset viewer.