From e348b39a719c81dce44594c56daf00cc71a0f55b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Jul 2004 14:32:03 +0000 Subject: [PATCH] * mmap.cc (mmap_record::alloc_page_map): Mark pages as allocated even on Windows 9x, FWIW. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/mmap.cc | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c21732939..406411416 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 Corinna Vinschen + + * mmap.cc (mmap_record::alloc_page_map): Mark pages as allocated even + on Windows 9x, FWIW. + 2004-07-15 Corinna Vinschen * mmap.cc (mprotect): When MAP_WRITE protection is requested, use diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 16611480c..ebca63d59 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -168,26 +168,29 @@ mmap_record::alloc_page_map (_off64_t off, DWORD len) sizeof (DWORD)))) return false; + off -= offset_; + len = PAGE_CNT (len); + if (wincap.virtual_protect_works_on_shared_pages ()) { DWORD old_prot; + DWORD vlen = len * getpagesize (); - off -= offset_; - len = PAGE_CNT (len) * getpagesize (); if (off > 0 && !VirtualProtect (base_address_, off, PAGE_NOACCESS, &old_prot)) syscall_printf ("VirtualProtect(%x,%D) failed: %E", base_address_, off); - if (off + len < size_to_map_ - && !VirtualProtect (base_address_ + off + len, - size_to_map_ - len - off, + if (off + vlen < size_to_map_ + && !VirtualProtect (base_address_ + off + vlen, + size_to_map_ - vlen - off, PAGE_NOACCESS, &old_prot)) syscall_printf ("VirtualProtect(%x,%D) failed: %E", - base_address_ + off + len, size_to_map_ - len - off); - off /= getpagesize (); - len /= getpagesize (); - while (len-- > 0) - MAP_SET (off + len); + base_address_ + off + vlen, size_to_map_ - vlen - off); } + + off /= getpagesize (); + + while (len-- > 0) + MAP_SET (off + len); return true; } -- 2.43.5