Changeset 624 for trunk/kernel/kern/kernel_init.c
- Timestamp:
- Mar 12, 2019, 1:37:38 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/kernel_init.c
r623 r624 97 97 process_t process_zero CONFIG_CACHE_LINE_ALIGNED; 98 98 99 // This variable defines extended pointers on the distributed chdevs99 // This variable defines a set of extended pointers on the distributed chdevs 100 100 __attribute__((section(".kdata"))) 101 101 chdev_directory_t chdev_dir CONFIG_CACHE_LINE_ALIGNED; … … 125 125 vfs_ctx_t fs_context[FS_TYPES_NR] CONFIG_CACHE_LINE_ALIGNED; 126 126 127 // kernel_init is the entry point defined in hal/tsar_mips32/kernel.ld128 // It is used by the bootloader to tranfer control to kernel.129 extern void kernel_init( boot_info_t * info );130 131 127 // This array is used for debug, and describes the kernel locks usage, 132 128 // It must be kept consistent with the defines in kernel_config.h file. 129 __attribute__((section(".kdata"))) 133 130 char * lock_type_str[] = 134 131 { … … 229 226 230 227 // intrumentation variables : cumulated costs per syscall type in cluster 228 229 #if CONFIG_INSTRUMENTATION_SYSCALLS 230 __attribute__((section(".kdata"))) 231 231 uint32_t syscalls_cumul_cost[SYSCALLS_NR]; 232 232 233 // intrumentation variables : number of syscalls per syscal type in cluster 233 __attribute__((section(".kdata"))) 234 234 uint32_t syscalls_occurences[SYSCALLS_NR]; 235 #endif 235 236 236 237 /////////////////////////////////////////////////////////////////////////////////////////// … … 978 979 #if DEBUG_KERNEL_INIT 979 980 if( (core_lid == 0) & (local_cxy == 0) ) 980 printk("\n[%s] :exit barrier 1 : TXT0 initialized / cycle %d\n",981 printk("\n[%s] exit barrier 1 : TXT0 initialized / cycle %d\n", 981 982 __FUNCTION__, (uint32_t)hal_get_cycles() ); 982 983 #endif … … 1011 1012 #if DEBUG_KERNEL_INIT 1012 1013 if( (core_lid == 0) & (local_cxy == 0) ) 1013 printk("\n[%s] :exit barrier 2 : cluster manager initialized / cycle %d\n",1014 printk("\n[%s] exit barrier 2 : cluster manager initialized / cycle %d\n", 1014 1015 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1015 1016 #endif 1016 1017 1017 1018 ///////////////////////////////////////////////////////////////////////////////// 1018 // STEP 3 : core[0] initializes the process_zero descriptor, 1019 // STEP 3 : all cores initialize the idle thread descriptor. 1020 // core[0] initializes the process_zero descriptor, 1019 1021 // including the kernel VMM (both GPT and VSL) 1020 1022 ///////////////////////////////////////////////////////////////////////////////// … … 1024 1026 core = &cluster->core_tbl[core_lid]; 1025 1027 1028 // all cores update the register(s) defining the kernel 1029 // entry points for interrupts, exceptions and syscalls, 1030 // this must be done before VFS initialisation, because 1031 // kernel_init() uses RPCs requiring IPIs... 1032 hal_set_kentry(); 1033 1034 // all cores initialize the idle thread descriptor 1035 thread_idle_init( thread, 1036 THREAD_IDLE, 1037 &thread_idle_func, 1038 NULL, 1039 core_lid ); 1040 1026 1041 // core[0] initializes the process_zero descriptor, 1027 1042 if( core_lid == 0 ) process_zero_create( &process_zero , info ); … … 1035 1050 #if DEBUG_KERNEL_INIT 1036 1051 if( (core_lid == 0) & (local_cxy == 0) ) 1037 printk("\n[%s] :exit barrier 3 : kernel processs initialized / cycle %d\n",1052 printk("\n[%s] exit barrier 3 : kernel processs initialized / cycle %d\n", 1038 1053 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1039 1054 #endif … … 1058 1073 #if DEBUG_KERNEL_INIT 1059 1074 if( (core_lid == 0) & (local_cxy == 0) ) 1060 printk("\n[%s] :exit barrier 4 : MMU and IOPIC initialized / cycle %d\n",1075 printk("\n[%s] exit barrier 4 : MMU and IOPIC initialized / cycle %d\n", 1061 1076 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1062 1077 #endif … … 1091 1106 #if DEBUG_KERNEL_INIT 1092 1107 if( (core_lid == 0) & (local_cxy == 0) ) 1093 printk("\n[%s] : exit barrier 5 : allchdevs initialised / cycle %d\n",1108 printk("\n[%s] exit barrier 5 : chdevs initialised / cycle %d\n", 1094 1109 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1095 1110 #endif … … 1101 1116 1102 1117 ///////////////////////////////////////////////////////////////////////////////// 1103 // STEP 6 : All cores enable IPI (Inter Procesor Interrupt),1104 // Alh cores initialize IDLE thread.1105 // Onlycore[0] in cluster[0] creates the VFS root inode.1118 // STEP 6 : all cores enable IPI (Inter Procesor Interrupt), 1119 // all cores unblock the idle thread, and register it in scheduler. 1120 // core[0] in cluster[0] creates the VFS root inode. 1106 1121 // It access the boot device to initialize the file system context. 1107 1122 ///////////////////////////////////////////////////////////////////////////////// … … 1111 1126 hal_enable_irq( &status ); 1112 1127 1113 // all cores initialize the idle thread descriptor 1114 thread_idle_init( thread, 1115 THREAD_IDLE, 1116 &thread_idle_func, 1117 NULL, 1118 core_lid ); 1119 1120 // all cores unblock idle thread, and register it in scheduler 1128 // all cores unblock the idle thread, and register it in scheduler 1121 1129 thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_GLOBAL ); 1122 1130 core->scheduler.idle = thread; … … 1171 1179 cxy_t vfs_root_cxy = GET_CXY( vfs_root_inode_xp ); 1172 1180 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 );1181 hal_remote_s32( XPTR( vfs_root_cxy , &vfs_root_ptr->type ), INODE_TYPE_DIR ); 1174 1182 hal_remote_spt( XPTR( vfs_root_cxy , &vfs_root_ptr->extend ), 1175 1183 (void*)(intptr_t)root_dir_cluster ); … … 1208 1216 #if DEBUG_KERNEL_INIT 1209 1217 if( (core_lid == 0) & (local_cxy == 0) ) 1210 printk("\n[%s] :exit barrier 6 : VFS root (%x,%x) in cluster 0 / cycle %d\n",1218 printk("\n[%s] exit barrier 6 : VFS root (%x,%x) in cluster 0 / cycle %d\n", 1211 1219 __FUNCTION__, GET_CXY(process_zero.vfs_root_xp), 1212 1220 GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() ); … … 1278 1286 #if DEBUG_KERNEL_INIT 1279 1287 if( (core_lid == 0) & (local_cxy == 1) ) 1280 printk("\n[%s] :exit barrier 7 : VFS root (%x,%x) in cluster 1 / cycle %d\n",1288 printk("\n[%s] exit barrier 7 : VFS root (%x,%x) in cluster 1 / cycle %d\n", 1281 1289 __FUNCTION__, GET_CXY(process_zero.vfs_root_xp), 1282 1290 GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() ); … … 1328 1336 #if DEBUG_KERNEL_INIT 1329 1337 if( (core_lid == 0) & (local_cxy == 0) ) 1330 printk("\n[%s] :exit barrier 8 : DEVFS root initialized in cluster 0 / cycle %d\n",1338 printk("\n[%s] exit barrier 8 : DEVFS root initialized in cluster 0 / cycle %d\n", 1331 1339 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1332 1340 #endif 1333 1341 1334 1342 ///////////////////////////////////////////////////////////////////////////////// 1335 // STEP 9 : All core[0]s complete in parallel theDEVFS initialization.1343 // STEP 9 : In all clusters in parallel, core[0] completes DEVFS initialization. 1336 1344 // Each core[0] get the "dev" and "external" extended pointers from 1337 // values stored in cluster 0. 1338 // Then each core[0] in cluster(i) creates the DEVFS "internal" directory, 1339 // and creates the pseudo-files for all chdevs in cluster (i). 1345 // values stored in cluster(0), creates the DEVFS "internal" directory, 1346 // and creates the pseudo-files for all chdevs in local cluster. 1340 1347 ///////////////////////////////////////////////////////////////////////////////// 1341 1348 … … 1365 1372 #if DEBUG_KERNEL_INIT 1366 1373 if( (core_lid == 0) & (local_cxy == 0) ) 1367 printk("\n[%s] :exit barrier 9 : DEVFS initialized in cluster 0 / cycle %d\n",1374 printk("\n[%s] exit barrier 9 : DEVFS initialized in cluster 0 / cycle %d\n", 1368 1375 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1369 1376 #endif … … 1384 1391 process_init_create(); 1385 1392 } 1393 1394 #if DEBUG_KERNEL_INIT 1395 if( (core_lid == 0) & (local_cxy == 0) ) 1396 printk("\n[%s] exit barrier 10 : process_init created in cluster 0 / cycle %d\n", 1397 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1398 #endif 1386 1399 1387 1400 #if (DEBUG_KERNEL_INIT & 1) … … 1444 1457 #endif 1445 1458 1446 // each core updates the register(s) definig the kernel1447 // entry points for interrupts, exceptions and syscalls...1448 hal_set_kentry();1449 1450 1459 // each core activates its private TICK IRQ 1451 1460 dev_pic_enable_timer( CONFIG_SCHED_TICK_MS_PERIOD );
Note: See TracChangeset
for help on using the changeset viewer.