aboutsummaryrefslogtreecommitdiff
path: root/boot/startup-x86_64.s
Commit message (Collapse)AuthorAge
* mm: use linked-list-allocator as kmallocTianhao Wang2024-06-11
| | | | | | | | | | | | | | | | | | | | | | | | I'll implement my own allocator later. Currently using linked-list allocator [1] to manage the kernel heap (as in kmalloc, not vmalloc). It manages the ID-mapped region (from VA 0xffff_8000_0000_0000). This allocator is initialized to use the _largest_ physical memory block. If the kernel image (text and data) live in this zone then skip the occupied part. Key difference between kmalloc and vmalloc: - kmalloc pretty much manages the physical memory: the allocated address are within the id-mapped region (see above) therefore the allocated memory must also be contigous in physical memory. Such memory MUST NOT page fault. This is prone to fragmentation, so do not use kmalloc to allocate big objects (e.g. bigger than one 4k page). - vmalloc manages kernel heap memory and the mapping is managed by paging. Such memory could trigger pagefault in kernel mode. Note that the kmalloc conflicts with the previous used stack based PMA as they operates on the same VM zone. References: [1] https://github.com/rust-osdev/linked-list-allocator Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* chore: add todoTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* chore: add v2p and p2v conversion wrt. id mappingTianhao Wang2024-06-11
| | | | Also renamed a few symbols to avoid confusion.
* chore: cleanupTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* mm: fully map the kernel to high memoryTianhao Wang2024-06-11
|
* mm: provide high memory kernel mapping in asm code.Tianhao Wang2024-06-11
| | | | | | | | | | | | | | | | | we use the first pml4 entry (+one pdp table) to map phy 0~512G to virt 0~512G for init code. This doesn't change. For the kernel to work in higher half memory, we also need to create mapping for it. We take the 256th entry of pml4 entry (hence one additional pdp table). Entry 0~63 are mapped to to the physical memory (with offset 0xffff_8000_0000_0000) Entry 64~127 are not used Entry 128~191 are mapped to the kernel image (text and code) (with offset 0xffff_8020_0000_0000) details in docs/mem_layout.txt
* chore: cleanup startup codeTianhao Wang2024-06-11
|
* mm: explicitly clear unused entries in init tableTianhao Wang2024-06-11
|
* mm: add stack based PMATianhao Wang2024-06-11
| | | | | | | use 8MiB reserved array to manage up to 4GiB of physical memory (4K Pages only) Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* multiboot: basic support for multiboot infoTianhao Wang2024-06-11
| | | | | | | | well, it's not trivial to use bios function because thanks to grub + multiboot, we are already in protected mode when the startup code takes control. Also the MB info is easier to play with than BIOS (or ACPI) Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* choreTianhao Wang2024-06-11
|
* doc: notes on x86 gdt and segmentationTianhao Wang2024-06-11
|
* choreTianhao Wang2024-06-11
|
* startup: define multiboot headers in linker scriptTianhao Wang2024-06-11
|
* startup: flatten control flowTianhao Wang2024-06-11
|
* interrupt: add rust binding for idtTianhao Wang2024-06-11
|
* split idt and vectors from startup codeTianhao Wang2024-06-11
|
* choreTianhao Wang2024-06-11
|
* interrupt: rename `guardian` to `interrupt_gate`Tianhao Wang2024-06-11
|
* pic: initialize with rust codeTianhao Wang2024-06-11
|
* cgascr: init cursor in rust codeTianhao Wang2024-06-11
|
* re-organize codeTianhao Wang2024-06-11