delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/28/10:19:28

X-Spam-Check-By: sourceware.org
Date: Mon, 28 Nov 2005 16:19:43 +0100
From: Samuel Thibault <samuel DOT thibault AT ens-lyon DOT org>
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: <dmajga$8lq$1 AT sea DOT gmane DOT org> <20051126214701 DOT GW5074 AT bouh DOT residence DOT ens-lyon DOT fr> <dmaov2$nk0$1 AT sea DOT gmane DOT org> <dmavc9$5bt$1 AT sea DOT gmane DOT org> <20051127130652 DOT GT2999 AT calimero DOT vinschen DOT de> <dmdba8$dd4$1 AT sea DOT gmane DOT org> <20051127222246 DOT GJ5150 AT bouh DOT residence DOT ens-lyon DOT fr> <dmdd26$hrf$1 AT sea DOT gmane DOT org> <20051128115109 DOT GF2999 AT calimero DOT vinschen DOT de> <u4q5w2553 DOT fsf AT gnu DOT org>
Mime-Version: 1.0
In-Reply-To: <u4q5w2553.fsf@gnu.org>
User-Agent: Mutt/1.5.9i-nntp
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019