Page 1 of 1

Calling the IDT and ISR at the same time crashes the OS

Posted: Mon Nov 15, 2021 10:07 pm
by Caffeine
Hey,
I've got a newbie problem - Calling the IDT and ISR at the same time crashes my OS, and calling the IDT and a init_video() crashes the OS.

What I've done so far:
I followed the tutorial linked here: https://www.youtube.com/watch?v=EpFUzjYehxs ad a base and am now continuing with Brans Kernel Development Tutorial. I wrote functions to control the screen based on his code as well.

How I have tried to fix it:
I've looked everywhere online and have even restarted the project twice. So I really have no idea what is wrong.

The Code:
The code can be found here: https://github.com/zachary-d-r/Os-Problem-Code


Again, I'm sorry for the newbie question, I am just really lost on how to get this to work.

Re: Calling the IDT and ISR at the same time crashes the OS

Posted: Tue Nov 16, 2021 8:04 am
by deadmutex
Did you remember to mask IRQs?

Re: Calling the IDT and ISR at the same time crashes the OS

Posted: Tue Nov 16, 2021 10:50 am
by Klakap
It seems like you are not remapping PIC https://wiki.osdev.org/8259_PIC#Initialisation

Re: Calling the IDT and ISR at the same time crashes the OS

Posted: Tue Nov 16, 2021 2:46 pm
by Caffeine
Klakap wrote:It seems like you are not remapping PIC https://wiki.osdev.org/8259_PIC#Initialisation
How should I implement this? - should I create a new file with the code and initialize it before the idt and irs? Or am I completely wrong? Also, how would I initialize the PIC controller?
how
Again, sorry for the newbie questions.

Re: Calling the IDT and ISR at the same time crashes the OS

Posted: Tue Nov 16, 2021 9:28 pm
by nullplan
You should keep your interrupts masked until you have discovered and initialized all interrupt controllers in the system. So initialize your IDT, keep interrupts masked. Then initialize PIC (and possibly APIC) and mask out all interrupts in them, then unmask interrupts in the CPU. Now, only unmask those IRQs you have drivers for. That way you will only get interrupts you actually know. It will not help you to know that, say, IRQ13 fired if you don't know what IRQ13 is.