- Timestamp:
- Aug 16, 2017, 2:54:04 PM (7 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/kernel_init.c
r381 r389 273 273 } 274 274 275 kinit_dmsg("\n[INFO] %s : created MMC in cluster %x / chdev = %x\n", 276 __FUNCTION__ , channel , local_cxy , chdev_ptr ); 275 #if( CONFIG_KINIT_DEBUG > 1 ) 276 printk("\n[INFO] %s : created MMC in cluster %x / chdev = %x\n", 277 __FUNCTION__ , channel , local_cxy , chdev_ptr ); 278 #endif 277 279 } 278 280 /////////////////////////////// … … 299 301 chdev_dir.dma[channel] = XPTR( local_cxy , chdev_ptr ); 300 302 301 kinit_dmsg("\n[INFO] %s : created DMA[%d] in cluster %x / chdev = %x\n", 302 __FUNCTION__ , channel , local_cxy , chdev_ptr ); 303 #if( CONFIG_KINIT_DEBUG > 1 ) 304 printk("\n[INFO] %s : created DMA[%d] in cluster %x / chdev = %x\n", 305 __FUNCTION__ , channel , local_cxy , chdev_ptr ); 306 #endif 303 307 } 304 308 } … … 431 435 } 432 436 433 kinit_dmsg("\n[INFO] %s : create chdev %s[%d] in cluster %x / chdev = %x\n", 434 __FUNCTION__ , chdev_func_str( func ), channel , local_cxy , chdev ); 435 437 #if( CONFIG_KINIT_DEBUG > 1 ) 438 printk("\n[INFO] %s : create chdev %s[%d] in cluster %x / chdev = %x\n", 439 __FUNCTION__ , chdev_func_str( func ), channel , local_cxy , chdev ); 440 #endif 436 441 } // end if match 437 442 … … 548 553 } 549 554 550 kinit_dmsg("\n[INFO] %s created PIC chdev in cluster %x at cycle %d\n", 551 __FUNCTION__ , local_cxy , (uint32_t)hal_time_stamp() ); 555 #if( CONFIG_KINIT_DEBUG > 1 ) 556 printk("\n[INFO] %s created PIC chdev in cluster %x at cycle %d\n", 557 __FUNCTION__ , local_cxy , (uint32_t)hal_time_stamp() ); 558 #endif 552 559 553 560 } // end iopic_init() … … 826 833 ///////////////////////////////////////////////////////////////////////////////// 827 834 828 if( CONFIG_KINIT_DEBUG ) chdev_dir_display(); 835 #if( CONFIG_KINIT_DEBUG > 1 ) 836 chdev_dir_display(); 837 #endif 829 838 830 839 // All cores enable the shared IPI channel … … 834 843 // All cores initialize specific core registers 835 844 hal_core_init( info ); 836 837 kinit_dmsg("\n[INFO] %s : IRQs enabled for core[%x,%d] / SR = %x\n",838 __FUNCTION__ , local_cxy , core_lid , hal_get_sr() );839 845 840 846 // all cores initialize the idle thread descriptor … … 855 861 core->scheduler.idle = thread; 856 862 857 if( (core_lid == 0) && (local_cxy == 0) ) 858 { 859 kinit_dmsg("\n[INFO] %s : initialized idle thread %x on core[%x,%d] / cycle %d\n", 860 __FUNCTION__ , thread->trdid , local_cxy, core_lid, (uint32_t)hal_time_stamp()); 861 } 862 863 #if CONFIG_KINIT_DEBUG 864 sched_display(); 865 #endif 863 #if( CONFIG_KINIT_DEBUG > 1 ) 864 sched_display(); 865 #endif 866 866 867 867 // CPO in cluster 0 creates the VFS root … … 874 874 if( CONFIG_VFS_ROOT_IS_FATFS ) 875 875 { 876 // 1. createFATFS context in cluster 0876 // 1. allocate memory for FATFS context in cluster 0 877 877 fatfs_ctx_t * fatfs_ctx = fatfs_ctx_alloc(); 878 878 … … 910 910 vfs_root_inode_xp, // VFS root 911 911 fatfs_ctx ); // extend 912 913 // 6. check initialisation 914 vfs_ctx_t * vfs_ctx = &fs_context[FS_TYPE_FATFS]; 915 assert( (((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster == 8), 916 __FUNCTION__ , "illegal value for FATFS context in cluster %x\n", local_cxy ); 912 917 } 913 918 else 914 919 { 915 printk("\n[PANIC] in %s : root FS must be FATFS\n", __FUNCTION__ ); 916 hal_core_sleep(); 917 } 918 919 // register VFS root inode in process_zero 920 _panic("\n[PANIC] in %s : root FS must be FATFS\n", __FUNCTION__ ); 921 } 922 923 // register VFS root inode in process_zero descriptor of cluster 0 920 924 process_zero.vfs_root_xp = vfs_root_inode_xp; 921 925 process_zero.vfs_cwd_xp = vfs_root_inode_xp; … … 945 949 if( CONFIG_VFS_ROOT_IS_FATFS ) 946 950 { 947 // allocate memory for FATFS context 948 fatfs_ctx_t * fatfs_ctx = fatfs_ctx_alloc(); 949 950 assert( (fatfs_ctx != NULL) , __FUNCTION__ , "cannot create FATFS context\n" ); 951 952 // get local pointer on VFS context for FATFS 951 // 1. allocate memory for local FATFS context 952 fatfs_ctx_t * local_fatfs_ctx = fatfs_ctx_alloc(); 953 954 assert( (local_fatfs_ctx != NULL) , __FUNCTION__ , 955 "cannot create FATFS context in cluster %x\n", local_cxy ); 956 957 // 2. get local pointer on VFS context for FATFS 953 958 vfs_ctx_t * vfs_ctx = &fs_context[FS_TYPE_FATFS]; 954 959 955 // copy VFS context from cluster 0 to local cluster 960 // 3. get local pointer on FATFS context in cluster 0 961 fatfs_ctx_t * remote_fatfs_ctx = hal_remote_lpt( XPTR( 0 , &vfs_ctx->extend ) ); 962 963 // 4. copy FATFS context from cluster 0 to local cluster 964 hal_remote_memcpy( XPTR( local_cxy , local_fatfs_ctx ), 965 XPTR( 0 , remote_fatfs_ctx ), sizeof(fatfs_ctx_t) ); 966 967 // 5. copy VFS context from cluster 0 to local cluster 956 968 hal_remote_memcpy( XPTR( local_cxy , vfs_ctx ), 957 XPTR( 0 , vfs_ctx ), 958 sizeof(vfs_ctx_t) ); 959 960 // copy FATFS context from cluster 0 to local cluster 961 hal_remote_memcpy( XPTR( local_cxy , fatfs_ctx ), 962 XPTR( 0 , fatfs_ctx ), 963 sizeof(fatfs_ctx_t) ); 964 965 // update extend field in local copy of VFS context 966 vfs_ctx->extend = fatfs_ctx; 969 XPTR( 0 , vfs_ctx ), sizeof(vfs_ctx_t) ); 970 971 // 6. update extend field in local copy of VFS context 972 vfs_ctx->extend = local_fatfs_ctx; 973 974 // 7. check initialisation 975 assert( (((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster == 8), 976 __FUNCTION__ , "illegal value for FATFS context in cluster %x\n", local_cxy ); 967 977 } 968 978 … … 1062 1072 { 1063 1073 process_init_create(); 1074 vfs_display( vfs_root_inode_xp ); 1064 1075 } 1065 1076 … … 1082 1093 print_banner( (info->x_size * info->y_size) , info->cores_nr ); 1083 1094 1084 kinit_dmsg("\n\n*** memory fooprint for main kernet objects ***\n\n"1095 kinit_dmsg("\n\n***** memory fooprint for main kernet objects\n\n" 1085 1096 " - thread descriptor : %d bytes\n" 1086 1097 " - process descriptor : %d bytes\n" -
trunk/kernel/kern/printk.h
r374 r389 187 187 188 188 #if CONFIG_IOC_DEBUG 189 #define ioc_dmsg(...) printk(__VA_ARGS__)189 #define ioc_dmsg(...) if(hal_time_stamp() > CONFIG_IOC_DEBUG) printk(__VA_ARGS__) 190 190 #else 191 191 #define ioc_dmsg(...) -
trunk/kernel/kern/rpc.c
r374 r389 70 70 &rpc_undefined, // 19 71 71 72 &rpc_vmm_get_ ref_vseg_server,// 2072 &rpc_vmm_get_vseg_server, // 20 73 73 &rpc_vmm_get_pte_server, // 21 74 74 &rpc_kcm_alloc_server, // 22 … … 1109 1109 // initialise RPC descriptor header 1110 1110 rpc_desc_t rpc; 1111 rpc.index = RPC_VFS_ INODE_LOAD;1111 rpc.index = RPC_VFS_MAPPER_LOAD_ALL; 1112 1112 rpc.response = 1; 1113 1113 … … 1147 1147 1148 1148 // set output argument 1149 hal_remote_swd( XPTR( client_cxy , &desc->args[ 3] ) , (uint64_t)error );1149 hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 1150 1150 1151 1151 rpc_dmsg("\n[INFO] %s : exit / thread %x on core[%x,%d] / cycle %d\n", … … 1229 1229 1230 1230 ///////////////////////////////////////////////////////////////////////////////////////// 1231 // [20] Marshaling functions attached to RPC_VMM_GET_ REF_VSEG1231 // [20] Marshaling functions attached to RPC_VMM_GET_VSEG 1232 1232 ///////////////////////////////////////////////////////////////////////////////////////// 1233 1233 1234 1234 ////////////////////////////////////////////////// 1235 void rpc_vmm_get_ref_vseg_client( cxy_t cxy, 1236 process_t * process, // in 1237 intptr_t vaddr, // in 1238 xptr_t * vseg_xp ) // out 1239 { 1240 rpc_dmsg("\n[INFO] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1241 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1242 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1243 1244 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 1245 1246 // initialise RPC descriptor header 1247 rpc_desc_t rpc; 1248 rpc.index = RPC_VMM_GET_REF_VSEG; 1235 void rpc_vmm_get_vseg_client( cxy_t cxy, 1236 process_t * process, // in 1237 intptr_t vaddr, // in 1238 xptr_t * vseg_xp, // out 1239 error_t * error ) // out 1240 { 1241 rpc_dmsg("\n[INFO] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1242 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1243 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1244 1245 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 1246 1247 // initialise RPC descriptor header 1248 rpc_desc_t rpc; 1249 rpc.index = RPC_VMM_GET_VSEG; 1249 1250 rpc.response = 1; 1250 1251 … … 1258 1259 // get output argument from rpc descriptor 1259 1260 *vseg_xp = rpc.args[2]; 1260 1261 rpc_dmsg("\n[INFO] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1262 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1263 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1264 } 1265 1266 ///////////////////////////////////////////// 1267 void rpc_vmm_get_ref_vseg_server( xptr_t xp ) 1261 *error = (error_t)rpc.args[3]; 1262 1263 rpc_dmsg("\n[INFO] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1264 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1265 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1266 } 1267 1268 ///////////////////////////////////////// 1269 void rpc_vmm_get_vseg_server( xptr_t xp ) 1268 1270 { 1269 1271 process_t * process; … … 1271 1273 vseg_t * vseg_ptr; 1272 1274 xptr_t vseg_xp; 1275 error_t error; 1273 1276 1274 1277 rpc_dmsg("\n[INFO] %s : enter / thread %x on core[%x,%d] / cycle %d\n", … … 1285 1288 1286 1289 // call local kernel function 1287 vseg_ptr = vmm_get_vseg( process , vaddr ); 1288 1289 // set output argument to client RPC descriptor 1290 if( vseg_ptr == NULL ) vseg_xp = XPTR_NULL; 1291 else vseg_xp = XPTR( local_cxy , vseg_ptr ); 1290 error = vmm_get_vseg( process , vaddr , &vseg_ptr ); 1291 1292 // set output arguments to client RPC descriptor 1293 vseg_xp = XPTR( local_cxy , vseg_ptr ); 1292 1294 hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp ); 1295 hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1293 1296 1294 1297 rpc_dmsg("\n[INFO] %s : exit / thread %x on core[%x,%d] / cycle %d\n", -
trunk/kernel/kern/rpc.h
r313 r389 76 76 RPC_FATFS_GET_CLUSTER = 18, 77 77 78 RPC_VMM_GET_ REF_VSEG= 20,78 RPC_VMM_GET_VSEG = 20, 79 79 RPC_VMM_GET_PTE = 21, 80 80 RPC_KCM_ALLOC = 22, … … 479 479 480 480 /*********************************************************************************** 481 * [20] The RPC_VMM_GET_ REF_VSEG returns an extended pointer481 * [20] The RPC_VMM_GET_VSEG returns an extended pointer 482 482 * on the vseg containing a given virtual address in a given process. 483 483 * The server cluster is supposed to be the reference cluster. 484 * It returns XPTR_NULLif no vseg has been founded.484 * It returns a non zero error value if no vseg has been founded. 485 485 *********************************************************************************** 486 486 * @ cxy : server cluster identifier. … … 488 488 * @ vaddr : [in] virtual address to be searched. 489 489 * @ vseg_xp : [out] buffer for extended pointer on vseg in client cluster. 490 **********************************************************************************/ 491 void rpc_vmm_get_ref_vseg_client( cxy_t cxy, 492 struct process_s * process, 493 intptr_t vaddr, 494 xptr_t * vseg_xp ); 495 496 void rpc_vmm_get_ref_vseg_server( xptr_t xp ); 490 * @ error : [out] local pointer on buffer for error code (in client cluster). 491 **********************************************************************************/ 492 void rpc_vmm_get_vseg_client( cxy_t cxy, 493 struct process_s * process, 494 intptr_t vaddr, 495 xptr_t * vseg_xp, 496 error_t error ); 497 498 void rpc_vmm_get_vseg_server( xptr_t xp ); 497 499 498 500 /***********************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.