* mmap.cc (mmap64): Handle MAP_FIXED request on non-granulation

boundary.
This commit is contained in:
Corinna Vinschen 2005-02-25 11:47:17 +00:00
parent c68de3a262
commit a3079b47fe
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-02-25 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap64): Handle MAP_FIXED request on non-granulation
boundary.
2005-02-25 Corinna Vinschen <corinna@vinschen.de> 2005-02-25 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (class mmap_record): Declare new map_pages method with * mmap.cc (class mmap_record): Declare new map_pages method with

View File

@ -530,6 +530,10 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
if (flags & MAP_ANONYMOUS) if (flags & MAP_ANONYMOUS)
fd = -1; fd = -1;
/* If MAP_FIXED is requested on a non-granularity boundary, change request
so that this looks like a request with offset addr % granularity. */
if (fd == -1 && (flags & MAP_FIXED) && ((DWORD)addr % granularity) && !off)
off = (DWORD)addr % granularity;
/* Map always in multipliers of `granularity'-sized chunks. */ /* Map always in multipliers of `granularity'-sized chunks. */
_off64_t gran_off = off & ~(granularity - 1); _off64_t gran_off = off & ~(granularity - 1);
DWORD gran_len = howmany (off + len, granularity) * granularity - gran_off; DWORD gran_len = howmany (off + len, granularity) * granularity - gran_off;
@ -615,7 +619,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
return ret; return ret;
} }
} }
if (map_list && fd == -1 && off == 0 && (flags & MAP_FIXED)) if (map_list && fd == -1 && (flags & MAP_FIXED))
{ {
caddr_t u_addr; caddr_t u_addr;
DWORD u_len; DWORD u_len;