* mmap.cc (mmap_record::alloc_page_map): Mark pages as allocated even

on Windows 9x, FWIW.
This commit is contained in:
Corinna Vinschen 2004-07-16 14:32:03 +00:00
parent 99d86313f4
commit e348b39a71
2 changed files with 18 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2004-07-15 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap_record::alloc_page_map): Mark pages as allocated even
on Windows 9x, FWIW.
2004-07-15 Corinna Vinschen <corinna@vinschen.de> 2004-07-15 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mprotect): When MAP_WRITE protection is requested, use * mmap.cc (mprotect): When MAP_WRITE protection is requested, use

View File

@ -168,26 +168,29 @@ mmap_record::alloc_page_map (_off64_t off, DWORD len)
sizeof (DWORD)))) sizeof (DWORD))))
return false; return false;
off -= offset_;
len = PAGE_CNT (len);
if (wincap.virtual_protect_works_on_shared_pages ()) if (wincap.virtual_protect_works_on_shared_pages ())
{ {
DWORD old_prot; DWORD old_prot;
DWORD vlen = len * getpagesize ();
off -= offset_;
len = PAGE_CNT (len) * getpagesize ();
if (off > 0 && if (off > 0 &&
!VirtualProtect (base_address_, off, PAGE_NOACCESS, &old_prot)) !VirtualProtect (base_address_, off, PAGE_NOACCESS, &old_prot))
syscall_printf ("VirtualProtect(%x,%D) failed: %E", base_address_, off); syscall_printf ("VirtualProtect(%x,%D) failed: %E", base_address_, off);
if (off + len < size_to_map_ if (off + vlen < size_to_map_
&& !VirtualProtect (base_address_ + off + len, && !VirtualProtect (base_address_ + off + vlen,
size_to_map_ - len - off, size_to_map_ - vlen - off,
PAGE_NOACCESS, &old_prot)) PAGE_NOACCESS, &old_prot))
syscall_printf ("VirtualProtect(%x,%D) failed: %E", syscall_printf ("VirtualProtect(%x,%D) failed: %E",
base_address_ + off + len, size_to_map_ - len - off); base_address_ + off + vlen, size_to_map_ - vlen - off);
}
off /= getpagesize (); off /= getpagesize ();
len /= getpagesize ();
while (len-- > 0) while (len-- > 0)
MAP_SET (off + len); MAP_SET (off + len);
}
return true; return true;
} }