Changeset 18 for trunk/kernel/mm/vmm.h
- Timestamp:
- Jun 3, 2017, 4:42:49 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.h
r1 r18 5 5 * Mohamed Lamine Karaoui (2015) 6 6 * Alain Greiner (2016) 7 * 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites 9 9 * … … 50 50 * The slot index can be computed form the slot base address, and reversely. 51 51 * All allocation / release operations are registered in the stack_bitmap, that completely 52 * define the STACK zone state. 52 * define the STACK zone state. 53 53 * In this implementation, the max number of slots is 32. 54 54 ********************************************************************************************/ … … 65 65 * This structure defines the MMAP allocator used by the VMM to dynamically allocate 66 66 * MMAP vsegs requested or released by an user process. 67 * This allocator s ould be only used in the reference cluster.68 * - allocation policy : all allocated vsegs occupy an integer number of pages that is 67 * This allocator should be only used in the reference cluster. 68 * - allocation policy : all allocated vsegs occupy an integer number of pages that is 69 69 * power of 2, and are aligned on a page boundary. The requested number of pages is 70 * rounded if req ired. The first_free_vpn variable defines completely the MMAP zone state.70 * rounded if required. The first_free_vpn variable defines completely the MMAP zone state. 71 71 * It is never decremented, as the released vsegs are simply registered in a zombi_list. 72 * The relevant zombi_list is checked first for each allocation request. 72 * The relevant zombi_list is checked first for each allocation request. 73 73 * - release policy : a released MMAP vseg is registered in an array of zombi_lists. 74 74 * This array is indexed by ln(number of pages), and each entry contains the root of … … 95 95 * and in the associated radix-tree. 96 96 * 2) It allocates virtual memory space for the STACKS and MMAP vsegs, 97 * using dedicated allocators. 97 * using dedicated allocators. 98 98 * 3) It contains the local copy of the generic page table descriptor. 99 99 ********************************************************************************************/ … … 136 136 typedef struct mmap_attr_s 137 137 { 138 void * addr; /*! requested virtual address (unused : should be NULL) */ 138 void * addr; /*! requested virtual address (unused : should be NULL) */ 139 139 uint32_t length; /*! requested vseg size (bytes) */ 140 140 uint32_t prot; /*! access modes */ … … 159 159 /********************************************************************************************* 160 160 * This function removes all vsegs registered in in a virtual memory manager, 161 * and releases the memory allocated to the local generic page table. 161 * and releases the memory allocated to the local generic page table. 162 162 ********************************************************************************************* 163 163 * @ vmm : pointer on process descriptor. … … 166 166 167 167 /********************************************************************************************* 168 * This function scan the list of vsegs registered in the VMM of a given process descriptor168 * This function scans the list of vsegs registered in the VMM of a given process descriptor 169 169 * to check if a given virtual region (defined by a base and size) overlap an existing vseg. 170 170 ********************************************************************************************* … … 179 179 180 180 /********************************************************************************************* 181 * This function allocates memory for a vseg descriptor, initialises it, and register it 181 * This function allocates memory for a vseg descriptor, initialises it, and register it 182 182 * in the VMM of the process. It checks the collision with pre-existing vsegs in VMM. 183 183 * For STACK and MMAP types vseg, it does not use the base argument, but uses the VMM STACK 184 184 * and MMAP specific allocators to get a base address in virtual space. 185 * To comply with the "on-demand" paging policy, this function does NOT mo fify the185 * To comply with the "on-demand" paging policy, this function does NOT modify the 186 186 * page table, and does not allocate physical memory for vseg data. 187 187 ********************************************************************************************* … … 193 193 ********************************************************************************************/ 194 194 vseg_t * vmm_create_vseg( struct process_s * process, 195 intptr_t base, 196 intptr_t size, 195 intptr_t base, 196 intptr_t size, 197 197 uint32_t type ); 198 198 199 199 /********************************************************************************************* 200 * Th s function removes a vseg identified by it's pointer from the VMM of the calling process.200 * This function removes a vseg identified by it's pointer from the VMM of the calling process. 201 201 * - If the vseg has not the STACK or MMAP type, it is removed from the vsegs list, 202 202 * and the physical memory allocated to vseg descriptor is released to KMEM. … … 213 213 214 214 /********************************************************************************************* 215 * This function allocates physical memory from the local cluster to map all PTEs 215 * This function allocates physical memory from the local cluster to map all PTEs 216 216 * of a "kernel" vseg (type KCODE , KDATA, or KDEV) in the page table of process_zero. 217 * It should not be used for other vseg types, because "user" vsegs use the 217 * It should not be used for other vseg types, because "user" vsegs use the 218 218 * "on-demand-paging" policy. 219 219 ********************************************************************************************* … … 226 226 227 227 /********************************************************************************************* 228 * This function unmap all PTEs of a given vseg, in the generic page table asociated228 * This function unmaps all PTEs of a given vseg, in the generic page table associated 229 229 * to a given process descriptor, and releases the corresponding physical memory. 230 230 * It can be used for any type of vseg. … … 237 237 238 238 /********************************************************************************************* 239 * This function remove a given region (defined by a base address and a size) from239 * This function removes a given region (defined by a base address and a size) from 240 240 * the VMM of a given process descriptor. This can modify several vsegs: 241 241 * (a) if the region is not entirely mapped in an existing vseg, it's an error. … … 254 254 255 255 /********************************************************************************************* 256 * This function search if a given virtual address is contained in a vseg registered in256 * This function searches if a given virtual address is contained in a vseg registered in 257 257 * the local process VMM and returns the vseg pointer if success. 258 258 ********************************************************************************************* … … 265 265 266 266 /********************************************************************************************* 267 * This function is called by the architecture specific exception handler when a 268 * page fault has been detected in a given cluster. 267 * This function is called by the architecture specific exception handler when a 268 * page fault has been detected in a given cluster. 269 269 * If the local cluster is not the reference cluster, it send a RPC_VMM_GET_PTE 270 270 * to the reference cluster to get the missing PTE attributes and PPN, and update … … 279 279 error_t vmm_handle_page_fault( struct process_s * process, 280 280 vseg_t * vseg, 281 vpn_t vpn ); 281 vpn_t vpn ); 282 282 283 283 /********************************************************************************************* 284 284 * This function returns in the "attr" and "ppn" arguments the PTE associated to a given 285 * VPN for a given process. This function must be called on the reference cluster. 285 * VPN for a given process. This function must be called on the reference cluster. 286 286 * To get the PTE from another cluster, use the RPC_VMM_GET_PTE. 287 287 * The vseg containing the searched VPN should be registered in the reference VMM. 288 288 * If the PTE in the reference page table is unmapped, this function allocates the missing 289 289 * physical page from the target cluster defined by the vseg type, and update the reference 290 * page table. It can call a RPC_PMEM_GET_PAGES to get the missing physical page, 290 * page table. It can call a RPC_PMEM_GET_PAGES to get the missing physical page, 291 291 * if the target cluster is not the reference cluster. 292 292 ********************************************************************************************* … … 303 303 304 304 /********************************************************************************************* 305 * This function makes the virtual to physical address translation, using the calling 306 * process page table. It uses identity mapping if required by the ident flag. 305 * This function makes the virtual to physical address translation, using the calling 306 * process page table. It uses identity mapping if required by the ident flag. 307 307 * This address translation is required to configure the devices 308 * that have a DMA capability, or to implement the software L2/L3 cache cohérence, 308 * that have a DMA capability, or to implement the software L2/L3 cache cohérence, 309 309 * using the MMC device synchronisation primitives. 310 310 * WARNING : the <ident> value must be defined by the CONFIG_KERNEL_IDENT parameter. … … 333 333 /********************************************************************************************* 334 334 ********************************************************************************************/ 335 int sys_sbrk( uint32_t current_heap_ptr, 335 int sys_sbrk( uint32_t current_heap_ptr, 336 336 uint32_t size ); 337 337 338 338 /********************************************************************************************* 339 339 ********************************************************************************************/ 340 error_t vmm_sbrk( vmm_t * vmm, 340 error_t vmm_sbrk( vmm_t * vmm, 341 341 uint32_t current, 342 342 uint32_t size ); … … 345 345 ********************************************************************************************/ 346 346 error_t vmm_madvise_migrate( vmm_t * vmm, 347 uint32_t start, 347 uint32_t start, 348 348 uint32_t len ); 349 349 … … 361 361 362 362 /********************************************************************************************* 363 * Hypothesis: the region is shared-anon, mapper list is rdlocked, page is locked 363 * Hypothesis: the region is shared-anon, mapper list is rdlocked, page is locked 364 364 ********************************************************************************************/ 365 365 error_t vmm_broadcast_inval( vseg_t * region, … … 368 368 369 369 /********************************************************************************************* 370 * Hypothesis: the region is shared-anon, mapper list is rdlocked, page is locked 370 * Hypothesis: the region is shared-anon, mapper list is rdlocked, page is locked 371 371 ********************************************************************************************/ 372 372 error_t vmm_migrate_shared_page_seq( vseg_t * region,
Note: See TracChangeset
for help on using the changeset viewer.