<div dir="ltr"><div><div><div><div><div><div><div><div>In principle, the linker will associate the kernel code/data to the Kernel virtual address space i.e. between 0xC000_0000 to 0xFFFF_FFFF and <br>the same linker will associate the Application's code/data to the user virtual address space i.e. between 0x0000_0000 to 0xBFFF_FFFF. <br>
<br></div>Linker itself cannot distinguish between the kernel code/data and user code/data but it is the linker script that will guide the linker to associate the code/data to the respective addresses. <br><br></div>What you are seeing is the linker script provided to the linker with -T option when building the kernel. <br>
</div><br></div>To build the user application the linker uses its default linker script which you get it by executing<br></div>$ ld --verbose. <br><br></div>To compare between the two just juxtapose the readelf output of both kernel executable (vmlinux) and any user application executable (a.out)<br>
<br></div>$ readelf -a vmlinux <br></div>$ readelf -a a.out<br><br>Just inspect the section header and program header of both the outputs you will get the difference. <br><br>Regards,<br>Prabhu<br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Mar 1, 2013 at 11:07 AM, Arun KS <span dir="ltr"><<a href="mailto:getarunks@gmail.com" target="_blank">getarunks@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Horseriver,<br>
<div class="im"><br>
On Sun, Feb 24, 2013 at 7:26 AM, horseriver <<a href="mailto:horserivers@gmail.com">horserivers@gmail.com</a>> wrote:<br>
> On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote:<br>
>> On Sat, Feb 23, 2013 at 6:45 AM, horseriver <<a href="mailto:horserivers@gmail.com">horserivers@gmail.com</a>> wrote:<br>
>> > hi:<br>
>> ><br>
>> > I have built vmlinux at the top dir of kernel source ,then I use objdump to look into<br>
>> > its section information.I find the statup_32 which is the start routine of kernel ,<br>
>> > locats at 0xc0100000. I know the 0x100000 is the defined address for locating<br>
>> > protect-mode code .But which I can not understand is the 0xc prefix .where does it come from?<br>
>><br>
>> If my guess is right, that's because kernel mode code start at<br>
>> 0xc000000 a.k.a a bit above 3 GiB on x86 32 bit machine<br>
><br>
> I have find this answer .<br>
> It is defined in lds script file .<br>
><br>
> here is the code :<br>
> SECTIONS<br>
> {<br>
> . = 0xC0000000 + 0x100000;<br>
> /* read-only */<br>
> _text = .; /* Text and read-only data */<br>
><br>
><br>
> why use 0xC0000000 as its start ? why not just use 0x100000 only ?<br>
> if use 0xC0000000,every linked symbole will be prefixed by 0xc , what is the purpose ?<br>
<br>
</div>Usually, user kernel space split is 3G:1G.<br>
ie 1G for kernel space. And this starts from 0xC000_0000 till 0xFFFF_FFFF<br>
<br>
All the address below 0xC000_0000(ie 3G from 0x0 to 0xBFFF_FFFF) is<br>
used for user space.<br>
<br>
Thanks,<br>
Arun<br>
<div class="HOEnZb"><div class="h5">><br>
> thanks!<br>
><br>
><br>
><br>
> --<br>
>> regards,<br>
>><br>
>> Mulyadi Santosa<br>
>> Freelance Linux trainer and consultant<br>
>><br>
>> blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>
>> training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a><br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br></div>