Changeset 611 for trunk/kernel/mm/vmm.h
- Timestamp:
- Jan 9, 2019, 3:02:51 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.h
r610 r611 38 38 39 39 struct process_s; 40 struct vseg_s; 40 41 41 42 /********************************************************************************************* 42 43 * 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. 45 46 * The stack size and the number of slots are defined by the CONFIG_VMM_STACK_SIZE, and 46 47 * CONFIG_VMM_STACK_BASE parameters. 47 * Each slot can contain one user stack vseg. The first page in the slot is not allocated48 * 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. 49 50 * The slot index can be computed form the slot base address, and reversely. 50 51 * All allocation / release operations are registered in the stack_bitmap, that completely 51 * define the STACK zone stat e.52 * define the STACK zone status. 52 53 ********************************************************************************************/ 53 54 … … 159 160 160 161 /********************************************************************************************* 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 VMM166 * @ vseg : pointer on the vseg descriptor167 ********************************************************************************************/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 VMM177 * @ vseg : pointer on the vseg descriptor178 ********************************************************************************************/179 void vmm_vseg_detach( struct vmm_s * vmm,180 vseg_t * vseg );181 182 /*********************************************************************************************183 162 * This function is called by the process_make_fork() function. It partially copies 184 163 * the content of a remote parent process VMM to the local child process VMM: … … 235 214 236 215 /********************************************************************************************* 237 * This function unmaps from the local GPT all mapped PTEs of a vseg identified by the238 * <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 referenced240 * 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 /*********************************************************************************************251 216 * This function deletes, in the local cluster, all vsegs registered in the VSL 252 217 * of the process identified by the <process> argument. For each vseg: … … 254 219 * - it removes the vseg from the local VSL. 255 220 * - 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. 257 222 ********************************************************************************************* 258 223 * @ process : pointer on process descriptor. … … 304 269 305 270 /********************************************************************************************* 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 ********************************************************************************************/ 285 void 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 ********************************************************************************************/ 296 void 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 ********************************************************************************************/ 313 void vmm_detach_vseg_from_vsl( vmm_t * vmm, 314 vseg_t * vseg ); 319 315 320 316 /********************************************************************************************* … … 338 334 339 335 /********************************************************************************************* 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 ********************************************************************************************/ 344 struct vseg_s * vmm_vseg_from_vaddr( vmm_t * vmm, 345 intptr_t vaddr ); 346 347 /********************************************************************************************* 340 348 * This function checks that a given virtual address is contained in a registered vseg. 341 349 * It can be called by any thread running in any cluster: … … 344 352 * register it in local VMM and returns the local vseg pointer, if success. 345 353 * - 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. 347 355 ********************************************************************************************* 348 356 * @ process : [in] pointer on process descriptor … … 350 358 * @ vseg : [out] local pointer on local vseg 351 359 * @ returns 0 if success / returns -1 if user error (out of segment). 352 ******************************************************************************************** */360 ********************************************************************************************/ 353 361 error_t vmm_get_vseg( struct process_s * process, 354 362 intptr_t vaddr,
Note: See TracChangeset
for help on using the changeset viewer.