Query regarding Kernel Space Memory
Hi Folks, In linux kernel space memory, on a system having 1G/3G address space division, the 0--3G address space is for user process whereas, ~ 3G+1--4G is for the kernel space. When i visualize this whole, on 32 bit architecture, what i see, basically,is both a userland and a kernel space processes, are , in fact just processes with compiler generating code for 4G address space. However,address range for a kernel code is restricted to 3G+1---4G address space, whereas for userland code it is between 0--3G. Then, as far as my understanding is, this is something which is done by linker/ loader. Which means, all the address generated for the kernel code, is relocated to 3G+1-4G address space by the linker/ loader, whereas all the address generated by the userland code is relocated to the 0-3G address space. This implies, kernel virtual address is always between 3G+1 -- 4G range on system which employ 1G/3G division rule. Can somebody confirm about this understanding? Any flaw here ??
Address generated by the linker is virtual address, it is not same as physical address. Kernel / MMU will do the virtual to physical address mapping. Hope this helps, PrasannaKumar
Hi Sannu, 1G/3G address split is for virtual address. I am not talking about physical address translation stuff here. When a kernel code is compiled for a 32 bit architecture, my assumption is, compiler will generate the code for the full 4G address range. So there must be somebody who is relocating/translating the kernel code address between 0-4G to 3G--4G address space. Who is that guy? and is my understanding correct?? On Tue, Feb 24, 2015 at 10:54 PM, Sannu K <sannumail4foss@gmail.com> wrote:
Address generated by the linker is virtual address, it is not same as physical address. Kernel / MMU will do the virtual to physical address mapping.
Hope this helps, PrasannaKumar
On Tue, Feb 24, 2015 at 11:53 AM, Vishwas Srivastava <vishu.kernel@gmail.com> wrote:
Hi Sannu, 1G/3G address split is for virtual address. I am not talking about physical address translation stuff here. When a kernel code is compiled for a 32 bit architecture, my assumption is, compiler will generate the code for the full 4G address range. So there must be somebody who is relocating/translating the kernel code address between 0-4G to 3G--4G address space. Who is that guy? and is my understanding correct??
On Tue, Feb 24, 2015 at 10:54 PM, Sannu K <sannumail4foss@gmail.com> wrote:
Address generated by the linker is virtual address, it is not same as physical address. Kernel / MMU will do the virtual to physical address mapping.
Hope this helps, PrasannaKumar
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
I believe it is done as part of kernel image linker script, please have a look at linux/arch/x86/kernel/vmlinux.lds.S. The very first logical address inside script is derived from LOAD_OFFSET (for x86_32) or __PAGE_OFFSET which is 3G mark. Hope I am pointing you in right way. -Rajat
participants (3)
-
Rajat Sharma -
Sannu K -
Vishwas Srivastava