Ignore:
Timestamp:
Feb 20, 2018, 5:32:17 PM (4 years ago)
Author:
alain
Message:

Fix a bad bug in scheduler...

File:
1 edited

Legend:

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

    r433 r435  
    3636// TODO: concurrent user page(s) munmap need to be handled [AG]
    3737
    38 // TODO : remove these debug variables
    3938extern uint32_t enter_sys_read;
    4039extern uint32_t enter_devfs_move;
     
    6463    reg_t        save_sr;     // required to enable IRQs during syscall
    6564
    66 #if CONFIG_READ_DEBUG
     65#if (CONFIG_DEBUG_SYS_READ & 1)
    6766enter_sys_read = (uint32_t)tm_start;
    6867#endif
     
    7675tm_start = hal_get_cycles();
    7776if( CONFIG_DEBUG_SYS_READ < tm_start )
    78 printk("\n[DBG] %s : thread %d enter / process %x / vaddr = %x / count %d / cycle %d\n",
     77printk("\n[DBG] %s : thread %x enter / process %x / vaddr = %x / count %d / cycle %d\n",
    7978__FUNCTION__, this, process->pid, vaddr, count, (uint32_t)tm_start );
    8079#endif
     
    8382        if( file_id >= CONFIG_PROCESS_FILE_MAX_NR )
    8483        {
    85         printk("\n[ERROR] in %s : illegal file descriptor index = %d\n",
    86         __FUNCTION__ , file_id );
     84
     85#if CONFIG_DEBUG_SYSCALLS_ERROR
     86printk("\n[ERROR] in %s : illegal file descriptor index = %d\n", __FUNCTION__ , file_id );
     87#endif
    8788                this->errno = EBADFD;
    8889                return -1;
     
    9495    if ( error )
    9596    {
    96         printk("\n[ERROR] in %s : user buffer unmapped = %x\n",
    97         __FUNCTION__ , (intptr_t)vaddr );
     97
     98#if CONFIG_DEBUG_SYSCALLS_ERROR
     99printk("\n[ERROR] in %s : user buffer unmapped = %x\n",
     100__FUNCTION__ , (intptr_t)vaddr );
     101#endif
    98102                this->errno = EINVAL;
    99103                return -1;
     
    108112    if( file_xp == XPTR_NULL )
    109113    {
    110         printk("\n[ERROR] in %s : undefined file descriptor index = %d in process %x\n",
    111         __FUNCTION__ , file_id , process->pid );
     114
     115#if CONFIG_DEBUG_SYSCALLS_ERROR
     116printk("\n[ERROR] in %s : undefined fd_id %d in process %x\n",
     117__FUNCTION__ , file_id , process->pid );
     118#endif
    112119        this->errno = EBADFD;
    113120        return -1;
     
    122129    if( (attr & FD_ATTR_READ_ENABLE) == 0 )
    123130        {
    124         printk("\n[ERROR] in %s : file %d not readable in process %x\n",
    125         __FUNCTION__ , file_id , process->pid );
     131
     132#if CONFIG_DEBUG_SYSCALLS_ERROR
     133printk("\n[ERROR] in %s : file %d not readable in process %x\n",
     134__FUNCTION__ , file_id , process->pid );
     135#endif
    126136                this->errno = EBADFD;
    127137                return -1;
     
    138148        if( (attr & FD_ATTR_READ_ENABLE) == 0 )
    139149            {
    140             printk("\n[ERROR] in %s : file %d not readable in process %x\n",
    141             __FUNCTION__ , file_id , process->pid );
     150
     151#if CONFIG_DEBUG_SYSCALLS_ERROR
     152printk("\n[ERROR] in %s : file %d not readable in process %x\n",
     153__FUNCTION__ , file_id , process->pid );
     154#endif
    142155                    this->errno = EBADFD;
    143156                    return -1;
     
    166179        if( XPTR( local_cxy , process ) != owner_xp )
    167180        {
    168             printk("\n[ERROR] in %s : process %x not in foreground for TXT%d\n",
    169             __FUNCTION__, process->pid, hal_remote_lw( XPTR(chdev_cxy,&chdev_ptr->channel) ) );
     181
     182#if CONFIG_DEBUG_SYSCALLS_ERROR
     183printk("\n[ERROR] in %s : process %x not in foreground for TXT%d\n",
     184__FUNCTION__, process->pid, hal_remote_lw( XPTR(chdev_cxy,&chdev_ptr->channel) ) );
     185#endif
    170186                    this->errno = EBADFD;
    171187                    return -1;
     
    180196    if( nbytes != count )
    181197    {
    182         printk("\n[ERROR] in %s cannot read data from file %d in process %x\n",
    183         __FUNCTION__ , file_id , process->pid );
     198
     199#if CONFIG_DEBUG_SYSCALLS_ERROR
     200printk("\n[ERROR] in %s cannot read data from file %d in process %x\n",
     201__FUNCTION__ , file_id , process->pid );
     202#endif
    184203        this->errno = error;
    185204        return -1;
     
    194213tm_end = hal_get_cycles();
    195214if( CONFIG_DEBUG_SYS_READ < tm_end )
    196 printk("\n[DBG] %s : thread %x / process %x / cycle %d\n"
     215printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
    197216"nbytes = %d / first byte = %c / file_id = %d / cost = %d\n",
    198217__FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid ,
     
    201220#endif
    202221
    203 #if (CONFIG_READ_DEBUG & 0x1)
     222#if (CONFIG_DEBUG_SYS_READ & 1)
    204223exit_sys_read = (uint32_t)tm_end;
    205224
    206225printk("\n@@@@@@@@@@@@ timing to read character %c\n"
    207 " - enter_sys_read     = %d / delta %d\n"
    208 " - enter_devfs_move   = %d / delta %d\n"
    209 " - enter_txt_read     = %d / delta %d\n"
    210 " - enter_chdev_cmd    = %d / delta %d\n"
    211 " - enter_chdev_server = %d / delta %d\n"
    212 " - enter_tty_cmd      = %d / delta %d\n"
    213 " - enter_tty_isr      = %d / delta %d\n"
    214 " - exit_tty_isr       = %d / delta %d\n"
    215 " - exit_tty_cmd       = %d / delta %d\n"
    216 " - exit_chdev_server  = %d / delta %d\n"
    217 " - exit_chdev_cmd     = %d / delta %d\n"
    218 " - exit_txt_read      = %d / delta %d\n"
    219 " - exit_devfs_move    = %d / delta %d\n"
    220 " - exit_sys_read      = %d / delta %d\n",
     226" - enter_sys_read          = %d / delta %d\n"
     227" - enter_devfs_read        = %d / delta %d\n"
     228" - enter_txt_read          = %d / delta %d\n"
     229" - enter_chdev_cmd_read    = %d / delta %d\n"
     230" - enter_chdev_server_read = %d / delta %d\n"
     231" - enter_tty_cmd_read      = %d / delta %d\n"
     232" - enter_tty_isr_read      = %d / delta %d\n"
     233" - exit_tty_isr_read       = %d / delta %d\n"
     234" - exit_tty_cmd_read       = %d / delta %d\n"
     235" - exit_chdev_server_read  = %d / delta %d\n"
     236" - exit_chdev_cmd_read     = %d / delta %d\n"
     237" - exit_txt_read           = %d / delta %d\n"
     238" - exit_devfs_read         = %d / delta %d\n"
     239" - exit_sys_read           = %d / delta %d\n",
    221240*((char *)(intptr_t)paddr) ,
    222 enter_sys_read     , 0 ,
    223 enter_devfs_move   , enter_devfs_move   - enter_sys_read     ,
    224 enter_txt_read     , enter_txt_read     - enter_devfs_move   ,
    225 enter_chdev_cmd    , enter_chdev_cmd    - enter_txt_read     ,
    226 enter_chdev_server , enter_chdev_server - enter_chdev_cmd    ,
    227 enter_tty_cmd      , enter_tty_cmd      - enter_chdev_server ,
    228 enter_tty_isr      , enter_tty_isr      - enter_tty_cmd      ,
    229 exit_tty_isr       , exit_tty_isr       - enter_tty_isr      ,
    230 exit_tty_cmd       , exit_tty_cmd       - exit_tty_isr       ,
    231 exit_chdev_server  , exit_chdev_server  - exit_tty_cmd       ,
    232 exit_chdev_cmd     , exit_chdev_cmd     - exit_chdev_server  ,
    233 exit_txt_read      , exit_txt_read      - exit_chdev_cmd     ,
    234 exit_devfs_move    , exit_devfs_move    - exit_txt_read      ,
    235 exit_sys_read      , exit_sys_read      - exit_devfs_move    );
     241enter_sys_read          , 0 ,
     242enter_devfs_read        , enter_devfs_read        - enter_sys_read          ,
     243enter_txt_read          , enter_txt_read          - enter_devfs_read        ,
     244enter_chdev_cmd_read    , enter_chdev_cmd_read    - enter_txt_read          ,
     245enter_chdev_server_read , enter_chdev_server_read - enter_chdev_cmd_read    ,
     246enter_tty_cmd_read      , enter_tty_cmd_read      - enter_chdev_server_read ,
     247enter_tty_isr_read      , enter_tty_isr_read      - enter_tty_cmd_read      ,
     248exit_tty_isr_read       , exit_tty_isr_read       - enter_tty_isr_read      ,
     249exit_tty_cmd_read       , exit_tty_cmd_read       - exit_tty_isr_read       ,
     250exit_chdev_server_read  , exit_chdev_server_read  - exit_tty_cmd_read       ,
     251exit_chdev_cmd_read     , exit_chdev_cmd_read     - exit_chdev_server_read  ,
     252exit_txt_read           , exit_txt_read           - exit_chdev_cmd_read     ,
     253exit_devfs_read         , exit_devfs_read         - exit_txt_read           ,
     254exit_sys_read           , exit_sys_read           - exit_devfs_read         );
    236255#endif
    237256 
Note: See TracChangeset for help on using the changeset viewer.