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

Last change on this file since 517 was 503, checked in by viala@…, 6 years ago

Add void type on function that takes no parameters, fix invalid call.

Fix invalid calls to thread_can_yield.

In file included from kern/chdev.c:29:
kern/chdev.c: In function 'chdev_sequencial_server':
kern/chdev.c:329:21: error: too many arguments to function 'thread_can_yield'

assert( thread_can_yield( server ) , "illegal sched_yield\n" );

~

Also fixed signature of mapper_create.

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