Changeset 623 for trunk/kernel/kern/rpc.c
- Timestamp:
- Mar 6, 2019, 4:37:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r619 r623 2 2 * rpc.c - RPC operations implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 58 58 &rpc_thread_user_create_server, // 6 59 59 &rpc_thread_kernel_create_server, // 7 60 &rpc_ undefined, // 8 unused slot60 &rpc_vfs_fs_update_dentry_server, // 8 61 61 &rpc_process_sigaction_server, // 9 62 62 … … 67 67 &rpc_vfs_file_create_server, // 14 68 68 &rpc_vfs_file_destroy_server, // 15 69 &rpc_vfs_fs_ get_dentry_server, // 1669 &rpc_vfs_fs_new_dentry_server, // 16 70 70 &rpc_vfs_fs_add_dentry_server, // 17 71 71 &rpc_vfs_fs_remove_dentry_server, // 18 … … 76 76 &rpc_kcm_alloc_server, // 22 77 77 &rpc_kcm_free_server, // 23 78 &rpc_ undefined, // 24 unused slot78 &rpc_mapper_sync_server, // 24 79 79 &rpc_mapper_handle_miss_server, // 25 80 80 &rpc_vmm_delete_vseg_server, // 26 … … 94 94 "THREAD_USER_CREATE", // 6 95 95 "THREAD_KERNEL_CREATE", // 7 96 " undefined",// 896 "VFS_FS_UPDATE_DENTRY", // 8 97 97 "PROCESS_SIGACTION", // 9 98 98 … … 112 112 "KCM_ALLOC", // 22 113 113 "KCM_FREE", // 23 114 " undefined",// 24114 "MAPPER_SYNC", // 24 115 115 "MAPPER_HANDLE_MISS", // 25 116 116 "VMM_DELETE_VSEG", // 26 … … 921 921 922 922 ///////////////////////////////////////////////////////////////////////////////////////// 923 // [7] Marshaling functions attached to RPC_THREAD_KERNEL_CREATE (blocking)923 // [7] Marshaling functions attached to RPC_THREAD_KERNEL_CREATE 924 924 ///////////////////////////////////////////////////////////////////////////////////////// 925 925 … … 1013 1013 1014 1014 ///////////////////////////////////////////////////////////////////////////////////////// 1015 // [8] undefined slot 1016 ///////////////////////////////////////////////////////////////////////////////////////// 1017 1015 // [8] Marshaling functions attached to RPC_VRS_FS_UPDATE_DENTRY 1016 ///////////////////////////////////////////////////////////////////////////////////////// 1017 1018 ///////////////////////////////////////////////////////// 1019 void 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 1026 thread_t * this = CURRENT_THREAD; 1027 uint32_t cycle = (uint32_t)hal_get_cycles(); 1028 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1029 printk("\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 1053 cycle = (uint32_t)hal_get_cycles(); 1054 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1055 printk("\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 ///////////////////////////////////////////////// 1061 void rpc_vfs_fs_update_dentry_server( xptr_t xp ) 1062 { 1063 #if DEBUG_RPC_VFS_FS_UPDATE_DENTRY 1064 thread_t * this = CURRENT_THREAD; 1065 uint32_t cycle = (uint32_t)hal_get_cycles(); 1066 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1067 printk("\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 1092 cycle = (uint32_t)hal_get_cycles(); 1093 if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY ) 1094 printk("\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 } 1018 1098 1019 1099 ///////////////////////////////////////////////////////////////////////////////////////// … … 1110 1190 void rpc_vfs_inode_create_client( cxy_t cxy, 1111 1191 uint32_t fs_type, // in 1112 uint32_t inode_type, // in1113 1192 uint32_t attr, // in 1114 1193 uint32_t rights, // in … … 1136 1215 // set input arguments in RPC descriptor 1137 1216 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; 1143 1221 1144 1222 // register RPC request in remote RPC fifo … … 1146 1224 1147 1225 // 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]; 1150 1228 1151 1229 #if DEBUG_RPC_VFS_INODE_CREATE … … 1169 1247 1170 1248 uint32_t fs_type; 1171 uint32_t inode_type;1172 1249 uint32_t attr; 1173 1250 uint32_t rights; … … 1183 1260 // get input arguments from client rpc descriptor 1184 1261 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] ) ); 1190 1266 1191 1267 // call local kernel function 1192 1268 error = vfs_inode_create( fs_type, 1193 inode_type,1194 1269 attr, 1195 1270 rights, … … 1199 1274 1200 1275 // 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 ); 1203 1278 1204 1279 #if DEBUG_RPC_VFS_INODE_CREATE … … 1601 1676 1602 1677 ///////////////////////////////////////////////////////// 1603 void rpc_vfs_fs_ get_dentry_client( cxy_t cxy,1678 void rpc_vfs_fs_new_dentry_client( cxy_t cxy, 1604 1679 vfs_inode_t * parent_inode, // in 1605 1680 char * name, // in … … 1643 1718 1644 1719 ////////////////////////////////////////////// 1645 void rpc_vfs_fs_ get_dentry_server( xptr_t xp )1720 void rpc_vfs_fs_new_dentry_server( xptr_t xp ) 1646 1721 { 1647 1722 #if DEBUG_RPC_VFS_FS_GET_DENTRY … … 1674 1749 1675 1750 // 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 ); 1677 1752 1678 1753 // set output argument … … 2245 2320 2246 2321 ///////////////////////////////////////////////////////////////////////////////////////// 2247 // [24] undefined slot 2248 ///////////////////////////////////////////////////////////////////////////////////////// 2322 // [25] Marshaling functions attached to RPC_MAPPER_SYNC 2323 ///////////////////////////////////////////////////////////////////////////////////////// 2324 2325 /////////////////////////////////////////////////// 2326 void rpc_mapper_sync_client( cxy_t cxy, 2327 struct mapper_s * mapper, 2328 error_t * error ) 2329 { 2330 #if DEBUG_RPC_MAPPER_SYNC 2331 thread_t * this = CURRENT_THREAD; 2332 uint32_t cycle = (uint32_t)hal_get_cycles(); 2333 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2334 printk("\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 2356 cycle = (uint32_t)hal_get_cycles(); 2357 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2358 printk("\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 //////////////////////////////////////// 2364 void rpc_mapper_sync_server( xptr_t xp ) 2365 { 2366 #if DEBUG_RPC_MAPPER_SYNC 2367 thread_t * this = CURRENT_THREAD; 2368 uint32_t cycle = (uint32_t)hal_get_cycles(); 2369 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2370 printk("\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 2391 cycle = (uint32_t)hal_get_cycles(); 2392 if( cycle > DEBUG_RPC_MAPPER_SYNC ) 2393 printk("\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 } 2249 2397 2250 2398 /////////////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.