Ignore:
Timestamp:
Nov 10, 2018, 2:33:26 PM (3 years ago)
Author:
alain
Message:

Fix various bugs in sys_stat() and sys_mmap() functions.
Improve debug in other functions.

File:
1 edited

Legend:

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

    r566 r594  
    6262        process    = parent->process;
    6363
     64#if (DEBUG_SYS_THREAD_CREATE || CONFIG_INSTRUMENTATION_SYSCALLS)
     65uint64_t     tm_start = hal_get_cycles();
     66#endif
     67
    6468#if DEBUG_SYS_THREAD_CREATE
    65 uint64_t tm_start;
    66 uint64_t tm_end;
    6769tm_start = hal_get_cycles();
    6870if( DEBUG_SYS_THREAD_CREATE < tm_start )
    69 printk("\n[DBG] %s : thread %x in process %x enter / cycle %d\n",
    70 __FUNCTION__, parent->trdid, process->pid, (uint32_t)tm_start );
     71printk("\n[%s] thread[%x,%x] enter / cycle %d\n",
     72__FUNCTION__, process_pid, parent->trdid, (uint32_t)tm_start );
    7173#endif
    7274
     
    7880
    7981#if DEBUG_SYSCALLS_ERROR
    80 printk("\n[ERROR] in %s : thread %x in process %x / trdid buffer %x unmapped %x\n",
    81 __FUNCTION__, parent->trdid, process->pid, (intptr_t)trdid_ptr );
     82printk("\n[ERROR] in %s : thread[%x,%x] / trdid buffer %x unmapped %x\n",
     83__FUNCTION__, process->pid, parent->trdid, (intptr_t)trdid_ptr );
    8284vmm_display( process , false );
    8385#endif
     
    9597
    9698#if DEBUG_SYSCALLS_ERROR
    97 printk("\n[ERROR] in %s : thread %x in process %x / user_attr buffer unmapped %x\n",
    98 __FUNCTION__, parent->trdid, process->pid, (intptr_t)user_attr );
     99printk("\n[ERROR] in %s : thread[%x,%x] / user_attr buffer unmapped %x\n",
     100__FUNCTION__, process->pid, parent->trdid, (intptr_t)user_attr );
    99101vmm_display( process , false );
    100102#endif
     
    113115
    114116#if DEBUG_SYSCALLS_ERROR
    115 printk("\n[ERROR] in %s : thread %x in process %x / start_func unmapped %x\n",
    116 __FUNCTION__, parent->trdid, process->pid, (intptr_t)start_func );
     117printk("\n[ERROR] in %s : thread[%x,%x] / start_func unmapped %x\n",
     118__FUNCTION__, process->pid, parent->trdid, (intptr_t)start_func );
    117119vmm_display( process , false );
    118120#endif
     
    130132
    131133#if DEBUG_SYSCALLS_ERROR
    132 printk("\n[ERROR] in %s : thread %x in process %x / start_args buffer unmapped %x\n",
    133 __FUNCTION__, parent->trdid, process->pid, (intptr_t)start_args );
     134printk("\n[ERROR] in %s : thread[%x,%x] / start_args buffer unmapped %x\n",
     135__FUNCTION__, process->pid, parent->trdid, (intptr_t)start_args );
    134136vmm_display( process , false );
    135137#endif
     
    149151
    150152#if DEBUG_SYSCALLS_ERROR
    151 printk("\n[ERROR] in %s : thread %x in process %x / illegal target cluster %x\n",
    152 __FUNCTION__, parent->trdid, process->pid, kern_attr.cxy );
     153printk("\n[ERROR] in %s : thread[%x,%x] / illegal target cluster %x\n",
     154__FUNCTION__, process->pid, parent->trdid, kern_attr.cxy );
    153155#endif
    154156                            parent->errno = EINVAL;
     
    200202
    201203#if DEBUG_SYSCALLS_ERROR
    202 printk("\n[ERROR] in %s : thread %x in process %x cannot create new thread\n",
    203 __FUNCTION__ , parent->trdid, process->pid );
     204printk("\n[ERROR] in %s : thread[%x,%x] cannot create new thread\n",
     205__FUNCTION__ , process->pid, parent->trdid );
    204206#endif
    205207                parent->errno = ENOMEM;
     
    216218    hal_fence();
    217219
     220#if (DEBUG_SYS_THREAD_CREATE || CONFIG_INSTRUMENTATION_SYSCALLS)
     221uint64_t     tm_end = hal_get_cycles();
     222#endif
     223
    218224#if DEBUG_SYS_THREAD_CREATE
    219 tm_end = hal_get_cycles();
    220225if( DEBUG_SYS_THREAD_CREATE < tm_end )
    221 printk("\n[DBG] %s : thread %x in process %x created thread %x / cycle %d\n",
    222 __FUNCTION__, parent->trdid, process->pid, child_ptr->trdid, (uint32_t)tm_end );
     226printk("\n[%s] thread[%x,%x] created thread %x / cycle %d\n",
     227__FUNCTION__, process->pid, parent->trdid, child_ptr->trdid, (uint32_t)tm_end );
     228#endif
     229
     230#if CONFIG_INSTRUMENTATION_SYSCALLS
     231hal_atomic_add( &syscalls_cumul_cost[SYS_THREAD_CREATE] , tm_end - tm_start );
     232hal_atomic_add( &syscalls_occurences[SYS_THREAD_CREATE] , 1 );
    223233#endif
    224234
Note: See TracChangeset for help on using the changeset viewer.