Good day!
Please tell me what command should I write to work interrupt IRQ12 if I already have a set up IDT? For example, for the functioning of the IRQ1 is outb(0x21 , 0xFD); What such a command should I write to work IRQ12?
[SOLVED] IRQ12
[SOLVED] IRQ12
Last edited by Klakap on Thu Apr 19, 2018 10:44 am, edited 1 time in total.
Re: IRQ12
Hi,
What you really want is a pair of functions like "mask_IRQ(int IRQ_number);" and "unmask_IRQ(int IRQ_number);" that any code that wants to mask or unmask any IRQ can use safely (without upsetting the cascade line or any other IRQs). There is example code for these functions in the wiki.
Cheers,
Brendan
The "outb(0x21 , 0xFD)" doesn't just unmask IRQ1, it masks everything else in the master PIC, and "everything else" includes the cascade line that the slave PIC is connected to.Klakap wrote:Please tell me what command should I write to work interrupt IRQ12 if I already have a set up IDT? For example, for the functioning of the IRQ1 is outb(0x21 , 0xFD); What such a command should I write to work IRQ12?
What you really want is a pair of functions like "mask_IRQ(int IRQ_number);" and "unmask_IRQ(int IRQ_number);" that any code that wants to mask or unmask any IRQ can use safely (without upsetting the cascade line or any other IRQs). There is example code for these functions in the wiki.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: IRQ12
When I copied the code to https://wiki.osdev.org/PIC#Masking and I wrote instead of outb(0x21, 0xFD); command IRQ_set_mask(1); IRQ1 didn't work. Please write me how do I properly call the method IRQ_set_mask(); to give me the interrupts of work.
Re: IRQ12
Maybe I have wrong set up IRQ12 in the IDT. I proceeded according to arjunsreedharan.org/post/99370248137/kernel-201-lets-write-a-kernel-with-keyboard and according to this tutorial I IRQ12 is set by the commands:
/* populate IDT entry of the mouse's interrupt */
mouse_address = (unsigned long)mouse_handler;
IDT[0x32].offset_lowerbits = mouse_address & 0xffff;
IDT[0x32].selector = 0x08; /* KERNEL_CODE_SEGMENT_OFFSET */
IDT[0x32].zero = 0;
IDT[0x32].type_attr = 0x8e; /* INTERRUPT_GATE */
IDT[0x32].offset_higherbits = (mouse_address & 0xffff0000) >> 16;
Is this correct? If not, please tell me how do I change.
/* populate IDT entry of the mouse's interrupt */
mouse_address = (unsigned long)mouse_handler;
IDT[0x32].offset_lowerbits = mouse_address & 0xffff;
IDT[0x32].selector = 0x08; /* KERNEL_CODE_SEGMENT_OFFSET */
IDT[0x32].zero = 0;
IDT[0x32].type_attr = 0x8e; /* INTERRUPT_GATE */
IDT[0x32].offset_higherbits = (mouse_address & 0xffff0000) >> 16;
Is this correct? If not, please tell me how do I change.
Re: IRQ12
Rather than blindly following dubious tutorials you would be better employed studying the various chips and how to program them. That way you will understand what you are doing rather than just copying code.
Re: IRQ12
I will ask a very silly question, calling qemu IRQ12?
Re: IRQ12
I've already figured out what the problem is, when I press some key, qemu calls the IRQ1 and IRQ12 but when move the mouse so IRQ12 calling only one time. Please help me. Code:
Code: Select all
/*PIC*/
outb(0x20, 0x11);
outb(0xA0, 0x11);
outb(0x21, 0x20);
outb(0xA1, 40);
outb(0x21, 0x04);
outb(0xA1, 0x02);
outb(0x21, 0x01);
outb(0xA1, 0x01);
outb(0x21, 0x0);
outb(0xA1, 0x0);
irq0_address = (unsigned long)irq0;
IDT[32].offset_lowerbits = irq0_address & 0xffff;
IDT[32].selector = 0x08; /* KERNEL_CODE_SEGMENT_OFFSET */
IDT[32].zero = 0;
IDT[32].type_attr = 0x8e; /* INTERRUPT_GATE */
IDT[32].offset_higherbits = (irq0_address & 0xffff0000) >> 16;
irq1_address = (unsigned long)irq1;
IDT[33].offset_lowerbits = irq1_address & 0xffff;
IDT[33].selector = 0x08; /* KERNEL_CODE_SEGMENT_OFFSET */
IDT[33].zero = 0;
IDT[33].type_attr = 0x8e; /* INTERRUPT_GATE */
IDT[33].offset_higherbits = (irq1_address & 0xffff0000) >> 16;
irq12_address = (unsigned long)irq12;
IDT[44].offset_lowerbits = irq12_address & 0xffff;
IDT[44].selector = 0x08; /* KERNEL_CODE_SEGMENT_OFFSET */
IDT[44].zero = 0;
IDT[44].type_attr = 0x8e; /* INTERRUPT_GATE */
IDT[44].offset_higherbits = (irq12_address & 0xffff0000) >> 16;
/* fill the IDT descriptor */
idt_address = (unsigned long)IDT ;
idt_ptr[0] = (sizeof (struct IDT_entry) * 286) + ((idt_address & 0xffff) << 16);
idt_ptr[1] = idt_address >> 16 ;
load_idt(idt_ptr);
Re: IRQ12
I have already this problem is resolved. I forgot the fact, the load input from port 0x60 because I am irq12_handler used only to list on the screen how many times was the handler of the call. When I added the command inb(0x60) interrupts work correctly.