Subject: Re: Choosing a default text address for user programs for a new port
To: Glenn Serre <gaserre@spiresoftware.com>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-ports
Date: 04/18/2002 16:30:22
On Thu, Apr 18, 2002 at 03:23:10PM -0700, Glenn Serre wrote:

 > It seems like 0 is a bad choice, since it would make it hard to detect
 > NULL pointer reads.  I note that /sbin/init on my i386 box has text
 > starting at 0x08048100, but I don't know why it leaves all that space
 > after 0.

...to answer this...

The .text address is often specified by a processor's ELF supplemental
document.  This is definitely the case for the x86.

The motivations for moving .text so far up vary, but one of them is to
put the stack below .text so that it gets an automatic guard page as it
grows down towards 0.  Another is to reduce the number of page tables
required to map the address space of a typical program.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>