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

Last change on this file since 583 was 583, checked in by alain, 5 years ago

Improve signals.

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