Changeset 633 for trunk/kernel


Ignore:
Timestamp:
May 28, 2019, 6:10:15 PM (5 years ago)
Author:
alain
Message:

cosmetic

Location:
trunk/kernel
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/Makefile

    r626 r633  
    284284##############################
    285285# Rule to generate kernel.elf
    286 build/kernel.elf:           $(KERN_OBJS)                 \
     286build/kernel.elf:       $(KERN_OBJS)                 \
    287287                        $(HAL_OBJS_0)                \
    288288                        $(HAL_OBJS_1)                \
  • trunk/kernel/fs/fatfs.c

    r630 r633  
    25952595    fatfs_ctx_t * fatfs_ctx_ptr;  // local pointer on FATFS context in FAT cluster
    25962596    xptr_t        fat_mapper_xp;  // extended pointer on FAT mapper
    2597     mapper_t    * fat_mapper_ptr; // local pointer on FAT mapper
    25982597    xptr_t        lock_xp;        // extended pointer on lock protecting FAT.
    25992598    xptr_t        first_xp;       // extended pointer on inode extension
     
    26332632    loc_fatfs_ctx = vfs_ctx->extend;
    26342633
    2635     // get pointers on FAT mapper
     2634    // get FAT mapper cluster
    26362635    fat_mapper_xp  = loc_fatfs_ctx->fat_mapper_xp;
    26372636    fat_cxy        = GET_CXY( fat_mapper_xp );
    2638     fat_mapper_ptr = GET_PTR( fat_mapper_xp );
    26392637   
    26402638    // get pointers on FATFS context in FAT cluster
  • trunk/kernel/fs/vfs.c

    r630 r633  
    10211021    xptr_t        iter_xp;          // iterator on xlist
    10221022    mapper_t    * mapper_ptr;       // local pointer on associated mapper
    1023     xptr_t        mapper_xp;        // extended pointer on mapper
    10241023    vfs_inode_t * inode_ptr;        // local pointer on associated inode
    1025     xptr_t        inode_xp;         // extended pointer on inode
    10261024    uint32_t      size;             // current file size (from inode descriptor)
    10271025    error_t       error;
     
    10521050    //////// 1) update all dirty pages from mapper to device
    10531051
    1054     // get pointers on mapper associated to file
     1052    // get local pointer on mapper associated to file
    10551053    mapper_ptr = hal_remote_lpt( XPTR( file_cxy , &file_ptr->mapper ) );
    1056     mapper_xp  = XPTR( file_cxy , mapper_ptr );
    10571054
    10581055    // copy all dirty pages from mapper to device
     
    10831080    //////// 2) update file size in all parent directory mapper(s) and update device
    10841081
    1085     // get pointers on remote inode
     1082    // get local pointer on remote inode
    10861083    inode_ptr = hal_remote_lpt( XPTR( file_cxy , &file_ptr->inode ) );
    1087     inode_xp  = XPTR( file_cxy , inode_ptr );
    10881084
    10891085    // get file size from remote inode
     
    17011697    // build extended pointer on lock protecting Inode Tree (in VFS root inode)
    17021698    vfs_root_xp  = process->vfs_root_xp;
    1703     vfs_root_ptr = GET_PTR( root_xp );
    1704     vfs_root_cxy = GET_CXY( root_xp );
     1699    vfs_root_ptr = GET_PTR( vfs_root_xp );
     1700    vfs_root_cxy = GET_CXY( vfs_root_xp );
    17051701    lock_xp      = XPTR( vfs_root_cxy , &vfs_root_ptr->main_lock );
    17061702
     
    21082104    cxy_t             inode_cxy;    // inode cluster identifier       
    21092105    vfs_inode_t     * inode_ptr;    // inode local pointer
    2110     vfs_inode_type_t  inode_type;   // target inode type
    21112106
    21122107// check lookup working mode
     
    21272122   
    21282123    // get inode type from remote inode
    2129     inode_type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
    2130 
    2131     // TODO implement this function
     2124    // inode_type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
     2125
     2126    // TODO finalize implementation
    21322127
    21332128assert( false , "not implemented" );
     2129
     2130    // set inode rights in remote inode
     2131    hal_remote_s32( XPTR( inode_cxy , &inode_ptr->rights ) , rights );
    21342132
    21352133    return 0;
     
    24732471    bool_t             last;         // true when the name is the last in path
    24742472    bool_t             found;        // true when a child has been found
    2475     bool_t             dir;          // searched inode is a directory
    24762473    bool_t             create;       // searched inode must be created if not found
    24772474    bool_t             excl;         // searched inode must not exist
     
    24982495
    24992496    // compute lookup flags
    2500     dir    = (lookup_mode & VFS_LOOKUP_DIR)    == VFS_LOOKUP_DIR;
    25012497    create = (lookup_mode & VFS_LOOKUP_CREATE) == VFS_LOOKUP_CREATE;
    25022498    excl   = (lookup_mode & VFS_LOOKUP_EXCL)   == VFS_LOOKUP_EXCL;
     
    28792875    vfs_inode_t   * child_ptr;         // local pointer on child inode directory
    28802876    cxy_t           child_cxy;         // child inode directory cluster identifier
    2881     vfs_inode_t   * parent_ptr;        // local pointer on parent inode directory
    2882     cxy_t           parent_cxy;        // parent inode directory cluster identifier
    28832877    vfs_ctx_t     * ctx_ptr;           // local pointer on child inode FS context
    28842878    vfs_fs_type_t   fs_type;           // FS type of child inode
     
    29062900    child_cxy  = GET_CXY( child_xp );
    29072901    child_ptr  = GET_PTR( child_xp );
    2908 
    2909     // get parent directory cluster and local pointer
    2910     parent_cxy = GET_CXY( parent_xp );
    2911     parent_ptr = GET_PTR( parent_xp );
    29122902
    29132903    // get child inode FS type
     
    30523042
    30533043    // don't register <..> dentry in parent_inode xlist of parents
    3054     // parents_root_xp  = XPTR( parent_cxy , &parent_ptr->parents );
    3055     // parents_entry_xp = XPTR( child_cxy  , &dentry_ptr->parents );
    3056     // xlist_add_first( parents_root_xp , parents_entry_xp );
    3057     // hal_remote_atomic_add( XPTR( parent_cxy , &parent_ptr->links ) , 1 );
    30583044
    30593045    // update "parent" and "child_xp" fields in <..> dentry
     
    33693355#if(DEBUG_VFS_ADD_CHILD & 1)
    33703356if( DEBUG_VFS_ADD_CHILD < cycle )
    3371 printk("\n[%s] thread[%x,%x] / dentry (%x,%x) registered in child inode (%x,%x)\n",
     3357printk("\n[%s] thread[%x,%x] link dentry(%x,%x) to child inode(%x,%x)\n",
    33723358__FUNCTION__, this->process->pid, this->trdid,
    33733359parent_cxy, new_dentry_ptr, child_cxy, new_inode_ptr );
     
    33813367#if(DEBUG_VFS_ADD_CHILD & 1)
    33823368if( DEBUG_VFS_ADD_CHILD < cycle )
    3383 printk("\n[%s] thread[%x,%x] / dentry (%x,%x) registered in parent inode (%x,%x)\n",
     3369printk("\n[%s] thread[%x,%x] link dentry(%x,%x) to parent inode(%x,%x)\n",
    33843370__FUNCTION__, this->process->pid, this->trdid,
    33853371parent_cxy, new_dentry_ptr, parent_cxy, parent_inode_ptr );
     
    33943380if( DEBUG_VFS_ADD_CHILD < cycle )
    33953381printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n",
    3396 __FUNCTION__, this->process->pid, this->trdid, name, (uint32_t)hal_get_cycles() );
     3382__FUNCTION__, this->process->pid, this->trdid, name, cycle );
    33973383#endif
    33983384
  • trunk/kernel/fs/vfs.h

    r626 r633  
    153153typedef struct vfs_inode_s
    154154{
    155         struct vfs_ctx_s * ctx;              /*! local pointer on FS context                 */
    156         uint32_t           inum;             /*! inode identifier (unique in file system)    */
    157         uint32_t           attr;             /*! inode attributes (see above)                */
    158         vfs_inode_type_t   type;             /*! inode type (see above)                      */
    159         uint32_t           size;             /*! number of bytes                             */
    160         uint32_t           uid;              /*! user owner identifier                       */
    161         uint32_t           gid;              /*! group owner identifier                      */
     155    struct vfs_ctx_s * ctx;              /*! local pointer on FS context                 */
     156    uint32_t           inum;             /*! inode identifier (unique in file system)    */
     157    uint32_t           attr;             /*! inode attributes (see above)                */
     158    vfs_inode_type_t   type;             /*! inode type (see above)                      */
     159    uint32_t           size;             /*! number of bytes                             */
     160    uint32_t           uid;              /*! user owner identifier                       */
     161    uint32_t           gid;              /*! group owner identifier                      */
    162162    uint32_t           rights;           /*! access rights                               */
    163         xlist_entry_t      parents;          /*! root of list of parents dentries            */
    164         uint32_t           links;            /*! number of parent dentries (hard links)      */
    165         xhtab_t            children;         /*! embedded xhtab of children dentries         */
    166         remote_rwlock_t    size_lock;        /*! protect read/write to size                  */
    167         remote_rwlock_t    main_lock;        /*! protect inode tree traversal and modifs     */
    168         struct mapper_s  * mapper;           /*! associated file cache                       */
    169         void             * extend;           /*! fs_type_specific inode extension            */
     163    xlist_entry_t      parents;          /*! root of list of parents dentries            */
     164    uint32_t           links;            /*! number of parent dentries (hard links)      */
     165    xhtab_t            children;         /*! embedded xhtab of children dentries         */
     166    remote_rwlock_t    size_lock;        /*! protect read/write to size                  */
     167    remote_rwlock_t    main_lock;        /*! protect inode tree traversal and modifs     */
     168    struct mapper_s  * mapper;           /*! associated file cache                       */
     169    void             * extend;           /*! fs_type_specific inode extension            */
    170170}
    171171vfs_inode_t;
  • trunk/kernel/kern/kernel_init.c

    r632 r633  
    277277    uint32_t        x;               // X cluster coordinate
    278278    uint32_t        y;               // Y cluster coordinate
    279     uint32_t        channels;        // number of channels
    280279
    281280    // get number of peripherals and base of devices array from boot_info
     
    289288        func        = FUNC_FROM_TYPE( dev_tbl[i].type );
    290289        impl        = IMPL_FROM_TYPE( dev_tbl[i].type );
    291         channels    = dev_tbl[i].channels;
    292290
    293291        if (func == DEV_FUNC_TXT )
     
    587585                    // initialize the replicated chdev_dir[x][y] structures
    588586                    // defining the extended pointers on chdev descriptors
    589                     xptr_t * entry;
     587                    xptr_t * entry = NULL;
    590588
    591589                    if(func==DEV_FUNC_IOB             ) entry  = &chdev_dir.iob;
     
    603601                            cxy_t cxy = HAL_CXY_FROM_XY( x , y );
    604602
    605                             if( cluster_is_active( cxy ) )
     603                            if( cluster_is_active( cxy ) && ( entry != NULL ) )
    606604                            {
    607605                                hal_remote_s64( XPTR( cxy , entry ),
  • trunk/kernel/kern/process.c

    r629 r633  
    789789    thread_t          * this;           // pointer on calling thread
    790790    uint32_t            ltid;           // index in process th_tbl[]
    791     cxy_t               owner_cxy;      // target process owner cluster
    792791    uint32_t            count;          // requests counter
    793792    volatile uint32_t   ack_count;      // acknowledges counter
     
    807806assert( (LPID_FROM_PID( process->pid ) != 0 ),
    808807"process %x is not an user process\n", process->pid );
    809 
    810     // get target process owner cluster
    811     owner_cxy = CXY_FROM_PID( process->pid );
    812808
    813809    // get lock protecting process th_tbl[]
     
    873869                             xptr_t      client_xp )
    874870{
    875     thread_t          * this;          // pointer on calling thread
    876871    thread_t          * target;        // local pointer on target thread
    877872    xptr_t              target_xp;     // extended pointer on target thread
     
    881876
    882877    // get calling thread pointer
    883     this = CURRENT_THREAD;
    884878
    885879    // get target process owner cluster
     
    887881
    888882#if DEBUG_PROCESS_SIGACTION
    889 uint32_t cycle = (uint32_t)hal_get_cycles();
     883thread_t * this  = CURRENT_THREAD;
     884uint32_t   cycle = (uint32_t)hal_get_cycles();
    890885if( DEBUG_PROCESS_SIGACTION < cycle )
    891886printk("\n[%s] thread[%x,%x] enter for process %x n cluster %x / cycle %d\n",
     
    937932{
    938933    thread_t          * target;        // pointer on target thead
    939     thread_t          * this;          // pointer on calling thread
    940934    uint32_t            ltid;          // index in process th_tbl
    941935    uint32_t            count;         // requests counter
    942936
    943     // get calling thread pointer
    944     this = CURRENT_THREAD;
    945 
    946937#if DEBUG_PROCESS_SIGACTION
    947 pid_t pid = process->pid;
    948 uint32_t cycle = (uint32_t)hal_get_cycles();
     938thread_t * this  = CURRENT_THREAD;
     939pid_t      pid   = process->pid;
     940uint32_t   cycle = (uint32_t)hal_get_cycles();
    949941if( DEBUG_PROCESS_SIGACTION < cycle )
    950942printk("\n[%s] thread[%x,%x] enter for process %x in cluster %x / cycle %d\n",
  • trunk/kernel/kern/thread.c

    r629 r633  
    10821082    ltid_t      target_ltid;            // target thread local index
    10831083    xptr_t      joining_xp;             // extended pointer on joining thread
    1084     thread_t  * joining_ptr;            // pointer on joining thread
    1085     cxy_t       joining_cxy;            // joining thread cluster
    10861084
    10871085    // get target thread cluster and local pointer
     
    11431141            // get extended pointer on joining thread
    11441142            joining_xp  = (xptr_t)hal_remote_l64( target_join_xp_xp );
    1145             joining_ptr = GET_PTR( joining_xp );
    1146             joining_cxy = GET_CXY( joining_xp );
    11471143           
    11481144            // reset the join_done flag in target thread
  • trunk/kernel/kernel_config.h

    r632 r633  
    6666
    6767#define DEBUG_DEVFS_GLOBAL_INIT           0
    68 #define DEBUG_DEVFS_LOCAL_INIT            0
     68#define DEBUG_DEVFS_LOCAL_INIT              1
    6969#define DEBUG_DEVFS_MOVE                  0
    7070
     
    112112#define DEBUG_KMEM                        0
    113113
    114 #define DEBUG_KERNEL_INIT                 0
     114#define DEBUG_KERNEL_INIT                   1
    115115
    116116#define DEBUG_MAPPER_GET_PAGE             0
     
    141141#define DEBUG_QUEUELOCK_CXY               0
    142142
    143 #define DEBUG_RPC_CLIENT_GENERIC             21000000
    144 #define DEBUG_RPC_SERVER_GENERIC             21000000
     143#define DEBUG_RPC_CLIENT_GENERIC             2
     144#define DEBUG_RPC_SERVER_GENERIC             2
    145145
    146146#define DEBUG_RPC_KCM_ALLOC               0
     
    148148#define DEBUG_RPC_MAPPER_HANDLE_MISS      0
    149149#define DEBUG_RPC_MAPPER_MOVE_USER        0
    150 #define DEBUG_RPC_PMEM_GET_PAGES             21000000
    151 #define DEBUG_RPC_PMEM_RELEASE_PAGES      0
    152150#define DEBUG_RPC_PROCESS_MAKE_FORK       0
    153151#define DEBUG_RPC_PROCESS_SIGACTION       0
    154152#define DEBUG_RPC_THREAD_USER_CREATE      0
    155153#define DEBUG_RPC_THREAD_KERNEL_CREATE    0
    156 #define DEBUG_RPC_VFS_DENTRY_CREATE       0
     154#define DEBUG_RPC_VFS_DENTRY_CREATE          2
    157155#define DEBUG_RPC_VFS_DENTRY_DESTROY      0
    158156#define DEBUG_RPC_VFS_DEVICE_GET_DENTRY   0
     
    168166#define DEBUG_RPC_VMM_DELETE_VSEG         0
    169167
    170 #define DEBUG_RWLOCK_TYPE                 35       // lock type 0 is undefined => no debug
    171 #define DEBUG_RWLOCK_PTR                  0xb1650
    172 #define DEBUG_RWLOCK_CXY                  0x11
     168#define DEBUG_RWLOCK_TYPE                 0        // lock type 0 is undefined => no debug
     169#define DEBUG_RWLOCK_PTR                  0
     170#define DEBUG_RWLOCK_CXY                  0
    173171
    174172#define DEBUG_SCHED_HANDLE_SIGNALS        2
     
    230228#define DEBUG_USER_DIR                    0
    231229
    232 #define DEBUG_VFS_ADD_CHILD               0
     230#define DEBUG_VFS_ADD_CHILD                  1
    233231#define DEBUG_VFS_ADD_SPECIAL             0
    234232#define DEBUG_VFS_CHDIR                   0
    235233#define DEBUG_VFS_CLOSE                   0
    236 #define DEBUG_VFS_DENTRY_CREATE           0
     234#define DEBUG_VFS_DENTRY_CREATE           0 
    237235#define DEBUG_VFS_FILE_CREATE             0
    238236#define DEBUG_VFS_GET_PATH                0
  • trunk/kernel/libk/user_dir.c

    r629 r633  
    386386{
    387387    thread_t     * this;       // local pointer on calling thread
    388     process_t    * process;    // local pointer on calling process
    389388    cluster_t    * cluster;    // local pointer on local cluster
    390389    intptr_t       ident;      // user pointer on dirent array
     
    401400    uint32_t       responses;  // response counter
    402401     
    403     // get pointers on calling process & thread
    404402    this    = CURRENT_THREAD;
    405     process = this->process;
    406403    cluster = LOCAL_CLUSTER;
    407404
     
    415412if( cycle > DEBUG_USER_DIR )
    416413printk("\n[%s] thread[%x,%x] enter for user_dir (%x,%x) and process %x / cycle %d\n",
    417 __FUNCTION__, process->pid, this->trdid, local_cxy, dir, ref_pid, cycle );
     414__FUNCTION__, this->process->pid, this->trdid, local_cxy, dir, ref_pid, cycle );
    418415#endif
    419416
     
    503500if( cycle > DEBUG_USER_DIR )
    504501printk("\n[%s] thread[%x,%x] deleted user_dir (%x,%x) / cycle %d\n",
    505 __FUNCTION__, process->pid, this->trdid, local_cxy, dir, cycle );
     502__FUNCTION__, this->process->pid, this->trdid, local_cxy, dir, cycle );
    506503#endif
    507504
  • trunk/kernel/mm/vmm.c

    r632 r633  
    12301230    page_t    * page_ptr;   // page descriptor pointer
    12311231    xptr_t      count_xp;   // extended pointer on page refcount
    1232     uint32_t    count;      // current value of page refcount
    12331232
    12341233// check arguments
     
    12821281            // decrement page refcount
    12831282            count_xp = XPTR( page_cxy , &page_ptr->refcount );
    1284             count    = hal_remote_atomic_add( count_xp , -1 );
     1283            hal_remote_atomic_add( count_xp , -1 );
    12851284
    12861285            // compute the ppn_release condition depending on vseg type
  • trunk/kernel/syscalls/sys_read.c

    r625 r633  
    5959    error_t       error;
    6060    vseg_t      * vseg;            // required for user space checking
    61         xptr_t        file_xp;         // remote file extended pointer
     61    xptr_t        file_xp;         // remote file extended pointer
    6262    vfs_file_t  * file_ptr;        // remote file local pointer
    6363    cxy_t         file_cxy;        // remote file cluster identifier
    6464    uint32_t      file_type;       // file type
    65     uint32_t      file_offset;     // current file offset
    6665    uint32_t      file_attr;       // file_attribute
    67     vfs_inode_t * inode_ptr;       // local pointer on associated inode
    6866    uint32_t      nbytes;          // number of bytes actually read
    6967    reg_t         save_sr;         // required to enable IRQs during syscall
     
    132130    file_cxy = GET_CXY( file_xp );
    133131
    134     // get file type, offset, attributes and associated inode
     132    // get file type and attributes
    135133    file_type   = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) );
    136     file_offset = hal_remote_l32( XPTR( file_cxy , &file_ptr->offset ) );
    137     inode_ptr   = hal_remote_lpt( XPTR( file_cxy , &file_ptr->inode ) );
    138134    file_attr   = hal_remote_l32( XPTR( file_cxy , &file_ptr->attr ) );
    139135
  • trunk/kernel/syscalls/sys_thread_create.c

    r626 r633  
    4747                       void                  * start_args )
    4848{
    49         pthread_attr_t   kern_attr;        // copy of pthread attributes in kernel space
    50         thread_t       * parent;           // pointer on thread executing the pthread_create
    51         xptr_t           parent_xp;        // extended pointer on calling thread
     49    pthread_attr_t   kern_attr;        // copy of pthread attributes in kernel space
     50    thread_t       * parent;           // pointer on thread executing the pthread_create
    5251    cxy_t            child_cxy;        // created child thread cluster identifier
    53         thread_t       * child_ptr;        // pointer on created child thread
    54         xptr_t           child_xp;         // extended pointer on created thread
    55         trdid_t          trdid;            // created thread identifier
    56         process_t      * process;          // pointer on local process descriptor
    57         vseg_t         * vseg;             // required for user space checking
    58         error_t          error;
    59 
    60         // get parent thead pointer, extended pointer, and process
    61         parent     = CURRENT_THREAD;
    62         parent_xp  = XPTR( local_cxy , parent );
    63         process    = parent->process;
     52    thread_t       * child_ptr;        // pointer on created child thread
     53    xptr_t           child_xp;         // extended pointer on created thread
     54    trdid_t          trdid;            // created thread identifier
     55    process_t      * process;          // pointer on local process descriptor
     56    vseg_t         * vseg;             // required for user space checking
     57    error_t          error;
     58
     59    // get parent thead pointer, extended pointer, and process
     60    parent     = CURRENT_THREAD;
     61    process    = parent->process;
    6462
    6563#if (DEBUG_SYS_THREAD_CREATE || CONFIG_INSTRUMENTATION_SYSCALLS)
  • trunk/kernel/syscalls/sys_thread_join.c

    r584 r633  
    4646    xptr_t        target_join_lock_xp;
    4747    xptr_t        target_flags_xp;
    48     xptr_t        target_blocked_xp;
    4948    xptr_t        target_join_xp_xp;
    5049    xptr_t        killer_xp;
     
    126125    target_join_lock_xp = XPTR( target_cxy , &target_ptr->join_lock );
    127126    target_flags_xp     = XPTR( target_cxy , &target_ptr->flags );
    128     target_blocked_xp   = XPTR( target_cxy , &target_ptr->blocked );
    129127    target_join_xp_xp   = XPTR( target_cxy , &target_ptr->join_xp );
    130128
Note: See TracChangeset for help on using the changeset viewer.