Changeset 459 for trunk/kernel/kern


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

Introduce the math library, to support the floating point
data used by the multi-thread fft application.
Fix several bugs regarding the FPU context save/restore.
Introduce support for the %f format in printf.

Location:
trunk/kernel/kern
Files:
5 edited

Legend:

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

    r457 r459  
    406406        remote_spinlock_lock_busy( lock_xp , &save_sr );
    407407
    408         // call nolock_printk to print function_name
    409         nolock_printk("\n[PANIC] on core[%x,%d] in %s : " ,
    410         local_cxy , CURRENT_THREAD->core->lid , function_name );
     408        // call nolock_printk to print core, function_name, and cycle
     409        nolock_printk("\n[PANIC] on core[%x,%d] in %s at cycle %d : " ,
     410        local_cxy, CURRENT_THREAD->core->lid, function_name, (uint32_t)hal_get_cycles() );
    411411
    412412        // call kernel_printf on TXT0, in busy waiting to print format
  • trunk/kernel/kern/process.c

    r457 r459  
    10181018                if( entry != XPTR_NULL )
    10191019                {
    1020             // increment file descriptor ref count
     1020            // increment file descriptor refcount
    10211021            vfs_file_count_up( entry );
    10221022
  • trunk/kernel/kern/rpc.c

    r457 r459  
    980980                                  error_t      * error )     // out
    981981{
     982#if DEBUG_RPC_VFS_INODE_CREATE
     983uint32_t cycle = (uint32_t)hal_get_cycles();
     984if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
     985printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     986__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     987#endif
     988
    982989    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    983990
     
    10051012    *error    = (error_t)rpc.args[9];
    10061013
     1014#if DEBUG_RPC_VFS_INODE_CREATE
     1015uint32_t cycle = (uint32_t)hal_get_cycles();
     1016if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
     1017printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
     1018__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1019#endif
    10071020}
    10081021
     
    10101023void rpc_vfs_inode_create_server( xptr_t xp )
    10111024{
     1025#if DEBUG_RPC_VFS_INODE_CREATE
     1026uint32_t cycle = (uint32_t)hal_get_cycles();
     1027if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
     1028printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1029__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1030#endif
     1031
    10121032    xptr_t           dentry_xp;
    10131033    uint32_t         fs_type;
     
    10501070    hal_remote_swd( XPTR( client_cxy , &desc->args[9] ) , (uint64_t)error );
    10511071
     1072#if DEBUG_RPC_VFS_INODE_CREATE
     1073uint32_t cycle = (uint32_t)hal_get_cycles();
     1074if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
     1075printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
     1076__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1077#endif
    10521078}
    10531079
     
    10581084/////////////////////////////////////////////////////////////
    10591085void rpc_vfs_inode_destroy_client( cxy_t                cxy,
    1060                                    struct vfs_inode_s * inode )
    1061 {
     1086                                   struct vfs_inode_s * inode,
     1087                                   error_t            * error )
     1088{
     1089#if DEBUG_RPC_VFS_INODE_DESTROY
     1090uint32_t cycle = (uint32_t)hal_get_cycles();
     1091if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
     1092printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1093__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1094#endif
     1095
    10621096    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    10631097
     
    10741108    rpc_send( cxy , &rpc );
    10751109
     1110#if DEBUG_RPC_VFS_INODE_DESTROY
     1111uint32_t cycle = (uint32_t)hal_get_cycles();
     1112if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
     1113printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
     1114__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1115#endif
    10761116}
    10771117
     
    10791119void rpc_vfs_inode_destroy_server( xptr_t xp )
    10801120{
     1121#if DEBUG_RPC_VFS_INODE_DESTROY
     1122uint32_t cycle = (uint32_t)hal_get_cycles();
     1123if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
     1124printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1125__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1126#endif
     1127
    10811128    vfs_inode_t * inode;
     1129    error_t       error;
    10821130
    10831131    // get client cluster identifier and pointer on RPC descriptor
     
    10891137                       
    10901138    // call local kernel function
    1091     vfs_inode_destroy( inode );
    1092 
     1139    error = vfs_inode_destroy( inode );
     1140
     1141    // set output argument
     1142    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
     1143
     1144#if DEBUG_RPC_VFS_INODE_DESTROY
     1145uint32_t cycle = (uint32_t)hal_get_cycles();
     1146if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
     1147printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
     1148__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1149#endif
    10931150}
    10941151
     
    11941251///////////////////////////////////////////////////////
    11951252void rpc_vfs_dentry_destroy_client( cxy_t          cxy,
    1196                                     vfs_dentry_t * dentry )
     1253                                    vfs_dentry_t * dentry,
     1254                                    error_t      * error )
    11971255{
    11981256#if DEBUG_RPC_VFS_DENTRY_DESTROY
     
    12361294
    12371295    vfs_dentry_t * dentry;
     1296    error_t        error;
    12381297
    12391298    // get client cluster identifier and pointer on RPC descriptor
     
    12451304                       
    12461305    // call local kernel function
    1247     vfs_dentry_destroy( dentry );
     1306    error = vfs_dentry_destroy( dentry );
     1307
     1308    // set output argument
     1309    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
    12481310
    12491311#if DEBUG_RPC_VFS_DENTRY_DESTROY
  • trunk/kernel/kern/rpc.h

    r457 r459  
    350350 * @ cxy       :  server cluster identifier
    351351 * @ inode     : [in]  local pointer on inode.
     352 * @ error     : [out] error status (0 if success).
    352353 **********************************************************************************/
    353354void rpc_vfs_inode_destroy_client( cxy_t                 cxy,
    354                                    struct vfs_inode_s * inode );
     355                                   struct vfs_inode_s * inode,
     356                                   error_t            * error );
    355357
    356358void rpc_vfs_inode_destroy_server( xptr_t xp );
     
    377379
    378380/***********************************************************************************
    379  * [13] The RPC_VFS_DENTRY_DESTROY releases memory allocated for an dentry descriptor
    380  * in a remote cluster.
     381 * [13] The RPC_VFS_DENTRY_DESTROY remove a denfry from the parent inode XHTAB,
     382 * and releases memory allocated for the dentry descriptor in a remote cluster.
    381383 ***********************************************************************************
    382384 * @ cxy       :  server cluster identifier
    383385 * @ dentry     : [in]  local pointer on dentry.
     386 * @ error     : [out] error status (0 if success).
    384387 **********************************************************************************/
    385388void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
    386                                     struct vfs_dentry_s * dentry );
     389                                    struct vfs_dentry_s * dentry,
     390                                    error_t             * error );
    387391
    388392void rpc_vfs_dentry_destroy_server( xptr_t xp );
  • trunk/kernel/kern/thread.h

    r457 r459  
    118118 * This structure defines a thread descriptor.
    119119 * It is used for both the user threads and the kernel threads.
    120  * In a process, a user thread is identified by a unique TRDID (thread identifier),
    121  * that is returned by the kernel to the user:
     120 * In a process, a user thread is identified by a unique TRDID (thread identifier):
    122121 * - The TRDID 16 LSB bits contain the LTID (Local Thread Index).
    123122 * - The TRDID 16 MSB bits contain the CXY of cluster containing the thread.
    124  * - The LTID is used to index the th_tbl[] array in the local process descriptor.
    125  _* This TRDID is computed by the process_register_thread() function, when the user
     123 * The main thread LTID value is always 0.
     124 * The LTID is used to index the th_tbl[] array in the local process descriptor.
     125 * This TRDID is computed by the process_register_thread() function, when the user
    126126 * thread is registered in the local copy of the process descriptor.
    127  *
    128127 * WARNING : Don't modify the first 4 fields order, as this order is used by the
    129128 * hal_kentry assembly code for the TSAR architecture.
Note: See TracChangeset for help on using the changeset viewer.