Interrupt Descriptor Table: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
m (Added link to protected mode wiki page)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(One intermediate revision by one other user not shown)
Line 98:
C Struct:
 
<sourcesyntaxhighlight lang="c">
struct InterruptDescriptor32 {
uint16_t offset_1; // offset bits 0..15
Line 106:
uint16_t offset_2; // offset bits 16..31
};
</syntaxhighlight>
</source>
 
Example ''type_attributes'' values that people are likely to use (assuming DPL is 0):
Line 190:
C Struct:
 
<sourcesyntaxhighlight lang="c">
struct InterruptDescriptor64 {
uint16_t offset_1; // offset bits 0..15
Line 200:
uint32_t zero; // reserved
};
</syntaxhighlight>
</source>
 
Example ''type_attributes'' values that people are likely to use (assuming DPL is 0):
Line 212:
=== Interrupt Gate ===
 
An '''Interrupt Gate''' is used to specify an '''[[Interrupt Service Routines|Interrupt Service Routine]]'''. For example, when the assembly instruction '''INT 50''' is performed while running in protected mode, the CPU looks up the 50th entry (located at 50 * 8) in the '''IDT'''. Then the Interrupt Gate's '''Selector''' and '''Offset''' values are loaded. The '''Selector''' and '''Offset''' are used to call the '''Interrupt Service Routine'''. When the '''IRET''' instruction is performed, the CPU returns from the interrupt. If the CPU was running in 32-bit mode and the specified selector is a 16-bit gate, then the CPU will go in 16-bit [https://wiki.osdev.org/Protected_Mode Protected Mode] after calling the '''ISR'''. To return in this case, the '''O32 IRET''' instruction should be used, or else the CPU will not know that it should do a 32-bit return (reading 32-bit values off the [[stack]] instead of 16 bit).
 
=== Trap Gate ===