Pyro Private Functions
|
Functions | |
void | list_areas (MemContext_s *psCtx) |
Prints all areas in the specified memory context to the debug console. More... | |
void | empty_mem_context (MemContext_s *psCtx) |
Deletes all areas in the specified memory context. More... | |
void | delete_mem_context (MemContext_s *psCtx) |
Deletes the specified memory context and all of its areas. More... | |
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. More... | |
MemContext_s * | clone_mem_context (MemContext_s *psOrig) |
Clones the specified memory context. More... | |
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. More... | |
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). More... | |
status_t | update_inactive_ctx (MemArea_s *psOriginalArea, area_id hCloneArea, uintptr_t nOffset) |
status_t | msync (uint32 nAddr, size_t nLen, int nFlags) |
Write dirty pages back to the file backing the area. More... | |
void | init_kernel_mem_context () |
Creates the memory context for the kernel. More... | |
void | init_areas (void) |
Initializes the area manager. More... | |
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.
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.
psOrig | a pointer to the memory context to clone. |
Copies a page-table entry, optionally setting up copy-on-write semantics.
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.
psCtx | a pointer to the MemContext_s to delete. |
void empty_mem_context | ( | MemContext_s * | psCtx | ) |
Deletes all areas in the specified memory context.
psCtx | a pointer to the MemContext_s containing areas to delete. |
void init_areas | ( | void | ) |
Initializes the area manager.
void init_kernel_mem_context | ( | void | ) |
Creates the memory context for the kernel.
This context holds all kernel areas below AREA_FIRST_USER_ADDRESS.
void list_areas | ( | MemContext_s * | psCtx | ) |
Prints all areas in the specified memory context to the debug console.
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.
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 msync | ( | uint32 | nAddr, |
size_t | nLen, | ||
int | nFlags | ||
) |
Write dirty pages back to the file backing the area.
nAddr | start address of the area to write. |
nLen | size of the area to write. |
nFlags | flags |
EINVAL
if the area handle is invalid, 0
otherwise. status_t update_inactive_ctx | ( | MemArea_s * | psOriginalArea, |
area_id | hCloneArea, | ||
uintptr_t | nOffset | ||
) |