GDT Tutorial: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
slight cleanup
mNo edit summary
Line 57: Line 57:
== Small Kernel Setup ==
== Small Kernel Setup ==


If you want (for specific reason) to have code and data clearly separated (let's say 4 MiB for both, starting at 4 MiB aswell), just use:
If you want (for specific reason) to have code and data clearly separated (let's say 4 MiB for both, starting at 4 MiB as well), just use:


<source lang="c">
<source lang="c">
Line 199: Line 199:
== What is the IDT and is it needed? ==
== What is the IDT and is it needed? ==


As said above, the IDT (Interrupt Descriptor Table) loads much the same way as the GDT and its structure is roughly the same except that it only contains gates and not segments. Each gate gives a full reference to a piece of code (code segment, priviledge level and offset to the code in that segment) that is now bound to a number between 0 and 255 (the slot in the IDT).
As said above, the IDT (Interrupt Descriptor Table) loads much the same way as the GDT and its structure is roughly the same except that it only contains gates and not segments. Each gate gives a full reference to a piece of code (code segment, privilege level and offset to the code in that segment) that is now bound to a number between 0 and 255 (the slot in the IDT).


The IDT will be one of the first things to be enabled in your kernel sequence, so that you can catch hardware exceptions, listen to external events, etc. See [[Interrupts for dummies]] for more information about the interrupts of X86 family.
The IDT will be one of the first things to be enabled in your kernel sequence, so that you can catch hardware exceptions, listen to external events, etc. See [[Interrupts for dummies]] for more information about the interrupts of X86 family.