Segments initiation problem

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator: Moderators

Segments initiation problem

Postby afdgdhfrtewdszs » Fri Nov 30, 2012 12:55 am

Hi,
I am confused at the point where we set registers as soon as we into protected mode. Especially when setting stack-segment with the same selector as data-segment. This means that they will have the same base-limit address. My question is this: Stack,data and code won't 'interfere' with each other while they are in the same segment(just different access-types)?Thanks.
afdgdhfrtewdszs
 
Posts: 18
Joined: Tue Feb 01, 2011 6:25 pm

Re: Segments initiation problem

Postby Mike » Fri Nov 30, 2012 2:09 pm

Hello,

The code, data, and stack all share the same linear address space and so can interfere with the others if not careful. This reflects a flat address space where segmentation is not used (all kernel segments start and end at the same place.) Of course, you can always still use segmentation but its not really useful if you plan to use paging and makes compatibility harder (other architectures that don't support it and C compilers that assume a flat memory model.)
User avatar
Mike
Site Admin
 
Posts: 463
Joined: Sat Oct 20, 2007 7:58 pm


Return to Beginning OS Development

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron