Changeset 640 for trunk/kernel/kern/rpc.c
- Timestamp:
- Oct 1, 2019, 1:19:00 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r637 r640 73 73 &rpc_vfs_inode_load_all_pages_server, // 19 74 74 75 &rpc_ vmm_get_vseg_server,// 2076 &rpc_ vmm_global_update_pte_server,// 2175 &rpc_undefined, // 20 76 &rpc_undefined, // 21 77 77 &rpc_undefined, // 22 78 78 &rpc_undefined, // 23 79 79 &rpc_mapper_sync_server, // 24 80 &rpc_ undefined,// 2581 &rpc_vmm_ delete_vseg_server, // 2680 &rpc_vmm_resize_vseg_server, // 25 81 &rpc_vmm_remove_vseg_server, // 26 82 82 &rpc_vmm_create_vseg_server, // 27 83 83 &rpc_vmm_set_cow_server, // 28 … … 109 109 "VFS_INODE_LOAD_ALL_PAGES", // 19 110 110 111 " GET_VSEG",// 20112 " GLOBAL_UPDATE_PTE",// 21111 "VMM_GLOBAL_RESIZE_VSEG", // 20 112 "VMM_GLOBAL_UPDATE_PTE", // 21 113 113 "undefined_22", // 22 114 114 "undefined_23", // 23 115 115 "MAPPER_SYNC", // 24 116 116 "undefined_25", // 25 117 "VMM_ DELETE_VSEG", // 26117 "VMM_REMOVE_VSEG", // 26 118 118 "VMM_CREATE_VSEG", // 27 119 119 "VMM_SET_COW", // 28 … … 1072 1072 1073 1073 ///////////////////////////////////////////////////////////////////////////////////////// 1074 // [8] Marshaling functions attached to RPC_V RS_FS_UPDATE_DENTRY1074 // [8] Marshaling functions attached to RPC_VFS_FS_UPDATE_DENTRY 1075 1075 ///////////////////////////////////////////////////////////////////////////////////////// 1076 1076 … … 2059 2059 2060 2060 ///////////////////////////////////////////////////////////////////////////////////////// 2061 // [20] Marshaling functions attached to RPC_VMM_GET_VSEG 2062 ///////////////////////////////////////////////////////////////////////////////////////// 2063 2061 // [20] RPC_VMM_GET_VSEG deprecated [AG] sept 2019 2062 ///////////////////////////////////////////////////////////////////////////////////////// 2063 2064 /* 2064 2065 ////////////////////////////////////////////////// 2065 2066 void rpc_vmm_get_vseg_client( cxy_t cxy, … … 2144 2145 #endif 2145 2146 } 2146 2147 2148 ///////////////////////////////////////////////////////////////////////////////////////// 2149 // [21] Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE 2150 ///////////////////////////////////////////////////////////////////////////////////////// 2151 2152 /////////////////////////////////////////////////////// 2153 void rpc_vmm_global_update_pte_client( cxy_t cxy, 2154 process_t * process, // in 2155 vpn_t vpn, // in 2156 uint32_t attr, // in 2157 ppn_t ppn ) // in 2158 { 2159 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 2160 thread_t * this = CURRENT_THREAD; 2161 uint32_t cycle = (uint32_t)hal_get_cycles(); 2162 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 2163 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2164 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2165 #endif 2166 2167 uint32_t responses = 1; 2168 2169 // initialise RPC descriptor header 2170 rpc_desc_t rpc; 2171 rpc.index = RPC_VMM_GLOBAL_UPDATE_PTE; 2172 rpc.blocking = true; 2173 rpc.rsp = &responses; 2174 2175 // set input arguments in RPC descriptor 2176 rpc.args[0] = (uint64_t)(intptr_t)process; 2177 rpc.args[1] = (uint64_t)vpn; 2178 rpc.args[2] = (uint64_t)attr; 2179 rpc.args[3] = (uint64_t)ppn; 2180 2181 // register RPC request in remote RPC fifo 2182 rpc_send( cxy , &rpc ); 2183 2184 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 2185 cycle = (uint32_t)hal_get_cycles(); 2186 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 2187 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2188 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2189 #endif 2190 } 2191 2192 ////////////////////////////////////////////////// 2193 void rpc_vmm_global_update_pte_server( xptr_t xp ) 2194 { 2195 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 2196 thread_t * this = CURRENT_THREAD; 2197 uint32_t cycle = (uint32_t)hal_get_cycles(); 2198 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 2199 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2200 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2201 #endif 2202 2203 process_t * process; 2204 vpn_t vpn; 2205 uint32_t attr; 2206 ppn_t ppn; 2207 2208 // get client cluster identifier and pointer on RPC descriptor 2209 cxy_t client_cxy = GET_CXY( xp ); 2210 rpc_desc_t * desc = GET_PTR( xp ); 2211 2212 // get input argument "process" & "vpn" from client RPC descriptor 2213 process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2214 vpn = (vpn_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2215 attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); 2216 ppn = (ppn_t) hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) ); 2217 2218 // call local kernel function 2219 vmm_global_update_pte( process , vpn , attr , ppn ); 2220 2221 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 2222 cycle = (uint32_t)hal_get_cycles(); 2223 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 2224 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2225 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2226 #endif 2227 } 2228 2229 ///////////////////////////////////////////////////////////////////////////////////////// 2230 // [22] Marshaling functions attached to RPC_KCM_ALLOC 2147 */ 2148 2149 ///////////////////////////////////////////////////////////////////////////////////////// 2150 // [21] undefined 2151 ///////////////////////////////////////////////////////////////////////////////////////// 2152 2153 ///////////////////////////////////////////////////////////////////////////////////////// 2154 // [22] RPC_KCM_ALLOC deprecated [AG] sept 2019 2231 2155 ///////////////////////////////////////////////////////////////////////////////////////// 2232 2156 … … 2308 2232 2309 2233 ///////////////////////////////////////////////////////////////////////////////////////// 2310 // [23] Marshaling functions attached to RPC_KCM_FREE2234 // [23] RPC_KCM_FREE deprecated [AG] sept 2019 2311 2235 ///////////////////////////////////////////////////////////////////////////////////////// 2312 2236 … … 2460 2384 2461 2385 ///////////////////////////////////////////////////////////////////////////////////////// 2462 // [25] Marshaling functions attached to RPC_MAPPER_HANDLE_MISS 2463 ///////////////////////////////////////////////////////////////////////////////////////// 2464 2465 /* 2386 // [25] Marshaling functions attached to RPC_VMM_RESIZE_VSEG 2387 ///////////////////////////////////////////////////////////////////////////////////////// 2388 2466 2389 ////////////////////////////////////////////////////////// 2467 void rpc_ mapper_handle_miss_client( cxy_t cxy,2468 struct mapper_s * mapper,2469 uint32_t page_id,2470 xptr_t * page_xp,2471 error_t * error)2472 { 2473 #if DEBUG_RPC_ MAPPER_HANDLE_MISS2474 thread_t * this = CURRENT_THREAD; 2475 uint32_t cycle = (uint32_t)hal_get_cycles(); 2476 if( cycle > DEBUG_RPC_ MAPPER_HANDLE_MISS)2390 void rpc_vmm_resize_vseg_client( cxy_t cxy, 2391 struct process_s * process, 2392 struct vseg_s * vseg, 2393 intptr_t new_base, 2394 intptr_t new_size ) 2395 { 2396 #if DEBUG_RPC_VMM_RESIZE_VSEG 2397 thread_t * this = CURRENT_THREAD; 2398 uint32_t cycle = (uint32_t)hal_get_cycles(); 2399 if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG ) 2477 2400 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2478 2401 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); … … 2483 2406 // initialise RPC descriptor header 2484 2407 rpc_desc_t rpc; 2485 rpc.index = RPC_ MAPPER_HANDLE_MISS;2408 rpc.index = RPC_VMM_RESIZE_VSEG; 2486 2409 rpc.blocking = true; 2487 2410 rpc.rsp = &responses; 2488 2411 2489 2412 // set input arguments in RPC descriptor 2490 rpc.args[0] = (uint64_t)(intptr_t)mapper; 2491 rpc.args[1] = (uint64_t)page_id; 2413 rpc.args[0] = (uint64_t)(intptr_t)process; 2414 rpc.args[1] = (uint64_t)(intptr_t)vseg; 2415 rpc.args[2] = (uint64_t)new_base; 2416 rpc.args[3] = (uint64_t)new_size; 2492 2417 2493 2418 // register RPC request in remote RPC fifo 2494 2419 rpc_send( cxy , &rpc ); 2495 2420 2496 // get output values from RPC descriptor 2497 *page_xp = (xptr_t)rpc.args[2]; 2498 *error = (error_t)rpc.args[3]; 2499 2500 #if DEBUG_RPC_MAPPER_HANDLE_MISS 2501 cycle = (uint32_t)hal_get_cycles(); 2502 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) 2503 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2504 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2505 #endif 2506 } 2507 2508 /////////////////////////////////////////////// 2509 void rpc_mapper_handle_miss_server( xptr_t xp ) 2510 { 2511 #if DEBUG_RPC_MAPPER_HANDLE_MISS 2512 thread_t * this = CURRENT_THREAD; 2513 uint32_t cycle = (uint32_t)hal_get_cycles(); 2514 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) 2515 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2516 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2517 #endif 2518 2519 mapper_t * mapper; 2520 uint32_t page_id; 2521 xptr_t page_xp; 2522 error_t error; 2421 #if DEBUG_RPC_VMM_RESIZE_VSEG 2422 cycle = (uint32_t)hal_get_cycles(); 2423 if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG ) 2424 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2425 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2426 #endif 2427 } 2428 2429 //////////////////////////////////////////// 2430 void rpc_vmm_resize_vseg_server( xptr_t xp ) 2431 { 2432 #if DEBUG_RPC_VMM_RESIZE_VSEG 2433 thread_t * this = CURRENT_THREAD; 2434 uint32_t cycle = (uint32_t)hal_get_cycles(); 2435 if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG ) 2436 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2437 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2438 #endif 2439 2440 process_t * process; 2441 vseg_t * vseg; 2442 intptr_t new_base; 2443 intptr_t new_size; 2523 2444 2524 2445 // get client cluster identifier and pointer on RPC descriptor … … 2527 2448 2528 2449 // get arguments from client RPC descriptor 2529 mapper = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2530 page_id = hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2531 2532 // call local kernel function 2533 error = mapper_handle_miss( mapper, 2534 page_id, 2535 &page_xp ); 2536 2537 // set output argument to client RPC descriptor 2538 hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)page_xp ); 2539 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 2540 2541 #if DEBUG_RPC_MAPPER_HANDLE_MISS 2542 cycle = (uint32_t)hal_get_cycles(); 2543 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) 2544 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2545 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2546 #endif 2547 } 2548 */ 2549 2550 ///////////////////////////////////////////////////////////////////////////////////////// 2551 // [26] Marshaling functions attached to RPC_VMM_DELETE_VSEG 2552 ///////////////////////////////////////////////////////////////////////////////////////// 2553 2554 ////////////////////////////////////////////////// 2555 void rpc_vmm_delete_vseg_client( cxy_t cxy, 2556 pid_t pid, 2557 intptr_t vaddr ) 2558 { 2559 #if DEBUG_RPC_VMM_DELETE_VSEG 2450 process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2451 vseg = (vseg_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2452 new_base = (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); 2453 new_size = (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) ); 2454 2455 // call relevant kernel function 2456 vmm_resize_vseg( process, 2457 vseg, 2458 new_base, 2459 new_size ); 2460 2461 #if DEBUG_RPC_VMM_RESIZE_VSEG 2462 cycle = (uint32_t)hal_get_cycles(); 2463 if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG ) 2464 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2465 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2466 #endif 2467 } 2468 2469 2470 ///////////////////////////////////////////////////////////////////////////////////////// 2471 // [26] Marshaling functions attached to RPC_VMM_REMOVE_VSEG 2472 ///////////////////////////////////////////////////////////////////////////////////////// 2473 2474 ///////////////////////////////////////////////// 2475 void rpc_vmm_remove_vseg_client( cxy_t cxy, 2476 process_t * process, 2477 vseg_t * vseg ) 2478 { 2479 #if DEBUG_RPC_VMM_REMOVE_VSEG 2560 2480 thread_t * this = CURRENT_THREAD; 2561 2481 uint32_t cycle = (uint32_t)hal_get_cycles(); 2562 if( cycle > DEBUG_RPC_VMM_ DELETE_VSEG )2482 if( cycle > DEBUG_RPC_VMM_REMOVE_VSEG ) 2563 2483 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2564 2484 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); … … 2569 2489 2570 2490 // initialise RPC descriptor header 2571 rpc.index = RPC_VMM_ DELETE_VSEG;2491 rpc.index = RPC_VMM_REMOVE_VSEG; 2572 2492 rpc.blocking = true; 2573 2493 rpc.rsp = &responses; 2574 2494 2575 2495 // set input arguments in RPC descriptor 2576 rpc.args[0] = (uint64_t) pid;2577 rpc.args[1] = (uint64_t) vaddr;2496 rpc.args[0] = (uint64_t)(intptr_t)process; 2497 rpc.args[1] = (uint64_t)(intptr_t)vseg; 2578 2498 2579 2499 // register RPC request in remote RPC fifo 2580 2500 rpc_send( cxy , &rpc ); 2581 2501 2582 #if DEBUG_RPC_VMM_ DELETE_VSEG2583 cycle = (uint32_t)hal_get_cycles(); 2584 if( cycle > DEBUG_RPC_VMM_ DELETE_VSEG )2502 #if DEBUG_RPC_VMM_REMOVE_VSEG 2503 cycle = (uint32_t)hal_get_cycles(); 2504 if( cycle > DEBUG_RPC_VMM_REMOVE_VSEG ) 2585 2505 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2586 2506 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); … … 2589 2509 2590 2510 //////////////////////////////////////////// 2591 void rpc_vmm_delete_vseg_server( xptr_t xp ) 2592 { 2593 #if DEBUG_RPC_VMM_DELETE_VSEG 2594 uint32_t cycle = (uint32_t)hal_get_cycles(); 2595 thread_t * this = CURRENT_THREAD; 2596 if( DEBUG_RPC_VMM_DELETE_VSEG < cycle ) 2597 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2598 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2599 #endif 2511 void rpc_vmm_remove_vseg_server( xptr_t xp ) 2512 { 2513 #if DEBUG_RPC_VMM_REMOVE_VSEG 2514 uint32_t cycle = (uint32_t)hal_get_cycles(); 2515 thread_t * this = CURRENT_THREAD; 2516 if( DEBUG_RPC_VMM_REMOVE_VSEG < cycle ) 2517 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2518 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 2519 #endif 2520 2521 process_t * process; 2522 vseg_t * vseg; 2600 2523 2601 2524 // get client cluster identifier and pointer on RPC descriptor … … 2604 2527 2605 2528 // get arguments from RPC descriptor 2606 p id_t pid = (pid_t) hal_remote_l64( XPTR(client_cxy , &desc->args[0]) );2607 intptr_t vaddr = (intptr_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) );2529 process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 2530 vseg = (vseg_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 2608 2531 2609 2532 // call relevant kernel function 2610 vmm_delete_vseg( pid , vaddr ); 2611 2612 #if DEBUG_RPC_VMM_DELETE_VSEG 2613 cycle = (uint32_t)hal_get_cycles(); 2614 if( DEBUG_RPC_VMM_DELETE_VSEG < cycle ) 2533 vmm_remove_vseg( process, 2534 vseg ); 2535 2536 #if DEBUG_RPC_VMM_REMOVE_VSEG 2537 cycle = (uint32_t)hal_get_cycles(); 2538 if( DEBUG_RPC_VMM_REMOVE_VSEG < cycle ) 2615 2539 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2616 2540 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
Note: See TracChangeset
for help on using the changeset viewer.