The title might sound pretty dumb or like something a total beginner would ask, but I'm having trouble creating my VMM. Even for a simple implementation, there doesn't seem to be any documentation that actually teaches you how to do it—it's all just abstract concepts or random tips. Does anyone have any documentation or a tutorial that could help me build it myself? I'm not asking for spoon-fed code, just a recommendation and some help with the addition logic for the VMM.[wiki]
repository: https://github.com/icarotelesdasilva/NexisK
How can I create a VMM on i386?
Re: How can I create a VMM on i386?
Well, of course it is all abstract concepts and random tips, because the VMM is typically the first place where operating systems diverge a lot. There are choices to make, such as: Do you want to make a classic high-half kernel? Or will your address space look completely differently? How do you want to access physical memory while paging is enabled? Do you just map all of memory (and are you OK with limiting yourself to 1GB of accessible memory?) Do you want to use the recursive paging trick (and are you aware of its downsides?)
I had a brief look around your repo, and it seems like your kernel is not currently set up for using higher-half stuff at all. Everything is linked to the 1MB line. If you use a higher-half setup, you typically need a part of the code to be linked there, but then most of gets linked elsewhere (e.g. to the 3GB line). The paging then has to be set up very early, because the GDT and IDT will only have to be loaded again once everything is moved. Typically, there is no need to load a GDT at all if the CPU is already in the right mode. That way, you only need to do it once after enabling paging and everything is ready.
I had a brief look around your repo, and it seems like your kernel is not currently set up for using higher-half stuff at all. Everything is linked to the 1MB line. If you use a higher-half setup, you typically need a part of the code to be linked there, but then most of gets linked elsewhere (e.g. to the 3GB line). The paging then has to be set up very early, because the GDT and IDT will only have to be loaded again once everything is moved. Typically, there is no need to load a GDT at all if the CPU is already in the right mode. That way, you only need to do it once after enabling paging and everything is ready.
Carpe diem!
Re: How can I create a VMM on i386?
Have you read the Intel Programmer’s manuals? The virtualization properties of the processor are described there in detail. But, like the gui question, it’s not what I would describe as simple.
Re: How can I create a VMM on i386?
Thank you very much; that was the best answer I've ever received.nullplan wrote: ↑Thu Oct 08, 2026 10:55 am Well, of course it is all abstract concepts and random tips, because the VMM is typically the first place where operating systems diverge a lot. There are choices to make, such as: Do you want to make a classic high-half kernel? Or will your address space look completely differently? How do you want to access physical memory while paging is enabled? Do you just map all of memory (and are you OK with limiting yourself to 1GB of accessible memory?) Do you want to use the recursive paging trick (and are you aware of its downsides?)
I had a brief look around your repo, and it seems like your kernel is not currently set up for using higher-half stuff at all. Everything is linked to the 1MB line. If you use a higher-half setup, you typically need a part of the code to be linked there, but then most of gets linked elsewhere (e.g. to the 3GB line). The paging then has to be set up very early, because the GDT and IDT will only have to be loaded again once everything is moved. Typically, there is no need to load a GDT at all if the CPU is already in the right mode. That way, you only need to do it once after enabling paging and everything is ready.
Re: How can I create a VMM on i386?
Thanks for the help and answers.
Re: How can I create a VMM on i386?
I’m guessing that I misread your question and by VMM you meant “virtual memory manager” rather than “virtual machine manager”. Very different things!
There’s a good introduction to paging here: https://os.phil-opp.com/paging-introduction/ and the following blogs.
There’s a good introduction to paging here: https://os.phil-opp.com/paging-introduction/ and the following blogs.
