Subject: Re: mmap() and page alignment
To: None <tech-kern@NetBSD.ORG>
From: Frank van der Linden <frank@fwi.uva.nl>
List: tech-kern
Date: 07/07/1995 23:37:58
Quoting Gordon W. Ross,

> 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.

vm_mmap first creates a map with the unrounded size, and then allocates
in that map with the rounded up size, so it always fails. A rather
strange behavior I thought, but when I tried a quick fix for it
I got panics, so I figured I'd better polish up my knowledge of the VM
system before trying again..

Rounding up the size before mapping also gave some problems, of which
I don't remember the details, but I think it had to do with overlapping
maps of text & data.

So, at first I wondered why Christos had not used demand paging in his
code, but I found out the hard way myself.  Anyway, I'd be very happy if
someone else was more successful here.

- Frank