im creating an os for fun and i allready jumped to the kernel and i am in protected mode.
I setup the GDT and IDT in the kernel and everything seems to work but if i try to run an infinite loop in C afterwards (anything eg. for(;;),while(1)...) it generates a double fault (i catched the double fault to display an error).
But if i remove the CPU_initGDT and CPU_initIDT (both set the IDT or GDT table to appropriate values and run lidt and lgdt) it works fine.
(im allready setting a default GDT in the second stage bootloader )
Did anyone had this problem and how did he/she fix it ?
thanks in advance
Double Fault if i run an infinite loop
Re: Double Fault if i run an infinite loop
Hi,
Cheers,
Brendan
I'd be tempted to guess that your "CPU_initIDT" enables IRQs and nothing has reconfigured the PIC chips; which means that when the PIT timer causes an IRQ0 it's mapped to interrupt 0x08 (and the "interrupt 0x08" you see is not actually a double fault).SeeSoftware wrote:Did anyone had this problem and how did he/she fix it ?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
-
- Posts: 13
- Joined: Tue Apr 18, 2017 6:02 pm
Re: Double Fault if i run an infinite loop
Brendan wrote:Hi,
I'd be tempted to guess that your "CPU_initIDT" enables IRQs and nothing has reconfigured the PIC chips; which means that when the PIT timer causes an IRQ0 it's mapped to interrupt 0x08 (and the "interrupt 0x08" you see is not actually a double fault).SeeSoftware wrote:Did anyone had this problem and how did he/she fix it ?
Cheers,
Brendan
ahh thank you it makes sense because if i clear the interrupt flag then it will run fine because the IRQs wont fire (or something)
-
- Posts: 13
- Joined: Tue Apr 18, 2017 6:02 pm
Re: Double Fault if i run an infinite loop
Setting the PIC fixed my problem thank you Brendan