[Stormdos-develop] 22 dec 2004 - new memory management doc. - "memdoc.txt"
Status: Planning
Brought to you by:
exhu
From: Juras <yb...@tu...> - 2004-12-21 22:15:32
|
Hello stormdos-develop, Memory management in SD-32-C2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Designed by Yury Benesh 22 December, 2004 Virtual memory addressing is used where each process uses 4 GiB address space which doesn't correspond to equal physical addresses. A part of PAGE DIRECTORY describing PAGE TABLES for the first 2 GiB are copied among all address spaces/processes/applications. Next 2 GiBs are private to all processes. While the first 1 GiB of it is for application addresses ( EXEcutable image, heap, dynamic memory etc. ) and higher 1 GiB is for DLLs. Memory addresses are controled via linked lists which can occupy more memory when the allocated block is insufficient for adding new free memory region structure. A memory block is allocated and measured by 4 KiB pages. There's one global linked list for describing lowest 2 GiB ( also called system/kernel memory region ) - through these addresses all system structures and page tables are accessed. It is also can be used by drivers. There is a linked lists for each process/application to control its private memory region. There is also one global linked list to control free addresses in the upper memory for DLLs. The hierarchy: THE LOWEST LAYER OF THE MEMORY MANAGER -------------------------------------- - get physical page ( DOS, DMA, HIGH, ANY ) - fill the page directory - reserve pages ( bit 11 of table entries is used to mark non-present but reserved pages ) - alloc table - add/remove free blocks ( adds memory addresses to the global list of free 0..2 GiB addresses ) - set pages addr, flags THE MIDDLE/DRIVER LAYER ----------------------- - allocate/free ( DOS, DMA, HIGH, ANY) block of pages - returns ready virtual address - reserve tables and/or directory entries in the range of the kernel memory region for storing page tables in adjacent addresses ( removes addresses from the global list of free 0..2 GiB addresses ) - map physical page to linear ( involves allocation of physical pages for the reserved tables if needed ) THE TOP/APP LAYER ----------------- - allocate/free heap ( in 4 KiB ) - allocate/free block of bytes in the heap -- Best regards, Juras mailto:yb...@tu... |