X-Spam-Check-By: sourceware.org Date: Mon, 28 Nov 2005 16:19:43 +0100 From: Samuel Thibault To: cygwin AT cygwin DOT com Subject: Re: mmap() on 64K aligned address fails Message-ID: <20051128151943.GW7492@implementation.labri.fr> Mail-Followup-To: cygwin AT cygwin DOT com References: <20051126214701 DOT GW5074 AT bouh DOT residence DOT ens-lyon DOT fr> <20051127130652 DOT GT2999 AT calimero DOT vinschen DOT de> <20051127222246 DOT GJ5150 AT bouh DOT residence DOT ens-lyon DOT fr> <20051128115109 DOT GF2999 AT calimero DOT vinschen DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.9i-nntp X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, Sam Steingold, le Mon 28 Nov 2005 09:55:52 -0500, a écrit : > | #define my_shift 24 > | #define my_low 1 > | #ifdef FOR_SUN4_29 > | #define my_high 31 > | #define my_size 32768 /* hope that 32768 is a multiple of the page size */ > | /* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */ > | #else > | #define my_high 64 > | #define my_size 8192 /* hope that 8192 is a multiple of the page size */ > | /* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */ > | #endif >... > | { caddr_t addr = (caddr_t)(i << my_shift); > | /* Check for 8 MB, not 16 MB. This is more likely to work on Solaris 2. */ > | #if bits_to_avoid > | long size = i*my_size; > | #else > | long size = ((i+1)/2)*my_size; > | #endif > | if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (void*)-1) exit(1); This test is just so strange... How can this ever work on many systems ? A system is free to refuse to mmap anything in the 0x1000000 area... Can't this test just be turned into mmaping 16MB (not fixed), unmap() it, and then, from this address, try to mmap pagesize() ? (instead of obviously wrong 8KB guess...) Regards, Samuel -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/