Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I've spent a few days now trying to understand why I'm getting a page fault when GRUB is booted with UEFI but not with BIOS.
Everything works up until https://gitlab.freedesktop.org/gnu-grub ... ain=1#L112 where GRUB jumps to a memory address some thousand bytes away from where the entry point is loaded. I think GRUB loads some code at that address which is supposed to do some relocations?
At this point, I'm not sure if this a GRUB issue or an issue with my code? I've attached a basic reproduction that has the same bug.
I ran into this issue a while back. If I remember correctly, it was caused by an attempt to write to a page that was not writeable, and that was outside the memory of the kernel (which was loaded into memory correctly). I found a patch to GRUB that solved this issue, but I'm not sure if it is actually a bug in GRUB or just an issue in how I was configuring it. The explanation given by the patch author seems reasonable, but, again, I haven't looked very deep into the issue, so it's quite possible the patch isn't needed, especially given that it hasn't been included in the latest versions of GRUB. I'll attach it if you want to try it out:
In the meantime, you can either build a version of GRUB that includes the above commit or revert to a version prior to the commit that introduced the bug such as 2.12.
An updated version of that patch will be included in the next version of GRUB.
I was doing my debugging with GRUB commit 94a457f and was getting boot loops (I presumed from a page fault and grub's debug build installing an interrupt to catch that). Maybe there's something else going on...?