Interupçoes operating system

Asked

Viewed 51 times

2

People can explain me this IDT[0x21] in the indices of these structs

Why 0x21 in the indices?

struct IDT_entry IDT[IDT_SIZE];
unsigned long keyboard_address;
unsigned long idt_address;
unsigned long idt_ptr[2];

/* populate IDT entry of keyboard's interrupt */
keyboard_address = (unsigned long)keyboard_handler; 
IDT[0x21].offset_lowerbits = keyboard_address & 0xffff;
IDT[0x21].selector = 0x08; /* KERNEL_CODE_SEGMENT_OFFSET */
IDT[0x21].zero = 0;
IDT[0x21].type_attr = 0x8e; /* INTERRUPT_GATE */
IDT[0x21].offset_higherbits = (keyboard_address & 0xffff0000) >> 16;

1 answer

2


Processors have two Pics (Programmable Interrupt Controller). The first takes care of the interruptions from IRQ0 to IRQ7, and the other takes care of IRQ8 until IRQ15.

The first uses the door 0x20 for Command (ICW) and 0x21 for Date. The second uses the doors 0xA0 and 0xA1.

You’re messing with keyboard interrupts (IRQ1), so you’ll mess with the first pic (door command 0x20 and data at the door 0x21).

Update: I found this link (in English), which explains well: http://arjunsreedharan.org/post/99370248137/kernel-201-lets-write-a-kernel-with-keyboard

Browser other questions tagged

You are not signed in. Login or sign up in order to post.