Ignore:
Timestamp:
Feb 14, 2018, 3:40:19 PM (6 years ago)
Author:
alain
Message:

blip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_write.c

    r421 r433  
    4646    reg_t        save_sr;         // required to enable IRQs during syscall
    4747
    48 #if CONFIG_WRITE_DEBUG
     48        thread_t   * this = CURRENT_THREAD;
     49        process_t  * process = this->process;
     50
     51#if CONFIG_DEBUG_SYS_WRITE
    4952uint32_t     tm_start;
    5053uint32_t     tm_end;
    5154tm_start = hal_get_cycles();
     55if( CONFIG_DEBUG_SYS_WRITE < tm_start )
     56printk("\n[DBG] %s : thread %x / process %x / vaddr %x / count %d / cycle %d\n",
     57__FUNCTION__, this, process->pid, vaddr, count, (uint32_t)tm_start );
    5258#endif
    53 
    54         thread_t   * this = CURRENT_THREAD;
    55         process_t  * process = this->process;
    5659 
    5760    // check file_id argument
    5861        if( file_id >= CONFIG_PROCESS_FILE_MAX_NR )
    5962        {
    60         printk("\n[ERROR] in %s : illegal file descriptor index\n", __FUNCTION__ );
     63
     64#if CONFIG_DEBUG_SYSCALLS_ERROR
     65printk("\n[ERROR] in %s : illegal file descriptor index\n", __FUNCTION__ );
     66#endif
    6167        this->errno = EBADFD;
    6268                return -1;
     
    6874    if ( error )
    6975    {
    70         printk("\n[ERROR] in %s : user buffer unmapped = %x\n",
    71         __FUNCTION__ , (intptr_t)vaddr );
     76
     77#if CONFIG_DEBUG_SYSCALLS_ERROR
     78printk("\n[ERROR] in %s : user buffer unmapped = %x\n", __FUNCTION__ , (intptr_t)vaddr );
     79#endif
    7280                this->errno = EINVAL;
    7381                return -1;
     
    8290    if( file_xp == XPTR_NULL )
    8391    {
    84         printk("\n[ERROR] in %s : undefined file descriptor index = %d in process %x\n",
    85         __FUNCTION__ , file_id , process->pid );
     92
     93#if CONFIG_DEBUG_SYSCALLS_ERROR
     94printk("\n[ERROR] in %s : undefined file descriptor index = %d in process %x\n",
     95__FUNCTION__ , file_id , process->pid );
     96#endif
    8697                this->errno = EBADFD;
    8798                return -1;
     
    103114        if( (attr & FD_ATTR_WRITE_ENABLE) == 0 )
    104115            {
    105             printk("\n[ERROR] in %s : file %d not writable in process %x\n",
    106             __FUNCTION__ , file_id , process->pid );
     116
     117#if CONFIG_DEBUG_SYSCALLS_ERROR
     118printk("\n[ERROR] in %s : file %d not writable in process %x\n",
     119__FUNCTION__ , file_id , process->pid );
     120#endif
    107121                    this->errno = EBADFD;
    108122                    return -1;
     
    131145    if( nbytes != count )
    132146    {
    133         printk("\n[ERROR] in %s cannot write data to file %d in process %x\n",
    134         __FUNCTION__ , file_id , process->pid );
     147
     148#if CONFIG_DEBUG_SYSCALLS_ERROR
     149printk("\n[ERROR] in %s cannot write data to file %d in process %x\n",
     150__FUNCTION__ , file_id , process->pid );
     151#endif
    135152        this->errno = error;
    136153        return -1;
     
    142159    hal_fence();
    143160
    144 #if CONFIG_WRITE_DEBUG
     161#if CONFIG_DEBUG_SYS_WRITE
    145162tm_end = hal_get_cycles();
    146 printk("\n[DBG] %s : core[%x,%d] / thread %x in process %x / cycle %d\n"
     163if( CONFIG_DEBUG_SYS_WRITE < tm_end )
     164printk("\n[DBG] %s : thread %x in process %x / cycle %d\n"
    147165"nbytes = %d / first byte = %c / file_id = %d / cost = %d\n",
    148 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid ,
    149 (uint32_t)tm_start , nbytes , *((char *)(intptr_t)paddr) , file_id ,
    150 (uint32_t)(tm_end - tm_start) );
     166__FUNCTION__, this, process->pid, (uint32_t)tm_start,
     167nbytes, *((char *)(intptr_t)paddr) , file_id , (uint32_t)(tm_end - tm_start) );
    151168#endif
    152169 
    153 #if (CONFIG_WRITE_DEBUG & 0x1)
    154 printk("\n@@@@@@@@@@@@ timing to write character %c\n"
    155 " - enter_sys_write    = %d\n"
    156 " - exit_sys_write     = %d\n",
    157 *((char *)(intptr_t)paddr) , (uint32_t)tm_start , (uint32_t)tm_end );
    158 #endif
    159 
    160170        return nbytes;
    161171
Note: See TracChangeset for help on using the changeset viewer.