arthurmco / annOS

Arthur's Not Named Operating System, an OS with a C++ kernel.
MIT License
7 stars 0 forks source link

Virtual memory manager #6

Open arthurmco opened 6 years ago

arthurmco commented 6 years ago

Do a virtual memory manager

It should have functions to:

(Check #5 for some clarification about physical addresses, specially this comment )


It should be divided in zones: just a zone for kernel memory and other for user memory.

It should have a function to switch the CR3 (the page directory base register (PDBR), a register where the physical address of the page directory list go), so it's easy to do it for usermode (each process will have it's own page directory).

arthurmco commented 6 years ago

Need to setup some preliminary tables at boot, so we can use higher half addressing (kernel mapped at the higher half, > 0x8000000 virtual) from the start. Every major OS does that. Might help. Read http://wiki.osdev.org/Higher_Half_Kernel, it has more arguments than I do.

arthurmco commented 6 years ago

See 5e1d877. It's a beginning.

Higher half is used.

arthurmco commented 6 years ago

Added allocation methods at 82b0a16.

But we still have to do

After doing the tasks above, this issue should be closed

arthurmco commented 6 years ago

1dae61f does deallocation.

It also adds a flag to the mapping. It maps with the page table mapping options, such as read-only page, or non-cached page.

arthurmco commented 6 years ago

I'm thinking about doing the heap allocator (#7 ) now.

It would help catching some errors in the VMM, since it's the only thing I can't test separately, prior to put here (the PMM was tested a little in user mode before integrating here, and I'm doing the heap allocator in user mode too)