<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi,</div><div><br></div><div>I <b>compile main.s</b> and it generates <b>main.o</b>. With objdump I can see:</div><div><br></div><div>0000000000000000 <_start>:</div><div> 0:<span class="Apple-tab-span" style="white-space:pre">        </span>b8 01 00 00 00 <span class="Apple-tab-span" style="white-space:pre">        </span>mov $0x1,%eax</div><div> 5:<span class="Apple-tab-span" style="white-space:pre">        </span>bb 00 00 00 00 <span class="Apple-tab-span" style="white-space:pre">        </span>mov $0x0,%ebx</div><div> a:<span class="Apple-tab-span" style="white-space:pre">        </span>cd 80 <span class="Apple-tab-span" style="white-space:pre">        </span> int $0x80</div><div><br></div><div>After<b> link main.o</b> it generates <b>main</b>. With objdump I now can see:</div><div><br></div><div>0000000000400078 <_start>:</div><div> 400078:<span class="Apple-tab-span" style="white-space:pre">        </span>b8 01 00 00 00 <span class="Apple-tab-span" style="white-space:pre">        </span>mov $0x1,%eax</div><div> 40007d:<span class="Apple-tab-span" style="white-space:pre">        </span>bb 00 00 00 00 <span class="Apple-tab-span" style="white-space:pre">        </span>mov $0x0,%ebx</div><div> 400082:<span class="Apple-tab-span" style="white-space:pre">        </span>cd 80 <span class="Apple-tab-span" style="white-space:pre">        </span> int $0x80</div><div><br></div><div>So, linker generates virtual address, doesn't it? But why it starts at 400078 and not in other any location? Is there any logic here? A virtual address can start at 0?</div><div><br></div><div>Regards.</div><div><br></div><div>El mié, 28-09-2016 a las 19:02 +0530, Gadre Nayan escribió:</div><blockquote type="cite"><p dir="ltr">Virtual addresses will be used only in case MMU is enabled, otherwise for a processor an address is something it can put on the bus, irrespective of physical or virtual.</p>
<p dir="ltr">So when your PC increments virtual address for a MMU enabled system, they will get translated to physical.</p>
<div class="gmail_quote">On 28 Sep 2016 4:29 p.m., "Prabhunath G" <<a href="mailto:gprabhunath@gmail.com">gprabhunath@gmail.com</a>> wrote:<br type="attribution"><blockquote type="cite"><div dir="ltr">The virtual addresses what you see in the output of objdump is given/associated by Linker to every instruction and data symbol in the data/bss section except for symbols in the stack section. It is wrong to use generated in the context of Linker. <div>When you initiate <b>$./a.out</b> for execution, the kernel will take your start address from the ELF header of <b>a.out</b> and place it on the PC (program counter) or IP (instruction pointer) of the CPU, thereafter CPU will start incrementing or generating virtual address for every subsequent instructions. </div><div><br></div><div>Regards,<br>Prabhu</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 3:41 PM, Madhu K <span dir="ltr"><<a href="mailto:madhu.sk89@gmail.com" target="_blank">madhu.sk89@gmail.com</a>></span> wrote:<br><blockquote type="cite"><div dir="ltr"><span style="font-size:12.8px">Hi Arun,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks for your response.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I will elaborate my question.Assume I have test.c file, I compiled test.c and generated the a.out ( Executable for linux ), when I do objdump of a.out, we can see addresses( virtual address ) associated with each instruction, these instructions are generated by whom?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 11:35 AM, Arun Sudhilal <span dir="ltr"><<a href="mailto:getarunks@gmail.com" target="_blank">getarunks@gmail.com</a>></span> wrote:<br><blockquote type="cite">Hello Madhu,<br>
<span><br>
On Wed, Sep 28, 2016 at 10:36 AM, Madhu K <<a href="mailto:madhu.sk89@gmail.com" target="_blank">madhu.sk89@gmail.com</a>> wrote:<br>
> Hi All,<br>
><br>
> This is to understand the Virtual address space.Basically who generates the<br>
> virtual addresses CPU or GNU compiler?<br>
<br>
</span>I didn't really get your question.<br>
<br>
Linux kernel starts at a fixed location in virtual space. This is<br>
called PAGE_OFFSET. On a kernel split of 3GB/1GB, 32 system, its is<br>
0xC000_0000. You can have a look at system.map file after compiling<br>
your kernel.<br>
When cpu runs with MMU on, your cpu generates virtual address.<br>
<br>
Regards,<br>
Arun<br>
<br>
><br>
> Thanks<br>
> Madhu<br>
><br>
> ______________________________<wbr>_________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.or<wbr>g</a><br>
> <a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.or<wbr>g/mailman/listinfo/kernelnewbi<wbr>es</a><br>
><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.or<wbr>g</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.or<wbr>g/mailman/listinfo/kernelnewbi<wbr>es</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature">Regards,<br>Prabhunath G<br>Linux Trainer<br>Bangalore<br></div>
</div></div></div>
<br>______________________________<wbr>_________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.<wbr>org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.<wbr>org/mailman/listinfo/<wbr>kernelnewbies</a><br>
<br></blockquote></div>
<pre>_______________________________________________
Kernelnewbies mailing list
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a>
</pre></blockquote></body></html>