Changeset 445 for trunk/kernel


Ignore:
Timestamp:
May 29, 2018, 9:27:23 AM (6 years ago)
Author:
alain
Message:

Restructure the mini_libc.

Location:
trunk/kernel
Files:
12 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/printk.c

    r443 r445  
    3030#include <chdev.h>
    3131#include <printk.h>
     32#include <shared_syscalls.h>
    3233
    3334///////////////////////////////////////////////////////////////////////////////////
     
    416417
    417418        // suicide
    418         hal_core_sleep();
     419        sys_exit( EXIT_FAILURE );
    419420    }
    420421}
  • trunk/kernel/kern/process.c

    r443 r445  
    401401uint32_t cycle = (uint32_t)hal_get_cycles();
    402402if( DEBUG_PROCESS_DESTROY )
    403 printk("\n[DBG] %s : thread %x enter in cluster %x / pid %x / process %x / cycle %d\n",
    404 __FUNCTION__ , CURRENT_THREAD , pid , process , cycle );
     403printk("\n[DBG] %s : thread %x enter for process %x in cluster %x / cycle %d\n",
     404__FUNCTION__ , CURRENT_THREAD , pid , local_cxy , cycle );
    405405#endif
    406406
     
    447447cycle = (uint32_t)hal_get_cycles();
    448448if( DEBUG_PROCESS_DESTROY )
    449 printk("\n[DBG] %s : thread %x exit / destroyed process %x (pid = %x) / cycle %d\n",
    450 __FUNCTION__ , CURRENT_THREAD , process, pid, cycle );
     449printk("\n[DBG] %s : thread %x exit / destroyed process %x in cluster %x / cycle %d\n",
     450__FUNCTION__ , CURRENT_THREAD , pid, local_cxy, cycle );
    451451#endif
    452452
     
    13791379    process_txt_detach( XPTR( local_cxy , old_process ) );
    13801380
    1381     // request old_thread destruction => old_process destruction
     1381    // block this old_thread
    13821382    thread_block( XPTR( local_cxy , old_thread ) , THREAD_BLOCKED_GLOBAL );
    1383     hal_atomic_or( &old_thread->flags , THREAD_FLAG_REQ_DELETE );
     1383
     1384    // atomically update old_process descriptor term_state to ask
     1385    // the parent process (wait() function) to delete this old_thread
     1386    hal_atomic_or( &old_process->term_state , PROCESS_TERM_EXIT );
    13841387
    13851388    hal_fence();
  • trunk/kernel/kern/process.h

    r443 r445  
    535535/*********************************************************************************************
    536536 * This function detach a process, identified by the <process_xp> argument,
    537  * from the list of process attached to a given TXT terminal.
     537 * from the list of process attached to a given TXT terminal. It transfer the TXT ownership,
     538 * if the detached process is the TXT owner.
    538539 * The target process descriptor must be in the owner cluster, but the calling thread can
    539540 * be running in any cluster.
  • trunk/kernel/kern/scheduler.c

    r443 r445  
    248248uint32_t cycle = (uint32_t)hal_get_cycles();
    249249if( DEBUG_SCHED_HANDLE_SIGNALS < cycle )
    250 printk("\n[DBG] %s : thread %x in proces %x on core[%x,%d] deleted / cycle %d\n",
     250printk("\n[DBG] %s : thread %x in process %x on core[%x,%d] deleted / cycle %d\n",
    251251__FUNCTION__ , thread->trdid , process->pid , local_cxy , thread->core->lid , cycle );
    252252#endif
  • trunk/kernel/kernel_config.h

    r443 r445  
    9797#define DEBUG_PROCESS_GET_LOCAL_COPY   0
    9898#define DEBUG_PROCESS_INIT_CREATE      0
    99 #define DEBUG_PROCESS_MAKE_EXEC        0
     99#define DEBUG_PROCESS_MAKE_EXEC        1
    100100#define DEBUG_PROCESS_MAKE_FORK        0
    101101#define DEBUG_PROCESS_REFERENCE_INIT   0
    102102#define DEBUG_PROCESS_SIGACTION        0
    103 #define DEBUG_PROCESS_TXT_ATTACH       0
     103#define DEBUG_PROCESS_TXT              2
    104104#define DEBUG_PROCESS_ZERO_CREATE      0
    105105
     
    124124
    125125#define DEBUG_SYS_DISPLAY              0
    126 #define DEBUG_SYS_EXEC                 0
    127 #define DEBUG_SYS_EXIT                 0
     126#define DEBUG_SYS_EXEC                 1
     127#define DEBUG_SYS_EXIT                 1
    128128#define DEBUG_SYS_FG                   0
    129129#define DEBUG_SYS_FORK                 0
    130130#define DEBUG_SYS_GET_CONFIG           0
    131131#define DEBUG_SYS_ISATTY               0
    132 #define DEBUG_SYS_KILL                 0
     132#define DEBUG_SYS_KILL                 2
    133133#define DEBUG_SYS_MMAP                 0
    134134#define DEBUG_SYS_READ                 0
     
    139139#define DEBUG_SYS_THREAD_SLEEP         0
    140140#define DEBUG_SYS_THREAD_WAKEUP        0
     141#define DEBUG_SYS_THREAD_YIELD         2
    141142#define DEBUG_SYS_TRACE                0
    142143#define DEBUG_SYS_WAIT                 0
     
    153154#define DEBUG_THREAD_KERNEL_CREATE     0
    154155#define DEBUG_THREAD_KILL              0
    155 #define DEBUG_THREAD_USER_CREATE       0
     156#define DEBUG_THREAD_USER_CREATE       2
    156157#define DEBUG_THREAD_USER_FORK         0
    157158#define DEBUG_THREAD_BLOCK             0
  • trunk/kernel/syscalls/sys_display.c

    r443 r445  
    244244        chdev_dir_display();
    245245    }
     246    ////////////////////////////////
     247    else if( type == DISPLAY_DQDT )
     248    {
     249        dqdt_display();
     250    }
    246251    ////
    247252    else
  • trunk/kernel/syscalls/sys_exit.c

    r443 r445  
    8686        thread_delete( XPTR( local_cxy , this ) , pid , true );
    8787    }
    88          
     88
    8989    // remove process from TXT list
    9090    process_txt_detach( owner_xp );
  • trunk/kernel/syscalls/sys_thread_yield.c

    r421 r445  
    2222 */
    2323
     24#include <hal_types.h>
     25#include <hal_special.h>
    2426#include <scheduler.h>
     27#include <thread.h>
    2528
    2629int sys_thread_yield()
    2730{
     31 
     32#if DEBUG_SYS_THREAD_YIELD
     33uint64_t     tm_start;
     34uint64_t     tm_end;
     35tm_start = hal_get_cycles();
     36if( DEBUG_SYS_THREAD_YIELD < tm_start )
     37printk("\n[DBG] %s : thread %x deschedule / process %x / cycle %d\n",
     38__FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, (uint32_t)tm_start );
     39#endif
     40
     41    // deschedule
    2842        sched_yield("user request");
     43
     44#if DEBUG_SYS_THREAD_YIELD
     45tm_end = hal_get_cycles();
     46if( DEBUG_SYS_THREAD_YIELD < tm_start )
     47printk("\n[DBG] %s : thread %x resume / process %x / cycle %d\n",
     48__FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, (uint32_t)tm_end );
     49#endif
     50
    2951        return 0;
    3052}
  • trunk/kernel/syscalls/syscalls.h

    r443 r445  
    195195 ******************************************************************************************
    196196 * @ pathname   : pathname (can be relative or absolute).
    197  * @ flags      : bit vector attributes (see below).
     197 * @ flags      : bit vector attributes (see in shared_fcntl.h file)
    198198 * @ mode       : access rights.
    199199 * @ return file descriptor index in fd_array if success / return -1 if failure.
     
    572572 * - DISPLAY_VFS             : all files registered in the VFS cache.
    573573 * - DISPLAY_CHDEV           : all registered channel devices.
     574 * - DISPLAY_DQDT            : all DQDT nodes.
    574575 ******************************************************************************************
    575576 * type      : [in] type of display
     
    622623int sys_fg( pid_t   pid );
    623624
     625/******************************************************************************************
     626 * [49] TBD
     627 ******************************************************************************************
     628 * @ cxy    : cluster identifier.
     629 * @ lid    : core local index.
     630 * @ return 0 if success / return -1 if failure.
     631 *****************************************************************************************/
    624632int sys_place( uint32_t cxy,
    625633               uint32_t lid );
Note: See TracChangeset for help on using the changeset viewer.