Ignore:
Timestamp:
Dec 27, 2018, 7:38:58 PM (3 years ago)
Author:
alain
Message:

Fix several bugs in VFS to support the following
ksh commandis : cp, mv, rm, mkdir, cd, pwd

File:
1 edited

Legend:

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

    r601 r610  
    146146
    147147    "THREAD_JOIN",           // 10
    148     "VFS_MAIN",              // 11
     148    "XHTAB_STATE",           // 11
    149149    "CHDEV_QUEUE",           // 12
    150150    "CHDEV_TXT0",            // 13
     
    154154    "CONDVAR_STATE",         // 17
    155155    "SEM_STATE",             // 18
    156     "XHTAB_STATE",           // 19
     156    "RPOCESS_CWD",           // 19
    157157
    158158    "unused_20",             // 20
     
    171171
    172172    "MAPPER_STATE",          // 30
    173     "PROCESS_CWD",           // 31
    174     "VFS_INODE",             // 32
    175     "VFS_FILE",              // 33
    176     "VMM_VSL",               // 34
    177     "VMM_GPT",               // 35
     173    "VFS_SIZE",              // 31
     174    "VFS_FILE",              // 32
     175    "VMM_VSL",               // 33
     176    "VMM_GPT",               // 34
     177    "VFS_MAIN",              // 35
    178178};       
    179179
     
    970970#if DEBUG_KERNEL_INIT
    971971if( (core_lid ==  0) & (local_cxy == 0) )
    972 printk("\n[%s] : exit barrier 0 : TXT0 initialized / sr %x / cycle %d\n",
    973 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     972printk("\n[%s] : exit barrier 0 : TXT0 initialized / cycle %d\n",
     973__FUNCTION__, (uint32_t)hal_get_cycles() );
    974974#endif
    975975
     
    10121012#if DEBUG_KERNEL_INIT
    10131013if( (core_lid ==  0) & (local_cxy == 0) )
    1014 printk("\n[%s] : exit barrier 1 : clusters initialised / sr %x / cycle %d\n",
    1015 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1014printk("\n[%s] : exit barrier 1 : clusters initialised / cycle %d\n",
     1015__FUNCTION__, (uint32_t)hal_get_cycles() );
    10161016#endif
    10171017
     
    10391039#if DEBUG_KERNEL_INIT
    10401040if( (core_lid ==  0) & (local_cxy == 0) )
    1041 printk("\n[%s] : exit barrier 2 : PIC initialised / sr %x / cycle %d\n",
    1042 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1041printk("\n[%s] : exit barrier 2 : PIC initialised / cycle %d\n",
     1042__FUNCTION__, (uint32_t)hal_get_cycles() );
    10431043#endif
    10441044
     
    10721072#if DEBUG_KERNEL_INIT
    10731073if( (core_lid ==  0) & (local_cxy == 0) )
    1074 printk("\n[%s] : exit barrier 3 : all chdevs initialised / sr %x / cycle %d\n",
    1075 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1074printk("\n[%s] : exit barrier 3 : all chdevs initialised / cycle %d\n",
     1075__FUNCTION__, (uint32_t)hal_get_cycles() );
    10761076#endif
    10771077
     
    11361136 
    11371137            // 4. create VFS root inode in cluster 0
    1138             error = vfs_inode_create( XPTR_NULL,                           // dentry_xp
    1139                                       FS_TYPE_FATFS,                       // fs_type
     1138            error = vfs_inode_create( FS_TYPE_FATFS,                       // fs_type
    11401139                                      INODE_TYPE_DIR,                      // inode_type
    11411140                                      0,                                   // attr
     
    11741173        // register VFS root inode in process_zero descriptor of cluster 0
    11751174        process_zero.vfs_root_xp = vfs_root_inode_xp;
    1176         process_zero.vfs_cwd_xp  = vfs_root_inode_xp;
     1175        process_zero.cwd_xp      = vfs_root_inode_xp;
    11771176    }
    11781177
     
    11851184#if DEBUG_KERNEL_INIT
    11861185if( (core_lid ==  0) & (local_cxy == 0) )
    1187 printk("\n[%s] : exit barrier 4 : VFS root initialized in cluster 0 / sr %x / cycle %d\n",
    1188 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1186printk("\n[%s] : exit barrier 4 : VFS root (%x,%x) in cluster 0 / cycle %d\n",
     1187__FUNCTION__, GET_CXY(process_zero.vfs_root_xp),
     1188GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() );
    11891189#endif
    11901190
     
    12431243        // update local process_zero descriptor
    12441244        process_zero.vfs_root_xp = vfs_root_inode_xp;
    1245         process_zero.vfs_cwd_xp  = vfs_root_inode_xp;
     1245        process_zero.cwd_xp      = vfs_root_inode_xp;
    12461246    }
    12471247
     
    12541254#if DEBUG_KERNEL_INIT
    12551255if( (core_lid ==  0) & (local_cxy == 1) )
    1256 printk("\n[%s] : exit barrier 5 : VFS root initialized in cluster 1 / sr %x / cycle %d\n",
    1257 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1256printk("\n[%s] : exit barrier 4 : VFS root (%x,%x) in cluster 1 / cycle %d\n",
     1257__FUNCTION__, GET_CXY(process_zero.vfs_root_xp),
     1258GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() );
    12581259#endif
    12591260
     
    13031304#if DEBUG_KERNEL_INIT
    13041305if( (core_lid ==  0) & (local_cxy == 0) )
    1305 printk("\n[%s] : exit barrier 6 : DEVFS root initialized in cluster 0 / sr %x / cycle %d\n",
    1306 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1306printk("\n[%s] : exit barrier 6 : DEVFS root initialized in cluster 0 / cycle %d\n",
     1307__FUNCTION__, (uint32_t)hal_get_cycles() );
    13071308#endif
    13081309
     
    13401341#if DEBUG_KERNEL_INIT
    13411342if( (core_lid ==  0) & (local_cxy == 0) )
    1342 printk("\n[%s] : exit barrier 7 : DEV initialized in cluster 0 / sr %x / cycle %d\n",
    1343 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1343printk("\n[%s] : exit barrier 7 : DEV initialized in cluster 0 / cycle %d\n",
     1344__FUNCTION__, (uint32_t)hal_get_cycles() );
    13441345#endif
    13451346
     
    13661367#if DEBUG_KERNEL_INIT
    13671368if( (core_lid ==  0) & (local_cxy == 0) )
    1368 printk("\n[%s] : exit barrier 8 : process init created / sr %x / cycle %d\n",
    1369 __FUNCTION__, (uint32_t)hal_get_sr(), (uint32_t)hal_get_cycles() );
     1369printk("\n[%s] : exit barrier 8 : process init created / cycle %d\n",
     1370__FUNCTION__, (uint32_t)hal_get_cycles() );
    13701371#endif
    13711372
     
    14361437    dev_pic_enable_timer( CONFIG_SCHED_TICK_MS_PERIOD );
    14371438
     1439    /////////////////////////////////////////////////////////////////////////////////
     1440    if( core_lid == 0 ) xbarrier_wait( XPTR( 0 , &global_barrier ),
     1441                                        (info->x_size * info->y_size) );
     1442    barrier_wait( &local_barrier , info->cores_nr );
     1443    /////////////////////////////////////////////////////////////////////////////////
     1444
    14381445#if DEBUG_KERNEL_INIT
    1439 printk("\n[%s] : thread %x on core[%x,%d] jumps to thread_idle_func() / cycle %d\n",
    1440 __FUNCTION__ , CURRENT_THREAD , local_cxy , core_lid , (uint32_t)hal_get_cycles() );
     1446thread_t * this = CURRENT_THREAD;
     1447printk("\n[%s] : thread[%x,%x] on core[%x,%d] jumps to thread_idle_func() / cycle %d\n",
     1448__FUNCTION__ , this->process->pid, this->trdid,
     1449local_cxy, core_lid, (uint32_t)hal_get_cycles() );
    14411450#endif
    14421451
    14431452    // each core jump to thread_idle_func
    14441453    thread_idle_func();
    1445 }
    1446 
     1454
     1455}  // end kernel_init()
     1456
Note: See TracChangeset for help on using the changeset viewer.