Enabling paging disables INTs; what's wrong?
Enabling paging disables INTs; what's wrong?
My OS enables paging after setting up a page table and directory. However, no matter when I do this, interrupts stop occuring. I don't get any sort of triple fault (the computer doesn't restart) and I can still call other functions after paging is enabled but no interrupts occur. I've remapped the PIC and loaded the IDTR and before I tried to enable paging everything involving interrupts worked just as I thought it would. What could be causing this interruption of interrupt service, so to speak, to occur? If you need any more specific information, just ask and I can provide it. Thanks for your help.
RE:Enabling paging disables INTs; what's wrong?
Just one other thing to check: Are there any cli instructions in the paging code?
RE:Enabling paging disables INTs; what's wrong?
No. Could it be the fact that I'm letting the compiler allocate the space necessary for my IDT? I followed Xsism's example for that and made a packed struct that was 256 entries long, and the routine sends the pointer when it loads the IDT. However, when I enable paging maybe I write something to CR0 or something that causes the address of the IDT to not be found; Of course, why do other variables like strings still work? And if the IDT were no longer found, I'd expect a triple fault, rather than nothing. I've tried enabling paging after disabling interrupts, before disabling them, before and after masking IRQs, before and after reenabling them, nothing. I worked from KJ's tutorial (http://www.osdev.neopages.net/tutorials ... ?the_id=43) incase that sheds any light on what could be causing my problem. One last note: I tried giving the table a definite address as he does, and I've also tried letting the compiler allocate memory for it as well. Both times the same thing happens. I also used gcc inline assembly for the asm functions as follows:
unsigned long read_cr0(void)
{
unsigned long ret;
__asm__ ("mov %%eax,%%cr0" : "=a"(ret));
return ret;
}
unsigned long read_cr3(void)
{
unsigned long ret;
__asm__ ("mov %%eax,%%cr3" : "=a"(ret));
return ret;
}
When I try using KJ's assembly code, it links just fine but then triple faults right when the computer boots up. Maybe my ASM functions aren't doing anything, and his do and the triple fault is because I overwrite the IDT or get a page fault when the system timer goes off? Sorry if this was a bit long winded, but maybe something will catch someone's eye. Thank you.
unsigned long read_cr0(void)
{
unsigned long ret;
__asm__ ("mov %%eax,%%cr0" : "=a"(ret));
return ret;
}
unsigned long read_cr3(void)
{
unsigned long ret;
__asm__ ("mov %%eax,%%cr3" : "=a"(ret));
return ret;
}
When I try using KJ's assembly code, it links just fine but then triple faults right when the computer boots up. Maybe my ASM functions aren't doing anything, and his do and the triple fault is because I overwrite the IDT or get a page fault when the system timer goes off? Sorry if this was a bit long winded, but maybe something will catch someone's eye. Thank you.
RE:I got it to work, but I don't know how!
I managed to git KJ's code to work just fine now; at the very least, it all runs and interrupts still occur. I had to copy his code exactly, and I made sure to make prototypes of his assembly functions and declare them external (I didn't do that before, which would explain the triple fault). However, why do his assembly functions work and my inline ones don't? I'm missing something important I know, but what?
RE:I got it to work, but I don't know how!
Sorry lifting this old topic up, but i had same problem. Reason was that when i enabled interrupts(PICs initialized) cpu started of course execute clock interrupt and there was no PIC reset code in clock interrupt.
PS. Sorry for bad english
PS. Sorry for bad english