On x86 and ppc32 the offset argument to mmap2 is specified in pages

not bytes. This is a horrible kludge of a fix and it should probably
be fixed properly with a separate sys_mmap for amd64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4821
This commit is contained in:
Tom Hughes 2005-09-29 23:26:06 +00:00
parent a8627dede8
commit 734ffbfb60

View File

@ -552,6 +552,7 @@ PRE(sys_mmap2)
{
Addr advised;
SysRes sres;
OffT offset;
// Exactly like old_mmap() in x86-linux except:
// - all 6 args are passed in regs, rather than in a memory-block.
@ -612,11 +613,17 @@ PRE(sys_mmap2)
vg_assert(! FAILURE);
#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux)
offset = ARG6 * VKI_PAGE_SIZE;
#else
offset = ARG6;
#endif
/* Otherwise we're OK (so far). Install aspacem's choice of
address, and let the mmap go through. */
sres = VG_(am_do_mmap_NO_NOTIFY)(advised, ARG2, ARG3,
ARG4 | VKI_MAP_FIXED,
ARG5, ARG6);
ARG5, offset);
SET_STATUS_from_SysRes(sres);
if (!sres.isError) {
@ -625,7 +632,7 @@ PRE(sys_mmap2)
(Addr)sres.val, /* addr kernel actually assigned */
ARG2, ARG3,
ARG4, /* the original flags value */
ARG5, ARG6
ARG5, offset
);
/* Load symbols? */
VG_(di_notify_mmap)( (Addr)sres.val );