X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Thu, 20 Nov 2008 17:50:37 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: mmap call gives invalid argument
Message-ID: <20081120165037.GA31444@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <2e7d31500811182249m6c38119cv67686eaaf2e1e5e1@mail.gmail.com> <20081119112813.GG10351@calimero.vinschen.de> <2e7d31500811190656k28244d3ev89a3c6b5ffd571e7@mail.gmail.com> <20081119154450.GJ9927@calimero.vinschen.de> <5E25AF06EFB9EA4A87C19BC98F5C875301EF44CC@core-email.int.ascribe.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5E25AF06EFB9EA4A87C19BC98F5C875301EF44CC@core-email.int.ascribe.com>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Nov 20 13:10, Phil Betts wrote:
> Corinna Vinschen wrote on Wednesday, November 19, 2008 3:45 PM::
> > On Nov 19 22:56, Carlo Florendo wrote:
> >> On Wed, Nov 19, 2008 at 7:28 PM, Corinna Vinschen wrote:
> >>> On Nov 19 14:49, Carlo Florendo wrote:
> 
> Trees removed to enable wood to be seen...

:-)

> >>>> Table at 0x3BEE3000.
> 
> > 152   61108 [main] dmidecode 540 mmap64: addr 0, len 13783, prot 1,
> >        flags 1, fd 3, off 1005453312 ^^^^^^^^^^
> >        Where does dmidecode get this offset from?  The address is
> >        beyond the memory size available.
> 
> off = 1005453312 = 0x3BEE0000
> len = 13783      = 0x000035D7
> 
> Based only on the code snippet provided, the offset is the table 
> address (0x3BEE3000) rounded down to the nearest page boundary 
> (0x3BEE0000), and len is the table length (0x5D7) plus the offset 
> of the table into the page (0x3000)
> 
> I've not looked at the cygwin mmap code or the /dev/mem code, but
> assuming it's close to the linux implementation I'll proceed...
> [...]
> So:
> 
> Firstly, is the table address correct?  Since lseek also fails, it
> would suggest not.
> 
> Secondly, the length (i.e. mmoffset+len) should be rounded up to a 
> multiple of the page size.  Perhaps the cygwin implementation is
> stricter in this regard than linux.

I don't think so.  The if-clause which fails in this case is basically:

  if (offset + length >= physical_memory_size)
    return EINVAL;


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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/

