GDT Tutorial: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Removed author&license due to the majority of other snippets on the site not requiring it.
m →‎Filling the table: Capitalized "I" twice.
Line 76: Line 76:
=== Filling the table ===
=== Filling the table ===


You noticed that i didn't gave a real structure for <tt>GDT[]</tt>, didn't you? That's on purpose. The actual structure of descriptors is a little messy for reasons unknown. Base address are split on 3 different fields and you cannot encode any limit you want. Plus, here and there, you have flags that you need to set up properly if you want things to work.
You noticed that I didn't gave a real structure for <tt>GDT[]</tt>, didn't you? That's on purpose. The actual structure of descriptors is a little messy for reasons unknown. Base address are split on 3 different fields and you cannot encode any limit you want. Plus, here and there, you have flags that you need to set up properly if you want things to work.


<source lang="c">
<source lang="c">
Line 113: Line 113:
</source>
</source>


Okay, that's rather ugly, but it's the most 'for dummies' i can come with ... hope you know about masking and shifting. You can hard-code that rather than convert it at runtime, of course. This code assumes that you only want 32-bit segments.
Okay, that's rather ugly, but it's the most 'for dummies' I can come with ... hope you know about masking and shifting. You can hard-code that rather than convert it at runtime, of course. This code assumes that you only want 32-bit segments.


=== Telling the CPU where the table stands ===
=== Telling the CPU where the table stands ===