• David Howells's avatar
    [PATCH] FRV: Better mmap support in uClinux · feed5ede
    David Howells authored
    The attached patch changes mm/nommu.c to better support mmap() when MMU
    support is disabled (as it is in uClinux).
    
    This was discussed on the uclibc mailing list in a thread revolving around the
    following message:
    
    	Date: Thu, 1 Apr 2004 12:05:50 +1000
    	From: David McCullough <davidm@snapgear.com>
    	To: David Howells <dhowells@redhat.com>
    	Cc: Alexandre Oliva <aoliva@redhat.com>, uclibc@uclibc.org
    	Subject: Re: [uClibc] mmaps for malloc should be private
    	Message-ID: <20040401020550.GG3150@beast>
    
    The revised rules are:
    
     (1) Anonymous mappings can be shared or private, read or write.
    
     (2) Chardevs can be mapped shared, provided they supply a get_unmapped_area()
         file operation and use that to set the address of the mapping (as a frame
         buffer driver might do, for instance).
    
     (3) Files (and blockdevs) cannot be mapped shared since it is not really
         possible to honour this by writing any changes back to the backing device.
    
     (4) Files (or sections thereof) can be mapped read-only private, in which case
         the mapped bit will be read into memory and shared, and its address will
         be returned. Any excess beyond EOF will be cleared.
    
     (5) Files (or sections thereof) can be mapped writable private, in which case
         a private copy of the mapped bit will be read into a new bit memory, and
         its address will be returned. Any excess beyond EOF will be cleared.
    
    Mappings are per MM structure still. You can only unmap what you've mapped.
    
    Fork semantics are irrelevant, since there's no fork.
    
    A global list of VMA's is maintained to keep track of the bits of memory
    currently mapped on the system.
    
    The new binfmt makes use of (4) to implement shared libraries.
    Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    feed5ede
nommu.c 18.1 KB