mmap call gives invalid argument

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Nov 20 19:21:00 GMT 2008


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/



More information about the Cygwin mailing list