1 | /* |
---|
2 | * rpc.c - RPC operations implementation. |
---|
3 | * |
---|
4 | * Author Alain Greiner (2016,2017,2018) |
---|
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 | |
---|
24 | #include <kernel_config.h> |
---|
25 | #include <hal_kernel_types.h> |
---|
26 | #include <hal_atomic.h> |
---|
27 | #include <hal_remote.h> |
---|
28 | #include <hal_irqmask.h> |
---|
29 | #include <hal_special.h> |
---|
30 | #include <printk.h> |
---|
31 | #include <remote_sem.h> |
---|
32 | #include <core.h> |
---|
33 | #include <mapper.h> |
---|
34 | #include <chdev.h> |
---|
35 | #include <bits.h> |
---|
36 | #include <thread.h> |
---|
37 | #include <cluster.h> |
---|
38 | #include <process.h> |
---|
39 | #include <vfs.h> |
---|
40 | #include <fatfs.h> |
---|
41 | #include <rpc.h> |
---|
42 | |
---|
43 | |
---|
44 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
45 | // array of function pointers (must be consistent with enum in rpc.h) |
---|
46 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
47 | |
---|
48 | rpc_server_t * rpc_server[RPC_MAX_INDEX] = |
---|
49 | { |
---|
50 | &rpc_pmem_get_pages_server, // 0 |
---|
51 | &rpc_pmem_release_pages_server, // 1 |
---|
52 | &rpc_undefined, // 2 unused slot |
---|
53 | &rpc_process_make_fork_server, // 3 |
---|
54 | &rpc_undefined, // 4 unused slot |
---|
55 | &rpc_undefined, // 5 unused slot |
---|
56 | &rpc_thread_user_create_server, // 6 |
---|
57 | &rpc_thread_kernel_create_server, // 7 |
---|
58 | &rpc_undefined, // 8 unused slot |
---|
59 | &rpc_process_sigaction_server, // 9 |
---|
60 | |
---|
61 | &rpc_vfs_inode_create_server, // 10 |
---|
62 | &rpc_vfs_inode_destroy_server, // 11 |
---|
63 | &rpc_vfs_dentry_create_server, // 12 |
---|
64 | &rpc_vfs_dentry_destroy_server, // 13 |
---|
65 | &rpc_vfs_file_create_server, // 14 |
---|
66 | &rpc_vfs_file_destroy_server, // 15 |
---|
67 | &rpc_vfs_inode_load_server, // 16 |
---|
68 | &rpc_vfs_mapper_load_all_server, // 17 |
---|
69 | &rpc_fatfs_get_cluster_server, // 18 |
---|
70 | &rpc_undefined, // 19 unused slot |
---|
71 | |
---|
72 | &rpc_vmm_get_vseg_server, // 20 |
---|
73 | &rpc_vmm_get_pte_server, // 21 |
---|
74 | &rpc_kcm_alloc_server, // 22 |
---|
75 | &rpc_kcm_free_server, // 23 |
---|
76 | &rpc_mapper_move_buffer_server, // 24 |
---|
77 | &rpc_mapper_get_page_server, // 25 |
---|
78 | &rpc_vmm_create_vseg_server, // 26 |
---|
79 | &rpc_undefined, // 27 unused slot |
---|
80 | &rpc_vmm_set_cow_server, // 28 |
---|
81 | &rpc_vmm_display_server, // 29 |
---|
82 | }; |
---|
83 | |
---|
84 | ////////////////////////////////////////////// |
---|
85 | void __attribute__((noinline)) rpc_undefined() |
---|
86 | { |
---|
87 | assert( false , __FUNCTION__ , "called in cluster %x", local_cxy ); |
---|
88 | } |
---|
89 | |
---|
90 | /***************************************************************************************/ |
---|
91 | /************ Generic functions supporting RPCs : client side **************************/ |
---|
92 | /***************************************************************************************/ |
---|
93 | |
---|
94 | /////////////////////////////////////// |
---|
95 | void rpc_send( cxy_t server_cxy, |
---|
96 | rpc_desc_t * rpc ) |
---|
97 | { |
---|
98 | lid_t server_core_lid; |
---|
99 | lid_t client_core_lid; |
---|
100 | volatile error_t full; |
---|
101 | thread_t * this; |
---|
102 | |
---|
103 | full = 0; |
---|
104 | this = CURRENT_THREAD; |
---|
105 | client_core_lid = this->core->lid; |
---|
106 | |
---|
107 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
108 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
109 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
110 | printk("\n[DBG] %s : thread %x in process %x enter for rpc[%d] / cycle %d\n", |
---|
111 | __FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle ); |
---|
112 | #endif |
---|
113 | |
---|
114 | // select a server_core : use client core index if possible / core 0 otherwise |
---|
115 | if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &LOCAL_CLUSTER->cores_nr ) ) ) |
---|
116 | { |
---|
117 | server_core_lid = client_core_lid; |
---|
118 | } |
---|
119 | else |
---|
120 | { |
---|
121 | server_core_lid = 0; |
---|
122 | } |
---|
123 | |
---|
124 | // register client_thread pointer and client_core lid in RPC descriptor |
---|
125 | rpc->thread = this; |
---|
126 | rpc->lid = client_core_lid; |
---|
127 | |
---|
128 | // build extended pointer on the RPC descriptor |
---|
129 | xptr_t desc_xp = XPTR( local_cxy , rpc ); |
---|
130 | |
---|
131 | // get local pointer on rpc_fifo in remote cluster, |
---|
132 | remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_core_lid]; |
---|
133 | |
---|
134 | // post RPC in remote fifo / deschedule and retry if fifo full |
---|
135 | do |
---|
136 | { |
---|
137 | full = remote_fifo_put_item( XPTR( server_cxy , rpc_fifo ), (uint64_t )desc_xp ); |
---|
138 | if ( full ) |
---|
139 | { |
---|
140 | printk("\n[WARNING] %s : cluster %x cannot post RPC to cluster %x\n", |
---|
141 | __FUNCTION__ , local_cxy , server_cxy ); |
---|
142 | |
---|
143 | // deschedule without blocking |
---|
144 | sched_yield("RPC fifo full"); |
---|
145 | } |
---|
146 | } |
---|
147 | while( full ); |
---|
148 | |
---|
149 | hal_fence(); |
---|
150 | |
---|
151 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
152 | cycle = (uint32_t)hal_get_cycles(); |
---|
153 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
154 | printk("\n[DBG] %s : thread %x in process %x / rpc[%d] / rpc_ptr %x / cycle %d\n", |
---|
155 | __FUNCTION__, this->trdid, this->process->pid, rpc->index, rpc, cycle ); |
---|
156 | #endif |
---|
157 | |
---|
158 | // send IPI to the selected server core |
---|
159 | dev_pic_send_ipi( server_cxy , server_core_lid ); |
---|
160 | |
---|
161 | // wait RPC completion before returning if blocking RPC |
---|
162 | // - busy waiting policy during kernel_init, or if threads cannot yield |
---|
163 | // - block and deschedule in all other cases |
---|
164 | if ( rpc->blocking ) |
---|
165 | { |
---|
166 | if( (this->type == THREAD_IDLE) || (thread_can_yield() == false) ) // busy waiting |
---|
167 | { |
---|
168 | |
---|
169 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
170 | cycle = (uint32_t)hal_get_cycles(); |
---|
171 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
172 | printk("\n[DBG] %s : thread %x in process %x busy waiting for rpc[%d] / cycle %d\n", |
---|
173 | __FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle ); |
---|
174 | #endif |
---|
175 | |
---|
176 | while( rpc->responses ) hal_fixed_delay( 100 ); |
---|
177 | |
---|
178 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
179 | cycle = (uint32_t)hal_get_cycles(); |
---|
180 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
181 | printk("\n[DBG] %s : thread %x in process %x resumes for rpc[%d] / cycle %d\n", |
---|
182 | __FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle ); |
---|
183 | #endif |
---|
184 | } |
---|
185 | else // block & deschedule |
---|
186 | { |
---|
187 | |
---|
188 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
189 | cycle = (uint32_t)hal_get_cycles(); |
---|
190 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
191 | printk("\n[DBG] %s : thread %x in process %x blocks & deschedules for rpc[%d] / cycle %d\n", |
---|
192 | __FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle ); |
---|
193 | #endif |
---|
194 | thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_RPC ); |
---|
195 | sched_yield("blocked on RPC"); |
---|
196 | |
---|
197 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
198 | cycle = (uint32_t)hal_get_cycles(); |
---|
199 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
200 | printk("\n[DBG] %s : thread %x in process %x resumes for rpc[%d] / cycle %d\n", |
---|
201 | __FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle ); |
---|
202 | #endif |
---|
203 | } |
---|
204 | |
---|
205 | // check response available |
---|
206 | assert( (rpc->responses == 0) , __FUNCTION__, "illegal RPC response\n" ); |
---|
207 | } |
---|
208 | else // non blocking RPC |
---|
209 | { |
---|
210 | |
---|
211 | #if DEBUG_RPC_CLIENT_GENERIC |
---|
212 | cycle = (uint32_t)hal_get_cycles(); |
---|
213 | if( DEBUG_RPC_CLIENT_GENERIC < cycle ) |
---|
214 | printk("\n[DBG] %s : thread %x in process %x returns for non blocking rpc[%d] / cycle %d\n", |
---|
215 | __FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle ); |
---|
216 | #endif |
---|
217 | |
---|
218 | } |
---|
219 | } // end rpc_send() |
---|
220 | |
---|
221 | |
---|
222 | /***************************************************************************************/ |
---|
223 | /************ Generic functions supporting RPCs : server side **************************/ |
---|
224 | /***************************************************************************************/ |
---|
225 | |
---|
226 | //////////////// |
---|
227 | void rpc_check() |
---|
228 | { |
---|
229 | error_t error; |
---|
230 | thread_t * thread; |
---|
231 | uint32_t sr_save; |
---|
232 | |
---|
233 | #if DEBUG_RPC_SERVER_GENERIC |
---|
234 | uint32_t cycle; |
---|
235 | #endif |
---|
236 | |
---|
237 | bool_t found = false; |
---|
238 | thread_t * this = CURRENT_THREAD; |
---|
239 | core_t * core = this->core; |
---|
240 | scheduler_t * sched = &core->scheduler; |
---|
241 | remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[core->lid]; |
---|
242 | |
---|
243 | // interrupted thread not preemptable during RPC chek |
---|
244 | hal_disable_irq( &sr_save ); |
---|
245 | |
---|
246 | // activate (or create) RPC thread if RPC FIFO not empty and no acive RPC thread |
---|
247 | if( (rpc_fifo->owner == 0) && (local_fifo_is_empty(rpc_fifo) == false) ) |
---|
248 | { |
---|
249 | |
---|
250 | #if DEBUG_RPC_SERVER_GENERIC |
---|
251 | cycle = (uint32_t)hal_get_cycles(); |
---|
252 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
253 | printk("\n[DBG] %s : RPC FIFO non empty for core[%x,%d] / cycle %d\n", |
---|
254 | __FUNCTION__, local_cxy, core->lid, cycle ); |
---|
255 | #endif |
---|
256 | |
---|
257 | // search one IDLE RPC thread associated to the selected core |
---|
258 | list_entry_t * iter; |
---|
259 | LIST_FOREACH( &sched->k_root , iter ) |
---|
260 | { |
---|
261 | thread = LIST_ELEMENT( iter , thread_t , sched_list ); |
---|
262 | if( (thread->type == THREAD_RPC) && (thread->blocked == THREAD_BLOCKED_IDLE ) ) |
---|
263 | { |
---|
264 | // unblock found RPC thread |
---|
265 | thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_IDLE ); |
---|
266 | |
---|
267 | // exit loop |
---|
268 | found = true; |
---|
269 | break; |
---|
270 | } |
---|
271 | } |
---|
272 | |
---|
273 | // create new RPC thread for the selected core if not found |
---|
274 | if( found == false ) |
---|
275 | { |
---|
276 | error = thread_kernel_create( &thread, |
---|
277 | THREAD_RPC, |
---|
278 | &rpc_thread_func, |
---|
279 | NULL, |
---|
280 | core->lid ); |
---|
281 | |
---|
282 | assert( (error == 0), __FUNCTION__ , |
---|
283 | "no memory to allocate a new RPC thread in cluster %x", local_cxy ); |
---|
284 | |
---|
285 | // unblock created RPC thread |
---|
286 | thread->blocked = 0; |
---|
287 | |
---|
288 | // update RRPC threads counter |
---|
289 | hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[core->lid] , 1 ); |
---|
290 | |
---|
291 | #if DEBUG_RPC_SERVER_GENERIC |
---|
292 | cycle = (uint32_t)hal_get_cycles(); |
---|
293 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
294 | printk("\n[DBG] %s : new RPC thread %x created for core[%x,%d] / cycle %d\n", |
---|
295 | __FUNCTION__, thread, local_cxy, core->lid, cycle ); |
---|
296 | #endif |
---|
297 | } |
---|
298 | } |
---|
299 | |
---|
300 | #if DEBUG_RPC_SERVER_GENERIC |
---|
301 | cycle = (uint32_t)hal_get_cycles(); |
---|
302 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
303 | printk("\n[DBG] %s : interrupted thread %x deschedules on core[%x,%d] / cycle %d\n", |
---|
304 | __FUNCTION__, this, local_cxy, core->lid, cycle ); |
---|
305 | #endif |
---|
306 | |
---|
307 | // interrupted thread always deschedule |
---|
308 | sched_yield("IPI received"); |
---|
309 | |
---|
310 | #if DEBUG_RPC_SERVER_GENERIC |
---|
311 | cycle = (uint32_t)hal_get_cycles(); |
---|
312 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
313 | printk("\n[DBG] %s : interrupted thread %x resumes on core[%x,%d] / cycle %d\n", |
---|
314 | __FUNCTION__, this, local_cxy, core->lid, cycle ); |
---|
315 | #endif |
---|
316 | |
---|
317 | // interrupted thread restore IRQs after resume |
---|
318 | hal_restore_irq( sr_save ); |
---|
319 | |
---|
320 | } // end rpc_check() |
---|
321 | |
---|
322 | |
---|
323 | ////////////////////// |
---|
324 | void rpc_thread_func() |
---|
325 | { |
---|
326 | error_t empty; // local RPC fifo state |
---|
327 | xptr_t desc_xp; // extended pointer on RPC request |
---|
328 | cxy_t desc_cxy; // RPC request cluster (client) |
---|
329 | rpc_desc_t * desc_ptr; // RPC request local pointer |
---|
330 | uint32_t index; // RPC request index |
---|
331 | thread_t * client_ptr; // local pointer on client thread |
---|
332 | thread_t * server_ptr; // local pointer on server thread |
---|
333 | xptr_t server_xp; // extended pointer on server thread |
---|
334 | lid_t client_core_lid; // local index of client core |
---|
335 | lid_t server_core_lid; // local index of server core |
---|
336 | bool_t blocking; // blocking RPC when true |
---|
337 | remote_fifo_t * rpc_fifo; // local pointer on RPC fifo |
---|
338 | |
---|
339 | // makes RPC thread not preemptable |
---|
340 | hal_disable_irq( NULL ); |
---|
341 | |
---|
342 | server_ptr = CURRENT_THREAD; |
---|
343 | server_xp = XPTR( local_cxy , server_ptr ); |
---|
344 | server_core_lid = server_ptr->core->lid; |
---|
345 | rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_core_lid]; |
---|
346 | |
---|
347 | // two embedded loops: |
---|
348 | // - external loop : "infinite" RPC thread |
---|
349 | // - internal loop : handle one RPC request per iteration |
---|
350 | |
---|
351 | while(1) // infinite loop |
---|
352 | { |
---|
353 | // try to take RPC_FIFO ownership |
---|
354 | if( hal_atomic_test_set( &rpc_fifo->owner , server_ptr->trdid ) ) |
---|
355 | { |
---|
356 | |
---|
357 | #if DEBUG_RPC_SERVER_GENERIC |
---|
358 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
359 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
360 | printk("\n[DBG] %s : RPC thread %x in cluster %x takes RPC fifo ownership / cycle %d\n", |
---|
361 | __FUNCTION__, server_ptr, local_cxy, cycle ); |
---|
362 | #endif |
---|
363 | while( 1 ) // one RPC request per iteration |
---|
364 | { |
---|
365 | empty = local_fifo_get_item( rpc_fifo , (uint64_t *)&desc_xp ); |
---|
366 | |
---|
367 | // exit when FIFO empty or FIFO ownership lost (in case of descheduling) |
---|
368 | if ( (empty == 0) && (rpc_fifo->owner == server_ptr->trdid) ) |
---|
369 | { |
---|
370 | // get client cluster and pointer on RPC descriptor |
---|
371 | desc_cxy = GET_CXY( desc_xp ); |
---|
372 | desc_ptr = GET_PTR( desc_xp ); |
---|
373 | |
---|
374 | index = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->index ) ); |
---|
375 | blocking = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->blocking ) ); |
---|
376 | |
---|
377 | #if DEBUG_RPC_SERVER_GENERIC |
---|
378 | cycle = (uint32_t)hal_get_cycles(); |
---|
379 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
380 | printk("\n[DBG] %s : RPC thread %x in cluster %x got rpc[%d] / rpc_cxy %x / rpc_ptr %x\n", |
---|
381 | __FUNCTION__, server_ptr, local_cxy, index, desc_cxy, desc_ptr ); |
---|
382 | #endif |
---|
383 | // call the relevant server function |
---|
384 | rpc_server[index]( desc_xp ); |
---|
385 | |
---|
386 | #if DEBUG_RPC_SERVER_GENERIC |
---|
387 | cycle = (uint32_t)hal_get_cycles(); |
---|
388 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
389 | printk("\n[DBG] %s : RPC thread %x in cluster %x completes rpc[%d] / rpc_ptr %x / cycle %d\n", |
---|
390 | __FUNCTION__, server_ptr, local_cxy, index, desc_ptr, cycle ); |
---|
391 | #endif |
---|
392 | // decrement response counter in RPC descriptor if blocking |
---|
393 | if( blocking ) |
---|
394 | { |
---|
395 | // decrement responses counter in RPC descriptor |
---|
396 | hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 ); |
---|
397 | |
---|
398 | // get client thread pointer and client core lid from RPC descriptor |
---|
399 | client_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) ); |
---|
400 | client_core_lid = hal_remote_lw ( XPTR( desc_cxy , &desc_ptr->lid ) ); |
---|
401 | |
---|
402 | // unblock client thread |
---|
403 | thread_unblock( XPTR( desc_cxy , client_ptr ) , THREAD_BLOCKED_RPC ); |
---|
404 | |
---|
405 | hal_fence(); |
---|
406 | |
---|
407 | #if DEBUG_RPC_SERVER_GENERIC |
---|
408 | cycle = (uint32_t)hal_get_cycles(); |
---|
409 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
410 | printk("\n[DBG] %s : RPC thread %x (cluster %x) unblocked client thread %x (cluster %x)\n", |
---|
411 | __FUNCTION__, server_ptr, local_cxy, client_ptr, desc_cxy, cycle ); |
---|
412 | #endif |
---|
413 | // send IPI to client core |
---|
414 | // dev_pic_send_ipi( desc_cxy , client_core_lid ); |
---|
415 | } |
---|
416 | } |
---|
417 | else |
---|
418 | { |
---|
419 | break; |
---|
420 | } |
---|
421 | } // end internal loop |
---|
422 | |
---|
423 | // release rpc_fifo ownership if not lost |
---|
424 | if( rpc_fifo->owner == server_ptr->trdid ) rpc_fifo->owner = 0; |
---|
425 | |
---|
426 | } // end if RPC fifo |
---|
427 | |
---|
428 | // RPC thread blocks on IDLE |
---|
429 | thread_block( server_xp , THREAD_BLOCKED_IDLE ); |
---|
430 | |
---|
431 | // sucide if too many RPC threads / simply deschedule otherwise |
---|
432 | if( LOCAL_CLUSTER->rpc_threads[server_core_lid] >= CONFIG_RPC_THREADS_MAX ) |
---|
433 | { |
---|
434 | |
---|
435 | #if DEBUG_RPC_SERVER_GENERIC |
---|
436 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
437 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
438 | printk("\n[DBG] %s : RPC thread %x in cluster %x suicides / cycle %d\n", |
---|
439 | __FUNCTION__, server_ptr, local_cxy, cycle ); |
---|
440 | #endif |
---|
441 | // update RPC threads counter |
---|
442 | hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , -1 ); |
---|
443 | |
---|
444 | // RPC thread blocks on GLOBAL |
---|
445 | thread_block( server_xp , THREAD_BLOCKED_GLOBAL ); |
---|
446 | |
---|
447 | // RPC thread set the REQ_DELETE flag to suicide |
---|
448 | hal_remote_atomic_or( server_xp , THREAD_FLAG_REQ_DELETE ); |
---|
449 | } |
---|
450 | else |
---|
451 | { |
---|
452 | |
---|
453 | #if DEBUG_RPC_SERVER_GENERIC |
---|
454 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
455 | if( DEBUG_RPC_SERVER_GENERIC < cycle ) |
---|
456 | printk("\n[DBG] %s : RPC thread %x in cluster %x block & deschedules / cycle %d\n", |
---|
457 | __FUNCTION__, server_ptr, local_cxy, cycle ); |
---|
458 | #endif |
---|
459 | |
---|
460 | // RPC thread deschedules |
---|
461 | assert( thread_can_yield( server_ptr ) , __FUNCTION__, "illegal sched_yield\n" ); |
---|
462 | sched_yield("RPC fifo empty"); |
---|
463 | } |
---|
464 | |
---|
465 | } // end infinite loop |
---|
466 | |
---|
467 | } // end rpc_thread_func() |
---|
468 | |
---|
469 | |
---|
470 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
471 | // [0] Marshaling functions attached to RPC_PMEM_GET_PAGES (blocking) |
---|
472 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
473 | |
---|
474 | /////////////////////////////////////////////// |
---|
475 | void rpc_pmem_get_pages_client( cxy_t cxy, |
---|
476 | uint32_t order, // in |
---|
477 | page_t ** page ) // out |
---|
478 | { |
---|
479 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
480 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
481 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
482 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
483 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
484 | #endif |
---|
485 | |
---|
486 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
487 | |
---|
488 | // initialise RPC descriptor header |
---|
489 | rpc_desc_t rpc; |
---|
490 | rpc.index = RPC_PMEM_GET_PAGES; |
---|
491 | rpc.blocking = true; |
---|
492 | rpc.responses = 1; |
---|
493 | |
---|
494 | // set input arguments in RPC descriptor |
---|
495 | rpc.args[0] = (uint64_t)order; |
---|
496 | |
---|
497 | // register RPC request in remote RPC fifo |
---|
498 | rpc_send( cxy , &rpc ); |
---|
499 | |
---|
500 | // get output arguments from RPC descriptor |
---|
501 | *page = (page_t *)(intptr_t)rpc.args[1]; |
---|
502 | |
---|
503 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
504 | cycle = (uint32_t)hal_get_cycles(); |
---|
505 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
506 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
507 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
508 | #endif |
---|
509 | } |
---|
510 | |
---|
511 | /////////////////////////////////////////// |
---|
512 | void rpc_pmem_get_pages_server( xptr_t xp ) |
---|
513 | { |
---|
514 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
515 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
516 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
517 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
518 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
519 | #endif |
---|
520 | |
---|
521 | // get client cluster identifier and pointer on RPC descriptor |
---|
522 | cxy_t cxy = GET_CXY( xp ); |
---|
523 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
524 | |
---|
525 | // get input arguments from client RPC descriptor |
---|
526 | uint32_t order = (uint32_t)hal_remote_lwd( XPTR( cxy , &desc->args[0] ) ); |
---|
527 | |
---|
528 | // call local pmem allocator |
---|
529 | page_t * page = ppm_alloc_pages( order ); |
---|
530 | |
---|
531 | // set output arguments into client RPC descriptor |
---|
532 | hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); |
---|
533 | |
---|
534 | #if DEBUG_RPC_PMEM_GET_PAGES |
---|
535 | cycle = (uint32_t)hal_get_cycles(); |
---|
536 | if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) |
---|
537 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
538 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
539 | #endif |
---|
540 | } |
---|
541 | |
---|
542 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
543 | // [1] Marshaling functions attached to RPC_PMEM_RELEASE_PAGES (blocking) |
---|
544 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
545 | |
---|
546 | ////////////////////////////////////////////////// |
---|
547 | void rpc_pmem_release_pages_client( cxy_t cxy, |
---|
548 | page_t * page ) // out |
---|
549 | { |
---|
550 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
551 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
552 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
553 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
554 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
555 | #endif |
---|
556 | |
---|
557 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
558 | |
---|
559 | // initialise RPC descriptor header |
---|
560 | rpc_desc_t rpc; |
---|
561 | rpc.index = RPC_PMEM_RELEASE_PAGES; |
---|
562 | rpc.blocking = true; |
---|
563 | rpc.responses = 1; |
---|
564 | |
---|
565 | // set input arguments in RPC descriptor |
---|
566 | rpc.args[0] = (uint64_t)(intptr_t)page; |
---|
567 | |
---|
568 | // register RPC request in remote RPC fifo |
---|
569 | rpc_send( cxy , &rpc ); |
---|
570 | |
---|
571 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
572 | cycle = (uint32_t)hal_get_cycles(); |
---|
573 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
574 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
575 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
576 | #endif |
---|
577 | } |
---|
578 | |
---|
579 | /////////////////////////////////////////////// |
---|
580 | void rpc_pmem_release_pages_server( xptr_t xp ) |
---|
581 | { |
---|
582 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
583 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
584 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
585 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
586 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
587 | #endif |
---|
588 | |
---|
589 | // get client cluster identifier and pointer on RPC descriptor |
---|
590 | cxy_t cxy = GET_CXY( xp ); |
---|
591 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
592 | |
---|
593 | // get input arguments from client RPC descriptor |
---|
594 | page_t * page = (page_t *)(intptr_t)hal_remote_lwd( XPTR( cxy , &desc->args[0] ) ); |
---|
595 | |
---|
596 | // release memory to local pmem |
---|
597 | kmem_req_t req; |
---|
598 | req.type = KMEM_PAGE; |
---|
599 | req.ptr = page; |
---|
600 | kmem_free( &req ); |
---|
601 | |
---|
602 | #if DEBUG_RPC_PMEM_RELEASE_PAGES |
---|
603 | cycle = (uint32_t)hal_get_cycles(); |
---|
604 | if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) |
---|
605 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
606 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
607 | #endif |
---|
608 | } |
---|
609 | |
---|
610 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
611 | // [2] undefined slot |
---|
612 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
613 | |
---|
614 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
615 | // [3] Marshaling functions attached to RPC_PROCESS_MAKE_FORK (blocking) |
---|
616 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
617 | |
---|
618 | /////////////////////////////////////////////////// |
---|
619 | void rpc_process_make_fork_client( cxy_t cxy, |
---|
620 | xptr_t ref_process_xp, // in |
---|
621 | xptr_t parent_thread_xp, // in |
---|
622 | pid_t * child_pid, // out |
---|
623 | thread_t ** child_thread_ptr, // out |
---|
624 | error_t * error ) // out |
---|
625 | { |
---|
626 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
627 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
628 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
629 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
630 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
631 | #endif |
---|
632 | |
---|
633 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
634 | |
---|
635 | // initialise RPC descriptor header |
---|
636 | rpc_desc_t rpc; |
---|
637 | rpc.index = RPC_PROCESS_MAKE_FORK; |
---|
638 | rpc.blocking = true; |
---|
639 | rpc.responses = 1; |
---|
640 | |
---|
641 | // set input arguments in RPC descriptor |
---|
642 | rpc.args[0] = (uint64_t)ref_process_xp; |
---|
643 | rpc.args[1] = (uint64_t)parent_thread_xp; |
---|
644 | |
---|
645 | // register RPC request in remote RPC fifo |
---|
646 | rpc_send( cxy , &rpc ); |
---|
647 | |
---|
648 | // get output arguments from RPC descriptor |
---|
649 | *child_pid = (pid_t)rpc.args[2]; |
---|
650 | *child_thread_ptr = (thread_t *)(intptr_t)rpc.args[3]; |
---|
651 | *error = (error_t)rpc.args[4]; |
---|
652 | |
---|
653 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
654 | cycle = (uint32_t)hal_get_cycles(); |
---|
655 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
656 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
657 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
658 | #endif |
---|
659 | } |
---|
660 | |
---|
661 | ////////////////////////////////////////////// |
---|
662 | void rpc_process_make_fork_server( xptr_t xp ) |
---|
663 | { |
---|
664 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
665 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
666 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
667 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
668 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
669 | #endif |
---|
670 | |
---|
671 | xptr_t ref_process_xp; // extended pointer on reference parent process |
---|
672 | xptr_t parent_thread_xp; // extended pointer on parent thread |
---|
673 | pid_t child_pid; // child process identifier |
---|
674 | thread_t * child_thread_ptr; // local copy of exec_info structure |
---|
675 | error_t error; // local error status |
---|
676 | |
---|
677 | // get client cluster identifier and pointer on RPC descriptor |
---|
678 | cxy_t client_cxy = GET_CXY( xp ); |
---|
679 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
680 | |
---|
681 | // get input arguments from cient RPC descriptor |
---|
682 | ref_process_xp = (xptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
683 | parent_thread_xp = (xptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
684 | |
---|
685 | // call local kernel function |
---|
686 | error = process_make_fork( ref_process_xp, |
---|
687 | parent_thread_xp, |
---|
688 | &child_pid, |
---|
689 | &child_thread_ptr ); |
---|
690 | |
---|
691 | // set output argument into client RPC descriptor |
---|
692 | hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)child_pid ); |
---|
693 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)(intptr_t)child_thread_ptr ); |
---|
694 | hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); |
---|
695 | |
---|
696 | #if DEBUG_RPC_PROCESS_MAKE_FORK |
---|
697 | cycle = (uint32_t)hal_get_cycles(); |
---|
698 | if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) |
---|
699 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
700 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
701 | #endif |
---|
702 | } |
---|
703 | |
---|
704 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
705 | // [4] undefined slot |
---|
706 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
707 | |
---|
708 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
709 | // [5] undefined slot |
---|
710 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
711 | |
---|
712 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
713 | // [6] Marshaling functions attached to RPC_THREAD_USER_CREATE (blocking) |
---|
714 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
715 | |
---|
716 | ///////////////////////////////////////////////////////// |
---|
717 | void rpc_thread_user_create_client( cxy_t cxy, |
---|
718 | pid_t pid, // in |
---|
719 | void * start_func, // in |
---|
720 | void * start_arg, // in |
---|
721 | pthread_attr_t * attr, // in |
---|
722 | xptr_t * thread_xp, // out |
---|
723 | error_t * error ) // out |
---|
724 | { |
---|
725 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
726 | |
---|
727 | // initialise RPC descriptor header |
---|
728 | rpc_desc_t rpc; |
---|
729 | rpc.index = RPC_THREAD_USER_CREATE; |
---|
730 | rpc.blocking = true; |
---|
731 | rpc.responses = 1; |
---|
732 | |
---|
733 | // set input arguments in RPC descriptor |
---|
734 | rpc.args[0] = (uint64_t)pid; |
---|
735 | rpc.args[1] = (uint64_t)(intptr_t)start_func; |
---|
736 | rpc.args[2] = (uint64_t)(intptr_t)start_arg; |
---|
737 | rpc.args[3] = (uint64_t)(intptr_t)attr; |
---|
738 | |
---|
739 | // register RPC request in remote RPC fifo |
---|
740 | rpc_send( cxy , &rpc ); |
---|
741 | |
---|
742 | // get output arguments from RPC descriptor |
---|
743 | *thread_xp = (xptr_t)rpc.args[4]; |
---|
744 | *error = (error_t)rpc.args[5]; |
---|
745 | |
---|
746 | } |
---|
747 | |
---|
748 | /////////////////////////////////////////////// |
---|
749 | void rpc_thread_user_create_server( xptr_t xp ) |
---|
750 | { |
---|
751 | |
---|
752 | pthread_attr_t * attr_ptr; // pointer on attributes structure in client cluster |
---|
753 | pthread_attr_t attr_copy; // attributes structure copy in server cluster |
---|
754 | thread_t * thread_ptr; // local pointer on thread descriptor |
---|
755 | xptr_t thread_xp; // extended pointer on thread descriptor |
---|
756 | |
---|
757 | pid_t pid; // process identifier |
---|
758 | void * start_func; |
---|
759 | void * start_arg; |
---|
760 | error_t error; |
---|
761 | |
---|
762 | // get client cluster identifier and pointer on RPC descriptor |
---|
763 | cxy_t client_cxy = GET_CXY( xp ); |
---|
764 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
765 | |
---|
766 | // get pointer on attributes structure in client cluster from RPC descriptor |
---|
767 | |
---|
768 | // get input arguments from RPC descriptor |
---|
769 | pid = (pid_t) hal_remote_lwd(XPTR(client_cxy , &desc->args[0])); |
---|
770 | start_func = (void *)(intptr_t) hal_remote_lwd(XPTR(client_cxy , &desc->args[1])); |
---|
771 | start_arg = (void *)(intptr_t) hal_remote_lwd(XPTR(client_cxy , &desc->args[2])); |
---|
772 | attr_ptr = (pthread_attr_t *)(intptr_t)hal_remote_lwd(XPTR(client_cxy , &desc->args[3])); |
---|
773 | |
---|
774 | // makes a local copy of attributes structure |
---|
775 | hal_remote_memcpy( XPTR( local_cxy , &attr_copy ), |
---|
776 | XPTR( client_cxy , attr_ptr ), |
---|
777 | sizeof(pthread_attr_t) ); |
---|
778 | |
---|
779 | // call kernel function |
---|
780 | error = thread_user_create( pid, |
---|
781 | start_func, |
---|
782 | start_arg, |
---|
783 | &attr_copy, |
---|
784 | &thread_ptr ); |
---|
785 | |
---|
786 | // set output arguments |
---|
787 | thread_xp = XPTR( local_cxy , thread_ptr ); |
---|
788 | hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)thread_xp ); |
---|
789 | hal_remote_swd( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error ); |
---|
790 | |
---|
791 | } |
---|
792 | |
---|
793 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
794 | // [7] Marshaling functions attached to RPC_THREAD_KERNEL_CREATE (blocking) |
---|
795 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
796 | |
---|
797 | //////////////////////////////////////////////////// |
---|
798 | void rpc_thread_kernel_create_client( cxy_t cxy, |
---|
799 | uint32_t type, // in |
---|
800 | void * func, // in |
---|
801 | void * args, // in |
---|
802 | xptr_t * thread_xp, // out |
---|
803 | error_t * error ) // out |
---|
804 | { |
---|
805 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
806 | |
---|
807 | // initialise RPC descriptor header |
---|
808 | rpc_desc_t rpc; |
---|
809 | rpc.index = RPC_THREAD_KERNEL_CREATE; |
---|
810 | rpc.blocking = true; |
---|
811 | rpc.responses = 1; |
---|
812 | |
---|
813 | // set input arguments in RPC descriptor |
---|
814 | rpc.args[0] = (uint64_t)type; |
---|
815 | rpc.args[1] = (uint64_t)(intptr_t)func; |
---|
816 | rpc.args[2] = (uint64_t)(intptr_t)args; |
---|
817 | |
---|
818 | // register RPC request in remote RPC fifo |
---|
819 | rpc_send( cxy , &rpc ); |
---|
820 | |
---|
821 | // get output arguments from RPC descriptor |
---|
822 | *thread_xp = (xptr_t)rpc.args[3]; |
---|
823 | *error = (error_t)rpc.args[4]; |
---|
824 | |
---|
825 | } |
---|
826 | |
---|
827 | ///////////////////////////////////////////////// |
---|
828 | void rpc_thread_kernel_create_server( xptr_t xp ) |
---|
829 | { |
---|
830 | thread_t * thread_ptr; // local pointer on thread descriptor |
---|
831 | xptr_t thread_xp; // extended pointer on thread descriptor |
---|
832 | lid_t core_lid; // core local index |
---|
833 | error_t error; |
---|
834 | |
---|
835 | // get client cluster identifier and pointer on RPC descriptor |
---|
836 | cxy_t client_cxy = GET_CXY( xp ); |
---|
837 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
838 | |
---|
839 | // get attributes from RPC descriptor |
---|
840 | uint32_t type = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
841 | void * func = (void*)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
842 | void * args = (void*)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); |
---|
843 | |
---|
844 | // select one core |
---|
845 | core_lid = cluster_select_local_core(); |
---|
846 | |
---|
847 | // call local kernel function |
---|
848 | error = thread_kernel_create( &thread_ptr , type , func , args , core_lid ); |
---|
849 | |
---|
850 | // set output arguments |
---|
851 | thread_xp = XPTR( local_cxy , thread_ptr ); |
---|
852 | hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); |
---|
853 | hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp ); |
---|
854 | |
---|
855 | } |
---|
856 | |
---|
857 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
858 | // [8] undefined slot |
---|
859 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
860 | |
---|
861 | |
---|
862 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
863 | // [9] Marshaling functions attached to RPC_PROCESS_SIGACTION (multicast / non blocking) |
---|
864 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
865 | |
---|
866 | //////////////////////////////////////////////////// |
---|
867 | void rpc_process_sigaction_client( cxy_t cxy, |
---|
868 | rpc_desc_t * rpc ) |
---|
869 | { |
---|
870 | |
---|
871 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
872 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
873 | uint32_t action = rpc->args[0]; |
---|
874 | pid_t pid = rpc->args[1]; |
---|
875 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
876 | printk("\n[DBG] %s : enter to request %s of process %x in cluster %x / cycle %d\n", |
---|
877 | __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle ); |
---|
878 | #endif |
---|
879 | |
---|
880 | // check some RPC arguments |
---|
881 | assert( (rpc->blocking == false) , __FUNCTION__ , "must be non-blocking\n"); |
---|
882 | assert( (rpc->index == RPC_PROCESS_SIGACTION ) , __FUNCTION__ , "bad RPC index\n" ); |
---|
883 | |
---|
884 | // register RPC request in remote RPC fifo and return |
---|
885 | rpc_send( cxy , rpc ); |
---|
886 | |
---|
887 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
888 | cycle = (uint32_t)hal_get_cycles(); |
---|
889 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
890 | printk("\n[DBG] %s : exit after requesting to %s process %x in cluster %x / cycle %d\n", |
---|
891 | __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle ); |
---|
892 | #endif |
---|
893 | |
---|
894 | } // end rpc_process_sigaction_client() |
---|
895 | |
---|
896 | ////////////////////////////////////////////// |
---|
897 | void rpc_process_sigaction_server( xptr_t xp ) |
---|
898 | { |
---|
899 | pid_t pid; // target process identifier |
---|
900 | process_t * process; // pointer on local target process descriptor |
---|
901 | uint32_t action; // sigaction index |
---|
902 | thread_t * client_ptr; // pointer on client thread in client cluster |
---|
903 | xptr_t client_xp; // extended pointer client thread |
---|
904 | cxy_t client_cxy; // client cluster identifier |
---|
905 | rpc_desc_t * rpc; // pointer on rpc descriptor in client cluster |
---|
906 | xptr_t count_xp; // extended pointer on responses counter |
---|
907 | uint32_t count_value; // responses counter value |
---|
908 | lid_t client_lid; // client core local index |
---|
909 | |
---|
910 | // get client cluster identifier and pointer on RPC descriptor |
---|
911 | client_cxy = GET_CXY( xp ); |
---|
912 | rpc = GET_PTR( xp ); |
---|
913 | |
---|
914 | // get arguments from RPC descriptor |
---|
915 | action = (uint32_t)hal_remote_lwd( XPTR(client_cxy , &rpc->args[0]) ); |
---|
916 | pid = (pid_t) hal_remote_lwd( XPTR(client_cxy , &rpc->args[1]) ); |
---|
917 | |
---|
918 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
919 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
920 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
921 | printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", |
---|
922 | __FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle ); |
---|
923 | #endif |
---|
924 | |
---|
925 | // get client thread pointers |
---|
926 | client_ptr = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) ); |
---|
927 | client_xp = XPTR( client_cxy , client_ptr ); |
---|
928 | |
---|
929 | // get local process descriptor |
---|
930 | process = cluster_get_local_process_from_pid( pid ); |
---|
931 | |
---|
932 | // call relevant kernel function |
---|
933 | if ( action == DELETE_ALL_THREADS ) process_delete_threads ( process , client_xp ); |
---|
934 | else if ( action == BLOCK_ALL_THREADS ) process_block_threads ( process , client_xp ); |
---|
935 | else if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process ); |
---|
936 | |
---|
937 | // build extended pointer on response counter in RPC |
---|
938 | count_xp = XPTR( client_cxy , &rpc->responses ); |
---|
939 | |
---|
940 | // decrement the responses counter in RPC descriptor, |
---|
941 | count_value = hal_remote_atomic_add( count_xp , -1 ); |
---|
942 | |
---|
943 | // unblock the client thread only if it is the last response. |
---|
944 | if( count_value == 1 ) |
---|
945 | { |
---|
946 | // get client core lid |
---|
947 | client_lid = (lid_t) hal_remote_lw ( XPTR( client_cxy , &rpc->lid ) ); |
---|
948 | |
---|
949 | // unblock client thread |
---|
950 | thread_unblock( client_xp , THREAD_BLOCKED_RPC ); |
---|
951 | |
---|
952 | // send an IPI to client core |
---|
953 | // dev_pic_send_ipi( client_cxy , client_lid ); |
---|
954 | } |
---|
955 | |
---|
956 | #if DEBUG_RPC_PROCESS_SIGACTION |
---|
957 | cycle = (uint32_t)hal_get_cycles(); |
---|
958 | if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) |
---|
959 | printk("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n", |
---|
960 | __FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle ); |
---|
961 | #endif |
---|
962 | |
---|
963 | } // end rpc_process_sigaction_server() |
---|
964 | |
---|
965 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
966 | // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE (blocking) |
---|
967 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
968 | |
---|
969 | ///////////////////////////////////////////////////// |
---|
970 | void rpc_vfs_inode_create_client( cxy_t cxy, |
---|
971 | xptr_t dentry_xp, // in |
---|
972 | uint32_t fs_type, // in |
---|
973 | uint32_t inode_type, // in |
---|
974 | void * extend, // in |
---|
975 | uint32_t attr, // in |
---|
976 | uint32_t rights, // in |
---|
977 | uint32_t uid, // in |
---|
978 | uint32_t gid, // in |
---|
979 | xptr_t * inode_xp, // out |
---|
980 | error_t * error ) // out |
---|
981 | { |
---|
982 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
983 | |
---|
984 | // initialise RPC descriptor header |
---|
985 | rpc_desc_t rpc; |
---|
986 | rpc.index = RPC_VFS_INODE_CREATE; |
---|
987 | rpc.blocking = true; |
---|
988 | rpc.responses = 1; |
---|
989 | |
---|
990 | // set input arguments in RPC descriptor |
---|
991 | rpc.args[0] = (uint64_t)dentry_xp; |
---|
992 | rpc.args[1] = (uint64_t)fs_type; |
---|
993 | rpc.args[2] = (uint64_t)inode_type; |
---|
994 | rpc.args[3] = (uint64_t)(intptr_t)extend; |
---|
995 | rpc.args[4] = (uint64_t)attr; |
---|
996 | rpc.args[5] = (uint64_t)rights; |
---|
997 | rpc.args[6] = (uint64_t)uid; |
---|
998 | rpc.args[7] = (uint64_t)gid; |
---|
999 | |
---|
1000 | // register RPC request in remote RPC fifo |
---|
1001 | rpc_send( cxy , &rpc ); |
---|
1002 | |
---|
1003 | // get output values from RPC descriptor |
---|
1004 | *inode_xp = (xptr_t)rpc.args[8]; |
---|
1005 | *error = (error_t)rpc.args[9]; |
---|
1006 | |
---|
1007 | } |
---|
1008 | |
---|
1009 | ///////////////////////////////////////////// |
---|
1010 | void rpc_vfs_inode_create_server( xptr_t xp ) |
---|
1011 | { |
---|
1012 | xptr_t dentry_xp; |
---|
1013 | uint32_t fs_type; |
---|
1014 | uint32_t inode_type; |
---|
1015 | void * extend; |
---|
1016 | uint32_t attr; |
---|
1017 | uint32_t rights; |
---|
1018 | uint32_t uid; |
---|
1019 | uint32_t gid; |
---|
1020 | xptr_t inode_xp; |
---|
1021 | error_t error; |
---|
1022 | |
---|
1023 | // get client cluster identifier and pointer on RPC descriptor |
---|
1024 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1025 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1026 | |
---|
1027 | // get input arguments from client rpc descriptor |
---|
1028 | dentry_xp = (xptr_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1029 | fs_type = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1030 | inode_type = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); |
---|
1031 | extend = (void *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[3] ) ); |
---|
1032 | attr = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[4] ) ); |
---|
1033 | rights = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[5] ) ); |
---|
1034 | uid = (uid_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[6] ) ); |
---|
1035 | gid = (gid_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[7] ) ); |
---|
1036 | |
---|
1037 | // call local kernel function |
---|
1038 | error = vfs_inode_create( dentry_xp, |
---|
1039 | fs_type, |
---|
1040 | inode_type, |
---|
1041 | extend, |
---|
1042 | attr, |
---|
1043 | rights, |
---|
1044 | uid, |
---|
1045 | gid, |
---|
1046 | &inode_xp ); |
---|
1047 | |
---|
1048 | // set output arguments |
---|
1049 | hal_remote_swd( XPTR( client_cxy , &desc->args[8] ) , (uint64_t)inode_xp ); |
---|
1050 | hal_remote_swd( XPTR( client_cxy , &desc->args[9] ) , (uint64_t)error ); |
---|
1051 | |
---|
1052 | } |
---|
1053 | |
---|
1054 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1055 | // [11] Marshaling functions attached to RPC_VFS_INODE_DESTROY (blocking) |
---|
1056 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1057 | |
---|
1058 | ///////////////////////////////////////////////////////////// |
---|
1059 | void rpc_vfs_inode_destroy_client( cxy_t cxy, |
---|
1060 | struct vfs_inode_s * inode ) |
---|
1061 | { |
---|
1062 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1063 | |
---|
1064 | // initialise RPC descriptor header |
---|
1065 | rpc_desc_t rpc; |
---|
1066 | rpc.index = RPC_VFS_INODE_DESTROY; |
---|
1067 | rpc.blocking = true; |
---|
1068 | rpc.responses = 1; |
---|
1069 | |
---|
1070 | // set input arguments in RPC descriptor |
---|
1071 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
1072 | |
---|
1073 | // register RPC request in remote RPC fifo |
---|
1074 | rpc_send( cxy , &rpc ); |
---|
1075 | |
---|
1076 | } |
---|
1077 | |
---|
1078 | ////////////////////////////////////////////// |
---|
1079 | void rpc_vfs_inode_destroy_server( xptr_t xp ) |
---|
1080 | { |
---|
1081 | vfs_inode_t * inode; |
---|
1082 | |
---|
1083 | // get client cluster identifier and pointer on RPC descriptor |
---|
1084 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1085 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1086 | |
---|
1087 | // get arguments "inode" from client RPC descriptor |
---|
1088 | inode = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1089 | |
---|
1090 | // call local kernel function |
---|
1091 | vfs_inode_destroy( inode ); |
---|
1092 | |
---|
1093 | } |
---|
1094 | |
---|
1095 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1096 | // [12] Marshaling functions attached to RPC_VFS_DENTRY_CREATE (blocking) |
---|
1097 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1098 | |
---|
1099 | ////////////////////////////////////////////////////////////// |
---|
1100 | void rpc_vfs_dentry_create_client( cxy_t cxy, |
---|
1101 | uint32_t type, // in |
---|
1102 | char * name, // in |
---|
1103 | struct vfs_inode_s * parent, // in |
---|
1104 | xptr_t * dentry_xp, // out |
---|
1105 | error_t * error ) // out |
---|
1106 | { |
---|
1107 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
1108 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1109 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
1110 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1111 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1112 | #endif |
---|
1113 | |
---|
1114 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1115 | |
---|
1116 | // initialise RPC descriptor header |
---|
1117 | rpc_desc_t rpc; |
---|
1118 | rpc.index = RPC_VFS_DENTRY_CREATE; |
---|
1119 | rpc.blocking = true; |
---|
1120 | rpc.responses = 1; |
---|
1121 | |
---|
1122 | // set input arguments in RPC descriptor |
---|
1123 | rpc.args[0] = (uint64_t)type; |
---|
1124 | rpc.args[1] = (uint64_t)(intptr_t)name; |
---|
1125 | rpc.args[2] = (uint64_t)(intptr_t)parent; |
---|
1126 | |
---|
1127 | // register RPC request in remote RPC fifo |
---|
1128 | rpc_send( cxy , &rpc ); |
---|
1129 | |
---|
1130 | // get output values from RPC descriptor |
---|
1131 | *dentry_xp = (xptr_t)rpc.args[3]; |
---|
1132 | *error = (error_t)rpc.args[4]; |
---|
1133 | |
---|
1134 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
1135 | cycle = (uint32_t)hal_get_cycles(); |
---|
1136 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
1137 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1138 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1139 | #endif |
---|
1140 | } |
---|
1141 | |
---|
1142 | ////////////////////////////////////////////// |
---|
1143 | void rpc_vfs_dentry_create_server( xptr_t xp ) |
---|
1144 | { |
---|
1145 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
1146 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1147 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
1148 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1149 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1150 | #endif |
---|
1151 | |
---|
1152 | uint32_t type; |
---|
1153 | char * name; |
---|
1154 | vfs_inode_t * parent; |
---|
1155 | xptr_t dentry_xp; |
---|
1156 | error_t error; |
---|
1157 | char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; |
---|
1158 | |
---|
1159 | // get client cluster identifier and pointer on RPC descriptor |
---|
1160 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1161 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1162 | |
---|
1163 | // get arguments "name", "type", and "parent" from client RPC descriptor |
---|
1164 | type = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1165 | name = (char *)(intptr_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1166 | parent = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); |
---|
1167 | |
---|
1168 | // makes a local copy of name |
---|
1169 | hal_remote_strcpy( XPTR( local_cxy , name_copy ), |
---|
1170 | XPTR( client_cxy , name ) ); |
---|
1171 | |
---|
1172 | // call local kernel function |
---|
1173 | error = vfs_dentry_create( type, |
---|
1174 | name_copy, |
---|
1175 | parent, |
---|
1176 | &dentry_xp ); |
---|
1177 | // set output arguments |
---|
1178 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)dentry_xp ); |
---|
1179 | hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); |
---|
1180 | |
---|
1181 | #if DEBUG_RPC_VFS_DENTRY_CREATE |
---|
1182 | cycle = (uint32_t)hal_get_cycles(); |
---|
1183 | if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) |
---|
1184 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1185 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1186 | #endif |
---|
1187 | } |
---|
1188 | |
---|
1189 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1190 | // [13] Marshaling functions attached to RPC_VFS_DENTRY_DESTROY (blocking) |
---|
1191 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1192 | |
---|
1193 | |
---|
1194 | /////////////////////////////////////////////////////// |
---|
1195 | void rpc_vfs_dentry_destroy_client( cxy_t cxy, |
---|
1196 | vfs_dentry_t * dentry ) |
---|
1197 | { |
---|
1198 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
1199 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1200 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
1201 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1202 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1203 | #endif |
---|
1204 | |
---|
1205 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1206 | |
---|
1207 | // initialise RPC descriptor header |
---|
1208 | rpc_desc_t rpc; |
---|
1209 | rpc.index = RPC_VFS_DENTRY_DESTROY; |
---|
1210 | rpc.blocking = true; |
---|
1211 | rpc.responses = 1; |
---|
1212 | |
---|
1213 | // set input arguments in RPC descriptor |
---|
1214 | rpc.args[0] = (uint64_t)(intptr_t)dentry; |
---|
1215 | |
---|
1216 | // register RPC request in remote RPC fifo |
---|
1217 | rpc_send( cxy , &rpc ); |
---|
1218 | |
---|
1219 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
1220 | cycle = (uint32_t)hal_get_cycles(); |
---|
1221 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
1222 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1223 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1224 | #endif |
---|
1225 | } |
---|
1226 | |
---|
1227 | /////////////////////////////////////////////// |
---|
1228 | void rpc_vfs_dentry_destroy_server( xptr_t xp ) |
---|
1229 | { |
---|
1230 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
1231 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1232 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
1233 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1234 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1235 | #endif |
---|
1236 | |
---|
1237 | vfs_dentry_t * dentry; |
---|
1238 | |
---|
1239 | // get client cluster identifier and pointer on RPC descriptor |
---|
1240 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1241 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1242 | |
---|
1243 | // get arguments "dentry" from client RPC descriptor |
---|
1244 | dentry = (vfs_dentry_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1245 | |
---|
1246 | // call local kernel function |
---|
1247 | vfs_dentry_destroy( dentry ); |
---|
1248 | |
---|
1249 | #if DEBUG_RPC_VFS_DENTRY_DESTROY |
---|
1250 | cycle = (uint32_t)hal_get_cycles(); |
---|
1251 | if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY ) |
---|
1252 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1253 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1254 | #endif |
---|
1255 | } |
---|
1256 | |
---|
1257 | |
---|
1258 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1259 | // [14] Marshaling functions attached to RPC_VFS_FILE_CREATE (blocking) |
---|
1260 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1261 | |
---|
1262 | ////////////////////////////////////////////////////////////// |
---|
1263 | void rpc_vfs_file_create_client( cxy_t cxy, |
---|
1264 | struct vfs_inode_s * inode, // in |
---|
1265 | uint32_t file_attr, // in |
---|
1266 | xptr_t * file_xp, // out |
---|
1267 | error_t * error ) // out |
---|
1268 | { |
---|
1269 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
1270 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1271 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
1272 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1273 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1274 | #endif |
---|
1275 | |
---|
1276 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1277 | |
---|
1278 | // initialise RPC descriptor header |
---|
1279 | rpc_desc_t rpc; |
---|
1280 | rpc.index = RPC_VFS_FILE_CREATE; |
---|
1281 | rpc.blocking = true; |
---|
1282 | rpc.responses = 1; |
---|
1283 | |
---|
1284 | // set input arguments in RPC descriptor |
---|
1285 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
1286 | rpc.args[1] = (uint64_t)file_attr; |
---|
1287 | |
---|
1288 | // register RPC request in remote RPC fifo |
---|
1289 | rpc_send( cxy , &rpc ); |
---|
1290 | |
---|
1291 | // get output values from RPC descriptor |
---|
1292 | *file_xp = (xptr_t)rpc.args[2]; |
---|
1293 | *error = (error_t)rpc.args[3]; |
---|
1294 | |
---|
1295 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
1296 | cycle = (uint32_t)hal_get_cycles(); |
---|
1297 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
1298 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1299 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1300 | #endif |
---|
1301 | } |
---|
1302 | |
---|
1303 | //////////////////////////////////////////// |
---|
1304 | void rpc_vfs_file_create_server( xptr_t xp ) |
---|
1305 | { |
---|
1306 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
1307 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1308 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
1309 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1310 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1311 | #endif |
---|
1312 | |
---|
1313 | uint32_t file_attr; |
---|
1314 | vfs_inode_t * inode; |
---|
1315 | xptr_t file_xp; |
---|
1316 | error_t error; |
---|
1317 | |
---|
1318 | // get client cluster identifier and pointer on RPC descriptor |
---|
1319 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1320 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1321 | |
---|
1322 | // get arguments "file_attr" and "inode" from client RPC descriptor |
---|
1323 | inode = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1324 | file_attr = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1325 | |
---|
1326 | // call local kernel function |
---|
1327 | error = vfs_file_create( inode, |
---|
1328 | file_attr, |
---|
1329 | &file_xp ); |
---|
1330 | |
---|
1331 | // set output arguments |
---|
1332 | hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp ); |
---|
1333 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
1334 | |
---|
1335 | #if DEBUG_RPC_VFS_FILE_CREATE |
---|
1336 | cycle = (uint32_t)hal_get_cycles(); |
---|
1337 | if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) |
---|
1338 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1339 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1340 | #endif |
---|
1341 | } |
---|
1342 | |
---|
1343 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1344 | // [15] Marshaling functions attached to RPC_VFS_FILE_DESTROY (blocking) |
---|
1345 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1346 | |
---|
1347 | /////////////////////////////////////////////////// |
---|
1348 | void rpc_vfs_file_destroy_client( cxy_t cxy, |
---|
1349 | vfs_file_t * file ) |
---|
1350 | { |
---|
1351 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
1352 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1353 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
1354 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1355 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1356 | #endif |
---|
1357 | |
---|
1358 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1359 | |
---|
1360 | // initialise RPC descriptor header |
---|
1361 | rpc_desc_t rpc; |
---|
1362 | rpc.index = RPC_VFS_FILE_DESTROY; |
---|
1363 | rpc.blocking = true; |
---|
1364 | rpc.responses = 1; |
---|
1365 | |
---|
1366 | // set input arguments in RPC descriptor |
---|
1367 | rpc.args[0] = (uint64_t)(intptr_t)file; |
---|
1368 | |
---|
1369 | // register RPC request in remote RPC fifo |
---|
1370 | rpc_send( cxy , &rpc ); |
---|
1371 | |
---|
1372 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
1373 | cycle = (uint32_t)hal_get_cycles(); |
---|
1374 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
1375 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1376 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1377 | #endif |
---|
1378 | } |
---|
1379 | |
---|
1380 | ///////////////////////////////////////////// |
---|
1381 | void rpc_vfs_file_destroy_server( xptr_t xp ) |
---|
1382 | { |
---|
1383 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
1384 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1385 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
1386 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1387 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1388 | #endif |
---|
1389 | |
---|
1390 | vfs_file_t * file; |
---|
1391 | |
---|
1392 | // get client cluster identifier and pointer on RPC descriptor |
---|
1393 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1394 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1395 | |
---|
1396 | // get arguments "dentry" from client RPC descriptor |
---|
1397 | file = (vfs_file_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1398 | |
---|
1399 | // call local kernel function |
---|
1400 | vfs_file_destroy( file ); |
---|
1401 | |
---|
1402 | #if DEBUG_RPC_VFS_FILE_DESTROY |
---|
1403 | cycle = (uint32_t)hal_get_cycles(); |
---|
1404 | if( cycle > DEBUG_RPC_VFS_FILE_DESTROY ) |
---|
1405 | printk("\n[DBG] %s : thread %x exit / cycle %d\n", |
---|
1406 | __FUNCTION__ , CURRENT_THREAD , cycle ); |
---|
1407 | #endif |
---|
1408 | } |
---|
1409 | |
---|
1410 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1411 | // [16] Marshaling functions attached to RPC_VFS_INODE_LOAD (blocking) |
---|
1412 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1413 | |
---|
1414 | ////////////////////////////////////////////////// |
---|
1415 | void rpc_vfs_inode_load_client( cxy_t cxy, |
---|
1416 | vfs_inode_t * parent_inode, // in |
---|
1417 | char * name, // in |
---|
1418 | xptr_t child_inode_xp, // in |
---|
1419 | error_t * error ) // out |
---|
1420 | { |
---|
1421 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1422 | |
---|
1423 | // initialise RPC descriptor header |
---|
1424 | rpc_desc_t rpc; |
---|
1425 | rpc.index = RPC_VFS_INODE_LOAD; |
---|
1426 | rpc.blocking = true; |
---|
1427 | rpc.responses = 1; |
---|
1428 | |
---|
1429 | // set input arguments in RPC descriptor |
---|
1430 | rpc.args[0] = (uint64_t)(intptr_t)parent_inode; |
---|
1431 | rpc.args[1] = (uint64_t)(intptr_t)name; |
---|
1432 | rpc.args[2] = (uint64_t)child_inode_xp; |
---|
1433 | |
---|
1434 | // register RPC request in remote RPC fifo |
---|
1435 | rpc_send( cxy , &rpc ); |
---|
1436 | |
---|
1437 | // get output values from RPC descriptor |
---|
1438 | *error = (error_t)rpc.args[3]; |
---|
1439 | |
---|
1440 | } |
---|
1441 | |
---|
1442 | /////////////////////////////////////////// |
---|
1443 | void rpc_vfs_inode_load_server( xptr_t xp ) |
---|
1444 | { |
---|
1445 | error_t error; |
---|
1446 | vfs_inode_t * parent; |
---|
1447 | xptr_t child_xp; |
---|
1448 | char * name; |
---|
1449 | |
---|
1450 | char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; |
---|
1451 | |
---|
1452 | // get client cluster identifier and pointer on RPC descriptor |
---|
1453 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1454 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1455 | |
---|
1456 | // get arguments "parent", "name", and "child_xp" |
---|
1457 | parent = (vfs_inode_t*)(intptr_t)hal_remote_lwd(XPTR(client_cxy , &desc->args[0])); |
---|
1458 | name = (char*)(intptr_t) hal_remote_lwd(XPTR(client_cxy , &desc->args[1])); |
---|
1459 | child_xp = (xptr_t) hal_remote_lwd(XPTR(client_cxy , &desc->args[2])); |
---|
1460 | |
---|
1461 | // get name local copy |
---|
1462 | hal_remote_strcpy( XPTR( local_cxy , name_copy ) , |
---|
1463 | XPTR( client_cxy , name ) ); |
---|
1464 | |
---|
1465 | // call the kernel function |
---|
1466 | error = vfs_inode_load( parent , name_copy , child_xp ); |
---|
1467 | |
---|
1468 | // set output argument |
---|
1469 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
1470 | |
---|
1471 | } |
---|
1472 | |
---|
1473 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1474 | // [17] Marshaling functions attached to RPC_VFS_MAPPER_LOAD_ALL (blocking) |
---|
1475 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1476 | |
---|
1477 | /////////////////////////////////////////////////////// |
---|
1478 | void rpc_vfs_mapper_load_all_client( cxy_t cxy, |
---|
1479 | vfs_inode_t * inode, // in |
---|
1480 | error_t * error ) // out |
---|
1481 | { |
---|
1482 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1483 | |
---|
1484 | // initialise RPC descriptor header |
---|
1485 | rpc_desc_t rpc; |
---|
1486 | rpc.index = RPC_VFS_MAPPER_LOAD_ALL; |
---|
1487 | rpc.blocking = true; |
---|
1488 | rpc.responses = 1; |
---|
1489 | |
---|
1490 | // set input arguments in RPC descriptor |
---|
1491 | rpc.args[0] = (uint64_t)(intptr_t)inode; |
---|
1492 | |
---|
1493 | // register RPC request in remote RPC fifo |
---|
1494 | rpc_send( cxy , &rpc ); |
---|
1495 | |
---|
1496 | // get output values from RPC descriptor |
---|
1497 | *error = (error_t)rpc.args[1]; |
---|
1498 | |
---|
1499 | } |
---|
1500 | |
---|
1501 | //////////////////////////////////////////////// |
---|
1502 | void rpc_vfs_mapper_load_all_server( xptr_t xp ) |
---|
1503 | { |
---|
1504 | error_t error; |
---|
1505 | vfs_inode_t * inode; |
---|
1506 | |
---|
1507 | // get client cluster identifier and pointer on RPC descriptor |
---|
1508 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1509 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1510 | |
---|
1511 | // get arguments "parent", "name", and "child_xp" |
---|
1512 | inode = (vfs_inode_t*)(intptr_t)hal_remote_lwd(XPTR(client_cxy , &desc->args[0])); |
---|
1513 | |
---|
1514 | // call the kernel function |
---|
1515 | error = vfs_mapper_load_all( inode ); |
---|
1516 | |
---|
1517 | // set output argument |
---|
1518 | hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); |
---|
1519 | |
---|
1520 | } |
---|
1521 | |
---|
1522 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1523 | // [18] Marshaling functions attached to RPC_FATFS_GET_CLUSTER (blocking) |
---|
1524 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1525 | |
---|
1526 | ////////////////////////////////////////////////// |
---|
1527 | void rpc_fatfs_get_cluster_client( cxy_t cxy, |
---|
1528 | mapper_t * mapper, // in |
---|
1529 | uint32_t first, // in |
---|
1530 | uint32_t index, // in |
---|
1531 | uint32_t * cluster, // out |
---|
1532 | error_t * error ) // out |
---|
1533 | { |
---|
1534 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1535 | |
---|
1536 | // initialise RPC descriptor header |
---|
1537 | rpc_desc_t rpc; |
---|
1538 | rpc.index = RPC_FATFS_GET_CLUSTER; |
---|
1539 | rpc.blocking = true; |
---|
1540 | rpc.responses = 1; |
---|
1541 | |
---|
1542 | // set input arguments in RPC descriptor |
---|
1543 | rpc.args[0] = (uint64_t)(intptr_t)mapper; |
---|
1544 | rpc.args[1] = (uint64_t)first; |
---|
1545 | rpc.args[2] = (uint64_t)index; |
---|
1546 | |
---|
1547 | // register RPC request in remote RPC fifo |
---|
1548 | rpc_send( cxy , &rpc ); |
---|
1549 | |
---|
1550 | // get output argument from rpc descriptor |
---|
1551 | *cluster = (uint32_t)rpc.args[3]; |
---|
1552 | *error = (error_t)rpc.args[4]; |
---|
1553 | |
---|
1554 | } |
---|
1555 | |
---|
1556 | ////////////////////////////////////////////// |
---|
1557 | void rpc_fatfs_get_cluster_server( xptr_t xp ) |
---|
1558 | { |
---|
1559 | mapper_t * mapper; |
---|
1560 | uint32_t first; |
---|
1561 | uint32_t index; |
---|
1562 | uint32_t cluster; |
---|
1563 | error_t error; |
---|
1564 | |
---|
1565 | // get client cluster identifier and pointer on RPC descriptor |
---|
1566 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1567 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1568 | |
---|
1569 | // get input arguments |
---|
1570 | mapper = (mapper_t *)(intptr_t)hal_remote_lpt( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1571 | first = (uint32_t) hal_remote_lw ( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1572 | index = (uint32_t) hal_remote_lw ( XPTR( client_cxy , &desc->args[2] ) ); |
---|
1573 | |
---|
1574 | // call the kernel function |
---|
1575 | error = fatfs_get_cluster( mapper , first , index , &cluster ); |
---|
1576 | |
---|
1577 | // set output argument |
---|
1578 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)cluster ); |
---|
1579 | hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); |
---|
1580 | |
---|
1581 | } |
---|
1582 | |
---|
1583 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1584 | // [20] Marshaling functions attached to RPC_VMM_GET_VSEG (blocking) |
---|
1585 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1586 | |
---|
1587 | ////////////////////////////////////////////////// |
---|
1588 | void rpc_vmm_get_vseg_client( cxy_t cxy, |
---|
1589 | process_t * process, // in |
---|
1590 | intptr_t vaddr, // in |
---|
1591 | xptr_t * vseg_xp, // out |
---|
1592 | error_t * error ) // out |
---|
1593 | { |
---|
1594 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
1595 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1596 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
1597 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1598 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1599 | #endif |
---|
1600 | |
---|
1601 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1602 | |
---|
1603 | // initialise RPC descriptor header |
---|
1604 | rpc_desc_t rpc; |
---|
1605 | rpc.index = RPC_VMM_GET_VSEG; |
---|
1606 | rpc.blocking = true; |
---|
1607 | rpc.responses = 1; |
---|
1608 | |
---|
1609 | // set input arguments in RPC descriptor |
---|
1610 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
1611 | rpc.args[1] = (uint64_t)vaddr; |
---|
1612 | |
---|
1613 | // register RPC request in remote RPC fifo |
---|
1614 | rpc_send( cxy , &rpc ); |
---|
1615 | |
---|
1616 | // get output argument from rpc descriptor |
---|
1617 | *vseg_xp = rpc.args[2]; |
---|
1618 | *error = (error_t)rpc.args[3]; |
---|
1619 | |
---|
1620 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
1621 | cycle = (uint32_t)hal_get_cycles(); |
---|
1622 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
1623 | printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n", |
---|
1624 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1625 | #endif |
---|
1626 | } |
---|
1627 | |
---|
1628 | ///////////////////////////////////////// |
---|
1629 | void rpc_vmm_get_vseg_server( xptr_t xp ) |
---|
1630 | { |
---|
1631 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
1632 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1633 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
1634 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1635 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1636 | #endif |
---|
1637 | |
---|
1638 | process_t * process; |
---|
1639 | intptr_t vaddr; |
---|
1640 | vseg_t * vseg_ptr; |
---|
1641 | xptr_t vseg_xp; |
---|
1642 | error_t error; |
---|
1643 | |
---|
1644 | // get client cluster identifier and pointer on RPC descriptor |
---|
1645 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1646 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1647 | |
---|
1648 | // get input argument from client RPC descriptor |
---|
1649 | process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1650 | vaddr = (intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1651 | |
---|
1652 | // call local kernel function |
---|
1653 | error = vmm_get_vseg( process , vaddr , &vseg_ptr ); |
---|
1654 | |
---|
1655 | // set output arguments to client RPC descriptor |
---|
1656 | vseg_xp = XPTR( local_cxy , vseg_ptr ); |
---|
1657 | hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp ); |
---|
1658 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); |
---|
1659 | |
---|
1660 | #if DEBUG_RPC_VMM_GET_VSEG |
---|
1661 | cycle = (uint32_t)hal_get_cycles(); |
---|
1662 | if( cycle > DEBUG_RPC_VMM_GET_VSEG ) |
---|
1663 | printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n", |
---|
1664 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1665 | #endif |
---|
1666 | } |
---|
1667 | |
---|
1668 | |
---|
1669 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1670 | // [21] Marshaling functions attached to RPC_VMM_GET_PTE (blocking) |
---|
1671 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1672 | |
---|
1673 | //////////////////////////////////////////// |
---|
1674 | void rpc_vmm_get_pte_client( cxy_t cxy, |
---|
1675 | process_t * process, // in |
---|
1676 | vpn_t vpn, // in |
---|
1677 | bool_t cow, // in |
---|
1678 | uint32_t * attr, // out |
---|
1679 | ppn_t * ppn, // out |
---|
1680 | error_t * error ) // out |
---|
1681 | { |
---|
1682 | #if DEBUG_RPC_VMM_GET_PTE |
---|
1683 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1684 | if( cycle > DEBUG_RPC_VMM_GET_PTE ) |
---|
1685 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1686 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1687 | #endif |
---|
1688 | |
---|
1689 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1690 | |
---|
1691 | // initialise RPC descriptor header |
---|
1692 | rpc_desc_t rpc; |
---|
1693 | rpc.index = RPC_VMM_GET_PTE; |
---|
1694 | rpc.blocking = true; |
---|
1695 | rpc.responses = 1; |
---|
1696 | |
---|
1697 | // set input arguments in RPC descriptor |
---|
1698 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
1699 | rpc.args[1] = (uint64_t)vpn; |
---|
1700 | rpc.args[2] = (uint64_t)cow; |
---|
1701 | |
---|
1702 | // register RPC request in remote RPC fifo |
---|
1703 | rpc_send( cxy , &rpc ); |
---|
1704 | |
---|
1705 | // get output argument from rpc descriptor |
---|
1706 | *attr = (uint32_t)rpc.args[3]; |
---|
1707 | *ppn = (ppn_t)rpc.args[4]; |
---|
1708 | *error = (error_t)rpc.args[5]; |
---|
1709 | |
---|
1710 | #if DEBUG_RPC_VMM_GET_PTE |
---|
1711 | cycle = (uint32_t)hal_get_cycles(); |
---|
1712 | if( cycle > DEBUG_RPC_VMM_GET_PTE ) |
---|
1713 | printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n", |
---|
1714 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1715 | #endif |
---|
1716 | } |
---|
1717 | |
---|
1718 | //////////////////////////////////////// |
---|
1719 | void rpc_vmm_get_pte_server( xptr_t xp ) |
---|
1720 | { |
---|
1721 | #if DEBUG_RPC_VMM_GET_PTE |
---|
1722 | uint32_t cycle = (uint32_t)hal_get_cycles(); |
---|
1723 | if( cycle > DEBUG_RPC_VMM_GET_PTE ) |
---|
1724 | printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", |
---|
1725 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1726 | #endif |
---|
1727 | |
---|
1728 | process_t * process; |
---|
1729 | vpn_t vpn; |
---|
1730 | bool_t cow; |
---|
1731 | uint32_t attr; |
---|
1732 | ppn_t ppn; |
---|
1733 | error_t error; |
---|
1734 | |
---|
1735 | // get client cluster identifier and pointer on RPC descriptor |
---|
1736 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1737 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1738 | |
---|
1739 | // get input argument "process" & "vpn" from client RPC descriptor |
---|
1740 | process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1741 | vpn = (vpn_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1742 | cow = (bool_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); |
---|
1743 | |
---|
1744 | // call local kernel function |
---|
1745 | error = vmm_get_pte( process , vpn , cow , &attr , &ppn ); |
---|
1746 | |
---|
1747 | // set output argument "attr" & "ppn" to client RPC descriptor |
---|
1748 | hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)attr ); |
---|
1749 | hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)ppn ); |
---|
1750 | hal_remote_swd( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error ); |
---|
1751 | |
---|
1752 | #if DEBUG_RPC_VMM_GET_PTE |
---|
1753 | cycle = (uint32_t)hal_get_cycles(); |
---|
1754 | if( cycle > DEBUG_RPC_VMM_GET_PTE ) |
---|
1755 | printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n", |
---|
1756 | __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); |
---|
1757 | #endif |
---|
1758 | } |
---|
1759 | |
---|
1760 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1761 | // [22] Marshaling functions attached to RPC_KCM_ALLOC (blocking) |
---|
1762 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1763 | |
---|
1764 | ////////////////////////////////////////// |
---|
1765 | void rpc_kcm_alloc_client( cxy_t cxy, |
---|
1766 | uint32_t kmem_type, // in |
---|
1767 | xptr_t * buf_xp ) // out |
---|
1768 | { |
---|
1769 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1770 | |
---|
1771 | // initialise RPC descriptor header |
---|
1772 | rpc_desc_t rpc; |
---|
1773 | rpc.index = RPC_KCM_ALLOC; |
---|
1774 | rpc.blocking = true; |
---|
1775 | rpc.responses = 1; |
---|
1776 | |
---|
1777 | // set input arguments in RPC descriptor |
---|
1778 | rpc.args[0] = (uint64_t)kmem_type; |
---|
1779 | |
---|
1780 | // register RPC request in remote RPC fifo |
---|
1781 | rpc_send( cxy , &rpc ); |
---|
1782 | |
---|
1783 | // get output arguments from RPC descriptor |
---|
1784 | *buf_xp = (xptr_t)rpc.args[1]; |
---|
1785 | |
---|
1786 | } |
---|
1787 | |
---|
1788 | ////////////////////////////////////// |
---|
1789 | void rpc_kcm_alloc_server( xptr_t xp ) |
---|
1790 | { |
---|
1791 | // get client cluster identifier and pointer on RPC descriptor |
---|
1792 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1793 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1794 | |
---|
1795 | // get input argument "kmem_type" from client RPC descriptor |
---|
1796 | uint32_t kmem_type = (uint32_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1797 | |
---|
1798 | // allocates memory for kcm |
---|
1799 | kmem_req_t req; |
---|
1800 | req.type = kmem_type; |
---|
1801 | req.flags = AF_ZERO; |
---|
1802 | void * buf_ptr = kmem_alloc( &req ); |
---|
1803 | |
---|
1804 | // set output argument |
---|
1805 | xptr_t buf_xp = XPTR( local_cxy , buf_ptr ); |
---|
1806 | hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp ); |
---|
1807 | |
---|
1808 | } |
---|
1809 | |
---|
1810 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1811 | // [23] Marshaling functions attached to RPC_KCM_FREE (blocking) |
---|
1812 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1813 | |
---|
1814 | ///////////////////////////////////////// |
---|
1815 | void rpc_kcm_free_client( cxy_t cxy, |
---|
1816 | void * buf, // in |
---|
1817 | uint32_t kmem_type ) // in |
---|
1818 | { |
---|
1819 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1820 | |
---|
1821 | // initialise RPC descriptor header |
---|
1822 | rpc_desc_t rpc; |
---|
1823 | rpc.index = RPC_KCM_FREE; |
---|
1824 | rpc.blocking = true; |
---|
1825 | rpc.responses = 1; |
---|
1826 | |
---|
1827 | // set input arguments in RPC descriptor |
---|
1828 | rpc.args[0] = (uint64_t)(intptr_t)buf; |
---|
1829 | rpc.args[1] = (uint64_t)kmem_type; |
---|
1830 | |
---|
1831 | // register RPC request in remote RPC fifo |
---|
1832 | rpc_send( cxy , &rpc ); |
---|
1833 | |
---|
1834 | } |
---|
1835 | |
---|
1836 | ///////////////////////////////////// |
---|
1837 | void rpc_kcm_free_server( xptr_t xp ) |
---|
1838 | { |
---|
1839 | // get client cluster identifier and pointer on RPC descriptor |
---|
1840 | cxy_t client_cxy = GET_CXY( xp ); |
---|
1841 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1842 | |
---|
1843 | // get input arguments "buf" and "kmem_type" from client RPC descriptor |
---|
1844 | void * buf = (void *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1845 | uint32_t kmem_type = (uint32_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1846 | |
---|
1847 | // releases memory |
---|
1848 | kmem_req_t req; |
---|
1849 | req.type = kmem_type; |
---|
1850 | req.ptr = buf; |
---|
1851 | kmem_free( &req ); |
---|
1852 | |
---|
1853 | } |
---|
1854 | |
---|
1855 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1856 | // [24] Marshaling functions attached to RPC_MAPPER_MOVE_BUFFER |
---|
1857 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1858 | |
---|
1859 | /////////////////////////////////////////////////// |
---|
1860 | void rpc_mapper_move_buffer_client( cxy_t cxy, |
---|
1861 | mapper_t * mapper, // in |
---|
1862 | bool_t to_buffer, // in |
---|
1863 | bool_t is_user, // in |
---|
1864 | uint32_t file_offset, // in |
---|
1865 | uint64_t buffer, // in |
---|
1866 | uint32_t size, // in |
---|
1867 | error_t * error ) // out |
---|
1868 | { |
---|
1869 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1870 | |
---|
1871 | // initialise RPC descriptor header |
---|
1872 | rpc_desc_t rpc; |
---|
1873 | rpc.index = RPC_MAPPER_MOVE_BUFFER; |
---|
1874 | rpc.blocking = true; |
---|
1875 | rpc.responses = 1; |
---|
1876 | |
---|
1877 | // set input arguments in RPC descriptor |
---|
1878 | rpc.args[0] = (uint64_t)(intptr_t)mapper; |
---|
1879 | rpc.args[1] = (uint64_t)to_buffer; |
---|
1880 | rpc.args[2] = (uint64_t)is_user; |
---|
1881 | rpc.args[3] = (uint64_t)file_offset; |
---|
1882 | rpc.args[4] = (uint64_t)buffer; |
---|
1883 | rpc.args[5] = (uint64_t)size; |
---|
1884 | |
---|
1885 | // register RPC request in remote RPC fifo |
---|
1886 | rpc_send( cxy , &rpc ); |
---|
1887 | |
---|
1888 | // get output values from RPC descriptor |
---|
1889 | *error = (error_t)rpc.args[6]; |
---|
1890 | |
---|
1891 | } |
---|
1892 | |
---|
1893 | /////////////////////////////////////////////// |
---|
1894 | void rpc_mapper_move_buffer_server( xptr_t xp ) |
---|
1895 | { |
---|
1896 | mapper_t * mapper; |
---|
1897 | bool_t to_buffer; |
---|
1898 | bool_t is_user; |
---|
1899 | uint32_t file_offset; |
---|
1900 | void * user_buffer; |
---|
1901 | xptr_t kern_buffer; |
---|
1902 | uint32_t size; |
---|
1903 | error_t error; |
---|
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 arguments from client RPC descriptor |
---|
1910 | mapper = (mapper_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); |
---|
1911 | to_buffer = hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); |
---|
1912 | is_user = hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); |
---|
1913 | file_offset = hal_remote_lwd( XPTR( client_cxy , &desc->args[3] ) ); |
---|
1914 | size = hal_remote_lwd( XPTR( client_cxy , &desc->args[5] ) ); |
---|
1915 | |
---|
1916 | // call local kernel function |
---|
1917 | if( is_user ) |
---|
1918 | { |
---|
1919 | user_buffer = (void *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[4] ) ); |
---|
1920 | |
---|
1921 | error = mapper_move_user( mapper, |
---|
1922 | to_buffer, |
---|
1923 | file_offset, |
---|
1924 | user_buffer, |
---|
1925 | size ); |
---|
1926 | } |
---|
1927 | else |
---|
1928 | { |
---|
1929 | kern_buffer = (xptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[4] ) ); |
---|
1930 | |
---|
1931 | error = mapper_move_kernel( mapper, |
---|
1932 | to_buffer, |
---|
1933 | file_offset, |
---|
1934 | kern_buffer, |
---|
1935 | size ); |
---|
1936 | } |
---|
1937 | |
---|
1938 | // set output argument to client RPC descriptor |
---|
1939 | hal_remote_swd( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error ); |
---|
1940 | |
---|
1941 | } |
---|
1942 | |
---|
1943 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1944 | // [25] Marshaling functions attached to RPC_MAPPER_GET_PAGE (blocking) |
---|
1945 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1946 | |
---|
1947 | /////////////////////////////////////////////////////// |
---|
1948 | void rpc_mapper_get_page_client( cxy_t cxy, |
---|
1949 | struct mapper_s * mapper, // in |
---|
1950 | uint32_t index, // in |
---|
1951 | page_t ** page ) // out |
---|
1952 | { |
---|
1953 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
1954 | |
---|
1955 | // initialise RPC descriptor header |
---|
1956 | rpc_desc_t rpc; |
---|
1957 | rpc.index = RPC_MAPPER_GET_PAGE; |
---|
1958 | rpc.blocking = true; |
---|
1959 | rpc.responses = 1; |
---|
1960 | |
---|
1961 | // set input arguments in RPC descriptor |
---|
1962 | rpc.args[0] = (uint64_t)(intptr_t)mapper; |
---|
1963 | rpc.args[1] = (uint64_t)index; |
---|
1964 | |
---|
1965 | // register RPC request in remote RPC fifo |
---|
1966 | rpc_send( cxy , &rpc ); |
---|
1967 | |
---|
1968 | // get output values from RPC descriptor |
---|
1969 | *page = (page_t *)(intptr_t)rpc.args[2]; |
---|
1970 | |
---|
1971 | } |
---|
1972 | |
---|
1973 | //////////////////////////////////////////// |
---|
1974 | void rpc_mapper_get_page_server( xptr_t xp ) |
---|
1975 | { |
---|
1976 | // get client cluster identifier and pointer on RPC descriptor |
---|
1977 | cxy_t cxy = GET_CXY( xp ); |
---|
1978 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
1979 | |
---|
1980 | // get input arguments from client RPC descriptor |
---|
1981 | mapper_t * mapper = (mapper_t *)(intptr_t)hal_remote_lwd( XPTR( cxy , &desc->args[0] ) ); |
---|
1982 | uint32_t index = (uint32_t) hal_remote_lwd( XPTR( cxy , &desc->args[1] ) ); |
---|
1983 | |
---|
1984 | // call local pmem allocator |
---|
1985 | page_t * page = mapper_get_page( mapper , index ); |
---|
1986 | |
---|
1987 | // set output arguments into client RPC descriptor |
---|
1988 | hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); |
---|
1989 | |
---|
1990 | } |
---|
1991 | |
---|
1992 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1993 | // [26] Marshaling functions attached to RPC_VMM_CREATE_VSEG (blocking) |
---|
1994 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
1995 | |
---|
1996 | //////////////////////////////////////////////////////// |
---|
1997 | void rpc_vmm_create_vseg_client( cxy_t cxy, |
---|
1998 | struct process_s * process, |
---|
1999 | vseg_type_t type, |
---|
2000 | intptr_t base, |
---|
2001 | uint32_t size, |
---|
2002 | uint32_t file_offset, |
---|
2003 | uint32_t file_size, |
---|
2004 | xptr_t mapper_xp, |
---|
2005 | cxy_t vseg_cxy, |
---|
2006 | struct vseg_s ** vseg ) |
---|
2007 | { |
---|
2008 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
2009 | |
---|
2010 | // initialise RPC descriptor header |
---|
2011 | rpc_desc_t rpc; |
---|
2012 | rpc.index = RPC_VMM_CREATE_VSEG; |
---|
2013 | rpc.blocking = true; |
---|
2014 | rpc.responses = 1; |
---|
2015 | |
---|
2016 | // set input arguments in RPC descriptor |
---|
2017 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
2018 | rpc.args[1] = (uint64_t)type; |
---|
2019 | rpc.args[2] = (uint64_t)base; |
---|
2020 | rpc.args[3] = (uint64_t)size; |
---|
2021 | rpc.args[4] = (uint64_t)file_offset; |
---|
2022 | rpc.args[5] = (uint64_t)file_size; |
---|
2023 | rpc.args[6] = (uint64_t)mapper_xp; |
---|
2024 | rpc.args[7] = (uint64_t)vseg_cxy; |
---|
2025 | |
---|
2026 | // register RPC request in remote RPC fifo |
---|
2027 | rpc_send( cxy , &rpc ); |
---|
2028 | |
---|
2029 | // get output values from RPC descriptor |
---|
2030 | *vseg = (vseg_t *)(intptr_t)rpc.args[8]; |
---|
2031 | |
---|
2032 | } |
---|
2033 | |
---|
2034 | //////////////////////////////////////////// |
---|
2035 | void rpc_vmm_create_vseg_server( xptr_t xp ) |
---|
2036 | { |
---|
2037 | // get client cluster identifier and pointer on RPC descriptor |
---|
2038 | cxy_t cxy = GET_CXY( xp ); |
---|
2039 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
2040 | |
---|
2041 | // get input arguments from client RPC descriptor |
---|
2042 | process_t * process = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0])); |
---|
2043 | vseg_type_t type = (vseg_type_t)(uint32_t)hal_remote_lwd( XPTR(cxy , &desc->args[1])); |
---|
2044 | intptr_t base = (intptr_t) hal_remote_lwd( XPTR(cxy , &desc->args[2])); |
---|
2045 | uint32_t size = (uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[3])); |
---|
2046 | uint32_t file_offset = (uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[4])); |
---|
2047 | uint32_t file_size = (uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[5])); |
---|
2048 | xptr_t mapper_xp = (xptr_t) hal_remote_lwd( XPTR(cxy , &desc->args[6])); |
---|
2049 | cxy_t vseg_cxy = (cxy_t)(uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[7])); |
---|
2050 | |
---|
2051 | // call local kernel function |
---|
2052 | vseg_t * vseg = vmm_create_vseg( process, |
---|
2053 | type, |
---|
2054 | base, |
---|
2055 | size, |
---|
2056 | file_offset, |
---|
2057 | file_size, |
---|
2058 | mapper_xp, |
---|
2059 | vseg_cxy ); |
---|
2060 | |
---|
2061 | // set output arguments into client RPC descriptor |
---|
2062 | hal_remote_swd( XPTR( cxy , &desc->args[8] ) , (uint64_t)(intptr_t)vseg ); |
---|
2063 | |
---|
2064 | } |
---|
2065 | |
---|
2066 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
2067 | // [27] undefined slot |
---|
2068 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
2069 | |
---|
2070 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
2071 | // [28] Marshaling functions attached to RPC_VMM_SET_COW (blocking) |
---|
2072 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
2073 | |
---|
2074 | ///////////////////////////////////////////// |
---|
2075 | void rpc_vmm_set_cow_client( cxy_t cxy, |
---|
2076 | process_t * process ) |
---|
2077 | { |
---|
2078 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
2079 | |
---|
2080 | // initialise RPC descriptor header |
---|
2081 | rpc_desc_t rpc; |
---|
2082 | rpc.index = RPC_VMM_SET_COW; |
---|
2083 | rpc.blocking = true; |
---|
2084 | rpc.responses = 1; |
---|
2085 | |
---|
2086 | // set input arguments in RPC descriptor |
---|
2087 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
2088 | |
---|
2089 | // register RPC request in remote RPC fifo |
---|
2090 | rpc_send( cxy , &rpc ); |
---|
2091 | |
---|
2092 | } |
---|
2093 | |
---|
2094 | //////////////////////////////////////// |
---|
2095 | void rpc_vmm_set_cow_server( xptr_t xp ) |
---|
2096 | { |
---|
2097 | process_t * process; |
---|
2098 | |
---|
2099 | // get client cluster identifier and pointer on RPC descriptor |
---|
2100 | cxy_t cxy = GET_CXY( xp ); |
---|
2101 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
2102 | |
---|
2103 | // get input arguments from client RPC descriptor |
---|
2104 | process = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0])); |
---|
2105 | |
---|
2106 | // call local kernel function |
---|
2107 | vmm_set_cow( process ); |
---|
2108 | |
---|
2109 | } |
---|
2110 | |
---|
2111 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
2112 | // [29] Marshaling functions attached to RPC_VMM_DISPLAY (blocking) |
---|
2113 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
2114 | |
---|
2115 | ///////////////////////////////////////////// |
---|
2116 | void rpc_vmm_display_client( cxy_t cxy, |
---|
2117 | process_t * process, |
---|
2118 | bool_t detailed ) |
---|
2119 | { |
---|
2120 | assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); |
---|
2121 | |
---|
2122 | // initialise RPC descriptor header |
---|
2123 | rpc_desc_t rpc; |
---|
2124 | rpc.index = RPC_VMM_DISPLAY; |
---|
2125 | rpc.blocking = true; |
---|
2126 | rpc.responses = 1; |
---|
2127 | |
---|
2128 | // set input arguments in RPC descriptor |
---|
2129 | rpc.args[0] = (uint64_t)(intptr_t)process; |
---|
2130 | rpc.args[1] = (uint64_t)detailed; |
---|
2131 | |
---|
2132 | // register RPC request in remote RPC fifo |
---|
2133 | rpc_send( cxy , &rpc ); |
---|
2134 | |
---|
2135 | } |
---|
2136 | |
---|
2137 | //////////////////////////////////////// |
---|
2138 | void rpc_vmm_display_server( xptr_t xp ) |
---|
2139 | { |
---|
2140 | process_t * process; |
---|
2141 | bool_t detailed; |
---|
2142 | |
---|
2143 | // get client cluster identifier and pointer on RPC descriptor |
---|
2144 | cxy_t cxy = GET_CXY( xp ); |
---|
2145 | rpc_desc_t * desc = GET_PTR( xp ); |
---|
2146 | |
---|
2147 | // get input arguments from client RPC descriptor |
---|
2148 | process = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0])); |
---|
2149 | detailed = (bool_t) hal_remote_lwd( XPTR(cxy , &desc->args[1])); |
---|
2150 | |
---|
2151 | // call local kernel function |
---|
2152 | vmm_display( process , detailed ); |
---|
2153 | |
---|
2154 | } |
---|
2155 | |
---|
2156 | |
---|