NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mmap and MAP_FIXED




On May 12, 2016, at 10:33 AM, Michael wrote:

Hello,

On Thu, 12 May 2016 11:26:08 +0200
Johnny Billquist <bqt%update.uu.se@localhost> wrote:

I haven't tested, or analyzed this to any depth, but I wonder... What is the pagesize of the machine? 8K? I wonder if you might have some issue when you try to map only 4K fixed. The man-page says that if MAP_FIXED is used, the address must be page aligned, but it does not say anything
about the size, but it makes me wonder...

Page size is hardware dependent, I have machines here that use 4K
( sparc, powerpc, etc. ), 8K ( sparc64, arm ) or 16K ( some MIPS )
pages.
But the start address in the test program is aligned to something much
larger, so the first test should succeed if that was the problem. I
wouldn't bet on the address range used being available though, but
that's just a hunch.
Also, why MMAP_FIXED in the first place?

MMAP_FIXED forces mmap to use the addr given or fail; without it, it
can act as if addr=0, and provide its own address.  So, result might
!= addr.  Don't know if it would make a difference, but you could try
w/o fixed, and changing to see if result != addr,  (and unmapping )
Im guessing CLISP is specifying the addr so it can use the same address
each run, for space for cons-cells and such?  And machine code refers?
to the address? Could you pass 0 as address, letting mmap pick the address,
then save result address somehow then, recompile with FIXED, and
that address?

Home | Main Index | Thread Index | Old Index