Subject: Re: Wine & NetBSD?
To: Bang Jun-Young <bjy@mogua.org>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-kern
Date: 11/20/2001 13:50:25
On Wed, 21 Nov 2001, Bang Jun-Young wrote:

: >    When MAP_FIXED is not set, the implementation uses addr in an unspecified
: >    manner to arrive at pa. The pa so chosen will be an area of the address
:
: 'unspecified' - we should be free to choose any address which is valid.

Yes, the *KERNEL* is free to choose any address which is valid if MAP_FIXED
is not set.  A userland program (Wine) has no say in the matter.  End of
story.

In particular, the straw example you gave had a completely bogus
expectation:  you thought that mmap(0x50000000, ...)  without MAP_FIXED
would remap 0x50000000.  It *cannot*, from the citation I gave:

: >    When the implementation selects a value for pa, it never places a mapping
: >    at address 0, nor does it replace any extant mapping.
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

: > aCCOrding to this citation, NetBSD is 100% correct in its implementation of
: > MAP_FIXED vs. non-MAP_FIXED.
:
: Yes, but the patch is also correct. Which one would we choose?

The current implementation works perfectly well based on my experience and
reading of the spec.  `If it ain't broke, don't fix it.'

Changing the NetBSD kernel just to make one program's bogus expectations
work is not the solution.  Wine will still have bogus expectations.

However, please feel free to fix Wine's broken mmap handling.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/