I'm following several tutorials and references trying to get my kernel set up, and I've come across voodoo code in a tutorial that isn't explained at all. Its code that I'm told maps the 16 IRQs (0-15) to ISR locations 32-47:
void irq_remap(void)
{
outportb(0x20, 0x11);
outportb(0xA0, 0x11);
outportb(0x21, 0x20);
outportb(0xA1, 0x28);
outportb(0x21, 0x04);
outportb(0xA1, 0x02);
outportb(0x21, 0x01);
outportb(0xA1, 0x01);
outportb(0x21, 0x0);
outportb(0xA1, 0x0);
}
The code for outportb() is as follows, but I already have a clear grasp of what its doing:
void outPortB(unsigned short port, unsigned char data)
{
__asm__ __volatile__ ("outb %1, %0" : : "dN" (port), "a" (data));
}
I should mention that this is on x86 architecture in protected mode. This code works fine, and I understand what it does, but I don't understand how on earth it does it. Can someone explain to me what's going on here, so that in case I need to expand on this I will know what I'm doing somewhat?
Thanks