[Stormdos-develop] mem.txt - memory management in SD-32
Status: Planning
Brought to you by:
exhu
From: Juras <yb...@tu...> - 2004-09-12 11:13:10
|
Hello stormdos-develop, New version: Memory management in SD-32 ~~~~~~~~~~~~~~~~~~~~~~~~~~ Designed with the usage of page translation mode of IA-32. 1) one list of free physical memory blocks - the lowest layer 2) one list [0, 80000000h) - shared addresses, "global memory" which points to the same physical addresses in address spaces of every context. This memory is allocated by the kernel for the kernel and drivers use (maps video memory, keep system structures and everything which must be accessed by the kernel being run withing the address space of a context...) 3) per application (application has threads which share the same address space) list of free virtual addresses in the range of [80000000h, C0000000) - memory used by process (application), i.e. where the executable image is loaded and relocated. 4) one list of free virtual addresses in the range of [C0000000, FFFFFFFF] - addresses for DLLs. We need this region separated because when any application loads a DLL we must provide the ability for the rest of applications running or which will be run later to use the same addresses for the same DLL attached to a new process. Memory maps for 3) and 4) map their SHARED and READ-ONLY sections to the same physical addresses (like in MS Windows). FUNCTIONS ~~~~~~~~~ AllocPhysical - allocates only continuous blocks ReallocPhysical - reallocates only continuous blocks FreePhysical AllocVirtual - allocates only addresses (continuous) ReallocVirtual FreeVirtual MapAddresses - uses allocated page dir to map addresses to physical DisableAddresses - uses allocated page dir to mark pages as unpresent. AllocVirtualPhys - allocates physical memory and virtual addresses and modifies page directory. underlying physical memory may be fragmented. ReallocVirtualPhys - underlying physical memory may be fragmented FreeVirtualPhys -- Best regards, Juras mailto:yb...@tu... |