how to set up IRQs and the PIC

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
uruseiyatsura
Posts: 16
Joined: Mon Apr 04, 2022 9:20 am

how to set up IRQs and the PIC

Post 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.
sounds
Member
Member
Posts: 112
Joined: Sat Feb 04, 2012 5:03 pm

Re: how to set up IRQs and the PIC

Post 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.
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: how to set up IRQs and the PIC

Post 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?
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: how to set up IRQs and the PIC

Post 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.
sounds
Member
Member
Posts: 112
Joined: Sat Feb 04, 2012 5:03 pm

Re: how to set up IRQs and the PIC

Post by sounds »

KineticManiac, we're attempting to be welcoming here, check uruseiyatsura's post history for the context.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: how to set up IRQs and the PIC

Post 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.
lochyj
Posts: 10
Joined: Fri Nov 11, 2022 10:28 pm

Re: how to set up IRQs and the PIC

Post 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
Post Reply