进程 起始地址 linux,为什么x86 Linux程序起始地址是从0x08048000开始的?

1. The load address is arbitrary, but was standardized back with SYSV for x86. It's different for every architecture. What goes above and below is also arbitrary, and is often taken up by linked in libraries and mmap() regions.2. The answer is really: a bunch of things. There is no magical meaning to the load address of the executable and pretty much anything can be mapped to the lower addresses. Common examples including: C library (such as the C library), the dynamic loader ld.so and the kernel VDSO (kernel mapped dynamic code library that provides some of the interface to the kernel in x86 Linux). But you can pretty much map anything you desire there, using the mmap() system call.

For example on my specific machine the map is as follows (acquired but "cat /proc/self/maps"):

gby@watson:~$ cat /proc/self/maps

001c0000-00317000 r-xp 00000000 08:01 245836     /lib/libc-2.12.1.so

00317000-00318000 ---p 00157000 08:01 245836     /lib/libc-2.12.1.so

00318000-0031a000 r--p 00157000 08:01 245836     /lib/libc-2.12.1.so

0031a000-0031b000 rw-p 00159000 08:01 245836     /lib/libc-2.12.1.so

0031b000-0031e000 rw-p 00000000 00:00 0

00376000-00377000 r-xp 00000000 00:00 0          [vdso]

00852000-0086e000 r-xp 00000000 08:01 245783     /lib/ld-2.12.1.so

0086e000-0086f000 r--p 0001b000 08:01 245783     /lib/ld-2.12.1.so

0086f000-00870000 rw-p 0001c000 08:01 245783     /lib/ld-2.12.1.so

08048000-08051000 r-xp 00000000 08:01 2244617    /bin/cat

08051000-08052000 r--p 00008000 08:01 2244617    /bin/cat

08052000-08053000 rw-p 00009000 08:01 2244617    /bin/cat

09ab5000-09ad6000 rw-p 00000000 00:00 0          [heap]

b7502000-b7702000 r--p 00000000 08:01 4456455    /usr/lib/locale/locale-archive

b7702000-b7703000 rw-p 00000000 00:00 0

b771b000-b771c000 r--p 002a1000 08:01 4456455    /usr/lib/locale/locale-archive

b771c000-b771e000 rw-p 00000000 00:00 0

bfbd9000-bfbfa000 rw-p 00000000 00:00 0          [stack]

3. We can use the address space below 0x08048000, use mmap system call.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值