-
Notifications
You must be signed in to change notification settings - Fork 62
KernelMemoryMap
See physalloc.c
Has two parts on ia32 - one is used to allocate low 1mb memory and used in a very special situations like in KernelVM86 support code. Main one allocates RAM which is not statically assigned to kernel image (everything above it). Allocation is in page size increments.
This allocator is used by kernel heap allocator to replentish heap, and directly by users which need page-aligned RAM (for phys-level access, usually).
See heap.c
Takes mem from page-level allocator, maps it above kernel end and below 0x40000000. Usual malloc/free.
Zone at 0x80000000 - 0xC0000000. Mapping to real memory (which is allocated from 1 above) and disk IO is provided by vm_map.c. This memory belongs to main (object-level) part of OS, and is allocated/freed by VM allocator/GC. No pointer from this part can look to some other memory space.
TODO: run vm interpreter/jit code in user mode with access to lower kernel mem restricted.
See physalloc.c
On ia32 0x40000000 - 0x80000000 zone is pure address space (unmapped at kernel start) and is used to map memory-accessed devices (namely, APIC), video RAM, temp buffers, etc. Usually memory allocated from low-level page allocator is mapped here by owner.
NB! How to map device memory: use page_map_io parameter, see hal.h
0x0 - 0x500 - BIOS data area, preserved
0x500 - 0x100000 - low memory. Allocable except for I/O and ROM area (1mb-640k)
0x100000 - 0x??????? = 1mb - ?mb = kernel
kernel end - 0x40000000 = kernel heap, mapped as is (will be mapped not as is later)
0x40000000 - 0x80000000 = unmapped, used to allocate unbacked address space (mem mapped devices, etc)
0x80000000 - 0xC0000000 = foreground, objects space
MIPS unpaged mem access address space is upper half of address space, so kernel runs in 0x80000000 and above.
Virtual machine (persistent block) is at 0x01000
Allocable address space is at 0xC0000000
TODO. Supposedly:
0x40000000 - 0x80000000 = unmapped, used to allocate unbacked address space (mem mapped devices, etc)
0x80000000 - max positive ptr = foreground, objects space
min neg - 0 = kernel
- KernelVM86 is implemented and does some low mem access. Document it!
- Page 0 - unmap to catch null ptr accesses - DONE.
- POSIX code - CS/DS segments mapped to binary objects
Interpreter code in a special segment?
:: Home :: RoadMap :: History :: ChangeLog :: ScreenShots :: Phantom Developer's Guide