I have been pulling my hair over this one for some time, so I hope you will come up with ideas about the solution. The situation is: I have a 32-bit kernel, it switches to 32-bit mode, uses paging, even also enables the APs and sets up all the required data structures, the kernel receives interrupts on all cores. I have been developing and testing for some time under bochs and qemu and everything works fine.
The problem is: several days ago I tested the whole on real hardware and there is some kind of problem with paging. Right after enabling paging, the kernel stops making any vga text output more and seems not to execute the further instructions at all. However, the cpu is not reset. This happens right after enabling paging:
Code: Select all
inline void enablePaging(){
paging_enabled = true;
asm volatile("mov ebx, cr0 \n"
"or ebx, 0x80000000 \n"
"mov cr0, ebx \n"
: : : "ebx");
}
I am really out of ideas why it might be wrong. Has anyone of you encountered such a problem or do you have any ideas what might be wrong? Could it be something connected to caching? I noticed that cr0 on emulators shows that cache is disabled.