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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Caffeine
Member
Member
Posts: 79
Joined: Mon Nov 15, 2021 9:48 pm

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

Post 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.
User avatar
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

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

Post by deadmutex »

Did you remember to mask IRQs?
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

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

Post by Klakap »

It seems like you are not remapping PIC https://wiki.osdev.org/8259_PIC#Initialisation
Caffeine
Member
Member
Posts: 79
Joined: Mon Nov 15, 2021 9:48 pm

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

Post 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.
Last edited by Caffeine on Wed Nov 17, 2021 5:52 pm, edited 1 time in total.
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

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

Post 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.
Carpe diem!
Post Reply