Page 1 of 1
VMM/Paging
Posted: Tue Dec 23, 2025 10:06 pm
by GhostedGaming
So ive been wanting to implement paging using limine but i have no idea where to start and looking at this
https://wiki.osdev.org/Paging only confuses me even more if i could get help on where to get started that would be really nice
here is my repo if you would like to look at it
https://github.com/GhostedGaming/eucalypt-dos
Re: VMM/Paging
Posted: Wed Dec 24, 2025 12:32 am
by iansjack
There’s a good introduction to paging here:
https://os.phil-opp.com/paging-introduction/ It’s written with Rust in mind, so you can’t just cut and paste the code (which is a good thing), but it’s a good explanation of the concepts involved.
Re: VMM/Paging
Posted: Wed Dec 24, 2025 6:43 am
by h3tR
What I got from the limine specs when I looked into it for my own implementation is that Limine maps the entire memorymap to the offset found in the hhdm response. Most of it would have the present and writable flags which really isn’t ideal in the long run. Only exception on this iirc is the kernel executable which is mapped at the virtual base found in the executable address response.
This makes it easy to set up initial structures for your frame, virtual page and heap allocators but you most likely should unmap everything that you aren’t using and change the flags to something appropriate on the things you do want to keep. Another thing to keep in mind is that from my experience limine maps huge pages which isn’t ideal everywhere. If you’d want to use other page sizes instead you’re gonna need to remap that as well.
Re: VMM/Paging
Posted: Wed Dec 24, 2025 10:08 am
by GhostedGaming
Would it be ok to just have every page 4kb or would i have to vary the size depending on what its for?
Re: VMM/Paging
Posted: Wed Dec 24, 2025 12:00 pm
by sounds
It's fine to design your system to use only 4k pages. After all, it's normal and expected that larger allocations would be built by mapping pages next to each other, where the pages are all the system size.
Linux used to do it, and it worked fine. Staying focused on the minimal features required to get your page table implemented will help you get to a working os fast.
Re: VMM/Paging
Posted: Thu Dec 25, 2025 8:15 pm
by GhostedGaming
iansjack wrote: ↑Wed Dec 24, 2025 12:32 am
There’s a good introduction to paging here:
https://os.phil-opp.com/paging-introduction/ It’s written with Rust in mind, so you can’t just cut and paste the code (which is a good thing), but it’s a good explanation of the concepts involved.
Will i be able to use it with x86_64 i know there are a few differences when it comes to paging on both but i dont know how big the differences are
Re: VMM/Paging
Posted: Fri Dec 26, 2025 12:36 am
by iansjack
My link references the x86_64. In addition you should look at the Intel (and/or AMD) programmer’s reference manuals.
Re: VMM/Paging
Posted: Sun Jan 04, 2026 10:35 am
by bunny
Did you get the info you needed to keep going with paging? Im not nearly as smart as some of these other posters but I have been able to get past paging, and fairly recently too, so I might be able to offer tips that helped me. Also might I plug my own OS professor's lecture notes, paging is near the bottom, but if you like OS dev then you should honestly read everything he has (again Im biased lol)
https://sites.cs.ucsb.edu/~rich/class/c ... index.html
happy os-dev-ing! <3
Re: VMM/Paging
Posted: Tue Jan 06, 2026 10:01 am
by GhostedGaming
bunny wrote: ↑Sun Jan 04, 2026 10:35 am
Did you get the info you needed to keep going with paging? Im not nearly as smart as some of these other posters but I have been able to get past paging, and fairly recently too, so I might be able to offer tips that helped me. Also might I plug my own OS professor's lecture notes, paging is near the bottom, but if you like OS dev then you should honestly read everything he has (again Im biased lol)
https://sites.cs.ucsb.edu/~rich/class/c ... index.html
happy os-dev-ing! <3
a little bit I still don't understand even though memory is just a bitmap array
Re: VMM/Paging
Posted: Wed Jan 07, 2026 1:38 pm
by bunny
GhostedGaming wrote: ↑Tue Jan 06, 2026 10:01 am
a little bit I still don't understand even though memory is just a bitmap array
I mean, its a bitmap array in the sense that you can think of it as a single logically contiguous region of storage but my intuition says the way you're thinking of it might be confusing you. Physical memory is a bunch of hardware single bit storage devices strung together and a physical address is how the memory controllers etc know where to find your data. When building an OS, aside from being able to allocate physical memory, we dont really want to mess around with physical addresses and so we have this layer of abstraction, virtual addresses, to help. Paging plays into this and solves some specific problems with using virtual addresses and honestly with memory in general. While there are loads of great resources out there if you would like to ask any specific questions I'll happily do my best to help you. In my humble opinion virtual memory is one of, if not the, most important things to fully understand for OS Dev, so its definitely worth pausing now to really figure it out before you get too far and have major problems.