|
From: <sv...@va...> - 2005-09-30 00:45:52
|
Author: sewardj
Date: 2005-09-30 01:45:47 +0100 (Fri, 30 Sep 2005)
New Revision: 4824
Log:
A corresponding fix to 4823: don't deal with MAP_FIXED case directly
here; instead uniformly pass all requests to VG_(am_get_advisory), so
that layout policy is controlled from one place only.
Modified:
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2005-09-30 00:37:04 UTC=
(rev 4823)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2005-09-30 00:45:47 UTC=
(rev 4824)
@@ -1472,6 +1472,8 @@
UWord a1, a2, a3, a4, a5, a6;
Addr advised;
SysRes sres;
+ Bool mreq_ok;
+ SysRes sres;
=20
UWord* args =3D (UWord*)ARG1;
PRE_REG_READ1(long, "old_mmap", struct mmap_arg_struct *, args);
@@ -1494,7 +1496,7 @@
return;
}
=20
- if (/*(a4 & VKI_MAP_FIXED) &&*/ !VG_IS_PAGE_ALIGNED(a1)) {
+ if (!VG_IS_PAGE_ALIGNED(a1)) {
/* zap any misaligned addresses. */
SET_STATUS_Failure( VKI_EINVAL );
return;
@@ -1502,38 +1504,30 @@
=20
/* Figure out what kind of allocation constraints there are
(fixed/hint/any), and ask aspacem what we should do. */
+ mreq.start =3D a1;
+ mreq.len =3D a2;
if (a4 & VKI_MAP_FIXED) {
- if (!ML_(valid_client_addr)(a1, a2, tid, "mmap2")) {
- SET_STATUS_Failure( VKI_EINVAL );
- return;
- }
+ mreq.rkind =3D MFixed;
+ } else
+ if (a1 !=3D 0) {
+ mreq.rkind =3D MHint;
} else {
- MapRequest mreq;
- Bool mreq_ok;
+ mreq.rkind =3D MAny;
+ }
=20
- mreq.start =3D a1;
- mreq.len =3D a2;
-
- if (a1 !=3D 0) {
- mreq.rkind =3D MHint;
- } else {
- mreq.rkind =3D MAny;
- }
-
- /* Enquire ... */
- advised =3D VG_(am_get_advisory)( &mreq, True/*client*/, &mreq_ok =
);
- if (!mreq_ok) {
- /* Our request was bounced, so we'd better fail. */
- SET_STATUS_Failure( VKI_EINVAL );
- return;
- }
-
- /* Otherwise we're OK (so far). Install aspacem's choice of
- address, and let the mmap go through. */
- a1 =3D advised;
- a4 |=3D VKI_MAP_FIXED;
+ /* Enquire ... */
+ advised =3D VG_(am_get_advisory)( &mreq, True/*client*/, &mreq_ok );
+ if (!mreq_ok) {
+ /* Our request was bounced, so we'd better fail. */
+ SET_STATUS_Failure( VKI_EINVAL );
+ return;
}
=20
+ /* Otherwise we're OK (so far). Install aspacem's choice of
+ address, and let the mmap go through. */
+ a1 =3D advised;
+ a4 |=3D VKI_MAP_FIXED;
+
vg_assert(! FAILURE);
=20
sres =3D VG_(am_do_mmap_NO_NOTIFY)(a1, a2, a3, a4, a5, a6);
|