Mail Archives: cygwin/2008/11/21/05:20:34
On Nov 21 11:20, Carlo Florendo wrote:
> On Wed, Nov 19, 2008 at 11:44 PM, Corinna Vinschen wrote:
> > Try building Cygwin from scratch after disabling the first `if' statement
> > in fhandler_dev_mem::mmap (file winsup/cygwin/mmap.cc). If that helps,
> > it seems that this check is too well meant and we should better rely on
> > the OS function doing the right thing.
>
> Ok. I've recompiled cygwin. I've also attached the new cygcheck.
>
> The diff output below shows the only change I did. So essentially, we
> just let the compiler skip the if statement you mentioned.
>
> --- mmap.cc.orig 2008-11-21 11:06:48.000000000 +0800
> +++ mmap.cc 2008-11-21 11:06:59.000000000 +0800
> @@ -1825,6 +1825,7 @@ HANDLE
> fhandler_dev_mem::mmap (caddr_t *addr, size_t len, int prot,
> int flags, _off64_t off)
> {
> +#ifdef IGNORE_CFF_DMIDECODE_ISSUE
> if (off >= mem_size
> || (DWORD) len >= mem_size
> || off + len >= mem_size)
> @@ -1833,6 +1834,7 @@ fhandler_dev_mem::mmap (caddr_t *addr, s
> debug_printf ("-1 = mmap(): illegal parameter, set EINVAL");
> return INVALID_HANDLE_VALUE;
> }
> +#endif
>
> UNICODE_STRING memstr;
> RtlInitUnicodeString (&memstr, L"\\device\\physicalmemory");
>
>
> In spite of that, after recompiling dmidecode with the new
> cygwin1.dll, this is what we get:
>
> $ ./dmidecode.exe
> /dev/mem: mmap: Invalid argument
> # dmidecode 2.9
> SMBIOS 2.5 present.
> 54 structures occupying 1495 bytes.
> Table at 0x3BEE3000.
>
> The new strace is here: http://astra.ph/research/carlo/strace2.out
>
> Is this some problem associated with accessing the device because it's 1GB?
I don't know. See the strace yourself:
156 133660 [main] dmidecode 2092 mmap64: addr 0, len 13783, prot 1, flags 1, fd 3, off 1005453312
101 133761 [main] dmidecode 2092 MapViewNT: 0 = NtMapViewOfSection (h:6F8, addr:0, len:13783, off:1005453312, protect:2, type:0)
85 133846 [main] dmidecode 2092 seterrno_from_win_error: /home/Administrator/cygwin-1.5.25-15/winsup/cygwin/mmap.cc:1871 windows error 87
79 133925 [main] dmidecode 2092 geterrno_from_win_error: windows error 87 == errno 22
74 133999 [main] dmidecode 2092 __set_errno: void seterrno_from_win_error(const char*, int, DWORD):310 val 22
82 134081 [main] dmidecode 2092 mmap64: 0xFFFFFFFF = mmap()
Now you get the error message directly from Windows. Unfortunately,
we don't see the actual NTSTATUS value returned by NtMapViewOfSection
because I left the value out of the debug message. Silly me!
What you see is the converted Win32 error code 87, which is
ERROR_INVALID_PARAMETER. The actual NTSTATUS code might give you
another hint. Just change the debug_printf statement in the MapViewNT
function (mmap.cc line 384) to
debug_printf ("%p (status %p) = NtMapViewOfSection (h:%x, addr:%x, len:%u,"
" off:%D, protect:%x, type:%x)",
base, ret, h, addr, len, off, protect, 0);
recompile, rerun, and look for the "NtMapViewOfSection" lines in
the strace output. What's the hex status code?
However, since this fails on the native NT level, I don't think this is
just a simple Cygwin problem. It seems that this SMBIOS stuff is
somehow broken on that system.
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/
- Raw text -