Changeset 623 for trunk/kernel/kern


Ignore:
Timestamp:
Mar 6, 2019, 4:37:15 PM (5 years ago)
Author:
alain
Message:

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

Location:
trunk/kernel/kern
Files:
8 edited

Legend:

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

    r619 r623  
    33 *
    44 * Authors :  Mohamed Lamine Karaoui (2015)
    5  *            Alain Greiner  (2016,2017,2018)
     5 *            Alain Greiner  (2016,2017,2018,2019)
    66 *
    77 * Copyright (c) Sorbonne Universites
     
    113113cxy_t                local_cxy                               CONFIG_CACHE_LINE_ALIGNED;
    114114
    115 // This variable is used for CP0 cores synchronisation in kernel_init()
     115// This variable is used for core[0] cores synchronisation in kernel_init()
    116116__attribute__((section(".kdata")))
    117117xbarrier_t           global_barrier                          CONFIG_CACHE_LINE_ALIGNED;
     
    126126
    127127// kernel_init is the entry point defined in hal/tsar_mips32/kernel.ld
    128 // It is used by the bootloader.
     128// It is used by the bootloader to tranfer control to kernel.
    129129extern void kernel_init( boot_info_t * info );
    130130
     
    466466// These chdev descriptors are distributed on all clusters, using a modulo on a global
    467467// index, identically computed in all clusters.
    468 // This function is executed in all clusters by the CP0 core, that computes a global index
    469 // for all external chdevs. Each CP0 core creates only the chdevs that must be placed in
     468// This function is executed in all clusters by the core[0] core, that computes a global index
     469// for all external chdevs. Each core[0] core creates only the chdevs that must be placed in
    470470// the local cluster, because the global index matches the local index.
    471471// The relevant entries in all copies of the devices directory are initialised.
     
    626626
    627627///////////////////////////////////////////////////////////////////////////////////////////
    628 // This function is called by CP0 in cluster 0 to allocate memory and initialize the PIC
     628// This function is called by core[0] in cluster 0 to allocate memory and initialize the PIC
    629629// device, namely the informations attached to the external IOPIC controller, that
    630630// must be replicated in all clusters (struct iopic_input).
     
    791791
    792792///////////////////////////////////////////////////////////////////////////////////////////
    793 // This function is called by all CP0s in all cluster to complete the PIC device
     793// This function is called by all core[0]s in all cluster to complete the PIC device
    794794// initialisation, namely the informations attached to the LAPIC controller.
    795795// This initialisation must be done after the IOPIC initialisation, but before other
     
    899899///////////////////////////////////////////////////////////////////////////////////////////
    900900// This function is the entry point for the kernel initialisation.
    901 // It is executed by all cores in all clusters, but only core[0], called CP0,
    902 // initializes the shared resources such as the cluster manager, or the local peripherals.
     901// It is executed by all cores in all clusters, but only core[0] initializes
     902// the shared resources such as the cluster manager, or the local peripherals.
    903903// To comply with the multi-kernels paradigm, it accesses only local cluster memory, using
    904904// only information contained in the local boot_info_t structure, set by the bootloader.
    905 // Only CP0 in cluster 0 print the log messages.
     905// Only core[0] in cluster 0 print the log messages.
    906906///////////////////////////////////////////////////////////////////////////////////////////
    907907// @ info    : pointer on the local boot-info structure.
     
    925925
    926926    /////////////////////////////////////////////////////////////////////////////////
    927     // STEP 0 : Each core get its core identifier from boot_info, and makes
     927    // STEP 1 : Each core get its core identifier from boot_info, and makes
    928928    //          a partial initialisation of its private idle thread descriptor.
    929     //          CP0 initializes the "local_cxy" global variable.
    930     //          CP0 in cluster IO initializes the TXT0 chdev to print log messages.
     929    //          core[0] initializes the "local_cxy" global variable.
     930    //          core[0] in cluster[0] initializes the TXT0 chdev for log messages.
    931931    /////////////////////////////////////////////////////////////////////////////////
    932932
     
    936936                                  &core_gid );
    937937
    938     // all CP0s initialize cluster identifier
     938    // core[0] initialize cluster identifier
    939939    if( core_lid == 0 ) local_cxy = info->cxy;
    940940
     
    956956#endif
    957957
    958     // all CP0s initialize cluster info
     958    // core[0] initializes cluster info
    959959    if( core_lid == 0 ) cluster_info_init( info );
    960960
    961     // CP0 in cluster 0 initialises TXT0 chdev descriptor
     961    // core[0] in cluster[0] initialises TXT0 chdev descriptor
    962962    if( (core_lid == 0) && (core_cxy == 0) ) txt0_device_init( info );
     963
     964    // all cores check identifiers
     965    if( error )
     966    {
     967        printk("\n[PANIC] in %s : illegal core : gid %x / cxy %x / lid %d",
     968        __FUNCTION__, core_lid, core_cxy, core_lid );
     969        hal_core_sleep();
     970    }
    963971
    964972    /////////////////////////////////////////////////////////////////////////////////
     
    970978#if DEBUG_KERNEL_INIT
    971979if( (core_lid ==  0) & (local_cxy == 0) )
    972 printk("\n[%s] : exit barrier 0 : TXT0 initialized / cycle %d\n",
     980printk("\n[%s] : exit barrier 1 : TXT0 initialized / cycle %d\n",
    973981__FUNCTION__, (uint32_t)hal_get_cycles() );
    974982#endif
    975983
    976     /////////////////////////////////////////////////////////////////////////////
    977     // STEP 1 : all cores check core identifier.
    978     //          CP0 initializes the local cluster manager.
    979     //          This includes the memory allocators.
    980     /////////////////////////////////////////////////////////////////////////////
    981 
    982     // all cores check identifiers
    983     if( error )
    984     {
    985         printk("\n[PANIC] in %s : illegal core : gid %x / cxy %x / lid %d",
    986         __FUNCTION__, core_lid, core_cxy, core_lid );
    987         hal_core_sleep();
    988     }
    989 
    990     // all CP0s initialise DQDT (only CPO in cluster 0 build the quad-tree)
     984    /////////////////////////////////////////////////////////////////////////////////
     985    // STEP 2 : core[0] initializes the cluter manager,
     986    //          including the physical memory allocator.
     987    /////////////////////////////////////////////////////////////////////////////////
     988
     989    // core[0] initialises DQDT (only core[0] in cluster 0 build the quad-tree)
    991990    if( core_lid == 0 ) dqdt_init();
    992991   
    993     // all CP0s initialize other cluster manager complex structures
     992    // core[0] initialize other cluster manager complex structures
    994993    if( core_lid == 0 )
    995994    {
     
    10121011#if DEBUG_KERNEL_INIT
    10131012if( (core_lid ==  0) & (local_cxy == 0) )
    1014 printk("\n[%s] : exit barrier 1 : clusters initialised / cycle %d\n",
     1013printk("\n[%s] : exit barrier 2 : cluster manager initialized / cycle %d\n",
    10151014__FUNCTION__, (uint32_t)hal_get_cycles() );
    10161015#endif
    10171016
    10181017    /////////////////////////////////////////////////////////////////////////////////
    1019     // STEP 2 : CP0 initializes the process_zero descriptor.
    1020     //          CP0 in cluster 0 initializes the IOPIC device.
     1018    // STEP 3 : core[0] initializes the process_zero descriptor,
     1019    //          including the kernel VMM (both GPT and VSL)
    10211020    /////////////////////////////////////////////////////////////////////////////////
    10221021
     
    10251024    core    = &cluster->core_tbl[core_lid];
    10261025
    1027     // all CP0s initialize the process_zero descriptor
    1028     if( core_lid == 0 ) process_zero_create( &process_zero );
    1029 
    1030     // CP0 in cluster 0 initializes the PIC chdev,
     1026    // core[0] initializes the process_zero descriptor,
     1027    if( core_lid == 0 ) process_zero_create( &process_zero , info );
     1028
     1029    /////////////////////////////////////////////////////////////////////////////////
     1030    if( core_lid == 0 ) xbarrier_wait( XPTR( 0 , &global_barrier ),
     1031                                        (info->x_size * info->y_size) );
     1032    barrier_wait( &local_barrier , info->cores_nr );
     1033    /////////////////////////////////////////////////////////////////////////////////
     1034
     1035#if DEBUG_KERNEL_INIT
     1036if( (core_lid ==  0) & (local_cxy == 0) )
     1037printk("\n[%s] : exit barrier 3 : kernel processs initialized / cycle %d\n",
     1038__FUNCTION__, (uint32_t)hal_get_cycles() );
     1039#endif
     1040
     1041    /////////////////////////////////////////////////////////////////////////////////
     1042    // STEP 4 : all cores initialize their private MMU
     1043    //          core[0] in cluster 0 initializes the IOPIC device.
     1044    /////////////////////////////////////////////////////////////////////////////////
     1045
     1046    // all cores initialise their MMU
     1047    hal_mmu_init( &process_zero.vmm.gpt );
     1048
     1049    // core[0] in cluster[0] initializes the PIC chdev,
    10311050    if( (core_lid == 0) && (local_cxy == 0) ) iopic_init( info );
    10321051   
     
    10391058#if DEBUG_KERNEL_INIT
    10401059if( (core_lid ==  0) & (local_cxy == 0) )
    1041 printk("\n[%s] : exit barrier 2 : PIC initialised / cycle %d\n",
     1060printk("\n[%s] : exit barrier 4 : MMU and IOPIC initialized / cycle %d\n",
    10421061__FUNCTION__, (uint32_t)hal_get_cycles() );
    10431062#endif
    10441063
    10451064    ////////////////////////////////////////////////////////////////////////////////
    1046     // STEP 3 : CP0 initializes the distibuted LAPIC descriptor.
    1047     //          CP0 initializes the internal chdev descriptors
    1048     //          CP0 initialize the local external chdev descriptors
     1065    // STEP 5 : core[0] initializes the distibuted LAPIC descriptor.
     1066    //          core[0] initializes the internal chdev descriptors
     1067    //          core[0] initialize the local external chdev descriptors
    10491068    ////////////////////////////////////////////////////////////////////////////////
    10501069
    1051     // all CP0s initialize their local LAPIC extension,
     1070    // all core[0]s initialize their local LAPIC extension,
    10521071    if( core_lid == 0 ) lapic_init( info );
    10531072
    1054     // CP0 scan the internal (private) peripherals,
     1073    // core[0] scan the internal (private) peripherals,
    10551074    // and allocates memory for the corresponding chdev descriptors.
    10561075    if( core_lid == 0 ) internal_devices_init( info );
    10571076       
    10581077
    1059     // All CP0s contribute to initialise external peripheral chdev descriptors.
    1060     // Each CP0[cxy] scan the set of external (shared) peripherals (but the TXT0),
     1078    // All core[0]s contribute to initialise external peripheral chdev descriptors.
     1079    // Each core[0][cxy] scan the set of external (shared) peripherals (but the TXT0),
    10611080    // and allocates memory for the chdev descriptors that must be placed
    10621081    // on the (cxy) cluster according to the global index value.
     
    10721091#if DEBUG_KERNEL_INIT
    10731092if( (core_lid ==  0) & (local_cxy == 0) )
    1074 printk("\n[%s] : exit barrier 3 : all chdevs initialised / cycle %d\n",
     1093printk("\n[%s] : exit barrier 5 : all chdevs initialised / cycle %d\n",
    10751094__FUNCTION__, (uint32_t)hal_get_cycles() );
    10761095#endif
     
    10821101   
    10831102    /////////////////////////////////////////////////////////////////////////////////
    1084     // STEP 4 : All cores enable IPI (Inter Procesor Interrupt),
     1103    // STEP 6 : All cores enable IPI (Inter Procesor Interrupt),
    10851104    //          Alh cores initialize IDLE thread.
    1086     //          Only CP0 in cluster 0 creates the VFS root inode.
     1105    //          Only core[0] in cluster[0] creates the VFS root inode.
    10871106    //          It access the boot device to initialize the file system context.
    10881107    /////////////////////////////////////////////////////////////////////////////////
     
    11071126#endif
    11081127
    1109     // CPO in cluster 0 creates the VFS root
     1128    // core[O] in cluster[0] creates the VFS root
    11101129    if( (core_lid ==  0) && (local_cxy == 0 ) )
    11111130    {
     
    11371156            // 4. create VFS root inode in cluster 0
    11381157            error = vfs_inode_create( FS_TYPE_FATFS,                       // fs_type
    1139                                       INODE_TYPE_DIR,                      // inode_type
    11401158                                      0,                                   // attr
    11411159                                      0,                                   // rights
     
    11501168            }
    11511169
    1152             // 5. update FATFS root inode extension 
     1170            // 5. update FATFS root inode "type" and "extend" fields 
    11531171            cxy_t         vfs_root_cxy = GET_CXY( vfs_root_inode_xp );
    11541172            vfs_inode_t * vfs_root_ptr = GET_PTR( vfs_root_inode_xp );
     1173            hal_remote_s32( XPTR( vfs_root_cxy , &vfs_root_ptr->extend ), INODE_TYPE_DIR );
    11551174            hal_remote_spt( XPTR( vfs_root_cxy , &vfs_root_ptr->extend ),
    11561175                            (void*)(intptr_t)root_dir_cluster );
     
    11891208#if DEBUG_KERNEL_INIT
    11901209if( (core_lid ==  0) & (local_cxy == 0) )
    1191 printk("\n[%s] : exit barrier 4 : VFS root (%x,%x) in cluster 0 / cycle %d\n",
     1210printk("\n[%s] : exit barrier 6 : VFS root (%x,%x) in cluster 0 / cycle %d\n",
    11921211__FUNCTION__, GET_CXY(process_zero.vfs_root_xp),
    11931212GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() );
     
    11951214
    11961215    /////////////////////////////////////////////////////////////////////////////////
    1197     // STEP 5 : Other CP0s allocate memory for the selected FS context,
    1198     //          and initialise both the local FS context and the local VFS context
    1199     //          from values stored in cluster 0.
     1216    // STEP 7 : In all other clusters than cluster[0], the core[0] allocates memory
     1217    //          for the selected FS context, and initialise the local FS context and
     1218    //          the local VFS context from values stored in cluster 0.
    12001219    //          They get the VFS root inode extended pointer from cluster 0.
    12011220    /////////////////////////////////////////////////////////////////////////////////
     
    12591278#if DEBUG_KERNEL_INIT
    12601279if( (core_lid ==  0) & (local_cxy == 1) )
    1261 printk("\n[%s] : exit barrier 5 : VFS root (%x,%x) in cluster 1 / cycle %d\n",
     1280printk("\n[%s] : exit barrier 7 : VFS root (%x,%x) in cluster 1 / cycle %d\n",
    12621281__FUNCTION__, GET_CXY(process_zero.vfs_root_xp),
    12631282GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() );
     
    12651284
    12661285    /////////////////////////////////////////////////////////////////////////////////
    1267     // STEP 6 : CP0 in cluster 0 makes the global DEVFS tree initialisation:
     1286    // STEP 8 : core[0] in cluster 0 makes the global DEVFS initialisation:
    12681287    //          It initializes the DEVFS context, and creates the DEVFS
    12691288    //          "dev" and "external" inodes in cluster 0.
     
    13091328#if DEBUG_KERNEL_INIT
    13101329if( (core_lid ==  0) & (local_cxy == 0) )
    1311 printk("\n[%s] : exit barrier 6 : DEVFS root initialized in cluster 0 / cycle %d\n",
     1330printk("\n[%s] : exit barrier 8 : DEVFS root initialized in cluster 0 / cycle %d\n",
    13121331__FUNCTION__, (uint32_t)hal_get_cycles() );
    13131332#endif
    13141333
    13151334    /////////////////////////////////////////////////////////////////////////////////
    1316     // STEP 7 : All CP0s complete in parallel the DEVFS tree initialization.
    1317     //          Each CP0 get the "dev" and "external" extended pointers from
     1335    // STEP 9 : All core[0]s complete in parallel the DEVFS initialization.
     1336    //          Each core[0] get the "dev" and "external" extended pointers from
    13181337    //          values stored in cluster 0.
    1319     //          Then each CP0 in cluster(i) creates the DEVFS "internal" directory,
     1338    //          Then each core[0] in cluster(i) creates the DEVFS "internal" directory,
    13201339    //          and creates the pseudo-files for all chdevs in cluster (i).
    13211340    /////////////////////////////////////////////////////////////////////////////////
     
    13461365#if DEBUG_KERNEL_INIT
    13471366if( (core_lid ==  0) & (local_cxy == 0) )
    1348 printk("\n[%s] : exit barrier 7 : DEV initialized in cluster 0 / cycle %d\n",
     1367printk("\n[%s] : exit barrier 9 : DEVFS initialized in cluster 0 / cycle %d\n",
    13491368__FUNCTION__, (uint32_t)hal_get_cycles() );
    13501369#endif
    13511370
    1352     /////////////////////////////////////////////////////////////////////////////////
    1353     // STEP 8 : CP0 in cluster 0 creates the first user process (process_init)
     1371#if( DEBUG_KERNEL_INIT & 1 )
     1372if( (core_lid ==  0) & (local_cxy == 0) )
     1373vfs_display( vfs_root_inode_xp );
     1374#endif
     1375
     1376    /////////////////////////////////////////////////////////////////////////////////
     1377    // STEP 10 : core[0] in cluster 0 creates the first user process (process_init).
     1378    //           This include the first user process VMM (GPT and VSL) creation.
     1379    //           Finally, it prints the ALMOS-MKH banner.
    13541380    /////////////////////////////////////////////////////////////////////////////////
    13551381
    13561382    if( (core_lid == 0) && (local_cxy == 0) )
    13571383    {
    1358 
    1359 #if( DEBUG_KERNEL_INIT & 1 )
    1360 vfs_display( vfs_root_inode_xp );
    1361 #endif
    1362 
    13631384       process_init_create();
    13641385    }
    1365 
    1366     /////////////////////////////////////////////////////////////////////////////////
    1367     if( core_lid == 0 ) xbarrier_wait( XPTR( 0 , &global_barrier ),
    1368                                         (info->x_size * info->y_size) );
    1369     barrier_wait( &local_barrier , info->cores_nr );
    1370     /////////////////////////////////////////////////////////////////////////////////
    1371 
    1372 #if DEBUG_KERNEL_INIT
    1373 if( (core_lid ==  0) & (local_cxy == 0) )
    1374 printk("\n[%s] : exit barrier 8 : process init created / cycle %d\n",
    1375 __FUNCTION__, (uint32_t)hal_get_cycles() );
    1376 #endif
    13771386
    13781387#if (DEBUG_KERNEL_INIT & 1)
     
    13811390#endif
    13821391
    1383     /////////////////////////////////////////////////////////////////////////////////
    1384     // STEP 9 : CP0 in cluster 0 print banner
    1385     /////////////////////////////////////////////////////////////////////////////////
    1386    
    13871392    if( (core_lid == 0) && (local_cxy == 0) )
    13881393    {
    13891394        print_banner( (info->x_size * info->y_size) , info->cores_nr );
     1395    }
    13901396
    13911397#if( DEBUG_KERNEL_INIT & 1 )
     1398if( (core_lid ==  0) & (local_cxy == 0) )
    13921399printk("\n\n***** memory fooprint for main kernel objects\n\n"
    13931400                   " - thread descriptor  : %d bytes\n"
     
    14371444#endif
    14381445
    1439     }
     1446    // each core updates the register(s) definig the kernel
     1447    // entry points for interrupts, exceptions and syscalls...
     1448    hal_set_kentry();
    14401449
    14411450    // each core activates its private TICK IRQ
     
    14481457    /////////////////////////////////////////////////////////////////////////////////
    14491458
    1450 #if DEBUG_KERNEL_INIT
     1459#if( DEBUG_KERNEL_INIT & 1 )
    14511460thread_t * this = CURRENT_THREAD;
    14521461printk("\n[%s] : thread[%x,%x] on core[%x,%d] jumps to thread_idle_func() / cycle %d\n",
  • trunk/kernel/kern/printk.c

    r583 r623  
    4848
    4949    va_list    args;      // printf arguments
    50     uint32_t   ps;        // write pointer to the string buffer
     50    uint32_t   ps;        // pointer to the string buffer
    5151
    5252    ps = 0;   
     
    5757    while ( *format != 0 )
    5858    {
    59 
    6059        if (*format == '%')   // copy argument to string
    6160        {
     
    9897                break;
    9998            }
    100             case ('d'):             // decimal signed integer
     99            case ('b'):             // excactly 2 digits hexadecimal integer
     100            {
     101                int  val = va_arg( args, int );
     102                int  val_lsb = val & 0xF;
     103                int  val_msb = (val >> 4) & 0xF;
     104                buf[0] = HexaTab[val_msb];
     105                buf[1] = HexaTab[val_lsb];
     106                len  = 2;
     107                pbuf = buf;
     108                break;
     109            }
     110            case ('d'):             // up to 10 digits decimal signed integer
    101111            {
    102112                int val = va_arg( args, int );
     
    108118                for(i = 0; i < 10; i++)
    109119                {
    110 
    111120                    buf[9 - i] = HexaTab[val % 10];
    112121                    if (!(val /= 10)) break;
     
    116125                break;
    117126            }
    118             case ('u'):             // decimal unsigned integer
     127            case ('u'):             // up to 10 digits decimal unsigned integer
    119128            {
    120129                uint32_t val = va_arg( args, uint32_t );
     
    128137                break;
    129138            }
    130             case ('x'):             // 32 bits hexadecimal
    131             case ('l'):             // 64 bits hexadecimal
     139            case ('x'):             // up to 8 digits hexadecimal
     140            case ('l'):             // up to 16 digits hexadecimal
    132141            {
    133142                uint32_t imax;
     
    157166                break;
    158167            }
    159             case ('X'):             // 32 bits hexadecimal on 8 characters
     168            case ('X'):             // exactly 8 digits hexadecimal
    160169            {
    161170                uint32_t val = va_arg( args , uint32_t );
     
    238247            case ('c'):             /* char conversion */
    239248            {
    240                 int val = va_arg( *args , int );
     249                int  val = va_arg( *args , int );
    241250                len = 1;
    242                 buf[0] = val;
     251                buf[0] = (char)val;
    243252                pbuf = &buf[0];
    244253                break;
    245254            }
    246             case ('d'):             /* 32 bits decimal signed  */
     255            case ('b'):             // excactly 2 digits hexadecimal
     256            {
     257                int  val = va_arg( *args, int );
     258                int  val_lsb = val & 0xF;
     259                int  val_msb = (val >> 4) & 0xF;
     260                buf[0] = HexaTab[val_msb];
     261                buf[1] = HexaTab[val_lsb];
     262                len  = 2;
     263                pbuf = buf;
     264                break;
     265            }
     266            case ('d'):             /* up to 10 digits signed decimal */
    247267            {
    248268                int val = va_arg( *args , int );
     
    261281                break;
    262282            }
    263             case ('u'):             /* 32 bits decimal unsigned */
     283            case ('u'):             /* up to 10 digits unsigned decimal */
    264284            {
    265285                uint32_t val = va_arg( *args , uint32_t );
     
    273293                break;
    274294            }
    275             case ('x'):             /* 32 bits hexadecimal unsigned */
     295            case ('x'):             /* up to 8 digits hexadecimal */
    276296            {
    277297                uint32_t val = va_arg( *args , uint32_t );
     
    286306                break;
    287307            }
    288             case ('X'):             /* 32 bits hexadecimal unsigned  on 10 char */
     308            case ('X'):             /* exactly 8 digits hexadecimal */
    289309            {
    290310                uint32_t val = va_arg( *args , uint32_t );
     
    299319                break;
    300320            }
    301             case ('l'):            /* 64 bits hexadecimal unsigned */
    302             {
    303                 unsigned long long val = va_arg( *args , unsigned long long );
     321            case ('l'):            /* up to 16 digits hexadecimal */
     322            {
     323                uint64_t val = va_arg( *args , uint64_t );
    304324                dev_txt_sync_write( "0x" , 2 );
    305325                for(i = 0; i < 16; i++)
     
    312332                break;
    313333            }
    314             case ('L'):           /* 64 bits hexadecimal unsigned on 18 char */
    315             {
    316                 unsigned long long val = va_arg( *args , unsigned long long );
     334            case ('L'):           /* exactly 16 digits hexadecimal */
     335            {
     336                uint64_t val = va_arg( *args , uint64_t );
    317337                dev_txt_sync_write( "0x" , 2 );
    318338                for(i = 0; i < 16; i++)
     
    525545}
    526546
     547/////////////////////////////
     548void putb( char     * string,
     549           uint8_t  * buffer,
     550           uint32_t   size )
     551{
     552    uint32_t line;
     553    uint32_t byte = 0;
     554
     555    // get pointers on TXT0 chdev
     556    xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
     557    cxy_t     txt0_cxy = GET_CXY( txt0_xp );
     558    chdev_t * txt0_ptr = GET_PTR( txt0_xp );
     559
     560    // get extended pointer on remote TXT0 chdev lock
     561    xptr_t  lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
     562
     563    // get TXT0 lock
     564    remote_busylock_acquire( lock_xp );
     565
     566    // display string on TTY0
     567    nolock_printk("\n***** %s *****\n", string );
     568
     569    for ( line = 0 ; line < (size>>4) ; line++ )
     570    {
     571         nolock_printk(" %X | %b %b %b %b | %b %b %b %b | %b %b %b %b | %b %b %b %b \n",
     572         byte,
     573         buffer[byte+ 0],buffer[byte+ 1],buffer[byte+ 2],buffer[byte+ 3],
     574         buffer[byte+ 4],buffer[byte+ 5],buffer[byte+ 6],buffer[byte+ 7],
     575         buffer[byte+ 8],buffer[byte+ 9],buffer[byte+10],buffer[byte+11],
     576         buffer[byte+12],buffer[byte+13],buffer[byte+14],buffer[byte+15] );
     577
     578         byte += 16;
     579    }
     580
     581    // release TXT0 lock
     582    remote_busylock_release( lock_xp );
     583}
     584
     585
    527586
    528587// Local Variables:
  • trunk/kernel/kern/printk.h

    r583 r623  
    2424///////////////////////////////////////////////////////////////////////////////////
    2525// The printk.c and printk.h files define the functions used by the kernel
    26 // to display messages on a text terminal.
    27 // Two access modes are supported:
    28 // - The printk() function displays kernel messages on the kernel terminal TXT0,
    29 //   using a busy waiting policy: It calls directly the relevant TXT driver,
    30 //   after taking the TXT0 busylock for exclusive access to the TXT0 terminal.
    31 // - The user_printk() function displays messages on the calling thread private
    32 //   terminal, using a descheduling policy: it register the request in the selected
    33 //   TXT chdev waiting queue and deschedule. The calling thread is reactivated by
    34 //   the IRQ signalling completion.
    35 // Both functions use the generic TXT device to call the proper implementation
    36 // dependant TXT driver.
    37 // Finally these files define a set of conditional trace <***_dmsg> for debug.
     26// to display messages on the kernel terminal TXT0, using a busy waiting policy.
     27// It calls synchronously the TXT0 driver, without descheduling.
    3828///////////////////////////////////////////////////////////////////////////////////
    3929
     
    4434#include <stdarg.h>
    4535
    46 #include <hal_special.h> // hal_get_cycles()
     36#include <hal_special.h>
    4737
    4838/**********************************************************************************
    4939 * This function build a formatted string.
    5040 * The supported formats are defined below :
    51  *   %c : single character
    52  *   %d : signed decimal 32 bits integer
    53  *   %u : unsigned decimal 32 bits integer
    54  *   %x : hexadecimal 32 bits integer
    55  *   %l : hexadecimal 64 bits integer
     41 *   %b : exactly 2 digits hexadecimal integer (8 bits)
     42 *   %c : single ascii character (8 bits)
     43 *   %d : up to 10 digits decimal integer (32 bits)
     44 *   %u : up to 10 digits unsigned decimal (32 bits)
     45 *   %x : up to 8 digits hexadecimal integer (32 bits)
     46 *   %X : exactly 8 digits hexadecimal integer (32 bits)
     47 *   %l : up to 16 digits hexadecimal integer (64 bits)
     48 *   %L : exactly 16 digits hexadecimal integer (64 bits)
    5649 *   %s : NUL terminated character string
    5750 **********************************************************************************
     
    153146void putl( uint64_t val );
    154147
     148/**********************************************************************************
     149 * This debug function displays on the kernel TXT0 terminal the content of an
     150 * array of bytes defined by <buffer> and <size> arguments (16 bytes per line).
     151 * The <string> argument is displayed before the buffer content.
     152 * The line format is an address folowed by 16 (hexa) bytes.
     153 **********************************************************************************
     154 * @ string   : buffer name or identifier.
     155 * @ buffer   : local pointer on bytes array.
     156 * @ size     : number of bytes bytes to display.
     157 *********************************************************************************/
     158void putb( char     * string,
     159           uint8_t  * buffer,
     160           uint32_t   size );
     161
     162
    155163
    156164#endif  // _PRINTK_H
  • trunk/kernel/kern/process.c

    r619 r623  
    2929#include <hal_uspace.h>
    3030#include <hal_irqmask.h>
     31#include <hal_vmm.h>
    3132#include <errno.h>
    3233#include <printk.h>
     
    486487    }
    487488
    488     // FIXME decrement the refcount on file pointer by vfs_bin_xp [AG]
     489    // FIXME decrement the refcount on file pointer for vfs_bin_xp [AG]
     490
    489491    // FIXME close all open files [AG]
     492
    490493    // FIXME synchronize dirty files [AG]
    491494
     
    14871490        printk("\n[ERROR] in %s : cannot initialise VMM for %s\n", __FUNCTION__ , path );
    14881491        vfs_close( file_xp , file_id );
    1489         // FIXME restore old process VMM
     1492        // FIXME restore old process VMM [AG]
    14901493        return -1;
    14911494    }
     
    15051508                printk("\n[ERROR] in %s : failed to access <%s>\n", __FUNCTION__ , path );
    15061509        vfs_close( file_xp , file_id );
    1507         // FIXME restore old process VMM
     1510        // FIXME restore old process VMM [AG]
    15081511        return -1;
    15091512        }
     
    15351538
    15361539
    1537 ///////////////////////////////////////////////
    1538 void process_zero_create( process_t * process )
     1540////////////////////////////////////////////////
     1541void process_zero_create( process_t   * process,
     1542                          boot_info_t * info )
    15391543{
    15401544    error_t error;
     
    15661570    process->parent_xp  = XPTR( local_cxy , process );
    15671571    process->term_state = 0;
     1572
     1573    // initialise kernel GPT and VSL, depending on architecture
     1574    hal_vmm_kernel_init( info );
    15681575
    15691576    // reset th_tbl[] array and associated fields
  • trunk/kernel/kern/process.h

    r618 r623  
    7373 * is always stored in the same cluster as the inode associated to the file.
    7474 * A free entry in this array contains the XPTR_NULL value.
    75  * The array size is defined by a the CONFIG_PROCESS_FILE_MAX_NR parameter.
     75 * The array size is defined by the CONFIG_PROCESS_FILE_MAX_NR parameter.
    7676 *
    7777 * NOTE: - Only the fd_array[] in the reference process contains a complete list of open
     
    7979 *       - the fd_array[] in a process copy is simply a cache containing a subset of the
    8080 *         open files to speed the fdid to xptr translation, but the "lock" and "current
    81  *         fields should not be used.
     81 *         fields are not used.
    8282 *       - all modifications made by the process_fd_remove() are done in reference cluster
    8383 *         and reported in all process_copies.
     
    200200
    201201/*********************************************************************************************
    202  * This function initialize, in each cluster, the kernel "process_zero", that is the owner
    203  * of all kernel threads in a given cluster. It is called by the kernel_init() function.
     202 * This function initialize, in each cluster, the kernel "process_zero", that contains
     203 * all kernel threads in a given cluster. It is called by the kernel_init() function.
    204204 * The process_zero descriptor is allocated as a global variable in file kernel_init.c
    205205 * Both the PID and PPID fields are set to zero, the ref_xp is the local process_zero,
    206206 * and the parent process is set to XPTR_NULL. The th_tbl[] is initialized as empty.
    207  *********************************************************************************************
    208  * @ process      : [in] pointer on local process descriptor to initialize.
    209  ********************************************************************************************/
    210 void process_zero_create( process_t * process );
     207 * The process GPT is initialised as required by the target architecture.
     208 * The "kcode" and "kdata" segments are registered in the process VSL.
     209 *********************************************************************************************
     210 * @ process  : [in] pointer on process descriptor to initialize.
     211 * @ info     : pointer on local boot_info_t (for kernel segments base and size).
     212 ********************************************************************************************/
     213void process_zero_create( process_t   * process,
     214                          boot_info_t * info );
    211215
    212216/*********************************************************************************************
     
    428432 * identified by the <process_xp> argument, register the <file_xp> argument in the
    429433 * allocated slot, and return the slot index in the <fdid> buffer.
    430  * It can be called by any thread in any cluster, because it uses portable remote access
     434 * It can be called by any thread in any cluster, because it uses remote access
    431435 * primitives to access the reference process descriptor.
    432436 * It takes the lock protecting the reference fd_array against concurrent accesses.
  • trunk/kernel/kern/rpc.c

    r619 r623  
    22 * rpc.c - RPC operations implementation.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c)  UPMC Sorbonne Universites
     
    5858    &rpc_thread_user_create_server,        // 6
    5959    &rpc_thread_kernel_create_server,      // 7
    60     &rpc_undefined,                        // 8    unused slot       
     60    &rpc_vfs_fs_update_dentry_server,      // 8
    6161    &rpc_process_sigaction_server,         // 9
    6262
     
    6767    &rpc_vfs_file_create_server,           // 14
    6868    &rpc_vfs_file_destroy_server,          // 15
    69     &rpc_vfs_fs_get_dentry_server,         // 16
     69    &rpc_vfs_fs_new_dentry_server,         // 16
    7070    &rpc_vfs_fs_add_dentry_server,         // 17
    7171    &rpc_vfs_fs_remove_dentry_server,      // 18
     
    7676    &rpc_kcm_alloc_server,                 // 22
    7777    &rpc_kcm_free_server,                  // 23
    78     &rpc_undefined,                        // 24   unused slot
     78    &rpc_mapper_sync_server,               // 24
    7979    &rpc_mapper_handle_miss_server,        // 25
    8080    &rpc_vmm_delete_vseg_server,           // 26
     
    9494    "THREAD_USER_CREATE",        // 6
    9595    "THREAD_KERNEL_CREATE",      // 7
    96     "undefined",                 // 8
     96    "VFS_FS_UPDATE_DENTRY",      // 8
    9797    "PROCESS_SIGACTION",         // 9
    9898
     
    112112    "KCM_ALLOC",                 // 22
    113113    "KCM_FREE",                  // 23
    114     "undefined",                 // 24
     114    "MAPPER_SYNC",               // 24
    115115    "MAPPER_HANDLE_MISS",        // 25
    116116    "VMM_DELETE_VSEG",           // 26
     
    921921
    922922/////////////////////////////////////////////////////////////////////////////////////////
    923 // [7]      Marshaling functions attached to RPC_THREAD_KERNEL_CREATE (blocking)
     923// [7]      Marshaling functions attached to RPC_THREAD_KERNEL_CREATE
    924924/////////////////////////////////////////////////////////////////////////////////////////
    925925
     
    10131013
    10141014/////////////////////////////////////////////////////////////////////////////////////////
    1015 // [8]   undefined slot
    1016 /////////////////////////////////////////////////////////////////////////////////////////
    1017 
     1015// [8]   Marshaling functions attached to RPC_VRS_FS_UPDATE_DENTRY
     1016/////////////////////////////////////////////////////////////////////////////////////////
     1017
     1018/////////////////////////////////////////////////////////
     1019void rpc_vfs_fs_update_dentry_client( cxy_t          cxy,
     1020                                      vfs_inode_t  * inode,
     1021                                      vfs_dentry_t * dentry,
     1022                                      uint32_t       size,
     1023                                      error_t      * error )
     1024{
     1025#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1026thread_t * this = CURRENT_THREAD;
     1027uint32_t cycle = (uint32_t)hal_get_cycles();
     1028if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1029printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     1030__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1031#endif
     1032
     1033    uint32_t responses = 1;
     1034
     1035    // initialise RPC descriptor header
     1036    rpc_desc_t  rpc;
     1037    rpc.index    = RPC_VFS_FS_UPDATE_DENTRY;
     1038    rpc.blocking = true;
     1039    rpc.rsp      = &responses;
     1040
     1041    // set input arguments in RPC descriptor
     1042    rpc.args[0] = (uint64_t)(intptr_t)inode;
     1043    rpc.args[1] = (uint64_t)(intptr_t)dentry;
     1044    rpc.args[2] = (uint64_t)size;
     1045
     1046    // register RPC request in remote RPC fifo
     1047    rpc_send( cxy , &rpc );
     1048
     1049    // get output values from RPC descriptor
     1050    *error   = (error_t)rpc.args[3];
     1051
     1052#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1053cycle = (uint32_t)hal_get_cycles();
     1054if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1055printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     1056__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1057#endif
     1058}
     1059
     1060/////////////////////////////////////////////////
     1061void rpc_vfs_fs_update_dentry_server( xptr_t xp )
     1062{
     1063#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1064thread_t * this = CURRENT_THREAD;
     1065uint32_t cycle = (uint32_t)hal_get_cycles();
     1066if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1067printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     1068__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1069#endif
     1070
     1071    error_t        error;
     1072    vfs_inode_t  * inode;
     1073    vfs_dentry_t * dentry;
     1074    uint32_t       size;
     1075
     1076    // get client cluster identifier and pointer on RPC descriptor
     1077    cxy_t        client_cxy  = GET_CXY( xp );
     1078    rpc_desc_t * desc        = GET_PTR( xp );
     1079
     1080    // get input arguments
     1081    inode  = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0]));
     1082    dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1]));
     1083    size   = (uint32_t)               hal_remote_l64(XPTR(client_cxy , &desc->args[2]));
     1084
     1085    // call the kernel function
     1086    error = vfs_fs_update_dentry( inode , dentry , size );
     1087
     1088    // set output argument
     1089    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
     1090
     1091#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1092cycle = (uint32_t)hal_get_cycles();
     1093if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1094printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     1095__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1096#endif
     1097}
    10181098
    10191099/////////////////////////////////////////////////////////////////////////////////////////
     
    11101190void rpc_vfs_inode_create_client( cxy_t          cxy,     
    11111191                                  uint32_t       fs_type,    // in
    1112                                   uint32_t       inode_type, // in
    11131192                                  uint32_t       attr,       // in
    11141193                                  uint32_t       rights,     // in
     
    11361215    // set input arguments in RPC descriptor
    11371216    rpc.args[0] = (uint64_t)fs_type;
    1138     rpc.args[1] = (uint64_t)inode_type;
    1139     rpc.args[2] = (uint64_t)attr;
    1140     rpc.args[3] = (uint64_t)rights;
    1141     rpc.args[4] = (uint64_t)uid;
    1142     rpc.args[5] = (uint64_t)gid;
     1217    rpc.args[1] = (uint64_t)attr;
     1218    rpc.args[2] = (uint64_t)rights;
     1219    rpc.args[3] = (uint64_t)uid;
     1220    rpc.args[4] = (uint64_t)gid;
    11431221
    11441222    // register RPC request in remote RPC fifo
     
    11461224
    11471225    // get output values from RPC descriptor
    1148     *inode_xp = (xptr_t)rpc.args[6];
    1149     *error    = (error_t)rpc.args[7];
     1226    *inode_xp = (xptr_t)rpc.args[5];
     1227    *error    = (error_t)rpc.args[6];
    11501228
    11511229#if DEBUG_RPC_VFS_INODE_CREATE
     
    11691247
    11701248    uint32_t         fs_type;
    1171     uint32_t         inode_type;
    11721249    uint32_t         attr;
    11731250    uint32_t         rights;
     
    11831260    // get input arguments from client rpc descriptor
    11841261    fs_type    = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
    1185     inode_type = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
    1186     attr       = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
    1187     rights     = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
    1188     uid        = (uid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
    1189     gid        = (gid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[5] ) );
     1262    attr       = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
     1263    rights     = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
     1264    uid        = (uid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
     1265    gid        = (gid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
    11901266
    11911267    // call local kernel function
    11921268    error = vfs_inode_create( fs_type,
    1193                               inode_type,
    11941269                              attr,
    11951270                              rights,
     
    11991274
    12001275    // set output arguments
    1201     hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)inode_xp );
    1202     hal_remote_s64( XPTR( client_cxy , &desc->args[7] ) , (uint64_t)error );
     1276    hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)inode_xp );
     1277    hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error );
    12031278
    12041279#if DEBUG_RPC_VFS_INODE_CREATE
     
    16011676
    16021677/////////////////////////////////////////////////////////
    1603 void rpc_vfs_fs_get_dentry_client( cxy_t         cxy,
     1678void rpc_vfs_fs_new_dentry_client( cxy_t         cxy,
    16041679                                   vfs_inode_t * parent_inode,    // in
    16051680                                   char        * name,            // in
     
    16431718
    16441719//////////////////////////////////////////////
    1645 void rpc_vfs_fs_get_dentry_server( xptr_t xp )
     1720void rpc_vfs_fs_new_dentry_server( xptr_t xp )
    16461721{
    16471722#if DEBUG_RPC_VFS_FS_GET_DENTRY
     
    16741749
    16751750    // call the kernel function
    1676     error = vfs_fs_get_dentry( parent , name_copy , child_xp );
     1751    error = vfs_fs_new_dentry( parent , name_copy , child_xp );
    16771752
    16781753    // set output argument
     
    22452320
    22462321/////////////////////////////////////////////////////////////////////////////////////////
    2247 // [24]          undefined slot
    2248 /////////////////////////////////////////////////////////////////////////////////////////
     2322// [25]          Marshaling functions attached to RPC_MAPPER_SYNC
     2323/////////////////////////////////////////////////////////////////////////////////////////
     2324
     2325///////////////////////////////////////////////////
     2326void rpc_mapper_sync_client( cxy_t             cxy,
     2327                             struct mapper_s * mapper,
     2328                             error_t         * error )
     2329{
     2330#if DEBUG_RPC_MAPPER_SYNC
     2331thread_t * this = CURRENT_THREAD;
     2332uint32_t cycle = (uint32_t)hal_get_cycles();
     2333if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2334printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2335__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2336#endif
     2337
     2338    uint32_t responses = 1;
     2339
     2340    // initialise RPC descriptor header
     2341    rpc_desc_t  rpc;
     2342    rpc.index    = RPC_MAPPER_SYNC;
     2343    rpc.blocking = true;
     2344    rpc.rsp      = &responses;
     2345
     2346    // set input arguments in RPC descriptor
     2347    rpc.args[0] = (uint64_t)(intptr_t)mapper;
     2348
     2349    // register RPC request in remote RPC fifo
     2350    rpc_send( cxy , &rpc );
     2351
     2352    // get output values from RPC descriptor
     2353    *error   = (error_t)rpc.args[1];
     2354
     2355#if DEBUG_RPC_MAPPER_SYNC
     2356cycle = (uint32_t)hal_get_cycles();
     2357if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2358printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2359__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2360#endif
     2361}
     2362
     2363////////////////////////////////////////
     2364void rpc_mapper_sync_server( xptr_t xp )
     2365{
     2366#if DEBUG_RPC_MAPPER_SYNC
     2367thread_t * this = CURRENT_THREAD;
     2368uint32_t cycle = (uint32_t)hal_get_cycles();
     2369if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2370printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2371__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2372#endif
     2373
     2374    mapper_t * mapper;
     2375    error_t    error;
     2376
     2377    // get client cluster identifier and pointer on RPC descriptor
     2378    cxy_t        client_cxy  = GET_CXY( xp );
     2379    rpc_desc_t * desc        = GET_PTR( xp );
     2380
     2381    // get arguments from client RPC descriptor
     2382    mapper  = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
     2383
     2384    // call local kernel function
     2385    error = mapper_sync( mapper );
     2386
     2387    // set output argument to client RPC descriptor
     2388    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
     2389
     2390#if DEBUG_RPC_MAPPER_SYNC
     2391cycle = (uint32_t)hal_get_cycles();
     2392if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2393printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2394__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2395#endif
     2396}
    22492397
    22502398/////////////////////////////////////////////////////////////////////////////////////////
  • trunk/kernel/kern/rpc.h

    r619 r623  
    6868    RPC_THREAD_USER_CREATE        = 6,
    6969    RPC_THREAD_KERNEL_CREATE      = 7,
    70     RPC_UNDEFINED_8               = 8,
     70    RPC_VFS_FS_UPDATE_DENTRY      = 8,
    7171    RPC_PROCESS_SIGACTION         = 9,
    7272
     
    8686    RPC_KCM_ALLOC                 = 22,
    8787    RPC_KCM_FREE                  = 23,
    88     RPC_UNDEFINED_24              = 24,
     88    RPC_MAPPER_SYNC               = 24,
    8989    RPC_MAPPER_HANDLE_MISS        = 25,
    9090    RPC_VMM_DELETE_VSEG           = 26,
     
    305305
    306306/***********************************************************************************
    307  * [8] undefined slot
    308  **********************************************************************************/
    309 
    310 /***********************************************************************************
    311  * [9] The RPC_PROCESS_SIGACTION allows any client thread to request to any cluster
    312  * execute a given sigaction, defined by the <action_type> for a given process,
     307 * [8] The RPC_VFS_FS_UPDATE_DENTRY allows a client thread to request a remote
     308 * cluster to update the <size> field of a directory entry in the mapper of a
     309 * remote directory inode, identified by the <inode> local pointer.
     310 * The target entry name is identified by the <dentry> local pointer.
     311 ***********************************************************************************
     312 * @ cxy     : server cluster identifier.
     313 * @ inode   : [in] local pointer on remote directory inode.
     314 * @ dentry  : [in] local pointer on remote dentry.
     315 * @ size    : [in] new size value.
     316 * @ error   : [out] error status (0 if success).
     317 **********************************************************************************/
     318void rpc_vfs_fs_update_dentry_client( cxy_t                 cxy,
     319                                      struct vfs_inode_s  * inode,
     320                                      struct vfs_dentry_s * dentry,
     321                                      uint32_t              size,
     322                                      error_t             * error );
     323
     324void rpc_vfs_fs_update_dentry_server( xptr_t xp );
     325
     326/***********************************************************************************
     327 * [9] The RPC_PROCESS_SIGACTION allows a client thread to request a remote cluster
     328 * to execute a given sigaction, defined by the <action_type> for a given process,
    313329 * identified by the <pid> argument.
    314330 ***********************************************************************************
     
    340356void rpc_vfs_inode_create_client( cxy_t      cxy,
    341357                                  uint32_t   fs_type,
    342                                   uint32_t   inode_type,
    343358                                  uint32_t   attr,   
    344359                                  uint32_t   rights, 
     
    423438
    424439/***********************************************************************************
    425  * [16] The RPC_VFS_FS_GET_DENTRY calls the vfs_fs_get_dentry()
     440 * [16] The RPC_VFS_FS_GET_DENTRY calls the vfs_fs_new_dentry()
    426441 * function in a remote cluster containing a parent inode directory to scan the
    427442 * associated mapper, find a directory entry identified by its name, and update
     
    434449 * @ error          : [out] error status (0 if success).
    435450 **********************************************************************************/
    436 void rpc_vfs_fs_get_dentry_client( cxy_t                cxy,
     451void rpc_vfs_fs_new_dentry_client( cxy_t                cxy,
    437452                                   struct vfs_inode_s * parent_inode,
    438453                                   char               * name,
     
    440455                                   error_t            * error );
    441456
    442 void rpc_vfs_fs_get_dentry_server( xptr_t xp );
     457void rpc_vfs_fs_new_dentry_server( xptr_t xp );
    443458
    444459/***********************************************************************************
     
    564579
    565580/***********************************************************************************
    566  * [24] undefined slot
    567  **********************************************************************************/
     581 * [24] The RPC_MAPPER_SYNC allows a client thread to synchronize on disk
     582 * all dirty pages of a remote mapper.
     583 ***********************************************************************************
     584 * @ cxy       : server cluster identifier.
     585 * @ mapper    : [in] local pointer on mapper in server cluster.
     586 * @ error       : [out] error status (0 if success).
     587 **********************************************************************************/
     588void rpc_mapper_sync_client( cxy_t             cxy,
     589                             struct mapper_s * mapper,
     590                             error_t         * error );
     591
     592void rpc_mapper_sync_server( xptr_t xp );
    568593
    569594/***********************************************************************************
  • trunk/kernel/kern/thread.c

    r620 r623  
    13821382                               const char * string )
    13831383{
     1384
    13841385    cxy_t      thread_cxy = GET_CXY( thread_xp );
    13851386    thread_t * thread_ptr = GET_PTR( thread_xp );
    13861387
    1387 #if( DEBUG_BUSYLOCK )
    1388 
    1389     xptr_t    iter_xp;
    1390 
    1391     // get relevant info from target trhead descriptor
     1388#if DEBUG_BUSYLOCK
     1389
     1390    xptr_t     iter_xp;
     1391
     1392    // get relevant info from target thread descriptor
    13921393    uint32_t    locks   = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->busylocks ) );
    13931394    trdid_t     trdid   = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
     
    14291430    remote_busylock_release( txt0_lock_xp );
    14301431
     1432#else
     1433
     1434printk("\n[ERROR] in %s : set DEBUG_BUSYLOCK in kernel_config.h for %s / thread(%x,%x)\n",
     1435__FUNCTION__, string, thread_cxy, thread_ptr );
     1436
     1437#endif
     1438
    14311439    return;
    14321440
    1433 #endif
    1434 
    1435     // display a warning
    1436     printk("\n[WARNING] set DEBUG_BUSYLOCK in kernel_config.h to display busylocks" );
    1437 
    14381441}  // end thread_display_busylock()
    14391442
Note: See TracChangeset for help on using the changeset viewer.