Remapping and masking all IRQs instead of just disabling PIC

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Remapping and masking all IRQs instead of just disabling PIC

Post by Roman »

The APIC wiki page states, that IRQs must be remapped and masked. On the other hand, the PIC wiki page states, that the PIC can be disabled by sending two bytes 0xFF to I/O ports 0xA1 and 0x21. My question is, is it enough to just use the PIC page method or should I also do, what's suggested by the APIC page?
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
LegendDairy
Member
Member
Posts: 52
Joined: Sat Nov 06, 2010 10:42 am
Location: Antwerp (Belgium)

Re: Remapping and masking all IRQs instead of just disabling

Post by LegendDairy »

You should first remap the pick and then mask all interrupts, the code on the PIC page, ie sending the two bytes 0xFF to I/O ports 0xA1 and 0x21, is actually just masking all interrupts on both PICs (the master and the slave)(There are actually two pics cascaded, 0x21 is the data port for the master, 0xA1 is the data port for the slave).

You should always first remap the pic so that any IRQ that is fired before that you mask the IRQs won't fire an interrupt , mapped in the 0x08 to 0x0F range, when you enable interrupts , which would cause a double (or tripple if you don't have a valid IDT yet) fault because 0x00->0x1FF are reserved. I used to just mask all the interrupts, but that so;etimes caused random double faults at boot.
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Remapping and masking all IRQs instead of just disabling

Post by Roman »

Thanks for help! I think, I'll edit the PIC page.
I used to just mask all the interrupts, but that so;etimes caused random double faults at boot.
That's because it fires spurious interrupts.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
Post Reply