[MPlayer-dev-eng] Re: amd64 -sws 0 fix (iow: playing with NX bit)

Aurelien Jacobs aurel at gnuage.org
Tue Jan 25 01:44:32 CET 2005

On Mon, 24 Jan 2005 15:23:22 -0800 (PST)
Trent Piepho <xyzzy at speakeasy.org> wrote:

> On Mon, 24 Jan 2005, Aurelien Jacobs wrote:
> > Hum... did you had a look at my mmap patch ?
> > It also check PAGESIZE to ensure that only funnyCode and nothing more
> > Maybe it's not useful ? I don't know if mmap only alloc full pages or
> If you just made the max funny code size a multiple of the pagesize, like
> PAGESIZE*4 or 10001/PAGESIZE*PAGESIZE+PAGESIZE then you could just ignore mmap
> alignment from then on.

That's what I've done... Look at the patch.
The point is that it require to know PAGESIZE, that's all.

> > Moreover, we also can't assume that we have mmap so we need an
> > alternative way to do it. That's why I think it's not simpler.
> If you have NX and mprotect, then can't you assume mmap too?  If you don't
> have NX, then you don't have to worry about mprotect or alignment.

Right, but the old code was not doing any allocation. It used a 32 bytes
aligned static array.
With this new versions, arrays are replaced by pointers, and are then mmaped.
But if mmap is not available we still need to alloc those pointers. And so
we should have 2 different freeing method. Or funnyCode should be
conditionally defined to array or pointers depending on availability of
mmap. Anyway there need to be 2 different path depending on mmap or not.

For now, the only thing I want to know is if mmap is really preferred over
memalign ?


More information about the MPlayer-dev-eng mailing list