Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I read somewhere that (at least since Linux v. 2.6) all user-space code is placed at load address 0x8048000 in the virtual memory address space.

My own observations confirm this. I have done a

cat /proc/......../maps

for several processes and the very first section of a process' program text always starts at '0x8048000'.

Furthermore the C library startup code and all the other runtime goodies all seem to be mapped after this default value.

This constitutes almost 128 M of address space, not a lot considering that 0xC0000000 - 0x8048000 is still almost 3G of address space for user space stuff.

So my question is why?

We are dealing with virtual addresses, interference or overlap with other programs is excluded by definition of the way VM works.

Are there some fixed/default mappings in the range 0x00000000 to 0x8048000 ?

Apart from the fact that the default start address falls on a page boundary, what is the rationale for having chosen this number as opposed to any other value?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

I admit that the following isn't a great answer, but I believe the 0x8048000 value is enshrined in the ELF Specification. See figures A.4, A.5 and A.6 in that doc. The System V ABI Intel 386 Architecture Supplement also standardizes on 0x8048000. See page 3-22, Figue 3-25. 0x804800 is prescribed as the low text segment address/high stack address. And that's weird in and of itself, as stacks are usually set in the high addresses of a process' memory space, and Linux is no exception.

You can get the GNU linker ld to set up an ELF executable so that the kernel maps it in to a somewhat lower or somewhat higher address. The method to do this varies from version to version of GCC and ld, so read man pages carefully. This would tend to indicate that 0x8048000 doesn't derive from some hardware requirement, but rather from other considerations.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.