OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 7:09 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: [SOLVED] IRQ12
PostPosted: Tue Mar 20, 2018 10:38 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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?

_________________
https://github.com/VendelinSlezak/BleskOS


Last edited by Klakap on Thu Apr 19, 2018 10:44 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Tue Mar 20, 2018 3:33 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

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?


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.

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.


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Sat Mar 24, 2018 5:45 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Sat Mar 24, 2018 8:27 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
You set the mask on IRQ1 and then IRQ1 didn't work. Isn't that exactly what you would expect? You need to clear the mask to enable the line.


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Mon Mar 26, 2018 8:03 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Mon Mar 26, 2018 10:37 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Sat Apr 14, 2018 8:33 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
I will ask a very silly question, calling qemu IRQ12?

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Mon Apr 16, 2018 11:57 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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:
/*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);

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: IRQ12
PostPosted: Thu Apr 19, 2018 10:44 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 85 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group