Ignore:
Timestamp:
Mar 28, 2018, 2:40:29 PM (6 years ago)
Author:
alain
Message:

Fix various bugs

File:
1 edited

Legend:

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

    r407 r437  
    22 * sys_thread_create.c - creates a new user thread
    33 *
    4  * Author     Alain Greiner (2016,2017)
     4 * Author     Alain Greiner (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    5757        error_t          error;
    5858
    59         uint32_t         tm_start;
    60         uint32_t         tm_end;
    61 
    62         tm_start = hal_get_cycles();
    63 
    6459        // get parent thead pointer, extended pointer, and process
    6560        parent     = CURRENT_THREAD;
     
    6762        process    = parent->process;
    6863
     64#if CONFIG_DEBUG_SYS_THREAD_CREATE
     65uint64_t tm_start;
     66uint64_t tm_end;
     67tm_start = hal_get_cycles();
     68if( CONFIG_DEBUG_SYS_THREAD_CREATE < tm_start )
     69printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
     70__FUNCTION__ , parent , process->pid, (uint32_t)tm_start );
     71#endif
     72
    6973        // check user_attr in user space & copy to kernel space
    7074    if( user_attr != NULL )
     
    7478            if( error )
    7579            {
    76                     printk("\n[ERROR] in %s : user_attr unmapped\n", __FUNCTION__ );
     80
     81#if CONFIG_DEBUG_SYSCALLS_ERROR
     82printk("\n[ERROR] in %s : user_attr unmapped\n", __FUNCTION__ );
     83#endif
    7784                    parent->errno = EINVAL;
    7885                    return -1;
     
    8794        if( error )
    8895        {
    89                 printk("\n[ERROR] in %s : start_func unmapped\n", __FUNCTION__ );
     96
     97#if CONFIG_DEBUG_SYSCALLS_ERROR
     98printk("\n[ERROR] in %s : start_func unmapped\n", __FUNCTION__ );
     99#endif
    90100                parent->errno = EINVAL;
    91101                return -1;
     
    97107        if( error )
    98108        {
    99                 printk("\n[ERROR] in %s : start_arg unmapped\n", __FUNCTION__ );
     109
     110#if CONFIG_DEBUG_SYSCALLS_ERROR
     111printk("\n[ERROR] in %s : start_arg unmapped\n", __FUNCTION__ );
     112#endif
    100113                parent->errno = EINVAL;
    101114                return -1;
     
    110123                    if( cluster_is_undefined( kern_attr.cxy ) )
    111124                    {
    112                             printk("\n[ERROR] in %s : illegal target cluster = %x\n",
    113                             __FUNCTION__ , kern_attr.cxy );
     125
     126#if CONFIG_DEBUG_SYSCALLS_ERROR
     127printk("\n[ERROR] in %s : illegal target cluster = %x\n", __FUNCTION__ , kern_attr.cxy );
     128#endif
    114129                            parent->errno = EINVAL;
    115130                            return -1;
     
    158173        if( error )
    159174        {
    160                 printk("\n[ERROR] in %s : cannot create thread\n", __FUNCTION__ );
     175
     176#if CONFIG_DEBUG_SYSCALLS_ERROR
     177printk("\n[ERROR] in %s : cannot create thread\n", __FUNCTION__ );
     178#endif
    161179                return ENOMEM;
    162180        }
     
    178196    hal_fence();
    179197
    180         tm_end = hal_get_cycles();
    181 
    182 syscall_dmsg("\n[DBG] %s : core[%x,%d] created thread %x for process %x / cycle %d\n"
    183 "      cluster %x / cost = %d cycles\n",
    184 __FUNCTION__ , local_cxy , parent->core->lid , trdid , process->pid , tm_end ,
    185 target_cxy , tm_end - tm_start );
     198#if CONFIG_DEBUG_SYS_THREAD_CREATE
     199tm_end = hal_get_cycles();
     200if( CONFIG_DEBUG_SYS_THREAD_CREATE < tm_end )
     201printk("\n[DBG] %s : thread %x created thread %x for process %x in cluster %x / cycle %d\n"
     202__FUNCTION__, parent, child_ptr, process->pid, target_cxy, (uint32_t)tm_end );
     203#endif
    186204
    187205        return 0;
Note: See TracChangeset for help on using the changeset viewer.