From: madhu.sk89@gmail.com (Madhu K)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Virtual Address Space
Date: Mon, 3 Oct 2016 10:42:15 +0530 [thread overview]
Message-ID: <CAA2oCOn8_JPg0hFGL289C0rvtrm3GBW_mq7eKK79QdWHew2LYg@mail.gmail.com> (raw)
In-Reply-To: <C3566FB7-AC4F-491E-8B64-C1A3080C3A01@gmail.com>
Hi All,
Thank you so much for all your answers.
Regards,
Madhu
On Sun, Oct 2, 2016 at 8:22 AM, Arshad Hussain <arshad.super@gmail.com>
wrote:
>
> On 30-Sep-2016, at 10:10 pm, Rom?n Mart?nez <rgmf@riseup.net> wrote:
>
> > Hi,
> >
> > I compile main.s and it generates main.o. With objdump I can see:
> >
> > 0000000000000000 <_start>:
> > 0: b8 01 00 00 00 mov $0x1,%eax
> > 5: bb 00 00 00 00 mov $0x0,%ebx
> > a: cd 80 int $0x80
> >
> > After link main.o it generates main. With objdump I now can see:
> >
> > 0000000000400078 <_start>:
> > 400078: b8 01 00 00 00 mov $0x1,%eax
> > 40007d: bb 00 00 00 00 mov $0x0,%ebx
> > 400082: cd 80 int $0x80
> >
> > 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?
> >
> The linker script would normally leave out some area and _not_ start from
> 0. (although this is not
> an absolute necessity ). It will pick up and valid virtual address and
> assign start of .text,.bss and
> .stack. This is possible because we now have virtual memory. And every
> program thinks that it
> has _all_ the memory for itself. So, 400078 is perfectly valid virtual
> address space and linker
> has chosen this for this executable.
>
> Also note that if the address space is getting shifted by little , this is
> because of the KASLR
> (layout randomisation) - If this is disabled then the linker would
> generate the same virtual
> address for all the executable every time.
>
>
>
> <snip>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161003/3b108c1b/attachment.html
next prev parent reply other threads:[~2016-10-03 5:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 5:06 Virtual Address Space Madhu K
2016-09-28 6:05 ` Arun Sudhilal
2016-09-28 10:11 ` Madhu K
2016-09-28 10:59 ` Prabhunath G
2016-09-28 13:32 ` Gadre Nayan
2016-09-30 16:40 ` Román Martínez
2016-10-02 2:52 ` Arshad Hussain
2016-10-03 5:12 ` Madhu K [this message]
2016-09-28 6:09 ` Greg KH
2016-09-28 10:14 ` Madhu K
2016-09-28 10:29 ` Greg KH
2016-09-28 9:14 ` Augusto Mecking Caringi
2016-09-28 10:21 ` Madhu K
2016-09-28 10:37 ` Alexander Kapshuk
2016-09-29 7:25 ` arshad hussain
2016-09-30 17:09 ` roman at mailoo.org
2016-10-01 18:02 ` piyush moghe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA2oCOn8_JPg0hFGL289C0rvtrm3GBW_mq7eKK79QdWHew2LYg@mail.gmail.com \
--to=madhu.sk89@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).