__USER_CS,__KERNEL_CS,__USER_DS,__KERNEL_DS, all have base=0x00000000 and limit=0xfffff.
What I can’t understand is that these linear addresses will give identical physical addresses
(I think I might be wrong here). The linear address (thus the physical address) generated will be same in all cases which means that user and kernel structures are stored at the same place.
Also, explain to me how, contrary to all this, we say that kernel structures are stored at the upper 1 GB and user structures are stored at the lower 3 GB.
Kindly point out my mistakes in the understanding of paging and segmentation.
Thank you.
You are mistaken in assuming that the linear address map to physical addresses in a 1:1 fashion. What happens instead is that page tables are used to map linear addresses to physical addresses. Each process has a different set of page tables, providing address separation and virtual memory. In the kernel space, the page tables of the first 3GB point to “virtual” addresses; the last GB maps in a roughly 1:1-fashion to physical addresses (in some configurations). Protection of kernel-mode pages is achieved by (not) setting the USER access bit in the page table entry.