Pyro Private Functions
Functions
Pyro Internal Functions: Areas

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_sclone_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...
 

Detailed Description

Function Documentation

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.

Parameters
psAreaa pointer to the area to clone.
nOffset
nLengthspecifies, together with nOffset, which part of the area is to be cloned. Both nOffset and nLength are expected to be page aligned.
Author
Jan Hauffa (hauff.nosp@m.a@in.nosp@m..tum..nosp@m.de)
MemContext_s* clone_mem_context ( MemContext_s psOrig)

Clones the specified memory context.

Parameters
psOriga pointer to the memory context to clone.
Returns
a pointer to the new memory context.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
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.

Parameters
pDsta pointer to the destination page-table entry.
pSrca pointer to the source page-table entry.
bCowtrue if the new virtual page should be set up for copy-on-write semantics; false to share the physical page.
Returns
Always returns 0.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
void delete_mem_context ( MemContext_s psCtx)

Deletes the specified memory context and all of its areas.

Parameters
psCtxa pointer to the MemContext_s to delete.
See Also
delete_all_areas(), free_pages()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
void empty_mem_context ( MemContext_s psCtx)

Deletes all areas in the specified memory context.

Parameters
psCtxa pointer to the MemContext_s containing areas to delete.
See Also
delete_all_areas()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
void init_areas ( void  )

Initializes the area manager.

Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
void init_kernel_mem_context ( void  )

Creates the memory context for the kernel.

This context holds all kernel areas below AREA_FIRST_USER_ADDRESS.

Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
void list_areas ( MemContext_s psCtx)

Prints all areas in the specified memory context to the debug console.

Parameters
psCtxa pointer to the MemContext_s structure to print.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
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.

Parameters
hAreaa handle to the area to map to the file.
psFilea pointer to the File_s to map the area onto.
nProtectiona protection bitmask containing any combination of: AREA_READ, AREA_WRITE, AREA_EXEC, AREA_KERNEL, and AREA_WRCOMB.
nOffsetthe offset from the start of psFile to use for the first byte of the mapped region of the file.
nSizethe size of the new area in bytes.
Returns
-EINVAL if hArea is invalid or has no associated memory context; 0 otherwise.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
status_t msync ( uint32  nAddr,
size_t  nLen,
int  nFlags 
)

Write dirty pages back to the file backing the area.

Parameters
nAddrstart address of the area to write.
nLensize of the area to write.
nFlagsflags
Returns
EINVAL if the area handle is invalid, 0 otherwise.
Author
Kristian Van Der Vliet (vande.nosp@m.rs@l.nosp@m.iqwyd.nosp@m..com)
status_t update_inactive_ctx ( MemArea_s psOriginalArea,
area_id  hCloneArea,
uintptr_t  nOffset 
)