Changeset 406 for trunk/kernel/mm/vmm.h
- Timestamp:
- Aug 29, 2017, 12:03:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.h
r401 r406 30 30 #include <bits.h> 31 31 #include <list.h> 32 #include <grdxt.h>33 32 #include <spinlock.h> 34 33 #include <hal_gpt.h> … … 92 91 * This structure defines the Virtual Memory Manager for a given process in a given cluster. 93 92 * This local VMM provides three main services: 94 * 1) It registers all vsegs statically or dynamically defined in the vseg list, 95 * and in the associated radix-tree. 96 * 2) It allocates virtual memory space for the STACKS and MMAP vsegs, 97 * using dedicated allocators. 93 * 1) It registers all vsegs statically or dynamically defined in the vseg list. 94 * 2) It allocates virtual memory space for the STACKS and MMAP vsegs. 98 95 * 3) It contains the local copy of the generic page table descriptor. 99 96 ********************************************************************************************/ … … 104 101 list_entry_t vsegs_root; /*! all vsegs in same process and same cluster */ 105 102 uint32_t vsegs_nr; /*! total number of local vsegs */ 106 grdxt_t grdxt; /*! embedded generic vsegs radix tree (key is vpn) */107 103 108 104 gpt_t gpt; /*! embedded generic page table descriptor */ … … 144 140 145 141 /********************************************************************************************* 146 * This function initialises the virtual memory manager attached to a process. 147 * - It initializes the VSL (list of vsegs and associated radix tree). 148 * - It initializes the generic page table (empty). 142 * This function initialises the virtual memory manager attached to an user process. 143 * - It registers the "kentry", "args", "envs" and "heap" vsegs in the vsegs list. 144 * The "code" and "data" vsegs are registered by the elf_load_process() function, 145 * the "stack" vsegs are registered by the thread_user_create() function, and the 146 * "mmap" vsegs are dynamically created by syscalls. 147 * - It initializes the generic page table, calling the HAL specific hal_gpt_init() function. 148 * For TSAR it map all pages for the "kentry" vseg, that must be identity mapping. 149 149 * - It initializes the STAK and MMAP allocators. 150 * - It registers the "kentry", "args", "envs" and "heap" vsegs in the vsegs list. 151 * Any error in this function gives a kernel panic. 150 * TODO : Any error in this function gives a kernel panic => improve error handling. 152 151 ********************************************************************************************* 153 152 * @ process : pointer on process descriptor … … 249 248 * (a) if the region is not entirely mapped in an existing vseg, it's an error. 250 249 * (b) if the region has same base and size as an existing vseg, the vseg is removed. 251 * (c) if the removed region cut the vseg in two parts, it is removed and re-created.252 * (d) if the removed region cut the vseg in three parts, it is removed, and two are created.253 * TODO : cases (c) and (d) are not implemented [AG]250 * (c) if the removed region cut the vseg in two parts, it is modified. 251 * (d) if the removed region cut the vseg in three parts, it is modified, and a new 252 * vseg is created with same type. 254 253 ********************************************************************************************* 255 254 * @ process : pointer on process descriptor … … 267 266 * - if the vseg is missing in local VMM, it uses a RPC to get it from the reference cluster, 268 267 * register it in local VMM and returns the local vseg pointer, if success. 269 * - if the vseg is missing in reference VMM, it returns an user error. 270 * It creates a kernel panic if there is not enough memory to create a new vseg descriptor 271 * in the cluster containing the calling thread. 268 * - it returns an user error if the vseg is missing in the reference VMM, or if there is 269 * not enough memory for a new vseg descriptor in cluster containing the calling thread. 272 270 ********************************************************************************************* 273 271 * @ process : [in] pointer on process descriptor … … 320 318 * Depending on the vseg type, defined by the <vseg> argument, it returns the PPN 321 319 * (Physical Page Number) associated to a missing page defined by the <vpn> argument. 322 * - For the VSEG_TYPE_FILE, it returns the physical page from the file mapper. 323 * For all other types, it allocates a new physical page from the cluster defined 324 * by the <vseg->cxy> field, or by the <vpn> MSB bits for a distributed vseg. 325 * - For the VSEG_TYPE_CODE and VSEG_TYPE_DATA types, the allocated page is initialized 326 * from the .elf file mapper. For others vseg types it is not initialised. 320 * - For the FILE type, it returns directly the physical page from the file mapper. 321 * - For the CODE and DATA types, it allocates a new phsical page from the cluster defined 322 * by the <vseg->cxy> field, or by the <vpn> MSB bits for a distributed vseg, 323 * and initialize this page from the .elf file mapper. 324 * - For all other types, it allocates a new physical page from the cluster defined 325 * by the <vseg->cxy> field, or by the <vpn> MSB bits for a distributed vseg, 326 * but the new page is not initialized. 327 327 ********************************************************************************************* 328 328 * @ vseg : local pointer on vseg containing the mising page.
Note: See TracChangeset
for help on using the changeset viewer.