[1] | 1 | /* |
---|
[437] | 2 | * rpc.c - RPC operations implementation. |
---|
[1] | 3 | * |
---|
[437] | 4 | * Author Alain Greiner (2016,2017,2018) |
---|
[1] | 5 | * |
---|
| 6 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-MKH. |
---|
| 9 | * |
---|
| 10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
[14] | 24 | #include <kernel_config.h> |
---|
[457] | 25 | #include <hal_kernel_types.h> |
---|
[1] | 26 | #include <hal_atomic.h> |
---|
| 27 | #include <hal_remote.h> |
---|
| 28 | #include <hal_irqmask.h> |
---|
| 29 | #include <hal_special.h> |
---|
| 30 | #include <printk.h> |
---|
[612] | 31 | #include <user_dir.h> |
---|
[1] | 32 | #include <remote_sem.h> |
---|
| 33 | #include <core.h> |
---|
| 34 | #include <mapper.h> |
---|
[5] | 35 | #include <chdev.h> |
---|
[1] | 36 | #include <bits.h> |
---|
| 37 | #include <thread.h> |
---|
| 38 | #include <cluster.h> |
---|
| 39 | #include <process.h> |
---|
| 40 | #include <vfs.h> |
---|
| 41 | #include <fatfs.h> |
---|
| 42 | #include <rpc.h> |
---|
| 43 | |
---|
[433] | 44 | |
---|
[1] | 45 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[564] | 46 | // Array of function pointers and array of printable strings. |
---|
| 47 | // These arrays must be kept consistent with enum in rpc.h file. |
---|
[1] | 48 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 49 | |
---|
| 50 | rpc_server_t * rpc_server[RPC_MAX_INDEX] = |
---|
| 51 | { |
---|
[601] | 52 | &rpc_pmem_get_pages_server, // 0 |
---|
| 53 | &rpc_pmem_release_pages_server, // 1 |
---|
| 54 | &rpc_undefined, // 2 unused slot |
---|
| 55 | &rpc_process_make_fork_server, // 3 |
---|
[614] | 56 | &rpc_user_dir_create_server, // 4 |
---|
| 57 | &rpc_user_dir_destroy_server, // 5 |
---|
[601] | 58 | &rpc_thread_user_create_server, // 6 |
---|
| 59 | &rpc_thread_kernel_create_server, // 7 |
---|
| 60 | &rpc_undefined, // 8 unused slot |
---|
| 61 | &rpc_process_sigaction_server, // 9 |
---|
[1] | 62 | |
---|
[601] | 63 | &rpc_vfs_inode_create_server, // 10 |
---|
| 64 | &rpc_vfs_inode_destroy_server, // 11 |
---|
| 65 | &rpc_vfs_dentry_create_server, // 12 |
---|
| 66 | &rpc_vfs_dentry_destroy_server, // 13 |
---|
| 67 | &rpc_vfs_file_create_server, // 14 |
---|
| 68 | &rpc_vfs_file_destroy_server, // 15 |
---|
[612] | 69 | &rpc_vfs_fs_get_dentry_server, // 16 |
---|
[601] | 70 | &rpc_vfs_fs_add_dentry_server, // 17 |
---|
| 71 | &rpc_vfs_fs_remove_dentry_server, // 18 |
---|
| 72 | &rpc_vfs_inode_load_all_pages_server, // 19 |
---|
[1] | 73 | |
---|
[601] | 74 | &rpc_vmm_get_vseg_server, // 20 |
---|
| 75 | &rpc_vmm_global_update_pte_server, // 21 |
---|
| 76 | &rpc_kcm_alloc_server, // 22 |
---|
| 77 | &rpc_kcm_free_server, // 23 |
---|
[610] | 78 | &rpc_undefined, // 24 unused slot |
---|
[601] | 79 | &rpc_mapper_handle_miss_server, // 25 |
---|
[611] | 80 | &rpc_vmm_delete_vseg_server, // 26 |
---|
[601] | 81 | &rpc_vmm_create_vseg_server, // 27 |
---|
| 82 | &rpc_vmm_set_cow_server, // 28 |
---|
| 83 | &rpc_vmm_display_server, // 29 |
---|
[1] | 84 | }; |
---|
| 85 | |
---|
[564] | 86 | char * rpc_str[RPC_MAX_INDEX] = |
---|
| 87 | { |
---|
[601] | 88 | "PMEM_GET_PAGES", // 0 |
---|
| 89 | "PMEM_RELEASE_PAGES", // 1 |
---|
| 90 | "undefined", // 2 |
---|
| 91 | "PROCESS_MAKE_FORK", // 3 |
---|
[614] | 92 | "USER_DIR_CREATE", // 4 |
---|
| 93 | "USER_DIR_DESTROY", // 5 |
---|
[601] | 94 | "THREAD_USER_CREATE", // 6 |
---|
| 95 | "THREAD_KERNEL_CREATE", // 7 |
---|
| 96 | "undefined", // 8 |
---|
| 97 | "PROCESS_SIGACTION", // 9 |
---|
[564] | 98 | |
---|
[601] | 99 | "VFS_INODE_CREATE", // 10 |
---|
| 100 | "VFS_INODE_DESTROY", // 11 |
---|
| 101 | "VFS_DENTRY_CREATE", // 12 |
---|
| 102 | "VFS_DENTRY_DESTROY", // 13 |
---|
| 103 | "VFS_FILE_CREATE", // 14 |
---|
| 104 | "VFS_FILE_DESTROY", // 15 |
---|
[612] | 105 | "VFS_FS_GET_DENTRY", // 16 |
---|
[601] | 106 | "VFS_FS_ADD_DENTRY", // 17 |
---|
| 107 | "VFS_FS_REMOVE_DENTRY", // 18 |
---|
| 108 | "VFS_INODE_LOAD_ALL_PAGES", // 19 |
---|
[564] | 109 | |
---|
[601] | 110 | "GET_VSEG", // 20 |
---|
| 111 | "GLOBAL_UPDATE_PTE", // 21 |
---|
| 112 | "KCM_ALLOC", // 22 |
---|
| 113 | "KCM_FREE", // 23 |
---|
[610] | 114 | "undefined", // 24 |
---|
[601] | 115 | "MAPPER_HANDLE_MISS", // 25 |
---|
[611] | 116 | "VMM_DELETE_VSEG", // 26 |
---|
[601] | 117 | "VMM_CREATE_VSEG", // 27 |
---|
| 118 | "VMM_SET_COW", // 28 |
---|
| 119 | "VMM_DISPLAY", // 29 |
---|
[564] | 120 | }; |
---|
| 121 | |
---|
| 122 | ////////////////////////////////////////////////////////////////////////////////// |
---|
[503] | 123 | void __attribute__((noinline)) rpc_undefined( xptr_t xp __attribute__ ((unused)) ) |
---|
[1] | 124 | { |
---|
[492] | 125 | assert( false , "called in cluster %x", local_cxy ); |
---|
[1] | 126 | } |
---|
| 127 | |
---|
[409] | 128 | /***************************************************************************************/ |
---|
[583] | 129 | /************ Generic function supporting RPCs : client side ***************************/ |
---|
[409] | 130 | /***************************************************************************************/ |
---|
| 131 | |
---|
| 132 | /////////////////////////////////////// |
---|
| 133 | void rpc_send( cxy_t server_cxy, |
---|
[416] | 134 | rpc_desc_t * rpc ) |
---|
[409] | 135 | { |
---|
[438] | 136 | lid_t server_core_lid; |
---|
| 137 | lid_t client_core_lid; |
---|
| 138 | volatile error_t full; |
---|
| 139 | thread_t * this; |
---|
[409] | 140 | |
---|
[457] | 141 | full = 0; |
---|
| 142 | this = CURRENT_THREAD; |
---|
| 143 | client_core_lid = this->core->lid; |
---|
| 144 | |
---|
[619] | 145 | // check calling thread can yield when is not the IDLE thread |
---|
[581] | 146 | // RPCs executed by the IDLE thread during kernel_init do not deschedule |
---|
| 147 | if( this->type != THREAD_IDLE ) thread_assert_can_yield( this , __FUNCTION__ ); |
---|
[564] | 148 | |
---|
[440] | 149 | // select a server_core : use client core index if possible / core 0 otherwise |
---|
[564] | 150 | if( client_core_lid < hal_remote_l32( XPTR( server_cxy , &LOCAL_CLUSTER->cores_nr ) ) ) |
---|
[438] | 151 | { |
---|
| 152 | server_core_lid = client_core_lid; |
---|
| 153 | } |
---|
| 154 | else |
---|
| 155 | { |
---|
| 156 | server_core_lid = 0; |
---|
| 157 | } |
---|
| 158 | |
---|
[583] | 159 | // register client_thread and client_core in RPC descriptor |
---|
[436] | 160 | rpc->thread = this; |
---|
[438] | 161 | rpc->lid = client_core_lid; |
---|
[409] | 162 | |
---|
[438] | 163 | // build extended pointer on the RPC descriptor |
---|
[409] | 164 | xptr_t desc_xp = XPTR( local_cxy , rpc ); |
---|
| 165 | |
---|
[436] | 166 | // get local pointer on rpc_fifo in remote cluster, |
---|
[564] | 167 | remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_core_lid]; |
---|
| 168 | xptr_t rpc_fifo_xp = XPTR( server_cxy , rpc_fifo ); |
---|
[409] | 169 | |
---|
[564] | 170 | // post RPC in remote fifo / deschedule without blocking if fifo full |
---|
[409] | 171 | do |
---|
| 172 | { |
---|
[564] | 173 | full = remote_fifo_put_item( rpc_fifo_xp , (uint64_t )desc_xp ); |
---|
| 174 | |
---|
[436] | 175 | if ( full ) |
---|
[409] | 176 | { |
---|
| 177 | printk("\n[WARNING] %s : cluster %x cannot post RPC to cluster %x\n", |
---|
| 178 | __FUNCTION__ , local_cxy , server_cxy ); |
---|
| 179 | |
---|
[436] | 180 | // deschedule without blocking |
---|
| 181 | sched_yield("RPC fifo full"); |
---|
[409] | 182 | } |
---|
| 183 | } |
---|
[436] | 184 | while( full ); |
---|
[409] | 185 | |
---|
[457] | 186 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
[583] | 187 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[564] | 188 | uint32_t items = remote_fifo_items( rpc_fifo_xp ); |
---|
[457] | 189 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
[601] | 190 | printk("\n[%s] thread[%x,%x] / rpc %s / server[%x,%d] / items %d / cycle %d\n", |
---|
| 191 | __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], |
---|
[583] | 192 | server_cxy, server_core_lid, items, cycle ); |
---|
[457] | 193 | #endif |
---|
[409] | 194 | |
---|
[457] | 195 | // send IPI to the selected server core |
---|
| 196 | dev_pic_send_ipi( server_cxy , server_core_lid ); |
---|
[409] | 197 | |
---|
[564] | 198 | // wait RPC completion before returning if blocking RPC : |
---|
[619] | 199 | // - deschedule without blocking if thread idle (in kernel init) |
---|
[564] | 200 | // - block and deschedule policy for any other thread |
---|
[416] | 201 | if ( rpc->blocking ) |
---|
[409] | 202 | { |
---|
[564] | 203 | if( this->type == THREAD_IDLE ) // deschedule without blocking policy |
---|
[409] | 204 | { |
---|
[564] | 205 | |
---|
[438] | 206 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
[436] | 207 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 208 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
[601] | 209 | printk("\n[%s] thread[%x,%x] enter waiting loop for rpc %s / cycle %d\n", |
---|
| 210 | __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); |
---|
[436] | 211 | #endif |
---|
[619] | 212 | while( 1 ) |
---|
| 213 | { |
---|
| 214 | // check responses counter |
---|
| 215 | if( hal_remote_l32( XPTR( local_cxy , rpc->rsp ) ) == 0 ) break; |
---|
| 216 | |
---|
| 217 | // deschedule |
---|
| 218 | sched_yield("busy_waiting RPC completion"); |
---|
| 219 | } |
---|
[409] | 220 | |
---|
[438] | 221 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
[436] | 222 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 223 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
[601] | 224 | printk("\n[%s] thread[%x,%x] received response for rpc %s / cycle %d\n", |
---|
| 225 | __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); |
---|
[436] | 226 | #endif |
---|
[564] | 227 | |
---|
| 228 | } |
---|
| 229 | else // block and deschedule policy |
---|
[409] | 230 | { |
---|
| 231 | |
---|
[438] | 232 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
[436] | 233 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 234 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
[601] | 235 | printk("\n[%s] thread[%x,%x] blocks & deschedules for rpc %s / cycle %d\n", |
---|
| 236 | __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); |
---|
[436] | 237 | #endif |
---|
[409] | 238 | |
---|
[564] | 239 | // block client thread |
---|
| 240 | thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_RPC ); |
---|
| 241 | |
---|
| 242 | // deschedule |
---|
| 243 | sched_yield("blocked on RPC"); |
---|
| 244 | |
---|
[438] | 245 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
[436] | 246 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 247 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
[619] | 248 | printk("\n[%s] thread[%x,%x] resumes after rpc %s / cycle %d\n", |
---|
[601] | 249 | __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); |
---|
[436] | 250 | #endif |
---|
[409] | 251 | } |
---|
| 252 | |
---|
[564] | 253 | // response must be available for a blocking RPC |
---|
[619] | 254 | assert( (*rpc->rsp == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] ); |
---|
[564] | 255 | |
---|
[409] | 256 | } |
---|
[564] | 257 | else // non blocking RPC |
---|
[436] | 258 | { |
---|
| 259 | |
---|
[438] | 260 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
[436] | 261 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 262 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
[601] | 263 | printk("\n[%s] thread[%x,%x] returns for non blocking rpc %s / cycle %d\n", |
---|
| 264 | __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); |
---|
[436] | 265 | #endif |
---|
| 266 | |
---|
| 267 | } |
---|
[409] | 268 | } // end rpc_send() |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | /***************************************************************************************/ |
---|
| 272 | /************ Generic functions supporting RPCs : server side **************************/ |
---|
| 273 | /***************************************************************************************/ |
---|
| 274 | |
---|
[564] | 275 | //////////////////////////// |
---|
[619] | 276 | void rpc_server_func( void ) |
---|
[409] | 277 | { |
---|
[440] | 278 | error_t empty; // local RPC fifo state |
---|
| 279 | xptr_t desc_xp; // extended pointer on RPC request |
---|
| 280 | cxy_t desc_cxy; // RPC request cluster (client) |
---|
| 281 | rpc_desc_t * desc_ptr; // RPC request local pointer |
---|
| 282 | uint32_t index; // RPC request index |
---|
| 283 | thread_t * client_ptr; // local pointer on client thread |
---|
[619] | 284 | xptr_t client_xp; // extended pointer on client thread |
---|
| 285 | lid_t client_lid; // local index of client core |
---|
[440] | 286 | thread_t * server_ptr; // local pointer on server thread |
---|
| 287 | xptr_t server_xp; // extended pointer on server thread |
---|
[619] | 288 | lid_t server_lid; // local index of server core |
---|
[440] | 289 | remote_fifo_t * rpc_fifo; // local pointer on RPC fifo |
---|
[619] | 290 | uint32_t * rsp_ptr; // local pointer on responses counter |
---|
| 291 | xptr_t rsp_xp; // extended pointer on responses counter |
---|
| 292 | uint32_t responses; // number of expected responses |
---|
| 293 | |
---|
[409] | 294 | // makes RPC thread not preemptable |
---|
| 295 | hal_disable_irq( NULL ); |
---|
| 296 | |
---|
[440] | 297 | server_ptr = CURRENT_THREAD; |
---|
| 298 | server_xp = XPTR( local_cxy , server_ptr ); |
---|
[619] | 299 | server_lid = server_ptr->core->lid; |
---|
| 300 | rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_lid]; |
---|
[409] | 301 | |
---|
[564] | 302 | // "infinite" RPC thread loop |
---|
| 303 | while(1) |
---|
[409] | 304 | { |
---|
| 305 | // try to take RPC_FIFO ownership |
---|
[564] | 306 | if( hal_atomic_test_set( &rpc_fifo->owner , server_ptr->trdid ) ) |
---|
[409] | 307 | { |
---|
[436] | 308 | |
---|
[438] | 309 | #if DEBUG_RPC_SERVER_GENERIC |
---|
[436] | 310 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 311 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
[611] | 312 | printk("\n[%s] RPC thread[%x,%x] on core[%d] takes RPC_FIFO ownership / cycle %d\n", |
---|
[619] | 313 | __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_lid, cycle ); |
---|
[436] | 314 | #endif |
---|
[564] | 315 | // try to consume one RPC request |
---|
| 316 | empty = remote_fifo_get_item( rpc_fifo , (uint64_t *)&desc_xp ); |
---|
| 317 | |
---|
| 318 | // release RPC_FIFO ownership |
---|
| 319 | rpc_fifo->owner = 0; |
---|
| 320 | |
---|
| 321 | // handle RPC request if success |
---|
| 322 | if ( empty == 0 ) |
---|
[409] | 323 | { |
---|
[564] | 324 | // get client cluster and pointer on RPC descriptor |
---|
| 325 | desc_cxy = GET_CXY( desc_xp ); |
---|
| 326 | desc_ptr = GET_PTR( desc_xp ); |
---|
[409] | 327 | |
---|
[619] | 328 | // get relevant infos from RPC descriptor |
---|
[610] | 329 | index = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->index ) ); |
---|
| 330 | client_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) ); |
---|
[619] | 331 | rsp_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->rsp ) ); |
---|
| 332 | client_lid = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->lid ) ); |
---|
[409] | 333 | |
---|
[619] | 334 | rsp_xp = XPTR( desc_cxy , rsp_ptr ); |
---|
| 335 | client_xp = XPTR( desc_cxy , client_ptr ); |
---|
| 336 | |
---|
[438] | 337 | #if DEBUG_RPC_SERVER_GENERIC |
---|
[436] | 338 | cycle = (uint32_t)hal_get_cycles(); |
---|
[564] | 339 | uint32_t items = remote_fifo_items( XPTR( local_cxy , rpc_fifo ) ); |
---|
[438] | 340 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
[611] | 341 | printk("\n[%s] RPC thread[%x,%x] got rpc %s / client_cxy %x / items %d / cycle %d\n", |
---|
| 342 | __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, items, cycle ); |
---|
[436] | 343 | #endif |
---|
[610] | 344 | // register client thread in RPC thread descriptor |
---|
[619] | 345 | server_ptr->rpc_client_xp = client_xp; |
---|
[610] | 346 | |
---|
[564] | 347 | // call the relevant server function |
---|
| 348 | rpc_server[index]( desc_xp ); |
---|
[409] | 349 | |
---|
[438] | 350 | #if DEBUG_RPC_SERVER_GENERIC |
---|
[436] | 351 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 352 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
[611] | 353 | printk("\n[%s] RPC thread[%x,%x] completes rpc %s / client_cxy %x / cycle %d\n", |
---|
| 354 | __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, cycle ); |
---|
[436] | 355 | #endif |
---|
[619] | 356 | // decrement expected responses counter |
---|
| 357 | responses = hal_remote_atomic_add( rsp_xp , -1 ); |
---|
[611] | 358 | |
---|
[619] | 359 | // unblock client thread if last response |
---|
| 360 | if( responses == 1 ) |
---|
[564] | 361 | { |
---|
| 362 | // unblock client thread |
---|
[619] | 363 | thread_unblock( client_xp , THREAD_BLOCKED_RPC ); |
---|
[409] | 364 | |
---|
[564] | 365 | hal_fence(); |
---|
[409] | 366 | |
---|
[438] | 367 | #if DEBUG_RPC_SERVER_GENERIC |
---|
| 368 | cycle = (uint32_t)hal_get_cycles(); |
---|
[619] | 369 | trdid_t client_trdid = hal_remote_l32( XPTR( desc_cxy , &client_ptr->trdid ) ); |
---|
| 370 | process_t * process = hal_remote_lpt( XPTR( desc_cxy , &client_ptr->process ) ); |
---|
| 371 | pid_t client_pid = hal_remote_l32( XPTR( desc_cxy , &process->pid ) ); |
---|
[438] | 372 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
[611] | 373 | printk("\n[%s] RPC thread[%x,%x] unblocked client thread[%x,%x] / cycle %d\n", |
---|
| 374 | __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, |
---|
[619] | 375 | client_pid, client_trdid, cycle ); |
---|
[438] | 376 | #endif |
---|
[564] | 377 | // send IPI to client core |
---|
[619] | 378 | dev_pic_send_ipi( desc_cxy , client_lid ); |
---|
[611] | 379 | } |
---|
[564] | 380 | } // end RPC handling if fifo non empty |
---|
| 381 | } // end if RPC_fIFO ownership successfully taken and released |
---|
[409] | 382 | |
---|
[564] | 383 | // sucide if too many RPC threads |
---|
[619] | 384 | if( LOCAL_CLUSTER->rpc_threads[server_lid] >= CONFIG_RPC_THREADS_MAX ) |
---|
[409] | 385 | { |
---|
| 386 | |
---|
[438] | 387 | #if DEBUG_RPC_SERVER_GENERIC |
---|
[436] | 388 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 389 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
[611] | 390 | printk("\n[%s] RPC thread[%x,%x] suicides / cycle %d\n", |
---|
| 391 | __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle ); |
---|
[436] | 392 | #endif |
---|
[409] | 393 | // update RPC threads counter |
---|
[619] | 394 | hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_lid] , -1 ); |
---|
[409] | 395 | |
---|
[440] | 396 | // RPC thread blocks on GLOBAL |
---|
| 397 | thread_block( server_xp , THREAD_BLOCKED_GLOBAL ); |
---|
| 398 | |
---|
| 399 | // RPC thread set the REQ_DELETE flag to suicide |
---|
| 400 | hal_remote_atomic_or( server_xp , THREAD_FLAG_REQ_DELETE ); |
---|
[409] | 401 | } |
---|
[564] | 402 | // block and deschedule otherwise |
---|
[440] | 403 | else |
---|
| 404 | { |
---|
[409] | 405 | |
---|
[438] | 406 | #if DEBUG_RPC_SERVER_GENERIC |
---|
[436] | 407 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 408 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
[619] | 409 | printk("\n[%s] RPC thread[%x,%x] blocks & deschedules / cycle %d\n", |
---|
[611] | 410 | __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle ); |
---|
[436] | 411 | #endif |
---|
[564] | 412 | // RPC thread blocks on IDLE |
---|
| 413 | thread_block( server_xp , THREAD_BLOCKED_IDLE ); |
---|
[409] | 414 | |
---|
[440] | 415 | // RPC thread deschedules |
---|
[564] | 416 | sched_yield("RPC_FIFO empty"); |
---|
[440] | 417 | } |
---|
[438] | 418 | } // end infinite loop |
---|
[409] | 419 | |
---|
[619] | 420 | } // end rpc_server_func() |
---|
[409] | 421 | |
---|
[619] | 422 | |
---|
[1] | 423 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[409] | 424 | // [0] Marshaling functions attached to RPC_PMEM_GET_PAGES (blocking) |
---|
[1] | 425 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 426 | |
---|
| 427 | /////////////////////////////////////////////// |
---|
| 428 | void rpc_pmem_get_pages_client( cxy_t cxy, |
---|
| 429 | uint32_t order, // in |
---|
[313] | 430 | page_t ** page ) // out |
---|
[1] | 431 | { |
---|
[438] | 432 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
[564] | 433 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 434 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 435 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
[601] | 436 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 437 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 438 | #endif |
---|
[296] | 439 | |
---|
[619] | 440 | uint32_t responses = 1; |
---|
[1] | 441 | |
---|
| 442 | // initialise RPC descriptor header |
---|
| 443 | rpc_desc_t rpc; |
---|
[438] | 444 | rpc.index = RPC_PMEM_GET_PAGES; |
---|
| 445 | rpc.blocking = true; |
---|
[619] | 446 | rpc.rsp = &responses; |
---|
[1] | 447 | |
---|
| 448 | // set input arguments in RPC descriptor |
---|
| 449 | rpc.args[0] = (uint64_t)order; |
---|
| 450 | |
---|
[436] | 451 | // register RPC request in remote RPC fifo |
---|
[416] | 452 | rpc_send( cxy , &rpc ); |
---|
[1] | 453 | |
---|
[313] | 454 | // get output arguments from RPC descriptor |
---|
[407] | 455 | *page = (page_t *)(intptr_t)rpc.args[1]; |
---|
[279] | 456 | |
---|
[438] | 457 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
| 458 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 459 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
[601] | 460 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 461 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 462 | #endif |
---|
[1] | 463 | } |
---|
| 464 | |
---|
| 465 | /////////////////////////////////////////// |
---|
| 466 | void rpc_pmem_get_pages_server( xptr_t xp ) |
---|
| 467 | { |
---|
[438] | 468 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
[564] | 469 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 470 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 471 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
[601] | 472 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 473 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 474 | #endif |
---|
[296] | 475 | |
---|
[1] | 476 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 477 | cxy_t cxy = GET_CXY( xp ); |
---|
| 478 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 479 | |
---|
| 480 | // get input arguments from client RPC descriptor |
---|
[564] | 481 | uint32_t order = (uint32_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) ); |
---|
[1] | 482 | |
---|
| 483 | // call local pmem allocator |
---|
| 484 | page_t * page = ppm_alloc_pages( order ); |
---|
| 485 | |
---|
| 486 | // set output arguments into client RPC descriptor |
---|
[564] | 487 | hal_remote_s64( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); |
---|
[296] | 488 | |
---|
[438] | 489 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
| 490 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 491 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
[601] | 492 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 493 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 494 | #endif |
---|
[1] | 495 | } |
---|
| 496 | |
---|
| 497 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 498 | // [1] Marshaling functions attached to RPC_PMEM_RELEASE_PAGES |
---|
[1] | 499 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 500 | |
---|
[409] | 501 | ////////////////////////////////////////////////// |
---|
| 502 | void rpc_pmem_release_pages_client( cxy_t cxy, |
---|
| 503 | page_t * page ) // out |
---|
| 504 | { |
---|
[438] | 505 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
[564] | 506 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 507 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 508 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
[601] | 509 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 510 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[438] | 511 | #endif |
---|
[409] | 512 | |
---|
[619] | 513 | uint32_t responses = 1; |
---|
[409] | 514 | |
---|
| 515 | // initialise RPC descriptor header |
---|
| 516 | rpc_desc_t rpc; |
---|
| 517 | rpc.index = RPC_PMEM_RELEASE_PAGES; |
---|
[416] | 518 | rpc.blocking = true; |
---|
[619] | 519 | rpc.rsp = &responses; |
---|
[409] | 520 | |
---|
| 521 | // set input arguments in RPC descriptor |
---|
| 522 | rpc.args[0] = (uint64_t)(intptr_t)page; |
---|
| 523 | |
---|
[436] | 524 | // register RPC request in remote RPC fifo |
---|
[416] | 525 | rpc_send( cxy , &rpc ); |
---|
[409] | 526 | |
---|
[438] | 527 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
| 528 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 529 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
[601] | 530 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 531 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 532 | #endif |
---|
[409] | 533 | } |
---|
| 534 | |
---|
| 535 | /////////////////////////////////////////////// |
---|
| 536 | void rpc_pmem_release_pages_server( xptr_t xp ) |
---|
| 537 | { |
---|
[438] | 538 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
[564] | 539 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 540 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 541 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
[601] | 542 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 543 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[438] | 544 | #endif |
---|
[409] | 545 | |
---|
| 546 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 547 | cxy_t cxy = GET_CXY( xp ); |
---|
| 548 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[409] | 549 | |
---|
| 550 | // get input arguments from client RPC descriptor |
---|
[564] | 551 | page_t * page = (page_t *)(intptr_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) ); |
---|
[409] | 552 | |
---|
| 553 | // release memory to local pmem |
---|
| 554 | kmem_req_t req; |
---|
| 555 | req.type = KMEM_PAGE; |
---|
| 556 | req.ptr = page; |
---|
| 557 | kmem_free( &req ); |
---|
| 558 | |
---|
[438] | 559 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
| 560 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 561 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
[601] | 562 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 563 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 564 | #endif |
---|
[409] | 565 | } |
---|
| 566 | |
---|
| 567 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[433] | 568 | // [2] undefined slot |
---|
[409] | 569 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 570 | |
---|
[1] | 571 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 572 | // [3] Marshaling functions attached to RPC_PROCESS_MAKE_FORK |
---|
[1] | 573 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 574 | |
---|
[408] | 575 | /////////////////////////////////////////////////// |
---|
| 576 | void rpc_process_make_fork_client( cxy_t cxy, |
---|
| 577 | xptr_t ref_process_xp, // in |
---|
| 578 | xptr_t parent_thread_xp, // in |
---|
| 579 | pid_t * child_pid, // out |
---|
| 580 | thread_t ** child_thread_ptr, // out |
---|
| 581 | error_t * error ) // out |
---|
[1] | 582 | { |
---|
[438] | 583 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
[564] | 584 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 585 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 586 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
[601] | 587 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 588 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[438] | 589 | #endif |
---|
| 590 | |
---|
[619] | 591 | uint32_t responses = 1; |
---|
[1] | 592 | |
---|
| 593 | // initialise RPC descriptor header |
---|
| 594 | rpc_desc_t rpc; |
---|
[408] | 595 | rpc.index = RPC_PROCESS_MAKE_FORK; |
---|
[416] | 596 | rpc.blocking = true; |
---|
[619] | 597 | rpc.rsp = &responses; |
---|
[1] | 598 | |
---|
| 599 | // set input arguments in RPC descriptor |
---|
[440] | 600 | rpc.args[0] = (uint64_t)ref_process_xp; |
---|
| 601 | rpc.args[1] = (uint64_t)parent_thread_xp; |
---|
[1] | 602 | |
---|
[436] | 603 | // register RPC request in remote RPC fifo |
---|
[416] | 604 | rpc_send( cxy , &rpc ); |
---|
[1] | 605 | |
---|
| 606 | // get output arguments from RPC descriptor |
---|
[408] | 607 | *child_pid = (pid_t)rpc.args[2]; |
---|
| 608 | *child_thread_ptr = (thread_t *)(intptr_t)rpc.args[3]; |
---|
| 609 | *error = (error_t)rpc.args[4]; |
---|
[279] | 610 | |
---|
[438] | 611 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
| 612 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 613 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
[601] | 614 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 615 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 616 | #endif |
---|
[1] | 617 | } |
---|
| 618 | |
---|
[408] | 619 | ////////////////////////////////////////////// |
---|
| 620 | void rpc_process_make_fork_server( xptr_t xp ) |
---|
[1] | 621 | { |
---|
[438] | 622 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
[564] | 623 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 624 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 625 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
[601] | 626 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 627 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 628 | #endif |
---|
[409] | 629 | |
---|
[408] | 630 | xptr_t ref_process_xp; // extended pointer on reference parent process |
---|
| 631 | xptr_t parent_thread_xp; // extended pointer on parent thread |
---|
| 632 | pid_t child_pid; // child process identifier |
---|
| 633 | thread_t * child_thread_ptr; // local copy of exec_info structure |
---|
| 634 | error_t error; // local error status |
---|
[1] | 635 | |
---|
| 636 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 637 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 638 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 639 | |
---|
[408] | 640 | // get input arguments from cient RPC descriptor |
---|
[564] | 641 | ref_process_xp = (xptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 642 | parent_thread_xp = (xptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[1] | 643 | |
---|
| 644 | // call local kernel function |
---|
[408] | 645 | error = process_make_fork( ref_process_xp, |
---|
| 646 | parent_thread_xp, |
---|
| 647 | &child_pid, |
---|
| 648 | &child_thread_ptr ); |
---|
[1] | 649 | |
---|
| 650 | // set output argument into client RPC descriptor |
---|
[564] | 651 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)child_pid ); |
---|
| 652 | hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)(intptr_t)child_thread_ptr ); |
---|
| 653 | hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); |
---|
[296] | 654 | |
---|
[438] | 655 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
| 656 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 657 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
[601] | 658 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 659 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 660 | #endif |
---|
[1] | 661 | } |
---|
| 662 | |
---|
| 663 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 664 | // [4] Marshaling functions attached to RPC_USER_DIR_CREATE |
---|
[1] | 665 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 666 | |
---|
[612] | 667 | //////////////////////////////////////////////////// |
---|
| 668 | void rpc_user_dir_create_client( cxy_t cxy, |
---|
| 669 | vfs_inode_t * inode, |
---|
[614] | 670 | xptr_t ref_xp, |
---|
[612] | 671 | user_dir_t ** dir ) |
---|
| 672 | { |
---|
| 673 | #if DEBUG_RPC_USER_DIR_CREATE |
---|
| 674 | thread_t * this = CURRENT_THREAD; |
---|
| 675 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 676 | if( cycle > DEBUG_RPC_USER_DIR_CREATE) |
---|
| 677 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 678 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 679 | #endif |
---|
| 680 | |
---|
[619] | 681 | uint32_t responses = 1; |
---|
[612] | 682 | |
---|
| 683 | // initialise RPC descriptor header |
---|
| 684 | rpc_desc_t rpc; |
---|
| 685 | rpc.index = RPC_USER_DIR_CREATE; |
---|
| 686 | rpc.blocking = true; |
---|
[619] | 687 | rpc.rsp = &responses; |
---|
[612] | 688 | |
---|
| 689 | // set input arguments in RPC descriptor |
---|
| 690 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
[614] | 691 | rpc.args[1] = (uint64_t)ref_xp; |
---|
[612] | 692 | |
---|
| 693 | // register RPC request in remote RPC fifo |
---|
| 694 | rpc_send( cxy , &rpc ); |
---|
| 695 | |
---|
| 696 | // get output argument from RPC descriptor |
---|
[614] | 697 | *dir = (user_dir_t *)(intptr_t)rpc.args[2]; |
---|
[612] | 698 | |
---|
| 699 | #if DEBUG_RPC_USER_DIR_CREATE |
---|
| 700 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 701 | if( cycle > DEBUG_RPC_USER_DIR_CREATE) |
---|
| 702 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 703 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 704 | #endif |
---|
| 705 | } |
---|
| 706 | |
---|
| 707 | //////////////////////////////////////////// |
---|
| 708 | void rpc_user_dir_create_server( xptr_t xp ) |
---|
| 709 | { |
---|
| 710 | #if DEBUG_RPC_USER_DIR_CREATE |
---|
| 711 | thread_t * this = CURRENT_THREAD; |
---|
| 712 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 713 | if( cycle > DEBUG_RPC_USER_DIR_CREATE) |
---|
| 714 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 715 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 716 | #endif |
---|
| 717 | |
---|
| 718 | vfs_inode_t * inode; // pointer on inode in server cluster |
---|
[614] | 719 | xptr_t ref_xp; // extended pointer on reference user process |
---|
[612] | 720 | user_dir_t * dir; // pointer on user_dir structure in server cluster |
---|
| 721 | |
---|
| 722 | // get client cluster identifier and pointer on RPC descriptor |
---|
| 723 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 724 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
| 725 | |
---|
| 726 | // get input argument from RPC descriptor |
---|
[614] | 727 | inode = (vfs_inode_t *)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 728 | ref_xp = (xptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[1])); |
---|
[612] | 729 | |
---|
| 730 | // call kernel function |
---|
[614] | 731 | dir = user_dir_create( inode , ref_xp ); |
---|
[612] | 732 | |
---|
| 733 | // set output argument into RPC descriptor |
---|
[614] | 734 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (intptr_t)dir ); |
---|
[612] | 735 | |
---|
| 736 | #if DEBUG_RPC_USER_DIR_CREATE |
---|
| 737 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 738 | if( cycle > DEBUG_RPC_USER_DIR_CREATE) |
---|
| 739 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 740 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 741 | #endif |
---|
| 742 | } |
---|
| 743 | |
---|
[409] | 744 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 745 | // [5] Marshaling functions attached to RPC_USER_DIR_DESTROY |
---|
[409] | 746 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 747 | |
---|
[612] | 748 | //////////////////////////////////////////////////// |
---|
| 749 | void rpc_user_dir_destroy_client( cxy_t cxy, |
---|
[614] | 750 | user_dir_t * dir, |
---|
| 751 | xptr_t ref_xp ) |
---|
[612] | 752 | { |
---|
| 753 | #if DEBUG_RPC_USER_DIR_DESTROY |
---|
| 754 | thread_t * this = CURRENT_THREAD; |
---|
| 755 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 756 | if( cycle > DEBUG_RPC_USER_DIR_DESTROY) |
---|
| 757 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 758 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 759 | #endif |
---|
| 760 | |
---|
[619] | 761 | uint32_t responses = 1; |
---|
[612] | 762 | |
---|
| 763 | // initialise RPC descriptor header |
---|
| 764 | rpc_desc_t rpc; |
---|
| 765 | rpc.index = RPC_USER_DIR_DESTROY; |
---|
| 766 | rpc.blocking = true; |
---|
[619] | 767 | rpc.rsp = &responses; |
---|
[612] | 768 | |
---|
| 769 | // set input arguments in RPC descriptor |
---|
| 770 | rpc.args[0] = (uint64_t)(intptr_t)dir; |
---|
[614] | 771 | rpc.args[1] = (uint64_t)ref_xp; |
---|
[612] | 772 | |
---|
| 773 | // register RPC request in remote RPC fifo |
---|
| 774 | rpc_send( cxy , &rpc ); |
---|
| 775 | |
---|
| 776 | #if DEBUG_RPC_USER_DIR_DESTROY |
---|
| 777 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 778 | if( cycle > DEBUG_RPC_USER_DIR_DESTROY) |
---|
| 779 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 780 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 781 | #endif |
---|
| 782 | } |
---|
| 783 | |
---|
| 784 | ///////////////////////////////////////////// |
---|
| 785 | void rpc_user_dir_destroy_server( xptr_t xp ) |
---|
| 786 | { |
---|
| 787 | #if DEBUG_RPC_USER_DIR_DESTROY |
---|
| 788 | thread_t * this = CURRENT_THREAD; |
---|
| 789 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 790 | if( cycle > DEBUG_RPC_USER_DIR_DESTROY) |
---|
| 791 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 792 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 793 | #endif |
---|
| 794 | |
---|
| 795 | user_dir_t * dir; // pointer on user_dir structure in server cluster |
---|
[614] | 796 | xptr_t ref_xp; // extended pointer on reference process |
---|
[612] | 797 | |
---|
| 798 | // get client cluster identifier and pointer on RPC descriptor |
---|
| 799 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 800 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
| 801 | |
---|
| 802 | // get input argument from RPC descriptor |
---|
[614] | 803 | dir = (user_dir_t *)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 804 | ref_xp = (xptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[1])); |
---|
[612] | 805 | |
---|
| 806 | // call kernel function |
---|
[614] | 807 | user_dir_destroy( dir , ref_xp ); |
---|
[612] | 808 | |
---|
| 809 | #if DEBUG_RPC_USER_DIR_DESTROY |
---|
| 810 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 811 | if( cycle > DEBUG_RPC_USER_DIR_DESTROY) |
---|
| 812 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 813 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 814 | #endif |
---|
| 815 | } |
---|
| 816 | |
---|
[1] | 817 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 818 | // [6] Marshaling functions attached to RPC_THREAD_USER_CREATE |
---|
[1] | 819 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 820 | |
---|
| 821 | ///////////////////////////////////////////////////////// |
---|
| 822 | void rpc_thread_user_create_client( cxy_t cxy, |
---|
[23] | 823 | pid_t pid, // in |
---|
| 824 | void * start_func, // in |
---|
| 825 | void * start_arg, // in |
---|
[1] | 826 | pthread_attr_t * attr, // in |
---|
| 827 | xptr_t * thread_xp, // out |
---|
| 828 | error_t * error ) // out |
---|
| 829 | { |
---|
[564] | 830 | #if DEBUG_RPC_THREAD_USER_CREATE |
---|
| 831 | thread_t * this = CURRENT_THREAD; |
---|
| 832 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 833 | if( cycle > DEBUG_RPC_THREAD_USER_CREATE) |
---|
[601] | 834 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 835 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 836 | #endif |
---|
[619] | 837 | |
---|
| 838 | uint32_t responses = 1; |
---|
[564] | 839 | |
---|
[1] | 840 | // initialise RPC descriptor header |
---|
| 841 | rpc_desc_t rpc; |
---|
[436] | 842 | rpc.index = RPC_THREAD_USER_CREATE; |
---|
[416] | 843 | rpc.blocking = true; |
---|
[619] | 844 | rpc.rsp = &responses; |
---|
[1] | 845 | |
---|
| 846 | // set input arguments in RPC descriptor |
---|
[23] | 847 | rpc.args[0] = (uint64_t)pid; |
---|
| 848 | rpc.args[1] = (uint64_t)(intptr_t)start_func; |
---|
| 849 | rpc.args[2] = (uint64_t)(intptr_t)start_arg; |
---|
| 850 | rpc.args[3] = (uint64_t)(intptr_t)attr; |
---|
[1] | 851 | |
---|
[436] | 852 | // register RPC request in remote RPC fifo |
---|
[416] | 853 | rpc_send( cxy , &rpc ); |
---|
[1] | 854 | |
---|
| 855 | // get output arguments from RPC descriptor |
---|
[23] | 856 | *thread_xp = (xptr_t)rpc.args[4]; |
---|
| 857 | *error = (error_t)rpc.args[5]; |
---|
[279] | 858 | |
---|
[564] | 859 | #if DEBUG_RPC_THREAD_USER_CREATE |
---|
| 860 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 861 | if( cycle > DEBUG_RPC_THREAD_USER_CREATE) |
---|
[601] | 862 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 863 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 864 | #endif |
---|
[1] | 865 | } |
---|
| 866 | |
---|
| 867 | /////////////////////////////////////////////// |
---|
| 868 | void rpc_thread_user_create_server( xptr_t xp ) |
---|
| 869 | { |
---|
[564] | 870 | #if DEBUG_RPC_THREAD_USER_CREATE |
---|
| 871 | thread_t * this = CURRENT_THREAD; |
---|
| 872 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 873 | if( cycle > DEBUG_RPC_THREAD_USER_CREATE) |
---|
[601] | 874 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 875 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 876 | #endif |
---|
[409] | 877 | |
---|
[1] | 878 | pthread_attr_t * attr_ptr; // pointer on attributes structure in client cluster |
---|
| 879 | pthread_attr_t attr_copy; // attributes structure copy in server cluster |
---|
| 880 | thread_t * thread_ptr; // local pointer on thread descriptor |
---|
| 881 | xptr_t thread_xp; // extended pointer on thread descriptor |
---|
[23] | 882 | |
---|
[1] | 883 | pid_t pid; // process identifier |
---|
[23] | 884 | void * start_func; |
---|
| 885 | void * start_arg; |
---|
| 886 | error_t error; |
---|
[1] | 887 | |
---|
| 888 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 889 | cxy_t client_cxy = GET_CXY( xp ); |
---|
[438] | 890 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 891 | |
---|
[23] | 892 | // get input arguments from RPC descriptor |
---|
[564] | 893 | pid = (pid_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 894 | start_func = (void *)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[1])); |
---|
| 895 | start_arg = (void *)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[2])); |
---|
| 896 | attr_ptr = (pthread_attr_t *)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[3])); |
---|
[23] | 897 | |
---|
[1] | 898 | // makes a local copy of attributes structure |
---|
| 899 | hal_remote_memcpy( XPTR( local_cxy , &attr_copy ), |
---|
| 900 | XPTR( client_cxy , attr_ptr ), |
---|
| 901 | sizeof(pthread_attr_t) ); |
---|
| 902 | |
---|
[23] | 903 | // call kernel function |
---|
| 904 | error = thread_user_create( pid, |
---|
| 905 | start_func, |
---|
| 906 | start_arg, |
---|
| 907 | &attr_copy, |
---|
| 908 | &thread_ptr ); |
---|
[1] | 909 | // set output arguments |
---|
| 910 | thread_xp = XPTR( local_cxy , thread_ptr ); |
---|
[564] | 911 | hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)thread_xp ); |
---|
| 912 | hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error ); |
---|
[296] | 913 | |
---|
[564] | 914 | #if DEBUG_RPC_THREAD_USER_CREATE |
---|
| 915 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 916 | if( cycle > DEBUG_RPC_THREAD_USER_CREATE) |
---|
[601] | 917 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 918 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 919 | #endif |
---|
[1] | 920 | } |
---|
| 921 | |
---|
| 922 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[436] | 923 | // [7] Marshaling functions attached to RPC_THREAD_KERNEL_CREATE (blocking) |
---|
[1] | 924 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 925 | |
---|
| 926 | //////////////////////////////////////////////////// |
---|
| 927 | void rpc_thread_kernel_create_client( cxy_t cxy, |
---|
| 928 | uint32_t type, // in |
---|
| 929 | void * func, // in |
---|
| 930 | void * args, // in |
---|
| 931 | xptr_t * thread_xp, // out |
---|
| 932 | error_t * error ) // out |
---|
| 933 | { |
---|
[564] | 934 | #if DEBUG_RPC_THREAD_KERNEL_CREATE |
---|
| 935 | thread_t * this = CURRENT_THREAD; |
---|
| 936 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 937 | if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE) |
---|
[601] | 938 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 939 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 940 | #endif |
---|
| 941 | |
---|
[619] | 942 | uint32_t responses = 1; |
---|
[1] | 943 | |
---|
| 944 | // initialise RPC descriptor header |
---|
| 945 | rpc_desc_t rpc; |
---|
| 946 | rpc.index = RPC_THREAD_KERNEL_CREATE; |
---|
[416] | 947 | rpc.blocking = true; |
---|
[619] | 948 | rpc.rsp = &responses; |
---|
[1] | 949 | |
---|
| 950 | // set input arguments in RPC descriptor |
---|
| 951 | rpc.args[0] = (uint64_t)type; |
---|
| 952 | rpc.args[1] = (uint64_t)(intptr_t)func; |
---|
| 953 | rpc.args[2] = (uint64_t)(intptr_t)args; |
---|
| 954 | |
---|
[436] | 955 | // register RPC request in remote RPC fifo |
---|
[416] | 956 | rpc_send( cxy , &rpc ); |
---|
[1] | 957 | |
---|
| 958 | // get output arguments from RPC descriptor |
---|
| 959 | *thread_xp = (xptr_t)rpc.args[3]; |
---|
| 960 | *error = (error_t)rpc.args[4]; |
---|
[279] | 961 | |
---|
[564] | 962 | #if DEBUG_RPC_THREAD_KERNEL_CREATE |
---|
| 963 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 964 | if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE) |
---|
[601] | 965 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 966 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 967 | #endif |
---|
[1] | 968 | } |
---|
| 969 | |
---|
| 970 | ///////////////////////////////////////////////// |
---|
| 971 | void rpc_thread_kernel_create_server( xptr_t xp ) |
---|
| 972 | { |
---|
[564] | 973 | #if DEBUG_RPC_THREAD_KERNEL_CREATE |
---|
| 974 | thread_t * this = CURRENT_THREAD; |
---|
| 975 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 976 | if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE) |
---|
[601] | 977 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 978 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 979 | #endif |
---|
| 980 | |
---|
[1] | 981 | thread_t * thread_ptr; // local pointer on thread descriptor |
---|
| 982 | xptr_t thread_xp; // extended pointer on thread descriptor |
---|
| 983 | lid_t core_lid; // core local index |
---|
| 984 | error_t error; |
---|
| 985 | |
---|
| 986 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 987 | cxy_t client_cxy = GET_CXY( xp ); |
---|
[438] | 988 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 989 | |
---|
| 990 | // get attributes from RPC descriptor |
---|
[564] | 991 | uint32_t type = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 992 | void * func = (void*)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
| 993 | void * args = (void*)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); |
---|
[1] | 994 | |
---|
| 995 | // select one core |
---|
| 996 | core_lid = cluster_select_local_core(); |
---|
| 997 | |
---|
| 998 | // call local kernel function |
---|
| 999 | error = thread_kernel_create( &thread_ptr , type , func , args , core_lid ); |
---|
| 1000 | |
---|
| 1001 | // set output arguments |
---|
| 1002 | thread_xp = XPTR( local_cxy , thread_ptr ); |
---|
[564] | 1003 | hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); |
---|
| 1004 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp ); |
---|
[296] | 1005 | |
---|
[564] | 1006 | #if DEBUG_RPC_THREAD_KERNEL_CREATE |
---|
| 1007 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1008 | if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE) |
---|
[601] | 1009 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1010 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[564] | 1011 | #endif |
---|
[1] | 1012 | } |
---|
| 1013 | |
---|
| 1014 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[436] | 1015 | // [8] undefined slot |
---|
[1] | 1016 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1017 | |
---|
[296] | 1018 | |
---|
[23] | 1019 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1020 | // [9] Marshaling functions attached to RPC_PROCESS_SIGACTION |
---|
[23] | 1021 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1022 | |
---|
[416] | 1023 | //////////////////////////////////////////////////// |
---|
| 1024 | void rpc_process_sigaction_client( cxy_t cxy, |
---|
[619] | 1025 | pid_t pid, |
---|
| 1026 | uint32_t action ) |
---|
[409] | 1027 | { |
---|
[438] | 1028 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
[611] | 1029 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[610] | 1030 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 1031 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
[619] | 1032 | printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n", |
---|
| 1033 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, |
---|
| 1034 | process_action_str( action ), pid, cycle ); |
---|
[436] | 1035 | #endif |
---|
[409] | 1036 | |
---|
[619] | 1037 | uint32_t responses = 1; |
---|
| 1038 | rpc_desc_t rpc; |
---|
[409] | 1039 | |
---|
[619] | 1040 | // initialise RPC descriptor header |
---|
| 1041 | rpc.index = RPC_PROCESS_SIGACTION; |
---|
| 1042 | rpc.blocking = true; |
---|
| 1043 | rpc.rsp = &responses; |
---|
[436] | 1044 | |
---|
[619] | 1045 | // set input arguments in RPC descriptor |
---|
| 1046 | rpc.args[0] = (uint64_t)pid; |
---|
| 1047 | rpc.args[1] = (uint64_t)action; |
---|
| 1048 | |
---|
| 1049 | // register RPC request in remote RPC fifo |
---|
| 1050 | rpc_send( cxy , &rpc ); |
---|
| 1051 | |
---|
[438] | 1052 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
[436] | 1053 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 1054 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
[619] | 1055 | printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n", |
---|
| 1056 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, |
---|
| 1057 | process_action_str( action ), pid, cycle ); |
---|
[436] | 1058 | #endif |
---|
| 1059 | } // end rpc_process_sigaction_client() |
---|
| 1060 | |
---|
[409] | 1061 | ////////////////////////////////////////////// |
---|
| 1062 | void rpc_process_sigaction_server( xptr_t xp ) |
---|
| 1063 | { |
---|
[611] | 1064 | // get client cluster identifier and pointer on RPC descriptor |
---|
| 1065 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1066 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
| 1067 | |
---|
| 1068 | // get arguments from RPC descriptor |
---|
| 1069 | pid_t pid = (pid_t) hal_remote_l64( XPTR(client_cxy , &desc->args[0]) ); |
---|
| 1070 | uint32_t action = (uint32_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) ); |
---|
| 1071 | |
---|
[619] | 1072 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
| 1073 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1074 | thread_t * this = CURRENT_THREAD; |
---|
| 1075 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
| 1076 | printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n", |
---|
| 1077 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, |
---|
| 1078 | process_action_str( action ), pid, cycle ); |
---|
| 1079 | #endif |
---|
| 1080 | |
---|
[440] | 1081 | // get client thread pointers |
---|
[611] | 1082 | thread_t * client_ptr = hal_remote_lpt( XPTR( client_cxy , &desc->thread ) ); |
---|
| 1083 | xptr_t client_xp = XPTR( client_cxy , client_ptr ); |
---|
[440] | 1084 | |
---|
[435] | 1085 | // get local process descriptor |
---|
[611] | 1086 | process_t * process = cluster_get_local_process_from_pid( pid ); |
---|
[435] | 1087 | |
---|
[619] | 1088 | // call relevant kernel function if found / does nothing if not found |
---|
| 1089 | if( process != NULL ) |
---|
| 1090 | { |
---|
| 1091 | if ( action == DELETE_ALL_THREADS ) process_delete_threads ( process , client_xp ); |
---|
| 1092 | if ( action == BLOCK_ALL_THREADS ) process_block_threads ( process ); |
---|
| 1093 | if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process ); |
---|
| 1094 | } |
---|
[409] | 1095 | |
---|
[438] | 1096 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
[436] | 1097 | cycle = (uint32_t)hal_get_cycles(); |
---|
[438] | 1098 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
[619] | 1099 | printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n", |
---|
| 1100 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, |
---|
| 1101 | process_action_str( action ), pid, cycle ); |
---|
[436] | 1102 | #endif |
---|
| 1103 | } // end rpc_process_sigaction_server() |
---|
| 1104 | |
---|
[409] | 1105 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1106 | // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE |
---|
[409] | 1107 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1108 | |
---|
[1] | 1109 | ///////////////////////////////////////////////////// |
---|
| 1110 | void rpc_vfs_inode_create_client( cxy_t cxy, |
---|
[23] | 1111 | uint32_t fs_type, // in |
---|
| 1112 | uint32_t inode_type, // in |
---|
[1] | 1113 | uint32_t attr, // in |
---|
[23] | 1114 | uint32_t rights, // in |
---|
[1] | 1115 | uint32_t uid, // in |
---|
| 1116 | uint32_t gid, // in |
---|
| 1117 | xptr_t * inode_xp, // out |
---|
| 1118 | error_t * error ) // out |
---|
| 1119 | { |
---|
[459] | 1120 | #if DEBUG_RPC_VFS_INODE_CREATE |
---|
[564] | 1121 | thread_t * this = CURRENT_THREAD; |
---|
[459] | 1122 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1123 | if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) |
---|
[601] | 1124 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1125 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[459] | 1126 | #endif |
---|
| 1127 | |
---|
[619] | 1128 | uint32_t responses = 1; |
---|
[1] | 1129 | |
---|
| 1130 | // initialise RPC descriptor header |
---|
| 1131 | rpc_desc_t rpc; |
---|
| 1132 | rpc.index = RPC_VFS_INODE_CREATE; |
---|
[416] | 1133 | rpc.blocking = true; |
---|
[619] | 1134 | rpc.rsp = &responses; |
---|
[1] | 1135 | |
---|
| 1136 | // set input arguments in RPC descriptor |
---|
[610] | 1137 | 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; |
---|
[1] | 1143 | |
---|
[436] | 1144 | // register RPC request in remote RPC fifo |
---|
[416] | 1145 | rpc_send( cxy , &rpc ); |
---|
[1] | 1146 | |
---|
| 1147 | // get output values from RPC descriptor |
---|
[610] | 1148 | *inode_xp = (xptr_t)rpc.args[6]; |
---|
| 1149 | *error = (error_t)rpc.args[7]; |
---|
[279] | 1150 | |
---|
[459] | 1151 | #if DEBUG_RPC_VFS_INODE_CREATE |
---|
[564] | 1152 | cycle = (uint32_t)hal_get_cycles(); |
---|
[459] | 1153 | if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) |
---|
[601] | 1154 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1155 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1156 | #endif |
---|
[1] | 1157 | } |
---|
| 1158 | |
---|
| 1159 | ///////////////////////////////////////////// |
---|
| 1160 | void rpc_vfs_inode_create_server( xptr_t xp ) |
---|
| 1161 | { |
---|
[459] | 1162 | #if DEBUG_RPC_VFS_INODE_CREATE |
---|
[564] | 1163 | thread_t * this = CURRENT_THREAD; |
---|
[459] | 1164 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1165 | if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) |
---|
[601] | 1166 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1167 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1168 | #endif |
---|
| 1169 | |
---|
[23] | 1170 | uint32_t fs_type; |
---|
| 1171 | uint32_t inode_type; |
---|
[1] | 1172 | uint32_t attr; |
---|
[23] | 1173 | uint32_t rights; |
---|
[1] | 1174 | uint32_t uid; |
---|
| 1175 | uint32_t gid; |
---|
| 1176 | xptr_t inode_xp; |
---|
| 1177 | error_t error; |
---|
| 1178 | |
---|
| 1179 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1180 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1181 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 1182 | |
---|
| 1183 | // get input arguments from client rpc descriptor |
---|
[610] | 1184 | 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] ) ); |
---|
[1] | 1190 | |
---|
| 1191 | // call local kernel function |
---|
[610] | 1192 | error = vfs_inode_create( fs_type, |
---|
[23] | 1193 | inode_type, |
---|
[1] | 1194 | attr, |
---|
[23] | 1195 | rights, |
---|
[1] | 1196 | uid, |
---|
| 1197 | gid, |
---|
| 1198 | &inode_xp ); |
---|
| 1199 | |
---|
| 1200 | // set output arguments |
---|
[610] | 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 ); |
---|
[296] | 1203 | |
---|
[459] | 1204 | #if DEBUG_RPC_VFS_INODE_CREATE |
---|
[564] | 1205 | cycle = (uint32_t)hal_get_cycles(); |
---|
[459] | 1206 | if( cycle > DEBUG_RPC_VFS_INODE_CREATE ) |
---|
[601] | 1207 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1208 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1209 | #endif |
---|
[1] | 1210 | } |
---|
| 1211 | |
---|
| 1212 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1213 | // [11] Marshaling functions attached to RPC_VFS_INODE_DESTROY |
---|
[1] | 1214 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1215 | |
---|
| 1216 | ///////////////////////////////////////////////////////////// |
---|
| 1217 | void rpc_vfs_inode_destroy_client( cxy_t cxy, |
---|
[601] | 1218 | struct vfs_inode_s * inode ) |
---|
[1] | 1219 | { |
---|
[459] | 1220 | #if DEBUG_RPC_VFS_INODE_DESTROY |
---|
[564] | 1221 | thread_t * this = CURRENT_THREAD; |
---|
[459] | 1222 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1223 | if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) |
---|
[601] | 1224 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1225 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1226 | #endif |
---|
| 1227 | |
---|
[619] | 1228 | uint32_t responses = 1; |
---|
[1] | 1229 | |
---|
| 1230 | // initialise RPC descriptor header |
---|
| 1231 | rpc_desc_t rpc; |
---|
| 1232 | rpc.index = RPC_VFS_INODE_DESTROY; |
---|
[416] | 1233 | rpc.blocking = true; |
---|
[619] | 1234 | rpc.rsp = &responses; |
---|
[1] | 1235 | |
---|
| 1236 | // set input arguments in RPC descriptor |
---|
| 1237 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
| 1238 | |
---|
[436] | 1239 | // register RPC request in remote RPC fifo |
---|
[416] | 1240 | rpc_send( cxy , &rpc ); |
---|
[279] | 1241 | |
---|
[459] | 1242 | #if DEBUG_RPC_VFS_INODE_DESTROY |
---|
[564] | 1243 | cycle = (uint32_t)hal_get_cycles(); |
---|
[459] | 1244 | if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) |
---|
[601] | 1245 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1246 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1247 | #endif |
---|
[1] | 1248 | } |
---|
| 1249 | |
---|
| 1250 | ////////////////////////////////////////////// |
---|
| 1251 | void rpc_vfs_inode_destroy_server( xptr_t xp ) |
---|
| 1252 | { |
---|
[459] | 1253 | #if DEBUG_RPC_VFS_INODE_DESTROY |
---|
[564] | 1254 | thread_t * this = CURRENT_THREAD; |
---|
[459] | 1255 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1256 | if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) |
---|
[601] | 1257 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1258 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1259 | #endif |
---|
| 1260 | |
---|
[1] | 1261 | vfs_inode_t * inode; |
---|
| 1262 | |
---|
| 1263 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1264 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1265 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 1266 | |
---|
[601] | 1267 | // get argument "inode" from client RPC descriptor |
---|
[564] | 1268 | inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
[1] | 1269 | |
---|
| 1270 | // call local kernel function |
---|
[601] | 1271 | vfs_inode_destroy( inode ); |
---|
[296] | 1272 | |
---|
[459] | 1273 | #if DEBUG_RPC_VFS_INODE_DESTROY |
---|
[564] | 1274 | cycle = (uint32_t)hal_get_cycles(); |
---|
[459] | 1275 | if( cycle > DEBUG_RPC_VFS_INODE_DESTROY ) |
---|
[601] | 1276 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1277 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[459] | 1278 | #endif |
---|
[1] | 1279 | } |
---|
| 1280 | |
---|
| 1281 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1282 | // [12] Marshaling functions attached to RPC_VFS_DENTRY_CREATE |
---|
[1] | 1283 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1284 | |
---|
| 1285 | ////////////////////////////////////////////////////////////// |
---|
| 1286 | void rpc_vfs_dentry_create_client( cxy_t cxy, |
---|
| 1287 | uint32_t type, // in |
---|
| 1288 | char * name, // in |
---|
| 1289 | xptr_t * dentry_xp, // out |
---|
| 1290 | error_t * error ) // out |
---|
| 1291 | { |
---|
[438] | 1292 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
[564] | 1293 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 1294 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1295 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
[601] | 1296 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1297 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 1298 | #endif |
---|
[296] | 1299 | |
---|
[619] | 1300 | uint32_t responses = 1; |
---|
[1] | 1301 | |
---|
| 1302 | // initialise RPC descriptor header |
---|
| 1303 | rpc_desc_t rpc; |
---|
| 1304 | rpc.index = RPC_VFS_DENTRY_CREATE; |
---|
[416] | 1305 | rpc.blocking = true; |
---|
[619] | 1306 | rpc.rsp = &responses; |
---|
[1] | 1307 | |
---|
| 1308 | // set input arguments in RPC descriptor |
---|
| 1309 | rpc.args[0] = (uint64_t)type; |
---|
| 1310 | rpc.args[1] = (uint64_t)(intptr_t)name; |
---|
| 1311 | |
---|
[436] | 1312 | // register RPC request in remote RPC fifo |
---|
[416] | 1313 | rpc_send( cxy , &rpc ); |
---|
[1] | 1314 | |
---|
| 1315 | // get output values from RPC descriptor |
---|
[610] | 1316 | *dentry_xp = (xptr_t)rpc.args[2]; |
---|
| 1317 | *error = (error_t)rpc.args[3]; |
---|
[279] | 1318 | |
---|
[438] | 1319 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
| 1320 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1321 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
[601] | 1322 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1323 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 1324 | #endif |
---|
[1] | 1325 | } |
---|
| 1326 | |
---|
| 1327 | ////////////////////////////////////////////// |
---|
| 1328 | void rpc_vfs_dentry_create_server( xptr_t xp ) |
---|
| 1329 | { |
---|
[438] | 1330 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
[564] | 1331 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 1332 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1333 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
[601] | 1334 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1335 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[438] | 1336 | #endif |
---|
| 1337 | |
---|
[1] | 1338 | uint32_t type; |
---|
| 1339 | char * name; |
---|
| 1340 | xptr_t dentry_xp; |
---|
| 1341 | error_t error; |
---|
[238] | 1342 | char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; |
---|
| 1343 | |
---|
[1] | 1344 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1345 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1346 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 1347 | |
---|
[238] | 1348 | // get arguments "name", "type", and "parent" from client RPC descriptor |
---|
[610] | 1349 | type = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 1350 | name = (char *)(intptr_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[296] | 1351 | |
---|
[238] | 1352 | // makes a local copy of name |
---|
| 1353 | hal_remote_strcpy( XPTR( local_cxy , name_copy ), |
---|
| 1354 | XPTR( client_cxy , name ) ); |
---|
| 1355 | |
---|
[1] | 1356 | // call local kernel function |
---|
| 1357 | error = vfs_dentry_create( type, |
---|
| 1358 | name_copy, |
---|
| 1359 | &dentry_xp ); |
---|
| 1360 | // set output arguments |
---|
[610] | 1361 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)dentry_xp ); |
---|
| 1362 | hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
[296] | 1363 | |
---|
[438] | 1364 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
| 1365 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1366 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
[601] | 1367 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1368 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 1369 | #endif |
---|
[1] | 1370 | } |
---|
| 1371 | |
---|
| 1372 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1373 | // [13] Marshaling functions attached to RPC_VFS_DENTRY_DESTROY |
---|
[1] | 1374 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1375 | |
---|
| 1376 | /////////////////////////////////////////////////////// |
---|
| 1377 | void rpc_vfs_dentry_destroy_client( cxy_t cxy, |
---|
[601] | 1378 | vfs_dentry_t * dentry ) |
---|
[1] | 1379 | { |
---|
[440] | 1380 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
[564] | 1381 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 1382 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1383 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
[601] | 1384 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1385 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1386 | #endif |
---|
| 1387 | |
---|
[619] | 1388 | uint32_t responses = 1; |
---|
[1] | 1389 | |
---|
| 1390 | // initialise RPC descriptor header |
---|
| 1391 | rpc_desc_t rpc; |
---|
| 1392 | rpc.index = RPC_VFS_DENTRY_DESTROY; |
---|
[416] | 1393 | rpc.blocking = true; |
---|
[619] | 1394 | rpc.rsp = &responses; |
---|
[1] | 1395 | |
---|
| 1396 | // set input arguments in RPC descriptor |
---|
| 1397 | rpc.args[0] = (uint64_t)(intptr_t)dentry; |
---|
| 1398 | |
---|
[436] | 1399 | // register RPC request in remote RPC fifo |
---|
[416] | 1400 | rpc_send( cxy , &rpc ); |
---|
[279] | 1401 | |
---|
[440] | 1402 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
| 1403 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1404 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
[601] | 1405 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1406 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[440] | 1407 | #endif |
---|
[1] | 1408 | } |
---|
| 1409 | |
---|
| 1410 | /////////////////////////////////////////////// |
---|
| 1411 | void rpc_vfs_dentry_destroy_server( xptr_t xp ) |
---|
| 1412 | { |
---|
[440] | 1413 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
[564] | 1414 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 1415 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1416 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
[601] | 1417 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1418 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1419 | #endif |
---|
| 1420 | |
---|
[1] | 1421 | vfs_dentry_t * dentry; |
---|
| 1422 | |
---|
| 1423 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1424 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1425 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 1426 | |
---|
| 1427 | // get arguments "dentry" from client RPC descriptor |
---|
[564] | 1428 | dentry = (vfs_dentry_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
[1] | 1429 | |
---|
| 1430 | // call local kernel function |
---|
[601] | 1431 | vfs_dentry_destroy( dentry ); |
---|
[296] | 1432 | |
---|
[440] | 1433 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
| 1434 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1435 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
[601] | 1436 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1437 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[440] | 1438 | #endif |
---|
[1] | 1439 | } |
---|
| 1440 | |
---|
| 1441 | |
---|
| 1442 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1443 | // [14] Marshaling functions attached to RPC_VFS_FILE_CREATE |
---|
[1] | 1444 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1445 | |
---|
[23] | 1446 | ////////////////////////////////////////////////////////////// |
---|
| 1447 | void rpc_vfs_file_create_client( cxy_t cxy, |
---|
| 1448 | struct vfs_inode_s * inode, // in |
---|
| 1449 | uint32_t file_attr, // in |
---|
| 1450 | xptr_t * file_xp, // out |
---|
| 1451 | error_t * error ) // out |
---|
| 1452 | { |
---|
[438] | 1453 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
[564] | 1454 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 1455 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1456 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
[601] | 1457 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1458 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[438] | 1459 | #endif |
---|
| 1460 | |
---|
[619] | 1461 | uint32_t responses = 1; |
---|
[23] | 1462 | |
---|
| 1463 | // initialise RPC descriptor header |
---|
| 1464 | rpc_desc_t rpc; |
---|
| 1465 | rpc.index = RPC_VFS_FILE_CREATE; |
---|
[416] | 1466 | rpc.blocking = true; |
---|
[619] | 1467 | rpc.rsp = &responses; |
---|
[23] | 1468 | |
---|
| 1469 | // set input arguments in RPC descriptor |
---|
| 1470 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
| 1471 | rpc.args[1] = (uint64_t)file_attr; |
---|
| 1472 | |
---|
[436] | 1473 | // register RPC request in remote RPC fifo |
---|
[416] | 1474 | rpc_send( cxy , &rpc ); |
---|
[23] | 1475 | |
---|
| 1476 | // get output values from RPC descriptor |
---|
| 1477 | *file_xp = (xptr_t)rpc.args[2]; |
---|
| 1478 | *error = (error_t)rpc.args[3]; |
---|
[279] | 1479 | |
---|
[438] | 1480 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
| 1481 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1482 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
[601] | 1483 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1484 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 1485 | #endif |
---|
[23] | 1486 | } |
---|
| 1487 | |
---|
| 1488 | //////////////////////////////////////////// |
---|
| 1489 | void rpc_vfs_file_create_server( xptr_t xp ) |
---|
| 1490 | { |
---|
[438] | 1491 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
[564] | 1492 | thread_t * this = CURRENT_THREAD; |
---|
[438] | 1493 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1494 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
[601] | 1495 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1496 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[438] | 1497 | #endif |
---|
| 1498 | |
---|
[23] | 1499 | uint32_t file_attr; |
---|
| 1500 | vfs_inode_t * inode; |
---|
| 1501 | xptr_t file_xp; |
---|
| 1502 | error_t error; |
---|
| 1503 | |
---|
| 1504 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1505 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1506 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[23] | 1507 | |
---|
| 1508 | // get arguments "file_attr" and "inode" from client RPC descriptor |
---|
[564] | 1509 | inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 1510 | file_attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[23] | 1511 | |
---|
| 1512 | // call local kernel function |
---|
| 1513 | error = vfs_file_create( inode, |
---|
| 1514 | file_attr, |
---|
| 1515 | &file_xp ); |
---|
| 1516 | |
---|
| 1517 | // set output arguments |
---|
[564] | 1518 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp ); |
---|
| 1519 | hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
[296] | 1520 | |
---|
[438] | 1521 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
| 1522 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1523 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
[601] | 1524 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1525 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[438] | 1526 | #endif |
---|
[23] | 1527 | } |
---|
| 1528 | |
---|
| 1529 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1530 | // [15] Marshaling functions attached to RPC_VFS_FILE_DESTROY |
---|
[23] | 1531 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1532 | |
---|
| 1533 | /////////////////////////////////////////////////// |
---|
| 1534 | void rpc_vfs_file_destroy_client( cxy_t cxy, |
---|
| 1535 | vfs_file_t * file ) |
---|
| 1536 | { |
---|
[440] | 1537 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
[564] | 1538 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 1539 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1540 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
[601] | 1541 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1542 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1543 | #endif |
---|
| 1544 | |
---|
[619] | 1545 | uint32_t responses = 1; |
---|
[23] | 1546 | |
---|
| 1547 | // initialise RPC descriptor header |
---|
| 1548 | rpc_desc_t rpc; |
---|
| 1549 | rpc.index = RPC_VFS_FILE_DESTROY; |
---|
[416] | 1550 | rpc.blocking = true; |
---|
[619] | 1551 | rpc.rsp = &responses; |
---|
[23] | 1552 | |
---|
| 1553 | // set input arguments in RPC descriptor |
---|
| 1554 | rpc.args[0] = (uint64_t)(intptr_t)file; |
---|
| 1555 | |
---|
[436] | 1556 | // register RPC request in remote RPC fifo |
---|
[416] | 1557 | rpc_send( cxy , &rpc ); |
---|
[279] | 1558 | |
---|
[440] | 1559 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
| 1560 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1561 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
[601] | 1562 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1563 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[440] | 1564 | #endif |
---|
[23] | 1565 | } |
---|
| 1566 | |
---|
| 1567 | ///////////////////////////////////////////// |
---|
| 1568 | void rpc_vfs_file_destroy_server( xptr_t xp ) |
---|
| 1569 | { |
---|
[440] | 1570 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
[564] | 1571 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 1572 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1573 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
[601] | 1574 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1575 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1576 | #endif |
---|
| 1577 | |
---|
[23] | 1578 | vfs_file_t * file; |
---|
| 1579 | |
---|
| 1580 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1581 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1582 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[23] | 1583 | |
---|
| 1584 | // get arguments "dentry" from client RPC descriptor |
---|
[564] | 1585 | file = (vfs_file_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
[23] | 1586 | |
---|
| 1587 | // call local kernel function |
---|
| 1588 | vfs_file_destroy( file ); |
---|
[296] | 1589 | |
---|
[440] | 1590 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
| 1591 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1592 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
[601] | 1593 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1594 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
[440] | 1595 | #endif |
---|
[23] | 1596 | } |
---|
| 1597 | |
---|
| 1598 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1599 | // [16] Marshaling functions attached to RPC_VFS_FS_GET_DENTRY |
---|
[23] | 1600 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1601 | |
---|
[601] | 1602 | ///////////////////////////////////////////////////////// |
---|
[612] | 1603 | void rpc_vfs_fs_get_dentry_client( cxy_t cxy, |
---|
[601] | 1604 | vfs_inode_t * parent_inode, // in |
---|
| 1605 | char * name, // in |
---|
| 1606 | xptr_t child_inode_xp, // in |
---|
| 1607 | error_t * error ) // out |
---|
[238] | 1608 | { |
---|
[612] | 1609 | #if DEBUG_RPC_VFS_FS_GET_DENTRY |
---|
[601] | 1610 | thread_t * this = CURRENT_THREAD; |
---|
| 1611 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[612] | 1612 | if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) |
---|
[601] | 1613 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1614 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1615 | #endif |
---|
| 1616 | |
---|
[619] | 1617 | uint32_t responses = 1; |
---|
[238] | 1618 | |
---|
| 1619 | // initialise RPC descriptor header |
---|
| 1620 | rpc_desc_t rpc; |
---|
[612] | 1621 | rpc.index = RPC_VFS_FS_GET_DENTRY; |
---|
[416] | 1622 | rpc.blocking = true; |
---|
[619] | 1623 | rpc.rsp = &responses; |
---|
[238] | 1624 | |
---|
| 1625 | // set input arguments in RPC descriptor |
---|
| 1626 | rpc.args[0] = (uint64_t)(intptr_t)parent_inode; |
---|
| 1627 | rpc.args[1] = (uint64_t)(intptr_t)name; |
---|
| 1628 | rpc.args[2] = (uint64_t)child_inode_xp; |
---|
| 1629 | |
---|
[436] | 1630 | // register RPC request in remote RPC fifo |
---|
[416] | 1631 | rpc_send( cxy , &rpc ); |
---|
[238] | 1632 | |
---|
| 1633 | // get output values from RPC descriptor |
---|
| 1634 | *error = (error_t)rpc.args[3]; |
---|
[279] | 1635 | |
---|
[612] | 1636 | #if DEBUG_RPC_VFS_FS_GET_DENTRY |
---|
[601] | 1637 | cycle = (uint32_t)hal_get_cycles(); |
---|
[612] | 1638 | if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) |
---|
[601] | 1639 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1640 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1641 | #endif |
---|
[238] | 1642 | } |
---|
| 1643 | |
---|
[601] | 1644 | ////////////////////////////////////////////// |
---|
[612] | 1645 | void rpc_vfs_fs_get_dentry_server( xptr_t xp ) |
---|
[238] | 1646 | { |
---|
[612] | 1647 | #if DEBUG_RPC_VFS_FS_GET_DENTRY |
---|
[601] | 1648 | thread_t * this = CURRENT_THREAD; |
---|
| 1649 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[612] | 1650 | if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) |
---|
[601] | 1651 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1652 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1653 | #endif |
---|
| 1654 | |
---|
[238] | 1655 | error_t error; |
---|
| 1656 | vfs_inode_t * parent; |
---|
| 1657 | xptr_t child_xp; |
---|
| 1658 | char * name; |
---|
| 1659 | |
---|
| 1660 | char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; |
---|
| 1661 | |
---|
| 1662 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1663 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1664 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[238] | 1665 | |
---|
| 1666 | // get arguments "parent", "name", and "child_xp" |
---|
[564] | 1667 | parent = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 1668 | name = (char*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[1])); |
---|
| 1669 | child_xp = (xptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[2])); |
---|
[238] | 1670 | |
---|
| 1671 | // get name local copy |
---|
| 1672 | hal_remote_strcpy( XPTR( local_cxy , name_copy ) , |
---|
| 1673 | XPTR( client_cxy , name ) ); |
---|
| 1674 | |
---|
| 1675 | // call the kernel function |
---|
[612] | 1676 | error = vfs_fs_get_dentry( parent , name_copy , child_xp ); |
---|
[238] | 1677 | |
---|
| 1678 | // set output argument |
---|
[564] | 1679 | hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
[296] | 1680 | |
---|
[612] | 1681 | #if DEBUG_RPC_VFS_FS_GET_DENTRY |
---|
[601] | 1682 | cycle = (uint32_t)hal_get_cycles(); |
---|
[612] | 1683 | if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) |
---|
[601] | 1684 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1685 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1686 | #endif |
---|
[238] | 1687 | } |
---|
| 1688 | |
---|
| 1689 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1690 | // [17] Marshaling function attached to RPC_VFS_FS_ADD_DENTRY |
---|
[238] | 1691 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1692 | |
---|
[601] | 1693 | void rpc_vfs_fs_add_dentry_client( cxy_t cxy, |
---|
| 1694 | vfs_inode_t * parent, // in |
---|
| 1695 | vfs_dentry_t * dentry, // in |
---|
| 1696 | error_t * error ) // out |
---|
[238] | 1697 | { |
---|
[601] | 1698 | #if DEBUG_RPC_VFS_FS_ADD_DENTRY |
---|
| 1699 | thread_t * this = CURRENT_THREAD; |
---|
| 1700 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1701 | if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) |
---|
| 1702 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1703 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1704 | #endif |
---|
| 1705 | |
---|
[619] | 1706 | uint32_t responses = 1; |
---|
[238] | 1707 | |
---|
| 1708 | // initialise RPC descriptor header |
---|
| 1709 | rpc_desc_t rpc; |
---|
[601] | 1710 | rpc.index = RPC_VFS_FS_ADD_DENTRY; |
---|
[416] | 1711 | rpc.blocking = true; |
---|
[619] | 1712 | rpc.rsp = &responses; |
---|
[238] | 1713 | |
---|
| 1714 | // set input arguments in RPC descriptor |
---|
[601] | 1715 | rpc.args[0] = (uint64_t)(intptr_t)parent; |
---|
| 1716 | rpc.args[1] = (uint64_t)(intptr_t)dentry; |
---|
[238] | 1717 | |
---|
[436] | 1718 | // register RPC request in remote RPC fifo |
---|
[416] | 1719 | rpc_send( cxy , &rpc ); |
---|
[238] | 1720 | |
---|
| 1721 | // get output values from RPC descriptor |
---|
[601] | 1722 | *error = (error_t)rpc.args[2]; |
---|
[279] | 1723 | |
---|
[601] | 1724 | #if DEBUG_RPC_VFS_FS_ADD_DENTRY |
---|
| 1725 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1726 | if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) |
---|
| 1727 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1728 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1729 | #endif |
---|
[238] | 1730 | } |
---|
| 1731 | |
---|
[619] | 1732 | ////////////////////////////////////////////// |
---|
[601] | 1733 | void rpc_vfs_fs_add_dentry_server( xptr_t xp ) |
---|
[238] | 1734 | { |
---|
[601] | 1735 | #if DEBUG_RPC_VFS_FS_ADD_DENTRY |
---|
| 1736 | thread_t * this = CURRENT_THREAD; |
---|
| 1737 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1738 | if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) |
---|
| 1739 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1740 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1741 | #endif |
---|
[238] | 1742 | |
---|
[601] | 1743 | error_t error; |
---|
| 1744 | vfs_inode_t * parent; |
---|
| 1745 | vfs_dentry_t * dentry; |
---|
| 1746 | |
---|
[238] | 1747 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1748 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1749 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[238] | 1750 | |
---|
[601] | 1751 | // get input arguments |
---|
| 1752 | parent = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 1753 | dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); |
---|
[238] | 1754 | |
---|
| 1755 | // call the kernel function |
---|
[601] | 1756 | error = vfs_fs_add_dentry( parent , dentry ); |
---|
[238] | 1757 | |
---|
| 1758 | // set output argument |
---|
[601] | 1759 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)error ); |
---|
[296] | 1760 | |
---|
[601] | 1761 | #if DEBUG_RPC_VFS_FS_ADD_DENTRY |
---|
| 1762 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1763 | if( cycle > DEBUG_RPC_VFS_FS_ADD_DENTRY ) |
---|
| 1764 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1765 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1766 | #endif |
---|
[238] | 1767 | } |
---|
| 1768 | |
---|
| 1769 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1770 | // [18] Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY |
---|
[238] | 1771 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1772 | |
---|
[601] | 1773 | void rpc_vfs_fs_remove_dentry_client( cxy_t cxy, |
---|
| 1774 | vfs_inode_t * parent, // in |
---|
| 1775 | vfs_dentry_t * dentry, // in |
---|
| 1776 | error_t * error ) // out |
---|
[23] | 1777 | { |
---|
[601] | 1778 | #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY |
---|
| 1779 | thread_t * this = CURRENT_THREAD; |
---|
| 1780 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1781 | if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) |
---|
| 1782 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1783 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1784 | #endif |
---|
| 1785 | |
---|
[619] | 1786 | uint32_t responses = 1; |
---|
[23] | 1787 | |
---|
| 1788 | // initialise RPC descriptor header |
---|
| 1789 | rpc_desc_t rpc; |
---|
[601] | 1790 | rpc.index = RPC_VFS_FS_REMOVE_DENTRY; |
---|
[416] | 1791 | rpc.blocking = true; |
---|
[619] | 1792 | rpc.rsp = &responses; |
---|
[23] | 1793 | |
---|
| 1794 | // set input arguments in RPC descriptor |
---|
[601] | 1795 | rpc.args[0] = (uint64_t)(intptr_t)parent; |
---|
| 1796 | rpc.args[1] = (uint64_t)(intptr_t)dentry; |
---|
[23] | 1797 | |
---|
[601] | 1798 | // register RPC request in remote RPC fifo |
---|
[416] | 1799 | rpc_send( cxy , &rpc ); |
---|
[23] | 1800 | |
---|
[601] | 1801 | // get output values from RPC descriptor |
---|
| 1802 | *error = (error_t)rpc.args[2]; |
---|
[279] | 1803 | |
---|
[601] | 1804 | #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY |
---|
| 1805 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1806 | if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) |
---|
| 1807 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1808 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1809 | #endif |
---|
[23] | 1810 | } |
---|
| 1811 | |
---|
[601] | 1812 | ///////////////////////////////////////////////// |
---|
| 1813 | void rpc_vfs_fs_remove_dentry_server( xptr_t xp ) |
---|
[23] | 1814 | { |
---|
[601] | 1815 | #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY |
---|
| 1816 | thread_t * this = CURRENT_THREAD; |
---|
| 1817 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1818 | if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) |
---|
| 1819 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1820 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1821 | #endif |
---|
[23] | 1822 | |
---|
[601] | 1823 | error_t error; |
---|
| 1824 | vfs_inode_t * parent; |
---|
| 1825 | vfs_dentry_t * dentry; |
---|
| 1826 | |
---|
[23] | 1827 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1828 | cxy_t client_cxy = GET_CXY( xp ); |
---|
[438] | 1829 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[23] | 1830 | |
---|
| 1831 | // get input arguments |
---|
[601] | 1832 | parent = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 1833 | dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1])); |
---|
[23] | 1834 | |
---|
| 1835 | // call the kernel function |
---|
[601] | 1836 | error = vfs_fs_remove_dentry( parent , dentry ); |
---|
[23] | 1837 | |
---|
| 1838 | // set output argument |
---|
[601] | 1839 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)error ); |
---|
[296] | 1840 | |
---|
[601] | 1841 | #if DEBUG_RPC_VFS_FS_REMOVE_DENTRY |
---|
| 1842 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1843 | if( cycle > DEBUG_RPC_VFS_FS_REMOVE_DENTRY ) |
---|
| 1844 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1845 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1846 | #endif |
---|
[23] | 1847 | } |
---|
| 1848 | |
---|
| 1849 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1850 | // [19] Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES |
---|
[601] | 1851 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1852 | |
---|
| 1853 | //////////////////////////////////////////////////////////// |
---|
| 1854 | void rpc_vfs_inode_load_all_pages_client( cxy_t cxy, |
---|
| 1855 | vfs_inode_t * inode, // in |
---|
| 1856 | error_t * error ) // out |
---|
| 1857 | { |
---|
| 1858 | #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES |
---|
| 1859 | thread_t * this = CURRENT_THREAD; |
---|
| 1860 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1861 | if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) |
---|
| 1862 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1863 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1864 | #endif |
---|
| 1865 | |
---|
[619] | 1866 | uint32_t responses = 1; |
---|
[601] | 1867 | |
---|
| 1868 | // initialise RPC descriptor header |
---|
| 1869 | rpc_desc_t rpc; |
---|
| 1870 | rpc.index = RPC_VFS_INODE_LOAD_ALL_PAGES; |
---|
| 1871 | rpc.blocking = true; |
---|
[619] | 1872 | rpc.rsp = &responses; |
---|
[601] | 1873 | |
---|
| 1874 | // set input arguments in RPC descriptor |
---|
| 1875 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
| 1876 | |
---|
| 1877 | // register RPC request in remote RPC fifo |
---|
| 1878 | rpc_send( cxy , &rpc ); |
---|
| 1879 | |
---|
| 1880 | // get output values from RPC descriptor |
---|
| 1881 | *error = (error_t)rpc.args[1]; |
---|
| 1882 | |
---|
| 1883 | #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES |
---|
| 1884 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1885 | if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) |
---|
| 1886 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1887 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1888 | #endif |
---|
| 1889 | } |
---|
| 1890 | |
---|
| 1891 | ///////////////////////////////////////////////////// |
---|
| 1892 | void rpc_vfs_inode_load_all_pages_server( xptr_t xp ) |
---|
| 1893 | { |
---|
| 1894 | #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES |
---|
| 1895 | thread_t * this = CURRENT_THREAD; |
---|
| 1896 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1897 | if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) |
---|
| 1898 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1899 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1900 | #endif |
---|
| 1901 | |
---|
| 1902 | error_t error; |
---|
| 1903 | vfs_inode_t * inode; |
---|
| 1904 | |
---|
| 1905 | // get client cluster identifier and pointer on RPC descriptor |
---|
| 1906 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1907 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
| 1908 | |
---|
| 1909 | // get input argument |
---|
| 1910 | inode = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); |
---|
| 1911 | |
---|
| 1912 | // call the kernel function |
---|
| 1913 | error = vfs_inode_load_all_pages( inode ); |
---|
| 1914 | |
---|
| 1915 | // set output argument |
---|
| 1916 | hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); |
---|
| 1917 | |
---|
| 1918 | #if DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES |
---|
| 1919 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1920 | if( cycle > DEBUG_RPC_VFS_INODE_LOAD_ALL_PAGES ) |
---|
| 1921 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1922 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 1923 | #endif |
---|
| 1924 | } |
---|
| 1925 | |
---|
| 1926 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 1927 | // [20] Marshaling functions attached to RPC_VMM_GET_VSEG |
---|
[23] | 1928 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1929 | |
---|
| 1930 | ////////////////////////////////////////////////// |
---|
[389] | 1931 | void rpc_vmm_get_vseg_client( cxy_t cxy, |
---|
| 1932 | process_t * process, // in |
---|
| 1933 | intptr_t vaddr, // in |
---|
| 1934 | xptr_t * vseg_xp, // out |
---|
| 1935 | error_t * error ) // out |
---|
[1] | 1936 | { |
---|
[440] | 1937 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
[564] | 1938 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 1939 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1940 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
[601] | 1941 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1942 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1943 | #endif |
---|
| 1944 | |
---|
[619] | 1945 | uint32_t responses = 1; |
---|
[1] | 1946 | |
---|
| 1947 | // initialise RPC descriptor header |
---|
| 1948 | rpc_desc_t rpc; |
---|
[389] | 1949 | rpc.index = RPC_VMM_GET_VSEG; |
---|
[416] | 1950 | rpc.blocking = true; |
---|
[619] | 1951 | rpc.rsp = &responses; |
---|
[1] | 1952 | |
---|
| 1953 | // set input arguments in RPC descriptor |
---|
| 1954 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
| 1955 | rpc.args[1] = (uint64_t)vaddr; |
---|
| 1956 | |
---|
[436] | 1957 | // register RPC request in remote RPC fifo |
---|
[416] | 1958 | rpc_send( cxy , &rpc ); |
---|
[1] | 1959 | |
---|
| 1960 | // get output argument from rpc descriptor |
---|
| 1961 | *vseg_xp = rpc.args[2]; |
---|
[389] | 1962 | *error = (error_t)rpc.args[3]; |
---|
[279] | 1963 | |
---|
[440] | 1964 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
| 1965 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 1966 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
[601] | 1967 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 1968 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1969 | #endif |
---|
[1] | 1970 | } |
---|
| 1971 | |
---|
[389] | 1972 | ///////////////////////////////////////// |
---|
| 1973 | void rpc_vmm_get_vseg_server( xptr_t xp ) |
---|
[1] | 1974 | { |
---|
[440] | 1975 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
[564] | 1976 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 1977 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 1978 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
[601] | 1979 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 1980 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 1981 | #endif |
---|
| 1982 | |
---|
[1] | 1983 | process_t * process; |
---|
| 1984 | intptr_t vaddr; |
---|
| 1985 | vseg_t * vseg_ptr; |
---|
| 1986 | xptr_t vseg_xp; |
---|
[389] | 1987 | error_t error; |
---|
[1] | 1988 | |
---|
| 1989 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 1990 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 1991 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 1992 | |
---|
| 1993 | // get input argument from client RPC descriptor |
---|
[564] | 1994 | process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 1995 | vaddr = (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[1] | 1996 | |
---|
| 1997 | // call local kernel function |
---|
[389] | 1998 | error = vmm_get_vseg( process , vaddr , &vseg_ptr ); |
---|
[1] | 1999 | |
---|
[389] | 2000 | // set output arguments to client RPC descriptor |
---|
| 2001 | vseg_xp = XPTR( local_cxy , vseg_ptr ); |
---|
[564] | 2002 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp ); |
---|
| 2003 | hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
[296] | 2004 | |
---|
[440] | 2005 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
| 2006 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2007 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
[601] | 2008 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2009 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 2010 | #endif |
---|
[1] | 2011 | } |
---|
| 2012 | |
---|
| 2013 | |
---|
| 2014 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2015 | // [21] Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE |
---|
[1] | 2016 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2017 | |
---|
[583] | 2018 | /////////////////////////////////////////////////////// |
---|
| 2019 | void rpc_vmm_global_update_pte_client( cxy_t cxy, |
---|
| 2020 | process_t * process, // in |
---|
| 2021 | vpn_t vpn, // in |
---|
| 2022 | uint32_t attr, // in |
---|
| 2023 | ppn_t ppn ) // in |
---|
[1] | 2024 | { |
---|
[583] | 2025 | #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE |
---|
[564] | 2026 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 2027 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[583] | 2028 | if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) |
---|
[601] | 2029 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2030 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 2031 | #endif |
---|
| 2032 | |
---|
[619] | 2033 | uint32_t responses = 1; |
---|
[1] | 2034 | |
---|
| 2035 | // initialise RPC descriptor header |
---|
| 2036 | rpc_desc_t rpc; |
---|
[583] | 2037 | rpc.index = RPC_VMM_GLOBAL_UPDATE_PTE; |
---|
[416] | 2038 | rpc.blocking = true; |
---|
[619] | 2039 | rpc.rsp = &responses; |
---|
[1] | 2040 | |
---|
| 2041 | // set input arguments in RPC descriptor |
---|
| 2042 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
| 2043 | rpc.args[1] = (uint64_t)vpn; |
---|
[583] | 2044 | rpc.args[2] = (uint64_t)attr; |
---|
| 2045 | rpc.args[3] = (uint64_t)ppn; |
---|
[1] | 2046 | |
---|
[436] | 2047 | // register RPC request in remote RPC fifo |
---|
[416] | 2048 | rpc_send( cxy , &rpc ); |
---|
[1] | 2049 | |
---|
[583] | 2050 | #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE |
---|
[440] | 2051 | cycle = (uint32_t)hal_get_cycles(); |
---|
[583] | 2052 | if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) |
---|
[601] | 2053 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2054 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 2055 | #endif |
---|
[1] | 2056 | } |
---|
| 2057 | |
---|
[583] | 2058 | ////////////////////////////////////////////////// |
---|
| 2059 | void rpc_vmm_global_update_pte_server( xptr_t xp ) |
---|
[1] | 2060 | { |
---|
[583] | 2061 | #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE |
---|
[564] | 2062 | thread_t * this = CURRENT_THREAD; |
---|
[440] | 2063 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
[583] | 2064 | if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) |
---|
[601] | 2065 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2066 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 2067 | #endif |
---|
| 2068 | |
---|
[1] | 2069 | process_t * process; |
---|
| 2070 | vpn_t vpn; |
---|
| 2071 | uint32_t attr; |
---|
| 2072 | ppn_t ppn; |
---|
| 2073 | |
---|
| 2074 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 2075 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 2076 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 2077 | |
---|
| 2078 | // get input argument "process" & "vpn" from client RPC descriptor |
---|
[564] | 2079 | process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 2080 | vpn = (vpn_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[583] | 2081 | attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); |
---|
| 2082 | ppn = (ppn_t) hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) ); |
---|
[1] | 2083 | |
---|
| 2084 | // call local kernel function |
---|
[583] | 2085 | vmm_global_update_pte( process , vpn , attr , ppn ); |
---|
[1] | 2086 | |
---|
[583] | 2087 | #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE |
---|
[440] | 2088 | cycle = (uint32_t)hal_get_cycles(); |
---|
[583] | 2089 | if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) |
---|
[601] | 2090 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2091 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[440] | 2092 | #endif |
---|
[1] | 2093 | } |
---|
| 2094 | |
---|
| 2095 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2096 | // [22] Marshaling functions attached to RPC_KCM_ALLOC |
---|
[1] | 2097 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2098 | |
---|
[23] | 2099 | ////////////////////////////////////////// |
---|
| 2100 | void rpc_kcm_alloc_client( cxy_t cxy, |
---|
| 2101 | uint32_t kmem_type, // in |
---|
[619] | 2102 | xptr_t * buf_xp ) // out |
---|
[1] | 2103 | { |
---|
[564] | 2104 | #if DEBUG_RPC_KCM_ALLOC |
---|
| 2105 | thread_t * this = CURRENT_THREAD; |
---|
| 2106 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2107 | if( cycle > DEBUG_RPC_KCM_ALLOC ) |
---|
[601] | 2108 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2109 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2110 | #endif |
---|
| 2111 | |
---|
[619] | 2112 | uint32_t responses = 1; |
---|
[1] | 2113 | |
---|
| 2114 | // initialise RPC descriptor header |
---|
| 2115 | rpc_desc_t rpc; |
---|
[441] | 2116 | rpc.index = RPC_KCM_ALLOC; |
---|
[416] | 2117 | rpc.blocking = true; |
---|
[619] | 2118 | rpc.rsp = &responses; |
---|
[1] | 2119 | |
---|
[23] | 2120 | // set input arguments in RPC descriptor |
---|
| 2121 | rpc.args[0] = (uint64_t)kmem_type; |
---|
| 2122 | |
---|
[436] | 2123 | // register RPC request in remote RPC fifo |
---|
[416] | 2124 | rpc_send( cxy , &rpc ); |
---|
[1] | 2125 | |
---|
| 2126 | // get output arguments from RPC descriptor |
---|
[23] | 2127 | *buf_xp = (xptr_t)rpc.args[1]; |
---|
[279] | 2128 | |
---|
[564] | 2129 | #if DEBUG_RPC_KCM_ALLOC |
---|
| 2130 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2131 | if( cycle > DEBUG_RPC_KCM_ALLOC ) |
---|
[601] | 2132 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2133 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2134 | #endif |
---|
[1] | 2135 | } |
---|
| 2136 | |
---|
[23] | 2137 | ////////////////////////////////////// |
---|
| 2138 | void rpc_kcm_alloc_server( xptr_t xp ) |
---|
[1] | 2139 | { |
---|
[564] | 2140 | #if DEBUG_RPC_KCM_ALLOC |
---|
| 2141 | thread_t * this = CURRENT_THREAD; |
---|
| 2142 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2143 | if( cycle > DEBUG_RPC_KCM_ALLOC ) |
---|
[601] | 2144 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2145 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2146 | #endif |
---|
| 2147 | |
---|
[1] | 2148 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 2149 | cxy_t client_cxy = GET_CXY( xp ); |
---|
[438] | 2150 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 2151 | |
---|
[23] | 2152 | // get input argument "kmem_type" from client RPC descriptor |
---|
[564] | 2153 | uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
[23] | 2154 | |
---|
| 2155 | // allocates memory for kcm |
---|
[1] | 2156 | kmem_req_t req; |
---|
[23] | 2157 | req.type = kmem_type; |
---|
[1] | 2158 | req.flags = AF_ZERO; |
---|
[23] | 2159 | void * buf_ptr = kmem_alloc( &req ); |
---|
[1] | 2160 | |
---|
| 2161 | // set output argument |
---|
[23] | 2162 | xptr_t buf_xp = XPTR( local_cxy , buf_ptr ); |
---|
[564] | 2163 | hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp ); |
---|
[296] | 2164 | |
---|
[564] | 2165 | #if DEBUG_RPC_KCM_ALLOC |
---|
| 2166 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2167 | if( cycle > DEBUG_RPC_KCM_ALLOC ) |
---|
[601] | 2168 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2169 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2170 | #endif |
---|
[1] | 2171 | } |
---|
| 2172 | |
---|
| 2173 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2174 | // [23] Marshaling functions attached to RPC_KCM_FREE |
---|
[1] | 2175 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2176 | |
---|
[23] | 2177 | ///////////////////////////////////////// |
---|
| 2178 | void rpc_kcm_free_client( cxy_t cxy, |
---|
| 2179 | void * buf, // in |
---|
| 2180 | uint32_t kmem_type ) // in |
---|
[1] | 2181 | { |
---|
[564] | 2182 | #if DEBUG_RPC_KCM_FREE |
---|
| 2183 | thread_t * this = CURRENT_THREAD; |
---|
| 2184 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2185 | if( cycle > DEBUG_RPC_KCM_FREE ) |
---|
[601] | 2186 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2187 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2188 | #endif |
---|
| 2189 | |
---|
[619] | 2190 | uint32_t responses = 1; |
---|
[1] | 2191 | |
---|
| 2192 | // initialise RPC descriptor header |
---|
| 2193 | rpc_desc_t rpc; |
---|
[441] | 2194 | rpc.index = RPC_KCM_FREE; |
---|
[416] | 2195 | rpc.blocking = true; |
---|
[619] | 2196 | rpc.rsp = &responses; |
---|
[1] | 2197 | |
---|
| 2198 | // set input arguments in RPC descriptor |
---|
[23] | 2199 | rpc.args[0] = (uint64_t)(intptr_t)buf; |
---|
| 2200 | rpc.args[1] = (uint64_t)kmem_type; |
---|
[1] | 2201 | |
---|
[436] | 2202 | // register RPC request in remote RPC fifo |
---|
[416] | 2203 | rpc_send( cxy , &rpc ); |
---|
[279] | 2204 | |
---|
[564] | 2205 | #if DEBUG_RPC_KCM_FREE |
---|
| 2206 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2207 | if( cycle > DEBUG_RPC_KCM_FREE ) |
---|
[601] | 2208 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2209 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2210 | #endif |
---|
[1] | 2211 | } |
---|
| 2212 | |
---|
[23] | 2213 | ///////////////////////////////////// |
---|
| 2214 | void rpc_kcm_free_server( xptr_t xp ) |
---|
[1] | 2215 | { |
---|
[564] | 2216 | #if DEBUG_RPC_KCM_FREE |
---|
| 2217 | thread_t * this = CURRENT_THREAD; |
---|
| 2218 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2219 | if( cycle > DEBUG_RPC_KCM_FREE ) |
---|
[601] | 2220 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2221 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2222 | #endif |
---|
| 2223 | |
---|
[1] | 2224 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 2225 | cxy_t client_cxy = GET_CXY( xp ); |
---|
[438] | 2226 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[1] | 2227 | |
---|
[23] | 2228 | // get input arguments "buf" and "kmem_type" from client RPC descriptor |
---|
[564] | 2229 | void * buf = (void *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 2230 | uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[1] | 2231 | |
---|
| 2232 | // releases memory |
---|
| 2233 | kmem_req_t req; |
---|
[23] | 2234 | req.type = kmem_type; |
---|
| 2235 | req.ptr = buf; |
---|
| 2236 | kmem_free( &req ); |
---|
[296] | 2237 | |
---|
[564] | 2238 | #if DEBUG_RPC_KCM_FREE |
---|
| 2239 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2240 | if( cycle > DEBUG_RPC_KCM_FREE ) |
---|
[601] | 2241 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2242 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
[564] | 2243 | #endif |
---|
[1] | 2244 | } |
---|
| 2245 | |
---|
| 2246 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[610] | 2247 | // [24] undefined slot |
---|
[1] | 2248 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2249 | |
---|
[313] | 2250 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2251 | // [25] Marshaling functions attached to RPC_MAPPER_HANDLE_MISS |
---|
[313] | 2252 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2253 | |
---|
[601] | 2254 | ////////////////////////////////////////////////////////// |
---|
| 2255 | void rpc_mapper_handle_miss_client( cxy_t cxy, |
---|
| 2256 | struct mapper_s * mapper, |
---|
| 2257 | uint32_t page_id, |
---|
| 2258 | xptr_t * page_xp, |
---|
| 2259 | error_t * error ) |
---|
[313] | 2260 | { |
---|
[601] | 2261 | #if DEBUG_RPC_MAPPER_HANDLE_MISS |
---|
[611] | 2262 | thread_t * this = CURRENT_THREAD; |
---|
[601] | 2263 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2264 | if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) |
---|
| 2265 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2266 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2267 | #endif |
---|
| 2268 | |
---|
[619] | 2269 | uint32_t responses = 1; |
---|
[313] | 2270 | |
---|
| 2271 | // initialise RPC descriptor header |
---|
| 2272 | rpc_desc_t rpc; |
---|
[601] | 2273 | rpc.index = RPC_MAPPER_HANDLE_MISS; |
---|
[416] | 2274 | rpc.blocking = true; |
---|
[619] | 2275 | rpc.rsp = &responses; |
---|
[313] | 2276 | |
---|
| 2277 | // set input arguments in RPC descriptor |
---|
| 2278 | rpc.args[0] = (uint64_t)(intptr_t)mapper; |
---|
[601] | 2279 | rpc.args[1] = (uint64_t)page_id; |
---|
[313] | 2280 | |
---|
[436] | 2281 | // register RPC request in remote RPC fifo |
---|
[416] | 2282 | rpc_send( cxy , &rpc ); |
---|
[313] | 2283 | |
---|
| 2284 | // get output values from RPC descriptor |
---|
[601] | 2285 | *page_xp = (xptr_t)rpc.args[2]; |
---|
| 2286 | *error = (error_t)rpc.args[3]; |
---|
[313] | 2287 | |
---|
[601] | 2288 | #if DEBUG_RPC_MAPPER_HANDLE_MISS |
---|
| 2289 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2290 | if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) |
---|
| 2291 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2292 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2293 | #endif |
---|
[313] | 2294 | } |
---|
| 2295 | |
---|
[601] | 2296 | /////////////////////////////////////////////// |
---|
| 2297 | void rpc_mapper_handle_miss_server( xptr_t xp ) |
---|
[313] | 2298 | { |
---|
[601] | 2299 | #if DEBUG_RPC_MAPPER_HANDLE_MISS |
---|
[611] | 2300 | thread_t * this = CURRENT_THREAD; |
---|
[601] | 2301 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2302 | if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) |
---|
| 2303 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2304 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2305 | #endif |
---|
| 2306 | |
---|
| 2307 | mapper_t * mapper; |
---|
| 2308 | uint32_t page_id; |
---|
| 2309 | xptr_t page_xp; |
---|
| 2310 | error_t error; |
---|
| 2311 | |
---|
[313] | 2312 | // get client cluster identifier and pointer on RPC descriptor |
---|
[601] | 2313 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 2314 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[313] | 2315 | |
---|
[601] | 2316 | // get arguments from client RPC descriptor |
---|
| 2317 | mapper = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); |
---|
| 2318 | page_id = hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); |
---|
[313] | 2319 | |
---|
[601] | 2320 | // call local kernel function |
---|
| 2321 | error = mapper_handle_miss( mapper, |
---|
| 2322 | page_id, |
---|
| 2323 | &page_xp ); |
---|
[313] | 2324 | |
---|
[601] | 2325 | // set output argument to client RPC descriptor |
---|
[610] | 2326 | hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)page_xp ); |
---|
| 2327 | hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
[601] | 2328 | |
---|
| 2329 | #if DEBUG_RPC_MAPPER_HANDLE_MISS |
---|
| 2330 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2331 | if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS ) |
---|
| 2332 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2333 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2334 | #endif |
---|
[313] | 2335 | } |
---|
| 2336 | |
---|
[407] | 2337 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2338 | // [26] Marshaling functions attached to RPC_VMM_DELETE_VSEG |
---|
[407] | 2339 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[313] | 2340 | |
---|
[611] | 2341 | ////////////////////////////////////////////////// |
---|
| 2342 | void rpc_vmm_delete_vseg_client( cxy_t cxy, |
---|
[619] | 2343 | pid_t pid, |
---|
| 2344 | intptr_t vaddr ) |
---|
[611] | 2345 | { |
---|
| 2346 | #if DEBUG_RPC_VMM_DELETE_VSEG |
---|
| 2347 | thread_t * this = CURRENT_THREAD; |
---|
| 2348 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2349 | if( cycle > DEBUG_RPC_VMM_DELETE_VSEG ) |
---|
| 2350 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2351 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 2352 | #endif |
---|
| 2353 | |
---|
[619] | 2354 | uint32_t responses = 1; |
---|
| 2355 | rpc_desc_t rpc; |
---|
[611] | 2356 | |
---|
[619] | 2357 | // initialise RPC descriptor header |
---|
| 2358 | rpc.index = RPC_VMM_DELETE_VSEG; |
---|
| 2359 | rpc.blocking = true; |
---|
| 2360 | rpc.rsp = &responses; |
---|
| 2361 | |
---|
| 2362 | // set input arguments in RPC descriptor |
---|
| 2363 | rpc.args[0] = (uint64_t)pid; |
---|
| 2364 | rpc.args[1] = (uint64_t)vaddr; |
---|
| 2365 | |
---|
[611] | 2366 | // register RPC request in remote RPC fifo |
---|
[619] | 2367 | rpc_send( cxy , &rpc ); |
---|
[611] | 2368 | |
---|
| 2369 | #if DEBUG_RPC_VMM_DELETE_VSEG |
---|
| 2370 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2371 | if( cycle > DEBUG_RPC_VMM_DELETE_VSEG ) |
---|
| 2372 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2373 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 2374 | #endif |
---|
| 2375 | } |
---|
| 2376 | |
---|
| 2377 | //////////////////////////////////////////// |
---|
| 2378 | void rpc_vmm_delete_vseg_server( xptr_t xp ) |
---|
| 2379 | { |
---|
| 2380 | #if DEBUG_RPC_VMM_DELETE_VSEG |
---|
| 2381 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2382 | thread_t * this = CURRENT_THREAD; |
---|
| 2383 | if( DEBUG_RPC_VMM_DELETE_VSEG < cycle ) |
---|
| 2384 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2385 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 2386 | #endif |
---|
| 2387 | |
---|
| 2388 | // get client cluster identifier and pointer on RPC descriptor |
---|
| 2389 | cxy_t client_cxy = GET_CXY( xp ); |
---|
| 2390 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
| 2391 | |
---|
| 2392 | // get arguments from RPC descriptor |
---|
| 2393 | pid_t pid = (pid_t) hal_remote_l64( XPTR(client_cxy , &desc->args[0]) ); |
---|
| 2394 | intptr_t vaddr = (intptr_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) ); |
---|
| 2395 | |
---|
| 2396 | // call relevant kernel function |
---|
| 2397 | vmm_delete_vseg( pid , vaddr ); |
---|
| 2398 | |
---|
| 2399 | #if DEBUG_RPC_VMM_DELETE_VSEG |
---|
| 2400 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2401 | if( DEBUG_RPC_VMM_DELETE_VSEG < cycle ) |
---|
| 2402 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2403 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); |
---|
| 2404 | #endif |
---|
| 2405 | } |
---|
| 2406 | |
---|
[601] | 2407 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2408 | // [27] Marshaling functions attached to RPC_VMM_CREATE_VSEG |
---|
[601] | 2409 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2410 | |
---|
[407] | 2411 | //////////////////////////////////////////////////////// |
---|
| 2412 | void rpc_vmm_create_vseg_client( cxy_t cxy, |
---|
| 2413 | struct process_s * process, |
---|
| 2414 | vseg_type_t type, |
---|
| 2415 | intptr_t base, |
---|
| 2416 | uint32_t size, |
---|
| 2417 | uint32_t file_offset, |
---|
| 2418 | uint32_t file_size, |
---|
| 2419 | xptr_t mapper_xp, |
---|
| 2420 | cxy_t vseg_cxy, |
---|
| 2421 | struct vseg_s ** vseg ) |
---|
| 2422 | { |
---|
[611] | 2423 | #if DEBUG_RPC_VMM_CREATE_VSEG |
---|
| 2424 | thread_t * this = CURRENT_THREAD; |
---|
| 2425 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2426 | if( cycle > DEBUG_RPC_VMM_CREATE_VSEG ) |
---|
| 2427 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2428 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2429 | #endif |
---|
[407] | 2430 | |
---|
[619] | 2431 | uint32_t responses = 1; |
---|
[611] | 2432 | |
---|
[407] | 2433 | // initialise RPC descriptor header |
---|
| 2434 | rpc_desc_t rpc; |
---|
| 2435 | rpc.index = RPC_VMM_CREATE_VSEG; |
---|
[416] | 2436 | rpc.blocking = true; |
---|
[619] | 2437 | rpc.rsp = &responses; |
---|
[407] | 2438 | |
---|
| 2439 | // set input arguments in RPC descriptor |
---|
| 2440 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
| 2441 | rpc.args[1] = (uint64_t)type; |
---|
| 2442 | rpc.args[2] = (uint64_t)base; |
---|
| 2443 | rpc.args[3] = (uint64_t)size; |
---|
| 2444 | rpc.args[4] = (uint64_t)file_offset; |
---|
| 2445 | rpc.args[5] = (uint64_t)file_size; |
---|
| 2446 | rpc.args[6] = (uint64_t)mapper_xp; |
---|
| 2447 | rpc.args[7] = (uint64_t)vseg_cxy; |
---|
| 2448 | |
---|
[436] | 2449 | // register RPC request in remote RPC fifo |
---|
[416] | 2450 | rpc_send( cxy , &rpc ); |
---|
[407] | 2451 | |
---|
| 2452 | // get output values from RPC descriptor |
---|
| 2453 | *vseg = (vseg_t *)(intptr_t)rpc.args[8]; |
---|
| 2454 | |
---|
[611] | 2455 | #if DEBUG_RPC_VMM_CREATE_VSEG |
---|
| 2456 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2457 | if( cycle > DEBUG_RPC_VMM_CREATE_VSEG ) |
---|
| 2458 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2459 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2460 | #endif |
---|
[407] | 2461 | } |
---|
| 2462 | |
---|
| 2463 | //////////////////////////////////////////// |
---|
| 2464 | void rpc_vmm_create_vseg_server( xptr_t xp ) |
---|
| 2465 | { |
---|
[611] | 2466 | #if DEBUG_RPC_VMM_CREATE_VSEG |
---|
| 2467 | thread_t * this = CURRENT_THREAD; |
---|
| 2468 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2469 | if( cycle > DEBUG_RPC_VMM_CREATE_VSEG ) |
---|
| 2470 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2471 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2472 | #endif |
---|
| 2473 | |
---|
[407] | 2474 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 2475 | cxy_t cxy = GET_CXY( xp ); |
---|
| 2476 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[407] | 2477 | |
---|
| 2478 | // get input arguments from client RPC descriptor |
---|
[564] | 2479 | process_t * process = (process_t *)(intptr_t)hal_remote_l64( XPTR(cxy , &desc->args[0])); |
---|
| 2480 | vseg_type_t type = (vseg_type_t)(uint32_t)hal_remote_l64( XPTR(cxy , &desc->args[1])); |
---|
| 2481 | intptr_t base = (intptr_t) hal_remote_l64( XPTR(cxy , &desc->args[2])); |
---|
| 2482 | uint32_t size = (uint32_t) hal_remote_l64( XPTR(cxy , &desc->args[3])); |
---|
| 2483 | uint32_t file_offset = (uint32_t) hal_remote_l64( XPTR(cxy , &desc->args[4])); |
---|
| 2484 | uint32_t file_size = (uint32_t) hal_remote_l64( XPTR(cxy , &desc->args[5])); |
---|
| 2485 | xptr_t mapper_xp = (xptr_t) hal_remote_l64( XPTR(cxy , &desc->args[6])); |
---|
| 2486 | cxy_t vseg_cxy = (cxy_t)(uint32_t) hal_remote_l64( XPTR(cxy , &desc->args[7])); |
---|
[407] | 2487 | |
---|
| 2488 | // call local kernel function |
---|
| 2489 | vseg_t * vseg = vmm_create_vseg( process, |
---|
| 2490 | type, |
---|
| 2491 | base, |
---|
| 2492 | size, |
---|
| 2493 | file_offset, |
---|
| 2494 | file_size, |
---|
| 2495 | mapper_xp, |
---|
| 2496 | vseg_cxy ); |
---|
| 2497 | |
---|
| 2498 | // set output arguments into client RPC descriptor |
---|
[564] | 2499 | hal_remote_s64( XPTR( cxy , &desc->args[8] ) , (uint64_t)(intptr_t)vseg ); |
---|
[407] | 2500 | |
---|
[611] | 2501 | #if DEBUG_RPC_VMM_CREATE_VSEG |
---|
| 2502 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2503 | if( cycle > DEBUG_RPC_VMM_CREATE_VSEG ) |
---|
| 2504 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2505 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2506 | #endif |
---|
[407] | 2507 | } |
---|
| 2508 | |
---|
| 2509 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2510 | // [28] Marshaling functions attached to RPC_VMM_SET_COW |
---|
[408] | 2511 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2512 | |
---|
| 2513 | ///////////////////////////////////////////// |
---|
| 2514 | void rpc_vmm_set_cow_client( cxy_t cxy, |
---|
| 2515 | process_t * process ) |
---|
| 2516 | { |
---|
[619] | 2517 | #if DEBUG_RPC_VMM_SET_COW |
---|
| 2518 | thread_t * this = CURRENT_THREAD; |
---|
| 2519 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2520 | if( cycle > DEBUG_RPC_VMM_SET_COW ) |
---|
| 2521 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2522 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2523 | #endif |
---|
[408] | 2524 | |
---|
[619] | 2525 | uint32_t responses = 1; |
---|
| 2526 | |
---|
[408] | 2527 | // initialise RPC descriptor header |
---|
| 2528 | rpc_desc_t rpc; |
---|
| 2529 | rpc.index = RPC_VMM_SET_COW; |
---|
[416] | 2530 | rpc.blocking = true; |
---|
[619] | 2531 | rpc.rsp = &responses; |
---|
[408] | 2532 | |
---|
| 2533 | // set input arguments in RPC descriptor |
---|
| 2534 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
| 2535 | |
---|
[436] | 2536 | // register RPC request in remote RPC fifo |
---|
[416] | 2537 | rpc_send( cxy , &rpc ); |
---|
[408] | 2538 | |
---|
[619] | 2539 | #if DEBUG_RPC_VMM_SET_COW |
---|
| 2540 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2541 | if( cycle > DEBUG_RPC_VMM_SET_COW ) |
---|
| 2542 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2543 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2544 | #endif |
---|
[408] | 2545 | } |
---|
| 2546 | |
---|
| 2547 | //////////////////////////////////////// |
---|
| 2548 | void rpc_vmm_set_cow_server( xptr_t xp ) |
---|
| 2549 | { |
---|
[619] | 2550 | #if DEBUG_RPC_VMM_SET_COW |
---|
| 2551 | thread_t * this = CURRENT_THREAD; |
---|
| 2552 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2553 | if( cycle > DEBUG_RPC_VMM_SET_COW ) |
---|
| 2554 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2555 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2556 | #endif |
---|
| 2557 | |
---|
[408] | 2558 | process_t * process; |
---|
| 2559 | |
---|
| 2560 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 2561 | cxy_t cxy = GET_CXY( xp ); |
---|
| 2562 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[408] | 2563 | |
---|
| 2564 | // get input arguments from client RPC descriptor |
---|
[564] | 2565 | process = (process_t *)(intptr_t)hal_remote_l64( XPTR(cxy , &desc->args[0])); |
---|
[408] | 2566 | |
---|
| 2567 | // call local kernel function |
---|
| 2568 | vmm_set_cow( process ); |
---|
| 2569 | |
---|
[619] | 2570 | #if DEBUG_RPC_VMM_SET_COW |
---|
| 2571 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2572 | if( cycle > DEBUG_RPC_VMM_SET_COW ) |
---|
| 2573 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2574 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2575 | #endif |
---|
[408] | 2576 | } |
---|
| 2577 | |
---|
[428] | 2578 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[619] | 2579 | // [29] Marshaling functions attached to RPC_VMM_DISPLAY |
---|
[428] | 2580 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
[1] | 2581 | |
---|
[428] | 2582 | ///////////////////////////////////////////// |
---|
| 2583 | void rpc_vmm_display_client( cxy_t cxy, |
---|
| 2584 | process_t * process, |
---|
| 2585 | bool_t detailed ) |
---|
| 2586 | { |
---|
[619] | 2587 | #if DEBUG_RPC_VMM_DISPLAY |
---|
| 2588 | thread_t * this = CURRENT_THREAD; |
---|
| 2589 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2590 | if( cycle > DEBUG_RPC_VMM_DISPLAY ) |
---|
| 2591 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2592 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2593 | #endif |
---|
[428] | 2594 | |
---|
[619] | 2595 | uint32_t responses = 1; |
---|
| 2596 | |
---|
[428] | 2597 | // initialise RPC descriptor header |
---|
| 2598 | rpc_desc_t rpc; |
---|
| 2599 | rpc.index = RPC_VMM_DISPLAY; |
---|
| 2600 | rpc.blocking = true; |
---|
[619] | 2601 | rpc.rsp = &responses; |
---|
[428] | 2602 | |
---|
| 2603 | // set input arguments in RPC descriptor |
---|
| 2604 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
| 2605 | rpc.args[1] = (uint64_t)detailed; |
---|
| 2606 | |
---|
[436] | 2607 | // register RPC request in remote RPC fifo |
---|
[428] | 2608 | rpc_send( cxy , &rpc ); |
---|
| 2609 | |
---|
[619] | 2610 | #if DEBUG_RPC_VMM_DISPLAY |
---|
| 2611 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2612 | if( cycle > DEBUG_RPC_VMM_DISPLAY ) |
---|
| 2613 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2614 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2615 | #endif |
---|
[428] | 2616 | } |
---|
| 2617 | |
---|
| 2618 | //////////////////////////////////////// |
---|
| 2619 | void rpc_vmm_display_server( xptr_t xp ) |
---|
| 2620 | { |
---|
[619] | 2621 | #if DEBUG_RPC_VMM_DISPLAY |
---|
| 2622 | thread_t * this = CURRENT_THREAD; |
---|
| 2623 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
| 2624 | if( cycle > DEBUG_RPC_VMM_DISPLAY ) |
---|
| 2625 | printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", |
---|
| 2626 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2627 | #endif |
---|
| 2628 | |
---|
[428] | 2629 | process_t * process; |
---|
| 2630 | bool_t detailed; |
---|
| 2631 | |
---|
| 2632 | // get client cluster identifier and pointer on RPC descriptor |
---|
[436] | 2633 | cxy_t cxy = GET_CXY( xp ); |
---|
| 2634 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
[428] | 2635 | |
---|
| 2636 | // get input arguments from client RPC descriptor |
---|
[564] | 2637 | process = (process_t *)(intptr_t)hal_remote_l64( XPTR(cxy , &desc->args[0])); |
---|
| 2638 | detailed = (bool_t) hal_remote_l64( XPTR(cxy , &desc->args[1])); |
---|
[428] | 2639 | |
---|
| 2640 | // call local kernel function |
---|
| 2641 | vmm_display( process , detailed ); |
---|
| 2642 | |
---|
[619] | 2643 | #if DEBUG_RPC_VMM_DISPLAY |
---|
| 2644 | cycle = (uint32_t)hal_get_cycles(); |
---|
| 2645 | if( cycle > DEBUG_RPC_VMM_DISPLAY ) |
---|
| 2646 | printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", |
---|
| 2647 | __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); |
---|
| 2648 | #endif |
---|
[428] | 2649 | } |
---|
| 2650 | |
---|
| 2651 | |
---|