OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 9:27 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Double Fault if i run an infinite loop
PostPosted: Tue Apr 18, 2017 6:17 pm 
Offline

Joined: Tue Apr 18, 2017 6:02 pm
Posts: 13
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


Top
 Profile  
 
 Post subject: Re: Double Fault if i run an infinite loop
PostPosted: Tue Apr 18, 2017 7:25 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

SeeSoftware wrote:
Did anyone had this problem and how did he/she fix it ?


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).


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.


Top
 Profile  
 
 Post subject: Re: Double Fault if i run an infinite loop
PostPosted: Tue Apr 18, 2017 7:34 pm 
Offline

Joined: Tue Apr 18, 2017 6:02 pm
Posts: 13
Brendan wrote:
Hi,

SeeSoftware wrote:
Did anyone had this problem and how did he/she fix it ?


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).


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)


Top
 Profile  
 
 Post subject: Re: Double Fault if i run an infinite loop
PostPosted: Tue Apr 18, 2017 9:03 pm 
Offline

Joined: Tue Apr 18, 2017 6:02 pm
Posts: 13
Setting the PIC fixed my problem thank you Brendan


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 86 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group