0

I've been struggling with understanding segmentation for some time now. Here's what I know.

There are different types of segments, such as the code segment, data segment, stack segment, and extra segments. In old architectures (286 and below), segments were limited to 64kB and used a segment:offset addressing scheme. In later architectures, the addressing scheme was changed to a selector:offset scheme where the selector would access an entry in a GDT or LDT which would contain the address of the segment and other information.

Here's what I'm confused about. What's the point of having different types of segments? If they can overlap, than there's no point in having separate data and code segments, just one general type of segment both can go in.

Secondly, if the segments specified in the LDT are for specific processes, what are the segments specified in the GDT for?

How are the segment addresses set in the LDT? I've written assembly code before but I've never had to tell the LDT where to find my segments before. Does the kernel handle all of that?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by BitBlt
0

The different kinds of segments are used in different, specifically optimized ways for different instructions. You can go to the Intel manual for those details (link here:http://www.intel.com/Assets/PDF/manual/253665.pdf). However, I get the feeling that you are less after the nitty-gritty and more interested in the philosophy of why things were designed the way they were.

Here's a brief write-up that covers some of those basics:
http://wiki.osdev.org/GDT_Tutorial

Or, if you prefer a bit more detail: http://www.osdever.net/bkerndev/Docs/gdt.htm

Not sure if this is what you're looking for, but good luck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.