No floppy drives on the physical machines, and I'm not touching a floppy controller (or any other storage controller) before the fault occurs. My bootsect loads the kernel using the BIOS in real mode before entering long mode.Octocontrabass wrote:Inline assembly to mess with rflags should be okay since your kernel is compiled with -mno-red-zone as long as you do it carefully. Since you haven't remapped the PICs, the only IRQ that could reach your page fault handler without causing a page fault is IRQ6 from the floppy drive, and I suspect you're not using one of those.
My inline assembly only does this:
Code: Select all
__asm__ __volatile__ ("pushfq ; popq %0 ; cli" : "=r"(rflags) : : );
and later:
if (rflags & 0x200) {
__asm__ __volatile__ ("sti");
}
I guess it's possible but because of this and other problems, at the moment my page fault handler is about as simple as you can get:I guess that leaves some fault in the page fault handler itself that causes it to report nonsense instead of the actual error?
Code: Select all
movabsq $err_msg_page_fault, %rdi
movq (%rsp), %rsi
movq 8(%rsp), %rdx
movq %cr2, %rcx
xorq %rax, %rax
call kprintf
hlt
PAGE FAULT: code 9, EIP=0xffff800000012b88, CR2=0xffff8000000202460
(this simple handler could certainly do with more detailed output)