Page 1 of 1

how to set up IRQs and the PIC

Posted: Mon Mar 27, 2023 12:58 am
by uruseiyatsura
Hello guys,
I just started OSdev and I'm building a very simple OS, but I cannot set up the PIC and the IRQ in protected mode.
I read the osdev wiki and I found something about the PIC initialisation, but nothing about the IRQ.
I admit I am pretty a noob, but I don't found any code about the IRQ init.
Could someone gimme a hand please?
Thank you.

Re: how to set up IRQs and the PIC

Posted: Mon Mar 27, 2023 10:37 am
by sounds
For starters, can you disable all interrupts in the PIC? That will prevent any IRQs from firing until you have set up interrupt handler code. https://wiki.osdev.org/8259_PIC#Disabling

Please share any code you have, and we can give you more detailed info.

Re: how to set up IRQs and the PIC

Posted: Mon Mar 27, 2023 3:23 pm
by Octocontrabass
IRQs are Interrupt ReQuests. Initialization is different for every device that can generate IRQs. So, which device do you want to initialize to generate IRQs?

Re: how to set up IRQs and the PIC

Posted: Tue Mar 28, 2023 2:24 am
by Klakap
IRQ are set up through IDT table. you simply build IDT table in memory, and point to it by assembly command lidt. some info about this is on https://wiki.osdev.org/Interrupts_tutorial or https://wiki.osdev.org/Interrupt_Descriptor_Table.

Re: how to set up IRQs and the PIC

Posted: Tue Mar 28, 2023 3:25 am
by Clover5411

Re: how to set up IRQs and the PIC

Posted: Tue Mar 28, 2023 9:48 am
by sounds
KineticManiac, we're attempting to be welcoming here, check uruseiyatsura's post history for the context.

Re: how to set up IRQs and the PIC

Posted: Tue Mar 28, 2023 10:48 am
by iansjack
sounds wrote:KineticManiac, we're attempting to be welcoming here, check uruseiyatsura's post history for the context.
What’s your point?

It was an eminently sensible comment.

Re: how to set up IRQs and the PIC

Posted: Thu Mar 30, 2023 7:28 pm
by lochyj
Here is a reasonably good tutorial that you may find useful:
http://www.osdever.net/bkerndev/Docs/isrs.htm

Edit:
Forgot to add this:
https://wiki.osdev.org/Bran%27s_Kernel_ ... Known_Bugs