Subject: mmap() and page alignment
To: None <frank@fwi.uva.nl>
From: Gordon W. Ross <gwr@mc.com>
List: tech-kern
Date: 07/07/1995 10:43:00
> From: frank@fwi.uva.nl (Frank van der Linden)
> X-Organisation: Faculty of Mathematics & Computer Science
>                 University of Amsterdam
>                 Kruislaan 403
>                 NL-1098 SJ Amsterdam
>                 The Netherlands
> X-Phone:        +31 20 525 7463
> X-Telex:        10262 hef nl
> X-Fax:          +31 20 525 7490
> Date: Fri, 7 Jul 1995 11:18:49 +0200 (MET DST)
> X-Mailer: ELM [version 2.4 PL23]
> Mime-Version: 1.0
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: 7bit
> Content-Length: 611       
> Sender: owner-tech-kern@netbsd.org
> Precedence: list
> X-Loop: tech-kern@NetBSD.ORG
> 
> Quoting Gordon W. Ross,
> 
> > The fact that old linux executables can not be mapped using perfectly
> > valid POSIX restrictions is an unfortunate mistake in the design of
> > that executable format.  This problem is sort of moot now that Linux
> > has moved to  ELF instead.  Hopefully the new format can be mapped
> > without violatating these restrictions.
> 
> Unfortunately, the current kern/exec_elf.c is not able to use demand
> paging because of what seems to be (as far as I looked into it) another
> restriction: vm_mmap wants the size to be page-aligned to. This restriction
> seems unnecessary to me, or is it?
> 
> - Frank

The exec code should page-align the size too, for the same reasons.
(Actually, I think vm_mmap will round-up the size, no?)

I've pointed out before that the ELF exec could use demand loading.
All it needs to do is round down the start address of each segment
(to a page) when it creates the mapping, and map them in file order.

I'd try it, but I don't have any machine that uses ELF.
(I hate 386/486 boxes...)

Gordon