Functions | |
void | list_areas (MemContext_s *psCtx) |
Prints all areas in the specified memory context to the debug console. | |
void | empty_mem_context (MemContext_s *psCtx) |
Deletes all areas in the specified memory context. | |
void | delete_mem_context (MemContext_s *psCtx) |
Deletes the specified memory context and all of its areas. | |
status_t | clone_page_pte (pte_t *pDst, pte_t *pSrc, bool bCow) |
Copies a page-table entry, optionally setting up copy-on-write semantics. | |
MemContext_s * | clone_mem_context (MemContext_s *psOrig) |
Clones the specified memory context. | |
status_t | map_area_to_file (area_id hArea, File_s *psFile, flags_t nProtection __attribute__((unused)), off_t nOffset, size_t nSize) |
Maps the specified area onto a file. | |
area_id | clone_from_inactive_ctx (MemArea_s *psArea, uintptr_t nOffset, size_t nLength) |
clone_from_inactive_ctx() and update_inactive_ctx() are used to access an inactive address space / memory context (the associated process is not currently running, page directory is not loaded into CR3). | |
status_t | update_inactive_ctx (MemArea_s *psOriginalArea, area_id hCloneArea, uintptr_t nOffset) |
| |
void | init_kernel_mem_context () |
Creates the memory context for the kernel. | |
void | init_areas (void) |
Initializes the area manager. |
area_id clone_from_inactive_ctx | ( | MemArea_s * | psArea, | |
uintptr_t | nOffset, | |||
size_t | nLength | |||
) |
clone_from_inactive_ctx() and update_inactive_ctx() are used to access an inactive address space / memory context (the associated process is not currently running, page directory is not loaded into CR3).
clone_from_inactive_ctx() will create in kernel space a clone of (a part of) the specified area. If you have written to the cloned area, call update_inactive_ctx() to make sure that pages allocated by the copy-on-write mechanism are transfered to the originating memory context.
For internal use only.
psArea | a pointer to the area to clone. | |
nOffset | ||
nLength | specifies, together with nOffset, which part of the area is to be cloned. Both nOffset and nLength are expected to be page aligned. |
MemContext_s* clone_mem_context | ( | MemContext_s * | psOrig | ) |
Clones the specified memory context.
For internal use only.
psOrig | a pointer to the memory context to clone. |
status_t clone_page_pte | ( | pte_t * | pDst, | |
pte_t * | pSrc, | |||
bool | bCow | |||
) | [inline] |
Copies a page-table entry, optionally setting up copy-on-write semantics.
For internal use only.
pDst | a pointer to the destination page-table entry. | |
pSrc | a pointer to the source page-table entry. | |
bCow | true if the new virtual page should be set up for copy-on-write semantics; false to share the physical page. |
0
. void delete_mem_context | ( | MemContext_s * | psCtx | ) |
Deletes the specified memory context and all of its areas.
For internal use only.
psCtx | a pointer to the MemContext_s to delete. |
void empty_mem_context | ( | MemContext_s * | psCtx | ) |
Deletes all areas in the specified memory context.
For internal use only.
psCtx | a pointer to the MemContext_s containing areas to delete. |
void init_areas | ( | void | ) |
Initializes the area manager.
For internal use only.
void init_kernel_mem_context | ( | void | ) |
Creates the memory context for the kernel.
This context holds all kernel areas below AREA_FIRST_USER_ADDRESS.
For internal use only.
void list_areas | ( | MemContext_s * | psCtx | ) |
Prints all areas in the specified memory context to the debug console.
For internal use only.
psCtx | a pointer to the MemContext_s structure to print. |
status_t map_area_to_file | ( | area_id | hArea, | |
File_s * | psFile, | |||
flags_t nProtection | __attribute__((unused)), | |||
off_t | nOffset, | |||
size_t | nSize | |||
) |
Maps the specified area onto a file.
For internal use only.
hArea | a handle to the area to map to the file. | |
psFile | a pointer to the File_s to map the area onto. | |
nProtection | a protection bitmask containing any combination of: AREA_READ , AREA_WRITE , AREA_EXEC , AREA_KERNEL , and AREA_WRCOMB . | |
nOffset | the offset from the start of psFile to use for the first byte of the mapped region of the file. | |
nSize | the size of the new area in bytes. |
-EINVAL
if hArea is invalid or has no associated memory context; 0
otherwise. status_t update_inactive_ctx | ( | MemArea_s * | psOriginalArea, | |
area_id | hCloneArea, | |||
uintptr_t | nOffset | |||
) |