Can segments overlap in protected mode?

jj1984

Member
In real mode, segments can overlap.

In 64-bit mode, all segments are usually set to 0 so all segments overlap perfectly.

But what about protected mode?

Are you allowed to have segments overlap in protected mode?

Because of privilege level enforcement, is there any hardware level mechanism for making sure that segments don't overlap?
 

Cromewell

Administrator
Staff member
Protected mode segments don't reference physical memory locations, it's a reference to an entry in the G/LDT. So I'm going to go with no they don't overlap.

OSDev can be a good reference for a lot of this stuff for when it's not clear by reading the manual. http://wiki.osdev.org/Segmentation
 

jj1984

Member
Protected mode segments don't reference physical memory locations,

They do if paging is turned off.

it's a reference to an entry in the G/LDT.

I was asking about segments, not selectors.

OK, here's a more concrete example:

Can I have, in protected mode, a segment descriptor in the GDT or LDT with a base of 10 and a limit of 20, and then another segment descriptor in the GDT or LDT with a base of 15 and a segment limit of 20?

Those two segments overlap in linear memory.

Is this possible in protected mode?
 
Last edited:

Cromewell

Administrator
Staff member
They do if paging is turned off.
Except paging won't be off, not in anything in the last like 20 years. And anything that runs x64, forget about segmentation entirely.
Can I have, in protected mode, a segment descriptor in the GDT or LDT with a base of 10 and a limit of 20, and then another segment descriptor in the GDT or LDT with a base of 15 and a segment limit of 20?
Probably not, but I don't know for sure.
 
Top