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

Last change on this file since 569 was 564, checked in by alain, 6 years ago

Complete restructuration of kernel locks.

File size: 34.0 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,
[1]84    RPC_VMM_GET_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/***********************************************************************************
[564]151 * This function contains the infinite loop executed by a RPC thread,
152 * to handle all pending RPCs registered in the RPC fifo attached to a given core.
[1]153 **********************************************************************************/
[485]154void rpc_thread_func( void );
[1]155
156/***********************************************************************************
157 * This function is executed in case of illegal RPC index.
158 **********************************************************************************/
[503]159void __attribute__((noinline)) rpc_undefined( xptr_t xp __attribute__ ((unused)) );
[1]160
[23]161
162
[1]163/**********************************************************************************/
164/******* Marshalling functions attached to the various RPCs ***********************/
165/**********************************************************************************/
166
167/***********************************************************************************
[23]168 * [0] The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster,
[313]169 * and returns the local pointer on the page descriptor.
[1]170 ***********************************************************************************
171 * @ cxy     : server cluster identifier
172 * @ order   : [in]  ln2( number of requested pages )
[313]173 * @ page    : [out] local pointer on page descriptor / NULL if failure
[1]174 **********************************************************************************/
[313]175void rpc_pmem_get_pages_client( cxy_t             cxy,
176                                uint32_t          order,
177                                struct page_s  ** page );
[1]178
179void rpc_pmem_get_pages_server( xptr_t xp );
180
181/***********************************************************************************
[409]182 * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster.
183 ***********************************************************************************
184 * @ cxy     : server cluster identifier
185 * @ page    : [in] local pointer on page descriptor to release.
186 **********************************************************************************/
187void rpc_pmem_release_pages_client( cxy_t            cxy,
188                                    struct page_s  * page );
189
190void rpc_pmem_release_pages_server( xptr_t xp );
191
192/***********************************************************************************
[433]193 * [2] undefined slot
[1]194 **********************************************************************************/
195
196/***********************************************************************************
[409]197 * [3] The RPC_PROCESS_MAKE_FORK creates a "child" process descriptor, and the
[408]198 * associated "child" thread descriptor in a target remote cluster that can be
199 * any cluster.  The child process is initialized from informations found in the
200 * "parent" process descriptor (that must be the parent reference cluster),
201 * and from the "parent" thread descriptor that can be in any cluster.
[1]202 ***********************************************************************************
[408]203 * @ cxy              : server cluster identifier.
204 * @ ref_process_xp   : [in]  extended pointer on reference parent process.
205 * @ parent_thread_xp : [in]  extended pointer on parent thread.
206 * @ child_pid        : [out] child process identifier.
207 * @ child_thread_ptr : [out] local pointer on child thread.
208 * @ error            : [out]  error status (0 if success).
[1]209 **********************************************************************************/
[408]210void rpc_process_make_fork_client( cxy_t              cxy,
211                                   xptr_t             ref_process_xp,
212                                   xptr_t             parent_thread_xp,
213                                   pid_t            * child_pid,
214                                   struct thread_s ** child_thread_ptr,
215                                   error_t          * error );
[1]216
[408]217void rpc_process_make_fork_server( xptr_t xp );
[1]218
219/***********************************************************************************
[433]220 * [4] undefined slot
[1]221 **********************************************************************************/
222
223/***********************************************************************************
[435]224 * [5] undefined slot
[409]225 **********************************************************************************/
226
227/***********************************************************************************
228 * [6] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster,
[23]229 * as specified by the arguments. It returns an extended pointer on the new
230 * thread descriptor in server cluster, and an error code.
231 * It is called by the sys_thread_create() system call.
[1]232 ***********************************************************************************
233 * @ cxy       : server cluster identifier.
[407]234 * @ attr      : [in]  local pointer on pthread_attr_t in client cluster.
235 * @ thread_xp : [out] buffer for thread extended pointer.
[1]236 * @ error     : [out] error status (0 if success).
237 **********************************************************************************/
238void rpc_thread_user_create_client( cxy_t                   cxy,
[23]239                                    pid_t                   pid,
240                                    void                  * start_func,
241                                    void                  * start_arg,
[407]242                                    pthread_attr_t        * attr,
[1]243                                    xptr_t                * thread_xp,
244                                    error_t               * error );
245
246void rpc_thread_user_create_server( xptr_t xp );
247
248/***********************************************************************************
[409]249 * [7] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster,
[1]250 * as specified by the type, func and args arguments. It returns the local pointer
251 * on the thread descriptor in server cluster and an error code.
[23]252 * It is used by the dev_init() function to create the device server thread.
[1]253 ***********************************************************************************
254 * @ cxy       : server cluster identifier.
255 * @ type      : [in]  type of kernel thread.
256 * @ func      : [in]  local pointer on thread function.
257 * @ args      : [in]  local pointer on function arguments.
258 * @ thread_xp : [out] pointer on buffer for thread extended pointer.
259 * @ error     : [out] error status (0 if success).
260 **********************************************************************************/
261void rpc_thread_kernel_create_client( cxy_t     cxy,
262                                      uint32_t  type,
263                                      void    * func,
264                                      void    * args,
265                                      xptr_t  * thread_xp,
266                                      error_t * error );
267
268void rpc_thread_kernel_create_server( xptr_t xp );
269
[23]270/***********************************************************************************
[436]271 * [8] undefined slot
[23]272 **********************************************************************************/
273
[409]274/***********************************************************************************
[436]275 * [9] The RPC_PROCESS_SIGACTION allows a thread running in any cluster
276 * to request a cluster identified by the <cxy> argument (local or remote)
277 * to execute a given sigaction for a given cluster. The <action_type> and
278 * the <pid> arguments are defined in the shared RPC descriptor, that must be
279 * initialised by the client thread.
[409]280 *
281 * WARNING : It is implemented as a NON BLOCKING multicast RPC, that can be sent
[436]282 * in parallel to all process copies. The various RPC server threads atomically
283 * decrement the <response> field in the shared RPC descriptor.
284 * The last server thread unblock the client thread that blocked (after sending
285 * all RPC requests) in the process_sigaction() function.
[409]286 ***********************************************************************************
[436]287 * @ cxy     : server cluster identifier.
288 * @ rpc     : pointer on ishared RPC descriptor initialized by the client thread.
[409]289 **********************************************************************************/
[436]290void rpc_process_sigaction_client( cxy_t               cxy,
291                                   struct rpc_desc_s * rpc );
[409]292                             
293void rpc_process_sigaction_server( xptr_t xp );
294
[1]295/***********************************************************************************
[23]296 * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a
[1]297 * remote cluster. The parent dentry must have been previously created.
298 * It returns an extended pointer on the created inode.
299 ***********************************************************************************
[23]300 * @ cxy        :  server cluster identifier.
301 * @ dentry_xp  : [in]  extended pointer on parent dentry.
302 * @ fs_type    : [in]  file system type.
303 * @ inode_type : [in]  file system type.
[188]304 * @ extend     : [in]  fs_type_specific inode extension.
[23]305 * @ attr       : [in]  inode attributes.
306 * @ rights     : [in]  access rights
307 * @ uid        : [in]  user ID
308 * @ gid        : [in]  group ID
309 * @ inode_xp   : [out] buffer for extended pointer on created inode.
310 * @ error      : [out] error status (0 if success).
[1]311 **********************************************************************************/
312void rpc_vfs_inode_create_client( cxy_t      cxy,
313                                  xptr_t     dentry_xp,
[23]314                                  uint32_t   fs_type,
315                                  uint32_t   inode_type,
[188]316                                  void     * extend,
[1]317                                  uint32_t   attr,   
[23]318                                  uint32_t   rights, 
[1]319                                  uint32_t   uid,
320                                  uint32_t   gid,
321                                  xptr_t   * inode_xp,
322                                  error_t  * error );
323
324void rpc_vfs_inode_create_server( xptr_t xp );
325
326/***********************************************************************************
[23]327 * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor
[1]328 * and for the associated mapper in a remote cluster.
329 ***********************************************************************************
330 * @ cxy       :  server cluster identifier
331 * @ inode     : [in]  local pointer on inode.
[459]332 * @ error     : [out] error status (0 if success).
[1]333 **********************************************************************************/
334void rpc_vfs_inode_destroy_client( cxy_t                 cxy,
[459]335                                   struct vfs_inode_s * inode,
336                                   error_t            * error );
[1]337
338void rpc_vfs_inode_destroy_server( xptr_t xp );
339
340/***********************************************************************************
[23]341 * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster.
[1]342 * It returns an extended pointer on the created dentry.
343 ***********************************************************************************
344 * @ cxy        :  server cluster identifier
345 * @ type       : [in]  file system type.
346 * @ name       : [in]  directory entry name.
347 * @ parent     : [in]  local pointer on parent inode.
348 * @ dentry_xp  : [out] buffer for extended pointer on created dentry.
349 * @ error      : [out] error status (0 if success).
350 **********************************************************************************/
351void rpc_vfs_dentry_create_client( cxy_t                  cxy,
352                                   uint32_t               type,
353                                   char                 * name,   
354                                   struct vfs_inode_s   * parent,
355                                   xptr_t               * dentry_xp,
356                                   error_t              * error );
357
358void rpc_vfs_dentry_create_server( xptr_t xp );
359
360/***********************************************************************************
[459]361 * [13] The RPC_VFS_DENTRY_DESTROY remove a denfry from the parent inode XHTAB,
362 * and releases memory allocated for the dentry descriptor in a remote cluster.
[1]363 ***********************************************************************************
364 * @ cxy       :  server cluster identifier
365 * @ dentry     : [in]  local pointer on dentry.
[459]366 * @ error     : [out] error status (0 if success).
[1]367 **********************************************************************************/
368void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
[459]369                                    struct vfs_dentry_s * dentry,
370                                    error_t             * error );
[1]371
372void rpc_vfs_dentry_destroy_server( xptr_t xp );
373
[23]374/***********************************************************************************
375 * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster.
376 * It returns an extended pointer on the created file structure.
377 ***********************************************************************************
378 * @ cxy        :  server cluster identifier
379 * @ inode      : [in]  local pointer on parent inode.
380 * @ file_attr  : [in]  new file attributes.
381 * @ file_xp    : [out] buffer for extended pointer on created file.
382 * @ error      : [out] error status (0 if success).
383 **********************************************************************************/
384void rpc_vfs_file_create_client( cxy_t                  cxy,
385                                 struct vfs_inode_s   * inode,
386                                 uint32_t               file_attr,
387                                 xptr_t               * file_xp,
388                                 error_t              * error );
[1]389
[23]390void rpc_vfs_file_create_server( xptr_t xp );
[1]391
[23]392/***********************************************************************************
393 * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor
394 * in a remote cluster.
395 ***********************************************************************************
396 * @ cxy       :  server cluster identifier
397 * @ file       : [in]  local pointer on file.
398 **********************************************************************************/
399void rpc_vfs_file_destroy_client( cxy_t               cxy,
400                                  struct vfs_file_s * file );
[1]401
[23]402void rpc_vfs_file_destroy_server( xptr_t xp );
403
[238]404/***********************************************************************************
405 * [16] The RPC_VFS_LOAD_INODE calls the vfs_inode_load() kernel function in a
406 * remote cluster containing a parent inode directory to scan the associated
407 * mapper, find a directory entry, identified by its name, and update the remote
408 * child inode.
409 ***********************************************************************************
410 * @ cxy            :  server cluster identifier
411 * @ parent_inode   : [in]  local pointer on parent inode.
412 * @ name           : [in]  local pointer on child name (in client cluster).
413 * @ child_inode_xp : [in]  extended pointer on child inode (in another cluster).
414 * @ error          : [out] error status (0 if success).
415 **********************************************************************************/
416void rpc_vfs_inode_load_client( cxy_t                cxy,
417                                struct vfs_inode_s * parent_inode,
418                                char               * name,
419                                xptr_t               child_inode_xp,
420                                error_t            * error );
421
422void rpc_vfs_inode_load_server( xptr_t xp );
423
424/***********************************************************************************
425 * [17] The RPC_VFS_MAPPER_LOAD_ALL calls the vfs_mapper_load_all() kernel function
426 * in a remote cluster containing an inode, to load all pages of the associated
427 * mapper from the file system on device.
428 ***********************************************************************************
429 * @ cxy     :  server cluster identifier
430 * @ inode   : [in]  local pointer on inode in server cluster.
431 * @ error   : [out] error status (0 if success).
432 **********************************************************************************/
433void rpc_vfs_mapper_load_all_client( cxy_t                cxy,
434                                     struct vfs_inode_s * inode,
435                                     error_t            * error );
436
437void rpc_vfs_mapper_load_all_server( xptr_t xp );
438
[1]439/***********************************************************************************
[238]440 * [18] The RPC_FATFS_GET_CLUSTER can be send by any thread running in a "client"
[23]441 * cluster to scan the FAT mapper, stored in a remote "server" cluster, and get
442 * from the mapper the local pointer on a given page.
443 ***********************************************************************************
444 * @ cxy      : server cluster identifier.
445 * @ mapper   : [in]  local pointer on FAT mapper.
446 * @ first    : [in]  FATFS cluster index allocated to first page of file.
447 * @ page     : [in]  page index in file.
448 * @ cluster  : [out] local pointer on buffer for found FATFS cluster index.
449 * @ error    : [out] local pointer on buffer for error code (in client cluster).
450 **********************************************************************************/
451void rpc_fatfs_get_cluster_client( cxy_t             cxy,
452                                   struct mapper_s * mapper,
453                                   uint32_t          first,
454                                   uint32_t          page,
455                                   uint32_t        * cluster,
456                                   error_t         * error );   
457
458void rpc_fatfs_get_cluster_server( xptr_t xp );
459
460/***********************************************************************************
[433]461 * [19] undefined slot
462 **********************************************************************************/
463
464/***********************************************************************************
[389]465 * [20] The RPC_VMM_GET_VSEG returns an extended pointer
[1]466 * on the vseg containing a given virtual address in a given process.
467 * The server cluster is supposed to be the reference cluster.
[389]468 * It returns a non zero error value if no vseg has been founded.
[1]469 ***********************************************************************************
470 * @ cxy     : server cluster identifier.
471 * @ process : [in]   pointer on process descriptor in server cluster.
472 * @ vaddr   : [in]   virtual address to be searched.
[16]473 * @ vseg_xp : [out]  buffer for extended pointer on vseg in client cluster.
[389]474 * @ error   : [out] local pointer on buffer for error code (in client cluster).
[1]475 **********************************************************************************/
[389]476void rpc_vmm_get_vseg_client( cxy_t              cxy,
477                              struct process_s * process,
478                              intptr_t           vaddr,
479                              xptr_t           * vseg_xp,
[401]480                              error_t          * error );
[1]481
[389]482void rpc_vmm_get_vseg_server( xptr_t xp );
[1]483
484/***********************************************************************************
[407]485 * [21] The RPC_VMM_GET_PTE returns in the <ppn> and <attr> arguments the PTE value
486 * for a given <vpn> in a given <process> (page_fault or copy_on_write event).
[1]487 * The server cluster is supposed to be the reference cluster, and the vseg
488 * containing the VPN must be registered in the reference VMM.
[407]489 * It returns an error if physical memory cannot be allocated for the missing PTE2,
[1]490 * or for the missing page itself.
491 ***********************************************************************************
492 * @ cxy     : server cluster identifier.
493 * @ process : [in]   pointer on process descriptor in server cluster.
494 * @ vaddr   : [in]   virtual address to be searched.
[407]495 * @ cow     : [in]   "copy_on_write" event if true / "page_fault" event if false.
[1]496 * @ attr    : [out]  address of buffer for attributes.
497 * @ ppn     : [out]  address of buffer for PPN.
498 * @ error   : [out]  address of buffer for error code.
499 **********************************************************************************/
500void rpc_vmm_get_pte_client( cxy_t              cxy,
501                             struct process_s * process,
502                             vpn_t              vpn,
[407]503                             bool_t             cow,
[1]504                             uint32_t         * attr,
505                             ppn_t            * ppn,
506                             error_t          * error );
507
508void rpc_vmm_get_pte_server( xptr_t xp );
509
510/***********************************************************************************
[23]511 * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster,
512 * and returns an extended pointer on the allocated object.
513  It returns XPTR_NULL if physical memory cannot be allocated.
[1]514 ***********************************************************************************
[23]515 * @ cxy       : server cluster identifier.
516 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
517 * @ buf_xp    : [out] buffer for extended pointer on allocated buffer.
[1]518 **********************************************************************************/
[23]519void rpc_kcm_alloc_client( cxy_t      cxy,
520                           uint32_t   kmem_type,
521                           xptr_t   * buf_xp ); 
[1]522
[23]523void rpc_kcm_alloc_server( xptr_t xp );
[1]524
525/***********************************************************************************
[23]526 * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type,
[1]527 * in a remote cluster.
528 ***********************************************************************************
[23]529 * @ cxy       : server cluster identifier.
530 * @ buf       : [in] local pointer on allocated buffer.
531 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
[1]532 **********************************************************************************/
[23]533void rpc_kcm_free_client( cxy_t     cxy,
534                          void    * buf,
535                          uint32_t  kmem_type );
[1]536
[23]537void rpc_kcm_free_server( xptr_t xp );
[1]538
539/***********************************************************************************
[313]540 * [24] The RPC_MAPPER_MOVE_BUFFER allows a client thread to require a remote
541 * mapper to move data to/from a kernel or user buffer.
542 * - It calls the mapper_move_user() function for a - possibly distributed -
543 *   user buffer identified by a user-space pointer, and casted to uint64_t.
544 * - It calls the mapper_move_kernel() function for a - possibly remote -
545 *   kernel buffer identified by an extended pointer, and casted to uint64_t.
546 * It is used by the vfs_move_user() function to move data between a mapper
547 * and an user buffer required by a sys_read() or a sys_write().
548 * It is used by the vmm_get_one_ppn() function to initialise a physical page
549 * from a .elf file mapper, for a CODE or DATA vseg page fault.
[1]550 ***********************************************************************************
[23]551 * @ cxy         : server cluster identifier.
552 * @ mapper      : [in]  local pointer on mapper
[313]553 * @ to_buffer   : [in]  move data from mapper to buffer if non zero.
554 * @ is_user     : [in]  buffer in user space if true
[23]555 * @ file_offset : [in]  first byte to move in mapper
[313]556 * @ buffer      : [in]  user space pointer / kernel extended pointer
[23]557 * @ size        : [in]  number of bytes to move
558 * @ error       : [out] error status (0 if success).
[1]559 **********************************************************************************/
[265]560void rpc_mapper_move_buffer_client( cxy_t             cxy,
561                                    struct mapper_s * mapper,
562                                    bool_t            to_buffer,
563                                    bool_t            is_user,
564                                    uint32_t          file_offset,
[313]565                                    uint64_t          buffer,
[265]566                                    uint32_t          size,
567                                    error_t         * error );
[1]568
[265]569void rpc_mapper_move_buffer_server( xptr_t xp );
[1]570
[313]571/***********************************************************************************
572 * [25] The RPC_MAPPER_GET_PAGE allows a client thread to get the local pointer
573 * on a remote page descriptor, for a page, identified by the page index in mapper.
574 * It is used by the vmm_get_one_ppn() function to handle a page fault on
575 * a FILE type vseg.
576 ***********************************************************************************
577 * @ cxy         : server cluster identifier.
578 * @ mapper      : [in]  local pointer on mapper.
579 * @ index       : [in]  page index in mapper.
580 * @ page        : [out] local pointer on page descriptor / NULL if failure.
581 **********************************************************************************/
582void rpc_mapper_get_page_client( cxy_t             cxy,
583                                 struct mapper_s * mapper,
584                                 uint32_t          index,
585                                 struct page_s  ** page );
[1]586
[313]587void rpc_mapper_get_page_server( xptr_t xp );
[1]588
[407]589/***********************************************************************************
590 * [26] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote
591 * reference cluster of a given process to allocate and register in the reference
592 * process VMM a new vseg descriptor.
593 * On the server side, this RPC uses the vmm_create_vseg() function, and returns
594 * to the client the local pointer on the created vseg descriptor.
595 ***********************************************************************************
596 * @ cxy         : server cluster identifier.
597 * @ process     : [in]  local pointer on process descriptor in server.
598 * @ type        : [in]  vseg type.
599 * @ base        : [in]  base address (unused for dynamically allocated vsegs).
600 * @ size        : [in]  number of bytes.
601 * @ file_offset : [in]  offset in file (for CODE, DATA, FILE types).
602 * @ file_size   : [in]  can be smaller than size for DATA type.
603 * @ mapper_xp   : [in]  extended pointer on mapper (for CODE, DATA, FILE types).
604 * @ vseg_cxy    : [in]  target cluster for mapping (if not data type).
605 * @ vseg        : [out] local pointer on vseg descriptor / NULL if failure.
606 **********************************************************************************/
607void rpc_vmm_create_vseg_client( cxy_t              cxy,
608                                 struct process_s * process,
609                                 vseg_type_t        type,
610                                 intptr_t           base,
611                                 uint32_t           size,
612                                 uint32_t           file_offset,
613                                 uint32_t           file_size,
614                                 xptr_t             mapper_xp,
615                                 cxy_t              vseg_cxy,
616                                 struct vseg_s   ** vseg );
617
618void rpc_vmm_create_vseg_server( xptr_t xp );
619
620/***********************************************************************************
[450]621 * [27] undefined slot
[407]622 **********************************************************************************/
623
[408]624/***********************************************************************************
625 * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference
626 * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for
627 * the DATA, MMAP and REMOTE vsegs of process identified by the <process> argument.
628
629 * of a remote scheduler, identified by the <lid> argument.
630 ***********************************************************************************
631 * @ cxy         : server cluster identifier.
632 * @ process     : [in]  local pointer on reference process descriptor.
633 **********************************************************************************/
634void rpc_vmm_set_cow_client( cxy_t              cxy,
635                             struct process_s * process );
636
637void rpc_vmm_set_cow_server( xptr_t xp );
638
[428]639/***********************************************************************************
640 * [29] The RPC_VMM_DISPLAY allows any client thread to display the VMM state
641 * of a remote reference process identified by the <cxy> and <process> arguments.
642 * The type of display is defined by the <detailed> boolean argument.
643 ***********************************************************************************
644 * @ cxy         : server cluster identifier.
645 * @ process     : [in]  local pointer on reference process descriptor.
646 * @ detailed    : [in]  detailed display if true.
647 **********************************************************************************/
648void rpc_vmm_display_client( cxy_t              cxy,
649                             struct process_s * process,
650                             bool_t             detailed );
651
652void rpc_vmm_display_server( xptr_t xp );
653
654
[1]655#endif
Note: See TracBrowser for help on using the repository browser.