Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual memory manager #6

Open
arthurmco opened this issue Jan 21, 2018 · 5 comments
Open

Virtual memory manager #6

arthurmco opened this issue Jan 21, 2018 · 5 comments

Comments

@arthurmco
Copy link
Owner

Do a virtual memory manager

It should have functions to:

  • Allocate a virtual address from some zone, with some allocated physical address, from some other physical zone.

    • One function might return the physical address too (for things like DMA, that need a physical address but any physical from a certain zone)
    • The another do not need to return the physical address.
  • Allocate a virtual address from some zone, with a specific physical address. (for things like MMIO, that need a certain, exact physical address)

(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
Copy link
Owner Author

arthurmco commented Jan 21, 2018

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
Copy link
Owner Author

See 5e1d877. It's a beginning.

Higher half is used.

@arthurmco
Copy link
Owner Author

arthurmco commented Jan 23, 2018

Added allocation methods at 82b0a16.

But we still have to do

  • allocation of uncontiguous physical pages. This isn't possible yet.
  • deallocation of virtual pages
  • checking if that virtual page allocation can be contiguous. We allocate only contiguous virtual pages.

After doing the tasks above, this issue should be closed

@arthurmco
Copy link
Owner Author

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
Copy link
Owner Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant