title: periodic RTC interrupt in My own OS kernel
body: <p>I am currently programming a kernel in c++. So as the basic part of kernel i have implemented a interrupt handling module in my kernel and it works well. But it is not working for RTC IRQ8 interrupt.</p>
  
  <p>This is the my code for enabling irq:</p>
  
  <pre><code>void IDT::enable_irq(unsigned short x, void (*handler)(), unsigned char control){
      current_mask &amp;= ~(1&lt;&lt;x) ;   //Zero off the IRQ mask to enable
  if (x&gt;=8)
  {
      current_mask &amp;= ~(1&lt;&lt;2);
      set_int((x + SLAVE_VEC - 7),(unsigned long) handler, control);
  }
  else            //Sets the appropriate interrupt at the same time
  {
      set_int((x + MASTER_VEC),(unsigned long) handler, control);
  }
  outb(PICMI, current_mask &amp; 0xff);
  outb(PICSI, (current_mask &gt;&gt; 8) &amp; 0xff);
  }
  </code></pre>
  
  <p><code>set_int</code> is function to add interrupt entry in IDT.</p>
  
  <p>It works great for keyboard interrupt if i call it as:</p>
  
  <pre><code>enable_irq(1,kbInt,INT_GATE|BITS_32|PRESENT|RING_2);
  </code></pre>
  
  <p>But if i called it for irq8 i.e. RTC then it is not working.</p>
  
  <pre><code>enable_irq(8,rtcInt,INT_GATE|BITS_32|PRESENT|RING_2);
  </code></pre>
  
  <p>It gives me error like: <code>An unhandled interrupt has occurred...</code></p>
  
  <p>Then i followd the instructions from this tutorial:
  <a href="http://wiki.osdev.org/RTC" rel="nofollow">http://wiki.osdev.org/RTC</a></p>
  
  <p>But what i want to do is, I want to generate periodic RTC interrupt and display time on screen on each interrupt. or i want to call a specific func on each rtc interrupt</p>
  
  <p>So please can any one help me to solve this problem.</p>
  
  <p>Thank you.</p>