Changeset 611 for trunk/kernel/mm/vmm.h


Ignore:
Timestamp:
Jan 9, 2019, 3:02:51 PM (3 years ago)
Author:
alain
Message:

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/vmm.h

    r610 r611  
    3838
    3939struct process_s;
     40struct vseg_s;
    4041
    4142/*********************************************************************************************
    4243 * This structure defines the STACK allocator used by the VMM to dynamically handle
    43  * a STACK vseg requested or released by an user process.
    44  * This allocator handles a fixed size array of fixed size slots in the STACK zone.
     44 * vseg allocation or release requests for an user thread.
     45 * This allocator handles a fixed size array of fixed size slots in STACK zone of user space.
    4546 * The stack size and the number of slots are defined by the CONFIG_VMM_STACK_SIZE, and
    4647 * CONFIG_VMM_STACK_BASE parameters.
    47  * Each slot can contain one user stack vseg. The first page in the slot is not allocated
    48  * to detect stack overflow.
     48 * Each slot can contain one user stack vseg. The first 4 Kbytes page in the slot is not
     49 * mapped to detect stack overflow.
    4950 * The slot index can be computed form the slot base address, and reversely.
    5051 * All allocation / release operations are registered in the stack_bitmap, that completely
    51  * define the STACK zone state.
     52 * define the STACK zone status.
    5253 ********************************************************************************************/
    5354
     
    159160
    160161/*********************************************************************************************
    161  * This function adds a vseg descriptor in the VSL of a given VMM,
    162  * and updates the vmm field in the vseg descriptor.
    163  * It takes the lock protecting VSL.
    164  *********************************************************************************************
    165  * @ vmm       : pointer on the VMM
    166  * @ vseg      : pointer on the vseg descriptor
    167  ********************************************************************************************/
    168 void vmm_vseg_attach( struct vmm_s  * vmm,
    169                       vseg_t        * vseg );
    170 
    171 /*********************************************************************************************
    172  * This function removes a vseg descriptor from the set of vsegs controlled by a given VMM,
    173  * and updates the vmm field in the vseg descriptor. No memory is released.
    174  * It takes the lock protecting VSL.
    175  *********************************************************************************************
    176  * @ vmm       : pointer on the VMM
    177  * @ vseg      : pointer on the vseg descriptor
    178  ********************************************************************************************/
    179 void vmm_vseg_detach( struct vmm_s  * vmm,
    180                       vseg_t        * vseg );
    181 
    182 /*********************************************************************************************
    183162 * This function is called by the process_make_fork() function. It partially copies
    184163 * the content of a remote parent process VMM to the local child process VMM:
     
    235214
    236215/*********************************************************************************************
    237  * This function unmaps from the local GPT all mapped PTEs of a vseg identified by the
    238  * <process> and <vseg> arguments. It can be used for any type of vseg.
    239  * If this function is executed in the reference cluster, it handles for each referenced
    240  * physical pages the pending forks counter :
    241  * - if counter is non-zero, it decrements it.
    242  * - if counter is zero, it releases the physical page to local kmem allocator.
    243  *********************************************************************************************
    244  * @ process  : pointer on process descriptor.
    245  * @ vseg     : pointer on the vseg to be unmapped.
    246  ********************************************************************************************/
    247 void vmm_unmap_vseg( struct process_s * process,
    248                      vseg_t           * vseg );
    249 
    250 /*********************************************************************************************
    251216 * This function deletes, in the local cluster, all vsegs registered in the VSL
    252217 * of the process identified by the <process> argument. For each vseg:
     
    254219 * - it removes the vseg from the local VSL.
    255220 * - it releases the memory allocated to the local vseg descriptors.
    256  * Finally, it releases the memory allocated to the GPT itself.
     221 * - it releases the memory allocated to the GPT itself.
    257222 *********************************************************************************************
    258223 * @ process   : pointer on process descriptor.
     
    304269
    305270/*********************************************************************************************
    306  * This function removes a vseg identified by it's pointer from the VMM of the calling process.
    307  * - If the vseg has not the STACK or MMAP type, it is removed from the vsegs list,
    308  *   and the physical memory allocated to vseg descriptor is released to KMEM.
    309  * - If the vseg has the STACK type, it is removed from the vsegs list, the physical memory
    310  *   allocated to vseg descriptor is released to KMEM, and the stack slot is returned to the
    311  *   VMM STACK allocator.
    312  * - If the vseg has the MMAP type, it is removed from the vsegs list and is registered
    313  *   in the zombi_list of the VMM MMAP allocator for future reuse. The physical memory
    314  *   allocated to vseg descriptor is NOT released to KMEM.
    315  *********************************************************************************************
    316  * @ vseg      : pointer on vseg to be removed.
    317  ********************************************************************************************/
    318 void vmm_remove_vseg( vseg_t * vseg );
     271 * This function removes from the local VMM of a process descriptor identified by the <pid>
     272 * argument a local vseg identified by its base address <vaddr> in user space.
     273 * It can be used for any type of vseg, but must be called by a local thread.
     274 * Use the RPC_VMM_DELETE_VSEG if the client thread is not local.
     275 * It does nothing if the process is not registered in the local cluster.
     276 * It does nothing if the vseg is not registered in the local process VSL.
     277 * - It removes from the local GPT all registered PTEs. If it is executed in the reference
     278 *   cluster, it releases the referenced physical pages, to the relevant kmem allocator,
     279 *   depending on vseg type and the pending forks counter.
     280 * - It removes the vseg from the local VSL, and release the vseg descriptor if not MMAP.
     281 *********************************************************************************************
     282 * @ process  : process identifier.
     283 * @ vaddr    : vseg base address in user space.
     284 ********************************************************************************************/
     285void vmm_delete_vseg( pid_t    pid,
     286                      intptr_t vaddr );
     287
     288/*********************************************************************************************
     289 * This function insert a new <vseg> descriptor in the VSL identifed by the <vmm> argument.
     290 * and updates the vmm field in the vseg descriptor.
     291 * It takes the lock protecting VSL.
     292 *********************************************************************************************
     293 * @ vmm       : local pointer on local VMM.
     294 * @ vseg      : local pointer on local vseg descriptor.
     295 ********************************************************************************************/
     296void vmm_attach_vseg_to_vsl( vmm_t  * vmm,
     297                             vseg_t * vseg );
     298
     299/*********************************************************************************************
     300 * This function removes a vseg identified by the <vseg> argument from the local VSL
     301 * identified by the <vmm> argument and release the memory allocated to vseg descriptor,
     302 * for all vseg types, BUT the MMAP type (i.e. ANON or REMOTE).
     303 * - If the vseg has not the STACK or MMAP type, it is simply removed from the VSL,
     304 *   and vseg descriptor is released.
     305 * - If the vseg has the STACK type, it is removed from VSL, vseg descriptor is released,
     306 *   and the stack slot is returned to the local VMM_STACK allocator.
     307 * - If the vseg has the MMAP type, it is removed from VSL and is registered in zombi_list
     308 *   of the VMM_MMAP allocator for future reuse. The vseg descriptor is NOT released.
     309 *********************************************************************************************
     310 * @ vmm       : local pointer on local VMM.
     311 * @ vseg      : local pointer on local vseg to be removed.
     312 ********************************************************************************************/
     313void vmm_detach_vseg_from_vsl( vmm_t  * vmm,
     314                               vseg_t * vseg );
    319315
    320316/*********************************************************************************************
     
    338334
    339335/*********************************************************************************************
     336 * This low-level function scan the local VSL in <vmm> to find the unique vseg containing
     337 * a given virtual address <vaddr>.
     338 * It is called by the vmm_get_vseg(), vmm_get_pte(), and vmm_resize_vseg() functions.
     339 *********************************************************************************************
     340 * @ vmm     : pointer on the process VMM.
     341 * @ vaddr   : virtual address.
     342 * @ return vseg pointer if success / return NULL if not found.
     343 ********************************************************************************************/
     344struct vseg_s * vmm_vseg_from_vaddr( vmm_t    * vmm,
     345                                     intptr_t   vaddr );
     346
     347/*********************************************************************************************
    340348 * This function checks that a given virtual address is contained in a registered vseg.
    341349 * It can be called by any thread running in any cluster:
     
    344352 *   register it in local VMM and returns the local vseg pointer, if success.
    345353 * - it returns an user error if the vseg is missing in the reference VMM, or if there is
    346  *   not enough memory for a new vseg descriptor in cluster containing the calling thread.
     354 *   not enough memory for a new vseg descriptor in the calling thread cluster.
    347355 *********************************************************************************************
    348356 * @ process   : [in] pointer on process descriptor
     
    350358 * @ vseg      : [out] local pointer on local vseg
    351359 * @ returns 0 if success / returns -1 if user error (out of segment).
    352  *********************************************************************************************/
     360 ********************************************************************************************/
    353361error_t vmm_get_vseg( struct process_s  * process,
    354362                      intptr_t            vaddr,
Note: See TracChangeset for help on using the changeset viewer.