Getting a "Messy" memory map from Bochs
Posted: Sat Mar 26, 2016 5:08 am
Hello,
I've been moving into the memory management area of kernel development with my personal project recently, and I'm at the point where I can obtain a memory map from GRUB (or another compliant bootloader) and now need to process this map in order to get an idea of what the computer's memory looks like and prepare it for management. Unfortunately, as some of you may know, bochs, the emulator I'm using to test my kernel, makes very clean and orderly memory maps when it simulates a PC, and in reality, the memory of a PC isn't just a bunch of simple, ordered, sections like bochs makes it out to be. This is normally a good aspect of an emulated PC, but in order to properly test my memory map processing code, I need to make sure it works on non-ideal cases such as those presented by real hardware.
I have a real computer I can test my kernel on (besides my dev machine), but the process of compiling a kernel, creating a boot-able USB drive, moving that drive to the computer, rebooting from the drive, every time I want to check if my code works, is pretty complex and time consuming, plus, there's not much in the way of debugging apart from printing info onto the screen (Bochs has the handy debug command line and magic break instruction). Is there a way to ask bochs to "Mess up" the memory maps it emulates, so as to provide a more realistic memory map I can work with, or do I have to test my algorithm by other means? If it possible to develop a plugin for bochs which might provide that functionality (and if so, how difficult and time consuming would that be)?
In summary, the general goal here is to save time by avoiding working with a real machine, and working instead with a virtual one, but I need that virtual machine to provide a more realistic (by realistic, I mean non-contiguous and possibly unordered) memory map. Is there a way for this to happen, and would it be faster than the overhead from just testing on a real PC?
Thanks for reading,
- Mikumiku747
I've been moving into the memory management area of kernel development with my personal project recently, and I'm at the point where I can obtain a memory map from GRUB (or another compliant bootloader) and now need to process this map in order to get an idea of what the computer's memory looks like and prepare it for management. Unfortunately, as some of you may know, bochs, the emulator I'm using to test my kernel, makes very clean and orderly memory maps when it simulates a PC, and in reality, the memory of a PC isn't just a bunch of simple, ordered, sections like bochs makes it out to be. This is normally a good aspect of an emulated PC, but in order to properly test my memory map processing code, I need to make sure it works on non-ideal cases such as those presented by real hardware.
I have a real computer I can test my kernel on (besides my dev machine), but the process of compiling a kernel, creating a boot-able USB drive, moving that drive to the computer, rebooting from the drive, every time I want to check if my code works, is pretty complex and time consuming, plus, there's not much in the way of debugging apart from printing info onto the screen (Bochs has the handy debug command line and magic break instruction). Is there a way to ask bochs to "Mess up" the memory maps it emulates, so as to provide a more realistic memory map I can work with, or do I have to test my algorithm by other means? If it possible to develop a plugin for bochs which might provide that functionality (and if so, how difficult and time consuming would that be)?
In summary, the general goal here is to save time by avoiding working with a real machine, and working instead with a virtual one, but I need that virtual machine to provide a more realistic (by realistic, I mean non-contiguous and possibly unordered) memory map. Is there a way for this to happen, and would it be faster than the overhead from just testing on a real PC?
Thanks for reading,
- Mikumiku747