[SOLVEDish] Behaviour changes based on presence of prints
Posted: Mon Sep 11, 2017 11:03 am
I'm building an OS in Rust, which has been a bit of an ordeal so far. I have managed to load a GRUB module and am now trying to identity map it from information in the Multiboot header. Note that I am already identity-mapping other things, such as the multiboot structure itself and the VGA buffer, so I'm fairly confident my mapping code does what it's meant to. However, in trying to map the range used by the GRUB modules, it fails and says that the P1 entries have already been mapped (which I don't think should be possible). Thinking this was a legitimate error on my part, I started adding `println`s to map the memory layout used by the kernel.
This is where it started to get weird; two of the `println`s (which should just be printing data held in a structure, not doing anything fancy) stop the error! The pages are mapped successfully and the code works (in this case executing the code loaded in the module). I know this is very little to go on, so sorry about that, and I guess I'm more interested in how you'd go about debugging this? It screams at me that something more serious is wrong with the memory layout or something, but I'm a bit out of my depth here (but would love to learn how to do this sort of debugging).
https://github.com/IsaacWoods/RustOS/bl ... #L265-L293 is the relavant piece of code to just give a feel, although this uses stuff all over the paging system. I realise this isn't a lot to go on and I'm very anxious not to appear like a noob not doing his own research or not being experienced enough for OsDev, I have run this through a debugger (a custom-patched gdb) which didn't really help and have literally no idea why printing stuff out would change anything at all. Any help at all would be appreciated!
This is where it started to get weird; two of the `println`s (which should just be printing data held in a structure, not doing anything fancy) stop the error! The pages are mapped successfully and the code works (in this case executing the code loaded in the module). I know this is very little to go on, so sorry about that, and I guess I'm more interested in how you'd go about debugging this? It screams at me that something more serious is wrong with the memory layout or something, but I'm a bit out of my depth here (but would love to learn how to do this sort of debugging).
https://github.com/IsaacWoods/RustOS/bl ... #L265-L293 is the relavant piece of code to just give a feel, although this uses stuff all over the paging system. I realise this isn't a lot to go on and I'm very anxious not to appear like a noob not doing his own research or not being experienced enough for OsDev, I have run this through a debugger (a custom-patched gdb) which didn't really help and have literally no idea why printing stuff out would change anything at all. Any help at all would be appreciated!