Segmentation concept Help!!!
Posted: Tue Sep 14, 2010 7:22 am
Hi, I read lots of pages, linux book about description of x86 segmentation, I got pretty good info but I have few doubts please help me on this. let m explain what I understood,
Segmentation is used to keep text, data, stack part separated so that we can manage access to respective memory. In linux the four segment user code, user data, kernel code kernel data has base offset as 0x00 and limit is 4 GB, user space has about 3 GB and kernel space has about 1 GB address space. kernel space begins somewhere 0xc000....
To access kernel data or code I need to load proper cs, ds same is true for user code and data. GDT is array of segment descriptor which has information of these limits and all.
My Que is: according to above segment arrangement any address above 3 GB is valid in user mode since base address of segment is zero and limit is 4 GB. so how segmentation separates user mode and kernel mode or raise exception on invalid access? how code and data are separated? what i mean by this is say 0x0010 is valid code address and data address for code and data segment but what will be its actual physical address because there can be same physical address for certain segment:offset pair?
Segmentation is used to keep text, data, stack part separated so that we can manage access to respective memory. In linux the four segment user code, user data, kernel code kernel data has base offset as 0x00 and limit is 4 GB, user space has about 3 GB and kernel space has about 1 GB address space. kernel space begins somewhere 0xc000....
To access kernel data or code I need to load proper cs, ds same is true for user code and data. GDT is array of segment descriptor which has information of these limits and all.
My Que is: according to above segment arrangement any address above 3 GB is valid in user mode since base address of segment is zero and limit is 4 GB. so how segmentation separates user mode and kernel mode or raise exception on invalid access? how code and data are separated? what i mean by this is say 0x0010 is valid code address and data address for code and data segment but what will be its actual physical address because there can be same physical address for certain segment:offset pair?