I Can't Get Interrupts Working: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Ender (talk | contribs)
m Fixed link
No edit summary
Line 9: Line 9:
For this test, you need to call the interrupt yourself, by software. Don't try to get [[IRQ]] handled right from the start before you're sure your IDT setup is correct. You need to have:
For this test, you need to call the interrupt yourself, by software. Don't try to get [[IRQ]] handled right from the start before you're sure your IDT setup is correct. You need to have:


* your IDT loaded and filled properly.
* Your IDT loaded and filled properly.
* your IDT's ''linear'' address loaded in a structure together with the table's size (in bytes, IIRC). Be especially cautious if you have a [[Higher Half Kernel]] design or did not set up [[Identity Paging|identity paging]].
* Your IDT's ''linear'' address loaded in a structure together with the table's size (in bytes, IIRC). Be especially cautious if you have a [[Higher Half Kernel]] design or did not set up [[Identity Paging|identity paging]].
* a valid Code selector and offset in the [[Descriptors|descriptor]], proper type, etc.
* A valid Code selector and offset in the [[Descriptors|descriptor]], proper type, etc.
* a handling code at the defined offset.
* A handling code at the defined offset.


'' see [[#Assembly_Examples|test code]] below ''
'' see [[#Assembly_Examples|test code]] below ''
Line 18: Line 18:
=== My Handler doesn't get called (C)?! ===
=== My Handler doesn't get called (C)?! ===


If you're programming the IDT setup in C, make sure the IDTR structure has been correctly understood by your compiler. As Intel's 6 bytes structures infringe most compiler's packing rules, you'll need to use either ''bitfields'' or ''packing pragmas''. Use <tt>sizeof()</tt> and <tt>OFFSETOF()</tt> macros to make sure the expected definition is used (a runtime test would be fine)
If you are programming the IDT setup in C, make sure the IDTR structure has been correctly understood by your compiler. As Intel's 6 bytes structures infringe most compiler's packing rules, you'll need to use either ''bitfields'' or ''packing pragmas''. Use <tt>sizeof()</tt> and <tt>OFFSETOF()</tt> macros to make sure the expected definition is used (a runtime test would be fine)


=== My handler is called but it doesn't return !? ===
=== My handler is called but it doesn't return !? ===