title: Understanding IRQs usage
body: <p>In the last couple of days, I've trying to implement a simple interrupt handler in C. So far so good, I think I've achieved my initial task. My ultimate goal is to inject some faults in the kernel through bit-flipping some CPU registers. After reading <a href="http://www.webopedia.com/quick_ref/IRQnumbers.asp" rel="nofollow noreferrer">this</a>, <a href="http://retired.beyondlogic.org/interrupts/interupt.htm#2" rel="nofollow noreferrer">this</a> and <a href="https://stackoverflow.com/questions/14481032/where-is-hardware-timer-interrupt?rq=1">this</a>, I chose IRQ number 10, since it seems it is a free, "open interrupt". My doubt is: how can I know if this is the "best" IRQ to call my interrupt handler? How can I possibly decide on this?</p>
  
  <p>Thanks and all the best,
  João</p>
  
  <p>P.S.: As far as I know, there are 16 IRQ lines, but Linux has 256 IDT entries, as clearly stated in <code>/include/asm/irq_vectors.h</code> (please see below). This also seems to be puzzling me.</p>
  
  <pre class="lang-c prettyprint-override"><code>/*
   * Linux IRQ vector layout.
   *
   * There are 256 IDT entries (per CPU - each entry is 8 bytes) which can
   * be defined by Linux. They are used as a jump table by the CPU when a
   * given vector is triggered - by a CPU-external, CPU-internal or
   * software-triggered event.
   *
   * Linux sets the kernel code address each entry jumps to early during
   * bootup, and never changes them. This is the general layout of the
   * IDT entries:
   *
   *  Vectors   0 ...  31 : system traps and exceptions - hardcoded events
   *  Vectors  32 ... 127 : device interrupts
   *  Vector  128         : legacy int80 syscall interface
   *  Vectors 129 ... 237 : device interrupts
   *  Vectors 238 ... 255 : special interrupts
   *
   * 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table.
   *
   * This file enumerates the exact layout of them:
   */
  </code></pre>