Interrupt Descriptor Table: Difference between revisions

m
Reverted edits by Nunolava1998 (talk) to last revision by Wallbraker
[unchecked revision][unchecked revision]
m (Reverted edits by Nunolava1998 (talk) to last revision by Wallbraker)
Line 257:
 
In your interrupt handler routines, '''remember to use IRETQ instead of IRET''', as nasm won't translate that for you. Many 64bit IDT related problems on the forum are caused by that missing 'Q'. Don't let this happen to you.
 
==But how do i load this stuff? (x86)==
 
"''How do i load this?''" you might ask. Well, here's a function to help you:
 
<source lang="c">
void loadidt(void* base) {
uint16_t size = 0x00FF; // Always needed, our IDT is always 256 bytes long
lidt((void*)base, size); // Load the IDT, this assumes you have the lidt(); function from Inline Assembly/Examples.
}
</source><source lang="c">void* base</source>
is the address. If you wanted to load it at 0xFC0000 (assuming it isn't reserved), you could simply execute this code:
 
<source lang="c">loadidt(0xFC0000);</source>
 
==See Also==
Anonymous user