Reason for different segments in Linux on x86
Posted
by
anjruu
on Stack Overflow
See other posts from Stack Overflow
or by anjruu
Published on 2011-01-01T18:01:56Z
Indexed on
2011/01/01
18:54 UTC
Read the original article
Hit count: 150
Hey all,
So, I know that Linux uses four default segments for an x86 processor (kernel code, kernel data, user code, user data), but they all have the same base and limit (0x00000000 and 0xfffff), meaning each segment maps to the same set of linear addresses.
Given this, why even have user/kernel segments? I understand why there should be separate segments for code and data (just due to how the x86 processor deals with the cs and ds registers), but why not have a single code segment and a single data segment? Memory protection is done through paging, and the user and kernel segments map to the same linear addresses anyway.
Thanks!
anjruu
© Stack Overflow or respective owner