Kernel mapping
Problem:
The allocator does not map memory correctly, causing allocations to fail when it hits an address that is not identity mapped.
Solution:
Make the allocator remap memory when necessary, refactor the kernel to allow for the use of "logical" addresses
Changes introduced by this pull request:
- Logical offsets for kernel allocations, map virtual memory when allocations happen
- Undo logical offset for use in drivers, when detected
- Do not identity map all memory
- Add three context "zones" for allocating memory to contexts: image, heap, and mmap
- The image zone is for the program's image (text, data, bss, loaded by exec)
- The heap zone is for the program's dynamic allocations (done by brk)
- The mmap zone is for the program's shared memory (while handling scheme operations as a server).
- The mmap zone will also be reused for mapping MMIO
Drawbacks:
This is by no means done in a safe, reliable, consistent, clean, idiomatic, or efficient way, and significant improvements can be made to the code quality and performance.
TODOs:
- Code cleanup
- Improvements for safety
- Improvements for performance
- Testing
Fixes: Fixes #536 (closed) Fixes #549 (closed) Fixes #590 (closed) Fixes #591 (closed) Fixes #592 (closed)