Changeset 469 for trunk/kernel/syscalls


Ignore:
Timestamp:
Aug 20, 2018, 1:04:16 PM (6 years ago)
Author:
alain
Message:

1) Introduce the libsemaphore library.
2) Introduce a small libmath library, required by the "fft" application..
3) Introduce the multithreaded "fft" application.
4) Fix a bad synchronisation bug in the Copy-On-Write mechanism.

Location:
trunk/kernel/syscalls
Files:
2 added
3 edited

Legend:

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

    r459 r469  
    231231tm_end = hal_get_cycles();
    232232if( DEBUG_SYS_READ < tm_end )
    233 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n"
    234 "nbytes %d / file_id %d / cost %d\n",
    235 __FUNCTION__ , this->trdid, process->pid,
    236 (uint32_t)tm_start , nbytes , file_id , (uint32_t)(tm_end - tm_start) );
     233printk("\n[DBG] %s : thread %x in process %x exit / cycle %d / cost %d\n",
     234__FUNCTION__ , this->trdid, process->pid, (uint32_t)tm_start, (uint32_t)(tm_end - tm_start) );
    237235#endif
    238236
  • trunk/kernel/syscalls/sys_sem.c

    r457 r469  
    7474
    7575#if DEBUG_SYSCALLS_ERROR
    76 printk("\n[ERROR] in %s : unmapped semaphore pointer %x / thread %x in process %x\n",
    77 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
     76printk("\n[ERROR] in %s : unmapped semaphore pointer %x / thread %x in process %x / cycle %d\n",
     77__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    7878vmm_display( process , false );
    7979#endif
     
    9797
    9898#if DEBUG_SYSCALLS_ERROR
    99 printk("\n[ERROR] in %s : cannot create semaphore / thread %x in process %x\n",
    100 __FUNCTION__, this->trdid, process->pid );
     99printk("\n[ERROR] in %s INIT: cannot create semaphore / thread %x in process %x / cycle %d\n",
     100__FUNCTION__, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    101101#endif
    102102                this->errno = ENOMEM;
     
    115115
    116116#if DEBUG_SYSCALLS_ERROR
    117 printk("\n[ERROR] in %s : unmapped buffer for current value %x / thread %x in process %x\n",
    118 __FUNCTION__ , (intptr_t)current_value, this->trdid, process->pid );
     117printk("\n[ERROR] in %s GETVALUE: unmapped target buffer %x / thread %x in process %x / cycle %d\n",
     118__FUNCTION__ , (intptr_t)current_value, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    119119vmm_display( process , false );
    120120#endif
     
    131131
    132132#if DEBUG_SYSCALLS_ERROR
    133 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x in process %x\n",
    134 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
     133printk("\n[ERROR] in %s GETVALUE: semaphore %x not found / thread %x in process %x / cycle %d\n",
     134__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    135135#endif
    136136                this->errno = EINVAL;
     
    157157
    158158#if DEBUG_SYSCALLS_ERROR
    159 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x in process %x\n",
    160 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
     159printk("\n[ERROR] in %s WAIT: semaphore %x not found / thread %x in process %x / cycle %d\n",
     160__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
     161vmm_display( process , true );
    161162#endif
    162163                this->errno = EINVAL;
     
    180181
    181182#if DEBUG_SYSCALLS_ERROR
    182 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x in process %x\n",
    183 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
     183printk("\n[ERROR] in %s POST: semaphore %x not found / thread %x in process %x / cycle %d\n",
     184__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    184185#endif
    185186                this->errno = EINVAL;
     
    203204
    204205#if DEBUG_SYSCALLS_ERROR
    205 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x in process %x\n",
    206 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
     206printk("\n[ERROR] in %s DESTROY: semaphore %x not found / thread %x in process %x / cycle %d\n",
     207__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    207208#endif
    208209                this->errno = EINVAL;
     
    220221
    221222#if DEBUG_SYSCALLS_ERROR
    222 printk("\n[ERROR] in %s : undefined operation type %d / thread %x in process %x\n",
    223 __FUNCTION__ , operation, this->trdid, process->pid );
     223printk("\n[ERROR] in %s : undefined operation type %d / thread %x in process %x / cycle %d\n",
     224__FUNCTION__ , operation, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    224225#endif
    225226            this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_write.c

    r459 r469  
    6161    reg_t        save_sr;         // required to enable IRQs during syscall
    6262
    63 #if (DEBUG_SYS_WRITE & 1)
    64 enter_sys_write = (uint32_t)tm_start;
    65 #endif
    66 
    6763        thread_t   * this = CURRENT_THREAD;
    6864        process_t  * process = this->process;
     
    7773#endif
    7874 
     75#if (DEBUG_SYS_WRITE & 1)
     76enter_sys_write = (uint32_t)tm_start;
     77#endif
     78
    7979    // check file_id argument
    8080        if( file_id >= CONFIG_PROCESS_FILE_MAX_NR )
     
    195195tm_end = hal_get_cycles();
    196196if( DEBUG_SYS_WRITE < tm_end )
    197 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n"
    198 "nbytes %d / file_id %d / cost %d\n",
    199 __FUNCTION__, this->trdid, process->pid, (uint32_t)tm_start,
    200 nbytes, file_id , (uint32_t)(tm_end - tm_start) );
     197printk("\n[DBG] %s : thread %x in process %x exit / cycle %d / cost %d\n",
     198__FUNCTION__, this->trdid, process->pid, (uint32_t)tm_start, (uint32_t)(tm_end - tm_start) );
    201199#endif
    202200 
Note: See TracChangeset for help on using the changeset viewer.