source: trunk/kernel/kern/rpc.h @ 433

Last change on this file since 433 was 433, checked in by alain, 4 years ago

blip

File size: 36.6 KB
Line 
1/*
2 * rpc.h - RPC (Remote Procedure Call) operations definition.
3 *
4 * Author  Alain Greiner (2016,2017)
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#ifndef _RPC_H_
25#define _RPC_H_
26
27#include <kernel_config.h>
28#include <hal_types.h>
29#include <hal_atomic.h>
30#include <bits.h>
31#include <spinlock.h>
32#include <vseg.h>
33#include <remote_fifo.h>
34#include <signal.h>
35
36/**** Forward declarations ****/
37
38struct process_s;
39struct page_s;
40struct vseg_s;
41struct exec_info_s;
42struct pthread_attr_s;
43struct remote_sem_s;
44struct fragment_s;
45struct vfs_inode_s;
46struct vfs_dentry_s;
47struct vfs_file_s;
48struct thread_s;
49struct mapper_s;
50
51/**********************************************************************************/
52/**************  structures for Remote Procedure Calls ****************************/
53/**********************************************************************************/
54
55/***********************************************************************************
56 * This enum defines all RPC indexes.
57 * It must be consistent with the rpc_server[] array defined in in the rpc.c file.
58 **********************************************************************************/
59
60typedef enum
61{
62    RPC_PMEM_GET_PAGES         = 0,
63    RPC_PMEM_RELEASE_PAGES     = 1,
64    RPC_UNDEFINED_2            = 2,     
65    RPC_PROCESS_MAKE_FORK      = 3,
66    RPC_UNDEFINED_4            = 4,
67    RPC_PROCESS_MAKE_KILL      = 5,
68    RPC_THREAD_USER_CREATE     = 6,
69    RPC_THREAD_KERNEL_CREATE   = 7,
70    RPC_THREAD_KILL            = 8,
71    RPC_PROCESS_SIGACTION      = 9,
72
73    RPC_VFS_INODE_CREATE       = 10,
74    RPC_VFS_INODE_DESTROY      = 11,
75    RPC_VFS_DENTRY_CREATE      = 12,
76    RPC_VFS_DENTRY_DESTROY     = 13,
77    RPC_VFS_FILE_CREATE        = 14,
78    RPC_VFS_FILE_DESTROY       = 15,
79    RPC_VFS_INODE_LOAD         = 16,
80    RPC_VFS_MAPPER_LOAD_ALL    = 17,
81    RPC_FATFS_GET_CLUSTER      = 18,
82    RPC_UNDEFINED_19           = 19,
83
84    RPC_VMM_GET_VSEG           = 20,
85    RPC_VMM_GET_PTE            = 21,
86    RPC_KCM_ALLOC              = 22,
87    RPC_KCM_FREE               = 23,
88    RPC_MAPPER_MOVE_BUFFER     = 24,
89    RPC_MAPPER_GET_PAGE        = 25,
90    RPC_VMM_CREATE_VSEG        = 26,
91    RPC_SCHED_DISPLAY          = 27,
92    RPC_VMM_SET_COW            = 28,
93    RPC_VMM_DISPLAY            = 29,
94
95    RPC_MAX_INDEX              = 30,
96}
97rpc_index_t;
98
99/***********************************************************************************
100 * This defines the prototype of the rpc_server functions,
101 * defined by the rpc_server[] array in the rpc.c file.
102 **********************************************************************************/
103
104typedef  void (rpc_server_t) ( xptr_t xp );
105
106/***********************************************************************************
107 *  This structure defines the RPC descriptor
108 **********************************************************************************/
109
110typedef struct rpc_desc_s
111{
112        rpc_index_t         index;       /*! index of requested RPC service           */
113        volatile uint32_t   response;    /*! all responses received when 0            */
114    struct thread_s   * thread;      /*! local pointer on client thread           */
115    uint32_t            lid;         /*! index of core running the calling thread */ 
116    bool_t              blocking;    /*! blocking RPC when true                   */
117    uint64_t            args[10];    /*! input/output arguments buffer            */
118} 
119rpc_desc_t;
120
121/**********************************************************************************/
122/******* Generic functions supporting RPCs : client side **************************/
123/**********************************************************************************/
124
125/***********************************************************************************
126 * This function is executed by the client thread in the client cluster.
127 * It puts one RPC descriptor defined by the <desc> argument in the remote fifo
128 * defined by the <cxy> argument.  It sends an IPI to the server if fifo is empty.
129 * The RPC descriptor must be allocated in the caller's stack, and initialised by
130 * the caller. It exit with a Panic message if remote fifo is still full after
131 * (CONFIG_RPC_PUT_MAX_ITERATIONS) retries.
132 * - When the RPC <blocking> field is true, this function blocks and deschedule.
133 *   It returns only when the server acknowledges the RPC by writing in the RPC
134 *   "response" field, and unblocks the client.
135 * - When the <blocking> field is false, this function returns as soon as the RPC
136 *   has been registered in the FIFO, and the server thread must directly signal
137 *   completion to the client thread.
138 ***********************************************************************************
139 * @ cxy   : server cluster identifier
140 * @ desc  : local pointer on RPC descriptor in client cluster
141 **********************************************************************************/
142void rpc_send( cxy_t        cxy,   
143               rpc_desc_t * desc );
144
145
146
147/**********************************************************************************/
148/******* Generic functions supporting RPCs : server side **************************/
149/**********************************************************************************/
150
151/***********************************************************************************
152 * This function is the entry point for RPC handling on the server side.
153 * It is executed by a core receiving an IPI, and each time the core enters,
154 * or exit the kernel to handle .
155 * It does nothing and return if the RPC_FIFO is empty.
156 * The calling thread checks if it exist at least one non-blocked RPC thread,
157 * creates a new RPC if required, and deschedule to allow the RPC thead to execute.
158 **********************************************************************************/
159void rpc_check();
160
161/***********************************************************************************
162 * This function contains the loop to execute all pending RPCs on the server side.
163 * It is called by the rpc_thread_func() function with irq disabled, and after
164 * RPC_FIFO ownership acquisition.
165 ***********************************************************************************
166 * @ rpc_fifo  : pointer on the local RPC fifo
167 **********************************************************************************/
168void rpc_execute_all( remote_fifo_t * rpc_fifo );
169
170/***********************************************************************************
171 * This function contains the infinite loop executed by a RPC thread.
172 **********************************************************************************/
173void rpc_thread_func();
174
175/***********************************************************************************
176 * This function is executed in case of illegal RPC index.
177 **********************************************************************************/
178void __attribute__((noinline)) rpc_undefined();
179
180
181
182
183/**********************************************************************************/
184/******* Marshalling functions attached to the various RPCs ***********************/
185/**********************************************************************************/
186
187/***********************************************************************************
188 * [0] The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster,
189 * and returns the local pointer on the page descriptor.
190 ***********************************************************************************
191 * @ cxy     : server cluster identifier
192 * @ order   : [in]  ln2( number of requested pages )
193 * @ page    : [out] local pointer on page descriptor / NULL if failure
194 **********************************************************************************/
195void rpc_pmem_get_pages_client( cxy_t             cxy,
196                                uint32_t          order,
197                                struct page_s  ** page );
198
199void rpc_pmem_get_pages_server( xptr_t xp );
200
201/***********************************************************************************
202 * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster.
203 ***********************************************************************************
204 * @ cxy     : server cluster identifier
205 * @ page    : [in] local pointer on page descriptor to release.
206 **********************************************************************************/
207void rpc_pmem_release_pages_client( cxy_t            cxy,
208                                    struct page_s  * page );
209
210void rpc_pmem_release_pages_server( xptr_t xp );
211
212/***********************************************************************************
213 * [2] undefined slot
214 **********************************************************************************/
215
216/***********************************************************************************
217 * [3] The RPC_PROCESS_MAKE_FORK creates a "child" process descriptor, and the
218 * associated "child" thread descriptor in a target remote cluster that can be
219 * any cluster.  The child process is initialized from informations found in the
220 * "parent" process descriptor (that must be the parent reference cluster),
221 * and from the "parent" thread descriptor that can be in any cluster.
222 ***********************************************************************************
223 * @ cxy              : server cluster identifier.
224 * @ ref_process_xp   : [in]  extended pointer on reference parent process.
225 * @ parent_thread_xp : [in]  extended pointer on parent thread.
226 * @ child_pid        : [out] child process identifier.
227 * @ child_thread_ptr : [out] local pointer on child thread.
228 * @ error            : [out]  error status (0 if success).
229 **********************************************************************************/
230void rpc_process_make_fork_client( cxy_t              cxy,
231                                   xptr_t             ref_process_xp,
232                                   xptr_t             parent_thread_xp,
233                                   pid_t            * child_pid,
234                                   struct thread_s ** child_thread_ptr,
235                                   error_t          * error );
236
237void rpc_process_make_fork_server( xptr_t xp );
238
239/***********************************************************************************
240 * [4] undefined slot
241 **********************************************************************************/
242
243/***********************************************************************************
244 * [5] The RPC_PROCESS_MAKE_KILL can be called by any thread to request the owner
245 * cluster to execute the process_make_kill() function for a target process.
246 ***********************************************************************************
247 * @ cxy      : owner cluster identifier.
248 * @ process  : pointer on process in owner cluster.
249 * @ is_exit  : true if called by sys_exit() / false if called by sys_kill()
250 * @ status   : exit status (only when called by sys_exit()
251 **********************************************************************************/
252void rpc_process_make_kill_client( cxy_t              cxy,
253                                   struct process_s * process,
254                                   bool_t             is_exit,
255                                   uint32_t           status );
256
257void rpc_process_make_kill_server( xptr_t xp );
258
259/***********************************************************************************
260 * [6] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster,
261 * as specified by the arguments. It returns an extended pointer on the new
262 * thread descriptor in server cluster, and an error code.
263 * It is called by the sys_thread_create() system call.
264 ***********************************************************************************
265 * @ cxy       : server cluster identifier.
266 * @ attr      : [in]  local pointer on pthread_attr_t in client cluster.
267 * @ thread_xp : [out] buffer for thread extended pointer.
268 * @ error     : [out] error status (0 if success).
269 **********************************************************************************/
270void rpc_thread_user_create_client( cxy_t                   cxy,
271                                    pid_t                   pid,
272                                    void                  * start_func,
273                                    void                  * start_arg,
274                                    pthread_attr_t        * attr,
275                                    xptr_t                * thread_xp,
276                                    error_t               * error );
277
278void rpc_thread_user_create_server( xptr_t xp );
279
280/***********************************************************************************
281 * [7] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster,
282 * as specified by the type, func and args arguments. It returns the local pointer
283 * on the thread descriptor in server cluster and an error code.
284 * It is used by the dev_init() function to create the device server thread.
285 ***********************************************************************************
286 * @ cxy       : server cluster identifier.
287 * @ type      : [in]  type of kernel thread.
288 * @ func      : [in]  local pointer on thread function.
289 * @ args      : [in]  local pointer on function arguments.
290 * @ thread_xp : [out] pointer on buffer for thread extended pointer.
291 * @ error     : [out] error status (0 if success).
292 **********************************************************************************/
293void rpc_thread_kernel_create_client( cxy_t     cxy,
294                                      uint32_t  type,
295                                      void    * func,
296                                      void    * args,
297                                      xptr_t  * thread_xp,
298                                      error_t * error );
299
300void rpc_thread_kernel_create_server( xptr_t xp );
301
302/***********************************************************************************
303 * [8] The RPC_THREAD_KILL ask a target cluster to kill a given thread descriptor.
304 * It is called by the sys_thread_cancel() function for a remote thread.
305 ***********************************************************************************
306 * @ cxy       : server cluster identifier.
307 * @ thread   : [in]  local pointer on target process descriptor in server.
308 **********************************************************************************/
309void rpc_thread_kill_client( cxy_t              cxy,
310                             struct thread_s  * thread );
311                             
312void rpc_thread_kill_server( xptr_t xp );
313
314/***********************************************************************************
315 * [9] The RPC_PROCESS_SIGACTION allows the owner cluster to request any other
316 * cluster to execute a given sigaction (BLOCK / UNBLOCK / DELETE) for all threads
317 * of a given process.
318 *
319 * WARNING : It is implemented as a NON BLOCKING multicast RPC, that can be sent
320 * in parallel to all process copies. The rpc descriptor is allocated in the client
321 * thread stack by the process_sigaction() function. The various server threads
322 * must decrement the responses counter defined in the rsp descriptor, and the last
323 * server thread unblock the client thread that blocked (after sending all RPC
324 * requests) in the process_sigaction() function.
325 * - The first RPC argument is the sigaction type (BLOCK / UNBLOCK / DELETE).
326 * - The second RPC argument is the local pointer on target process.
327 ***********************************************************************************
328 * @ cxy       : server cluster identifier.
329 * @ rpc_ptr   : [in]  local pointer on rpc descriptor in client cluster.
330 **********************************************************************************/
331void rpc_process_sigaction_client( cxy_t        cxy,
332                                   rpc_desc_t * rpc_ptr );
333                             
334void rpc_process_sigaction_server( xptr_t xp );
335
336/***********************************************************************************
337 * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a
338 * remote cluster. The parent dentry must have been previously created.
339 * It returns an extended pointer on the created inode.
340 ***********************************************************************************
341 * @ cxy        :  server cluster identifier.
342 * @ dentry_xp  : [in]  extended pointer on parent dentry.
343 * @ fs_type    : [in]  file system type.
344 * @ inode_type : [in]  file system type.
345 * @ extend     : [in]  fs_type_specific inode extension.
346 * @ attr       : [in]  inode attributes.
347 * @ rights     : [in]  access rights
348 * @ uid        : [in]  user ID
349 * @ gid        : [in]  group ID
350 * @ inode_xp   : [out] buffer for extended pointer on created inode.
351 * @ error      : [out] error status (0 if success).
352 **********************************************************************************/
353void rpc_vfs_inode_create_client( cxy_t      cxy,
354                                  xptr_t     dentry_xp,
355                                  uint32_t   fs_type,
356                                  uint32_t   inode_type,
357                                  void     * extend,
358                                  uint32_t   attr,   
359                                  uint32_t   rights, 
360                                  uint32_t   uid,
361                                  uint32_t   gid,
362                                  xptr_t   * inode_xp,
363                                  error_t  * error );
364
365void rpc_vfs_inode_create_server( xptr_t xp );
366
367/***********************************************************************************
368 * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor
369 * and for the associated mapper in a remote cluster.
370 ***********************************************************************************
371 * @ cxy       :  server cluster identifier
372 * @ inode     : [in]  local pointer on inode.
373 **********************************************************************************/
374void rpc_vfs_inode_destroy_client( cxy_t                 cxy,
375                                   struct vfs_inode_s * inode );
376
377void rpc_vfs_inode_destroy_server( xptr_t xp );
378
379/***********************************************************************************
380 * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster.
381 * It returns an extended pointer on the created dentry.
382 ***********************************************************************************
383 * @ cxy        :  server cluster identifier
384 * @ type       : [in]  file system type.
385 * @ name       : [in]  directory entry name.
386 * @ parent     : [in]  local pointer on parent inode.
387 * @ dentry_xp  : [out] buffer for extended pointer on created dentry.
388 * @ error      : [out] error status (0 if success).
389 **********************************************************************************/
390void rpc_vfs_dentry_create_client( cxy_t                  cxy,
391                                   uint32_t               type,
392                                   char                 * name,   
393                                   struct vfs_inode_s   * parent,
394                                   xptr_t               * dentry_xp,
395                                   error_t              * error );
396
397void rpc_vfs_dentry_create_server( xptr_t xp );
398
399/***********************************************************************************
400 * [13] The RPC_VFS_DENTRY_DESTROY releases memory allocated for an dentry descriptor
401 * in a remote cluster.
402 ***********************************************************************************
403 * @ cxy       :  server cluster identifier
404 * @ dentry     : [in]  local pointer on dentry.
405 **********************************************************************************/
406void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
407                                    struct vfs_dentry_s * dentry );
408
409void rpc_vfs_dentry_destroy_server( xptr_t xp );
410
411/***********************************************************************************
412 * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster.
413 * It returns an extended pointer on the created file structure.
414 ***********************************************************************************
415 * @ cxy        :  server cluster identifier
416 * @ inode      : [in]  local pointer on parent inode.
417 * @ file_attr  : [in]  new file attributes.
418 * @ file_xp    : [out] buffer for extended pointer on created file.
419 * @ error      : [out] error status (0 if success).
420 **********************************************************************************/
421void rpc_vfs_file_create_client( cxy_t                  cxy,
422                                 struct vfs_inode_s   * inode,
423                                 uint32_t               file_attr,
424                                 xptr_t               * file_xp,
425                                 error_t              * error );
426
427void rpc_vfs_file_create_server( xptr_t xp );
428
429/***********************************************************************************
430 * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor
431 * in a remote cluster.
432 ***********************************************************************************
433 * @ cxy       :  server cluster identifier
434 * @ file       : [in]  local pointer on file.
435 **********************************************************************************/
436void rpc_vfs_file_destroy_client( cxy_t               cxy,
437                                  struct vfs_file_s * file );
438
439void rpc_vfs_file_destroy_server( xptr_t xp );
440
441/***********************************************************************************
442 * [16] The RPC_VFS_LOAD_INODE calls the vfs_inode_load() kernel function in a
443 * remote cluster containing a parent inode directory to scan the associated
444 * mapper, find a directory entry, identified by its name, and update the remote
445 * child inode.
446 ***********************************************************************************
447 * @ cxy            :  server cluster identifier
448 * @ parent_inode   : [in]  local pointer on parent inode.
449 * @ name           : [in]  local pointer on child name (in client cluster).
450 * @ child_inode_xp : [in]  extended pointer on child inode (in another cluster).
451 * @ error          : [out] error status (0 if success).
452 **********************************************************************************/
453void rpc_vfs_inode_load_client( cxy_t                cxy,
454                                struct vfs_inode_s * parent_inode,
455                                char               * name,
456                                xptr_t               child_inode_xp,
457                                error_t            * error );
458
459void rpc_vfs_inode_load_server( xptr_t xp );
460
461/***********************************************************************************
462 * [17] The RPC_VFS_MAPPER_LOAD_ALL calls the vfs_mapper_load_all() kernel function
463 * in a remote cluster containing an inode, to load all pages of the associated
464 * mapper from the file system on device.
465 ***********************************************************************************
466 * @ cxy     :  server cluster identifier
467 * @ inode   : [in]  local pointer on inode in server cluster.
468 * @ error   : [out] error status (0 if success).
469 **********************************************************************************/
470void rpc_vfs_mapper_load_all_client( cxy_t                cxy,
471                                     struct vfs_inode_s * inode,
472                                     error_t            * error );
473
474void rpc_vfs_mapper_load_all_server( xptr_t xp );
475
476/***********************************************************************************
477 * [18] The RPC_FATFS_GET_CLUSTER can be send by any thread running in a "client"
478 * cluster to scan the FAT mapper, stored in a remote "server" cluster, and get
479 * from the mapper the local pointer on a given page.
480 ***********************************************************************************
481 * @ cxy      : server cluster identifier.
482 * @ mapper   : [in]  local pointer on FAT mapper.
483 * @ first    : [in]  FATFS cluster index allocated to first page of file.
484 * @ page     : [in]  page index in file.
485 * @ cluster  : [out] local pointer on buffer for found FATFS cluster index.
486 * @ error    : [out] local pointer on buffer for error code (in client cluster).
487 **********************************************************************************/
488void rpc_fatfs_get_cluster_client( cxy_t             cxy,
489                                   struct mapper_s * mapper,
490                                   uint32_t          first,
491                                   uint32_t          page,
492                                   uint32_t        * cluster,
493                                   error_t         * error );   
494
495void rpc_fatfs_get_cluster_server( xptr_t xp );
496
497/***********************************************************************************
498 * [19] undefined slot
499 **********************************************************************************/
500
501/***********************************************************************************
502 * [20] The RPC_VMM_GET_VSEG returns an extended pointer
503 * on the vseg containing a given virtual address in a given process.
504 * The server cluster is supposed to be the reference cluster.
505 * It returns a non zero error value if no vseg has been founded.
506 ***********************************************************************************
507 * @ cxy     : server cluster identifier.
508 * @ process : [in]   pointer on process descriptor in server cluster.
509 * @ vaddr   : [in]   virtual address to be searched.
510 * @ vseg_xp : [out]  buffer for extended pointer on vseg in client cluster.
511 * @ error   : [out] local pointer on buffer for error code (in client cluster).
512 **********************************************************************************/
513void rpc_vmm_get_vseg_client( cxy_t              cxy,
514                              struct process_s * process,
515                              intptr_t           vaddr,
516                              xptr_t           * vseg_xp,
517                              error_t          * error );
518
519void rpc_vmm_get_vseg_server( xptr_t xp );
520
521/***********************************************************************************
522 * [21] The RPC_VMM_GET_PTE returns in the <ppn> and <attr> arguments the PTE value
523 * for a given <vpn> in a given <process> (page_fault or copy_on_write event).
524 * The server cluster is supposed to be the reference cluster, and the vseg
525 * containing the VPN must be registered in the reference VMM.
526 * It returns an error if physical memory cannot be allocated for the missing PTE2,
527 * or for the missing page itself.
528 ***********************************************************************************
529 * @ cxy     : server cluster identifier.
530 * @ process : [in]   pointer on process descriptor in server cluster.
531 * @ vaddr   : [in]   virtual address to be searched.
532 * @ cow     : [in]   "copy_on_write" event if true / "page_fault" event if false.
533 * @ attr    : [out]  address of buffer for attributes.
534 * @ ppn     : [out]  address of buffer for PPN.
535 * @ error   : [out]  address of buffer for error code.
536 **********************************************************************************/
537void rpc_vmm_get_pte_client( cxy_t              cxy,
538                             struct process_s * process,
539                             vpn_t              vpn,
540                             bool_t             cow,
541                             uint32_t         * attr,
542                             ppn_t            * ppn,
543                             error_t          * error );
544
545void rpc_vmm_get_pte_server( xptr_t xp );
546
547/***********************************************************************************
548 * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster,
549 * and returns an extended pointer on the allocated object.
550  It returns XPTR_NULL if physical memory cannot be allocated.
551 ***********************************************************************************
552 * @ cxy       : server cluster identifier.
553 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
554 * @ buf_xp    : [out] buffer for extended pointer on allocated buffer.
555 **********************************************************************************/
556void rpc_kcm_alloc_client( cxy_t      cxy,
557                           uint32_t   kmem_type,
558                           xptr_t   * buf_xp ); 
559
560void rpc_kcm_alloc_server( xptr_t xp );
561
562/***********************************************************************************
563 * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type,
564 * in a remote cluster.
565 ***********************************************************************************
566 * @ cxy       : server cluster identifier.
567 * @ buf       : [in] local pointer on allocated buffer.
568 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
569 **********************************************************************************/
570void rpc_kcm_free_client( cxy_t     cxy,
571                          void    * buf,
572                          uint32_t  kmem_type );
573
574void rpc_kcm_free_server( xptr_t xp );
575
576/***********************************************************************************
577 * [24] The RPC_MAPPER_MOVE_BUFFER allows a client thread to require a remote
578 * mapper to move data to/from a kernel or user buffer.
579 * - It calls the mapper_move_user() function for a - possibly distributed -
580 *   user buffer identified by a user-space pointer, and casted to uint64_t.
581 * - It calls the mapper_move_kernel() function for a - possibly remote -
582 *   kernel buffer identified by an extended pointer, and casted to uint64_t.
583 * It is used by the vfs_move_user() function to move data between a mapper
584 * and an user buffer required by a sys_read() or a sys_write().
585 * It is used by the vmm_get_one_ppn() function to initialise a physical page
586 * from a .elf file mapper, for a CODE or DATA vseg page fault.
587 ***********************************************************************************
588 * @ cxy         : server cluster identifier.
589 * @ mapper      : [in]  local pointer on mapper
590 * @ to_buffer   : [in]  move data from mapper to buffer if non zero.
591 * @ is_user     : [in]  buffer in user space if true
592 * @ file_offset : [in]  first byte to move in mapper
593 * @ buffer      : [in]  user space pointer / kernel extended pointer
594 * @ size        : [in]  number of bytes to move
595 * @ error       : [out] error status (0 if success).
596 **********************************************************************************/
597void rpc_mapper_move_buffer_client( cxy_t             cxy,
598                                    struct mapper_s * mapper,
599                                    bool_t            to_buffer,
600                                    bool_t            is_user,
601                                    uint32_t          file_offset,
602                                    uint64_t          buffer,
603                                    uint32_t          size,
604                                    error_t         * error );
605
606void rpc_mapper_move_buffer_server( xptr_t xp );
607
608/***********************************************************************************
609 * [25] The RPC_MAPPER_GET_PAGE allows a client thread to get the local pointer
610 * on a remote page descriptor, for a page, identified by the page index in mapper.
611 * It is used by the vmm_get_one_ppn() function to handle a page fault on
612 * a FILE type vseg.
613 ***********************************************************************************
614 * @ cxy         : server cluster identifier.
615 * @ mapper      : [in]  local pointer on mapper.
616 * @ index       : [in]  page index in mapper.
617 * @ page        : [out] local pointer on page descriptor / NULL if failure.
618 **********************************************************************************/
619void rpc_mapper_get_page_client( cxy_t             cxy,
620                                 struct mapper_s * mapper,
621                                 uint32_t          index,
622                                 struct page_s  ** page );
623
624void rpc_mapper_get_page_server( xptr_t xp );
625
626/***********************************************************************************
627 * [26] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote
628 * reference cluster of a given process to allocate and register in the reference
629 * process VMM a new vseg descriptor.
630 * On the server side, this RPC uses the vmm_create_vseg() function, and returns
631 * to the client the local pointer on the created vseg descriptor.
632 ***********************************************************************************
633 * @ cxy         : server cluster identifier.
634 * @ process     : [in]  local pointer on process descriptor in server.
635 * @ type        : [in]  vseg type.
636 * @ base        : [in]  base address (unused for dynamically allocated vsegs).
637 * @ size        : [in]  number of bytes.
638 * @ file_offset : [in]  offset in file (for CODE, DATA, FILE types).
639 * @ file_size   : [in]  can be smaller than size for DATA type.
640 * @ mapper_xp   : [in]  extended pointer on mapper (for CODE, DATA, FILE types).
641 * @ vseg_cxy    : [in]  target cluster for mapping (if not data type).
642 * @ vseg        : [out] local pointer on vseg descriptor / NULL if failure.
643 **********************************************************************************/
644void rpc_vmm_create_vseg_client( cxy_t              cxy,
645                                 struct process_s * process,
646                                 vseg_type_t        type,
647                                 intptr_t           base,
648                                 uint32_t           size,
649                                 uint32_t           file_offset,
650                                 uint32_t           file_size,
651                                 xptr_t             mapper_xp,
652                                 cxy_t              vseg_cxy,
653                                 struct vseg_s   ** vseg );
654
655void rpc_vmm_create_vseg_server( xptr_t xp );
656
657/***********************************************************************************
658 * [27] The RPC_SCHED_DISPLAY allows a client thread to request the display
659 * of a remote scheduler, identified by the <lid> argument.
660 ***********************************************************************************
661 * @ cxy         : server cluster identifier.
662 * @ lid         : [in]  local index of target core in client cluster.
663 **********************************************************************************/
664void rpc_sched_display_client( cxy_t              cxy,
665                               lid_t              lid );
666
667void rpc_sched_display_server( xptr_t xp );
668
669/***********************************************************************************
670 * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference
671 * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for
672 * the DATA, MMAP and REMOTE vsegs of process identified by the <process> argument.
673
674 * of a remote scheduler, identified by the <lid> argument.
675 ***********************************************************************************
676 * @ cxy         : server cluster identifier.
677 * @ process     : [in]  local pointer on reference process descriptor.
678 **********************************************************************************/
679void rpc_vmm_set_cow_client( cxy_t              cxy,
680                             struct process_s * process );
681
682void rpc_vmm_set_cow_server( xptr_t xp );
683
684/***********************************************************************************
685 * [29] The RPC_VMM_DISPLAY allows any client thread to display the VMM state
686 * of a remote reference process identified by the <cxy> and <process> arguments.
687 * The type of display is defined by the <detailed> boolean argument.
688 ***********************************************************************************
689 * @ cxy         : server cluster identifier.
690 * @ process     : [in]  local pointer on reference process descriptor.
691 * @ detailed    : [in]  detailed display if true.
692 **********************************************************************************/
693void rpc_vmm_display_client( cxy_t              cxy,
694                             struct process_s * process,
695                             bool_t             detailed );
696
697void rpc_vmm_display_server( xptr_t xp );
698
699
700#endif
Note: See TracBrowser for help on using the repository browser.