You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(12) |
2
(11) |
3
(8) |
|
4
(9) |
5
(10) |
6
(18) |
7
(8) |
8
(12) |
9
(23) |
10
(14) |
|
11
(15) |
12
(31) |
13
(45) |
14
(28) |
15
(20) |
16
(16) |
17
(9) |
|
18
(18) |
19
(26) |
20
(49) |
21
(14) |
22
(18) |
23
(24) |
24
(28) |
|
25
(39) |
26
(17) |
27
(27) |
28
(27) |
29
(14) |
30
(44) |
|
|
From: <sv...@va...> - 2005-09-13 12:45:21
|
Author: sewardj
Date: 2005-09-13 13:45:13 +0100 (Tue, 13 Sep 2005)
New Revision: 4639
Log:
In struct NSegment, merge the isClient field into the kind field, so
as to avoid having to represnet nonsensical client-vs-non-client
distinctions for SkFree and SkResvn segments.
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
branches/ASPACEM/coregrind/m_signals.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_translate.c
branches/ASPACEM/coregrind/pub_core_aspacemgr.h
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.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
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 11:57:5=
1 UTC (rev 4638)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 12:45:1=
3 UTC (rev 4639)
@@ -1602,12 +1602,14 @@
if (i < 0)
return NULL;
}
- if (nsegments[i].kind =3D=3D SkFile=20
- || nsegments[i].kind =3D=3D SkAnon
- || nsegments[i].kind =3D=3D SkResvn)
- return &nsegments[i];
- else=20
- return NULL;
+ switch (nsegments[i].kind) {
+ case SkFileC: case SkFileV:=20
+ case SkAnonC: case SkAnonV: case SkResvn:
+ return &nsegments[i];
+ default:
+ break;
+ }
+ return NULL;
}
=20
=20
@@ -1632,9 +1634,10 @@
Int i;
ULong total =3D 0;
for (i =3D 0; i < nsegments_used; i++) {
- if (nsegments[i].kind !=3D SkAnon)
- continue;
- total +=3D (ULong)nsegments[i].end - (ULong)nsegments[i].start + 1=
ULL;
+ if (nsegments[i].kind =3D=3D SkAnonC || nsegments[i].kind =3D=3D S=
kAnonV) {
+ total +=3D (ULong)nsegments[i].end=20
+ - (ULong)nsegments[i].start + 1ULL;
+ }
}
return total;
}
@@ -1661,8 +1664,7 @@
iLo =3D find_nsegment_idx(start);
iHi =3D find_nsegment_idx(start + len - 1);
for (i =3D iLo; i <=3D iHi; i++) {
- if (nsegments[i].isClient
- && (nsegments[i].kind =3D=3D SkFile || nsegments[i].kind =3D=3D=
SkAnon)
+ if ((nsegments[i].kind =3D=3D SkFileC || nsegments[i].kind =3D=3D =
SkAnonC)
&& (needR ? nsegments[i].hasR : True)
&& (needW ? nsegments[i].hasW : True)
&& (needX ? nsegments[i].hasX : True)) {
@@ -1685,8 +1687,10 @@
{
switch (seg->kind) {
case SkFree: return " ";
- case SkAnon: return seg->isClient ? "anon" : "ANON";
- case SkFile: return seg->isClient ? "file" : "FILE";
+ case SkAnonC: return "anon";
+ case SkAnonV: return "ANON";
+ case SkFileC: return "file";
+ case SkFileV: return "FILE";
case SkResvn: return "RSVN";
default: return "????";
}
@@ -1732,7 +1736,7 @@
);
break;
=20
- case SkAnon:
+ case SkAnonC: case SkAnonV:
VG_(debugLog)(
logLevel, "aspacem",
"%3d: %s %08llx-%08llx %s %c%c%c%c d=3D0x%03x i=3D%-7d o=3D%=
-7lld (%d)\n",
@@ -1744,7 +1748,7 @@
);
break;
=20
- case SkFile:
+ case SkFileC: case SkFileV:
VG_(debugLog)(
logLevel, "aspacem",
"%3d: %s %08llx-%08llx %s %c%c%c%c d=3D0x%03x i=3D%-7d o=3D%=
-7lld (%d)\n",
@@ -1921,8 +1925,7 @@
=20
static void init_nsegment ( /*OUT*/NSegment* seg )
{
- seg->kind =3D SkAnon;
- seg->isClient =3D False;
+ seg->kind =3D SkFree;
seg->start =3D 0;
seg->end =3D 0;
seg->smode =3D SmFixed;
@@ -1942,9 +1945,9 @@
aspacem_assert(VG_IS_PAGE_ALIGNED(start));
aspacem_assert(VG_IS_PAGE_ALIGNED(end+1));
init_nsegment(seg);
- seg->kind =3D SkResvn;
+ seg->kind =3D SkResvn;
seg->start =3D start;
- seg->end =3D end;
+ seg->end =3D end;
}
=20
=20
@@ -1970,13 +1973,13 @@
seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
seg.hasT =3D False;
=20
- seg.kind =3D SkAnon;
+ seg.kind =3D SkAnonV;
if (filename) {=20
- seg.kind =3D SkFile;
+ seg.kind =3D SkFileV;
seg.fnIdx =3D allocate_segname( filename );
}
=20
- show_nsegment( 2,0, &seg );
+ if (0) show_nsegment( 2,0, &seg );
add_segment( &seg );
}
=20
@@ -2168,7 +2171,7 @@
Bool allow =3D True;
for (i =3D iLo; i <=3D iHi; i++) {
if (nsegments[i].kind =3D=3D SkFree
- || (nsegments[i].kind =3D=3D SkFile && nsegments[i].isClien=
t)) {
+ || nsegments[i].kind =3D=3D SkFileC) {
/* ok */
} else {
allow =3D False;
@@ -2284,14 +2287,13 @@
aspacem_assert(VG_IS_PAGE_ALIGNED(a));
aspacem_assert(VG_IS_PAGE_ALIGNED(len));
init_nsegment( &seg );
- seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnon : SkFile;
- seg.isClient =3D True;
- seg.start =3D a;
- seg.end =3D a + len - 1;
- seg.offset =3D offset;
- seg.hasR =3D toBool(prot & VKI_PROT_READ);
- seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
- seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnonC : SkFileC;
+ seg.start =3D a;
+ seg.end =3D a + len - 1;
+ seg.offset =3D offset;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
/* TODO: what about seg.hasT ? */
if (get_inode_for_fd(fd, &dev, &ino)) {
seg.dev =3D dev;
@@ -2319,7 +2321,7 @@
if (iLo =3D=3D iHi=20
&& nsegments[iLo].start =3D=3D start=20
&& nsegments[iLo].end+1 =3D=3D start+len
- && (nsegments[iLo].kind =3D=3D SkFile || nsegments[iLo].kind =3D=3D=
SkAnon)) {
+ && (nsegments[iLo].kind =3D=3D SkFileC || nsegments[iLo].kind =3D=
=3D SkAnonC)) {
nsegments[iLo].hasR =3D toBool(prot & VKI_PROT_READ);
nsegments[iLo].hasW =3D toBool(prot & VKI_PROT_WRITE);
nsegments[iLo].hasX =3D toBool(prot & VKI_PROT_EXEC);
@@ -2403,14 +2405,13 @@
=20
/* Ok, the mapping succeeded. Now notify the interval map. */
init_nsegment( &seg );
- seg.kind =3D SkFile;
- seg.isClient =3D True;
- seg.start =3D start;
- seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
- seg.offset =3D offset;
- seg.hasR =3D toBool(prot & VKI_PROT_READ);
- seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
- seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ seg.kind =3D SkFileC;
+ seg.start =3D start;
+ seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
+ seg.offset =3D offset;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
if (get_inode_for_fd(fd, &dev, &ino)) {
seg.dev =3D dev;
seg.ino =3D ino;
@@ -2468,13 +2469,12 @@
=20
/* Ok, the mapping succeeded. Now notify the interval map. */
init_nsegment( &seg );
- seg.kind =3D SkAnon;
- seg.isClient =3D True;
- seg.start =3D start;
- seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
- seg.hasR =3D toBool(prot & VKI_PROT_READ);
- seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
- seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ seg.kind =3D SkAnonC;
+ seg.start =3D start;
+ seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
add_segment( &seg );
=20
return sres;
@@ -2525,13 +2525,12 @@
=20
/* Ok, the mapping succeeded. Now notify the interval map. */
init_nsegment( &seg );
- seg.kind =3D SkAnon;
- seg.isClient =3D True;
- seg.start =3D advised;
- seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
- seg.hasR =3D toBool(prot & VKI_PROT_READ);
- seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
- seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ seg.kind =3D SkAnonC;
+ seg.start =3D advised;
+ seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
add_segment( &seg );
=20
return sres;
@@ -2584,13 +2583,12 @@
=20
/* Ok, the mapping succeeded. Now notify the interval map. */
init_nsegment( &seg );
- seg.kind =3D SkAnon;
- seg.isClient =3D False;
- seg.start =3D advised;
- seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
- seg.hasR =3D True;
- seg.hasW =3D True;
- seg.hasX =3D True;
+ seg.kind =3D SkAnonV;
+ seg.start =3D advised;
+ seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
+ seg.hasR =3D True;
+ seg.hasW =3D True;
+ seg.hasX =3D True;
add_segment( &seg );
=20
return sres;
@@ -2663,7 +2661,7 @@
segA =3D segAddr_to_index( seg );
aspacem_assert(segA >=3D 0 && segA < nsegments_used);
=20
- if (nsegments[segA].kind !=3D SkAnon)
+ if (nsegments[segA].kind !=3D SkAnonC && nsegments[segA].kind !=3D Sk=
AnonV)
return False;
=20
if (delta =3D=3D 0)
Modified: branches/ASPACEM/coregrind/m_signals.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
--- branches/ASPACEM/coregrind/m_signals.c 2005-09-13 11:57:51 UTC (rev 4=
638)
+++ branches/ASPACEM/coregrind/m_signals.c 2005-09-13 12:45:13 UTC (rev 4=
639)
@@ -1709,7 +1709,7 @@
NSegment* seg_next =3D seg ? VG_(am_next_nsegment)( seg, True/*fwds*/=
)
: NULL;
=20
- if (seg && seg->kind =3D=3D SkAnon)
+ if (seg && seg->kind =3D=3D SkAnonC)
/* addr is already mapped. Nothing to do. */
return True;
=20
@@ -1720,8 +1720,7 @@
&& seg->kind =3D=3D SkResvn
&& seg->smode =3D=3D SmUpper
&& seg_next
- && seg_next->kind =3D=3D SkAnon
- && seg_next->isClient
+ && seg_next->kind =3D=3D SkAnonC
&& seg->end+1 =3D=3D seg_next->start))
return False;
=20
@@ -1870,8 +1869,7 @@
&& seg->kind =3D=3D SkResvn
&& seg->smode =3D=3D SmUpper
&& seg_next
- && seg_next->kind =3D=3D SkAnon
- && seg_next->isClient
+ && seg_next->kind =3D=3D SkAnonC
&& seg->end+1 =3D=3D seg_next->start
&& fault >=3D (esp - VG_STACK_REDZONE_SZB)) {
/* If the fault address is above esp but below the current known
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-13 11:=
57:51 UTC (rev 4638)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-13 12:=
45:13 UTC (rev 4639)
@@ -832,7 +832,7 @@
/* These should be assured by setup_client_dataseg in m_main. */
vg_assert(aseg);
vg_assert(rseg);
- vg_assert(aseg->kind =3D=3D SkAnon);
+ vg_assert(aseg->kind =3D=3D SkAnonC);
vg_assert(rseg->kind =3D=3D SkResvn);
vg_assert(aseg->end+1 =3D=3D rseg->start);
=20
Modified: branches/ASPACEM/coregrind/m_translate.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
--- branches/ASPACEM/coregrind/m_translate.c 2005-09-13 11:57:51 UTC (rev=
4638)
+++ branches/ASPACEM/coregrind/m_translate.c 2005-09-13 12:45:13 UTC (rev=
4639)
@@ -410,8 +410,7 @@
ThreadId tid =3D chase_into_ok__CLOSURE_tid;
NSegment* seg =3D VG_(am_find_nsegment)(addr);
if (seg
- && (seg->kind =3D=3D SkAnon || seg->kind =3D=3D SkFile)
- && seg->isClient
+ && (seg->kind =3D=3D SkAnonC || seg->kind =3D=3D SkFileC)
&& seg->start <=3D VG_(get_SP)(tid)
&& VG_(get_SP)(tid)+sizeof(Word)-1 <=3D seg->end)
goto dontchase;
@@ -533,8 +532,7 @@
seg =3D VG_(am_find_nsegment)(orig_addr);
=20
if (seg =3D=3D NULL=20
- || !(seg->kind =3D=3D SkAnon || seg->kind =3D=3D SkFile)
- || !seg->isClient
+ || !(seg->kind =3D=3D SkAnonC || seg->kind =3D=3D SkFileC)
|| !seg->hasX) {
=20
/* U R busted, sonny. Place your hands on your head and step
Modified: branches/ASPACEM/coregrind/pub_core_aspacemgr.h
=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
--- branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-13 11:57:51 U=
TC (rev 4638)
+++ branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-13 12:45:13 U=
TC (rev 4639)
@@ -175,10 +175,12 @@
/* Describes segment kinds. */
typedef
enum {
- SkFree, // unmapped space
- SkAnon, // anonymous mapping
- SkFile, // mapping to a file
- SkResvn // reservation
+ SkFree, // unmapped space
+ SkAnonC, // anonymous mapping belonging to the client
+ SkAnonV, // anonymous mapping belonging to valgrind
+ SkFileC, // file mapping belonging to the client
+ SkFileV, // file mapping belonging to valgrind
+ SkResvn // reservation
}
MKind;
=20
@@ -196,13 +198,13 @@
kind =3D=3D SkFree:
// the only meaningful fields are .start and .end
=20
- kind =3D=3D SkAnon:
+ kind =3D=3D SkAnon{C,V}:
// the segment may be resized if required
// there's no associated file:
dev=3D=3Dino=3D=3Dfoff =3D 0, fnidx =3D=3D -1
// segment may have permissions
=20
- kind =3D=3D SkFile
+ kind =3D=3D SkFile{C,V}:
// the segment may not be resized:
moveLo =3D=3D moveHi =3D=3D NotMovable, maxlen =3D=3D 0
// there is an associated file
@@ -215,24 +217,23 @@
// segment has no permissions
hasR=3D=3DhasW=3D=3DhasX=3D=3DanyTranslated =3D=3D False
=20
- Also: if !isClient then anyTranslated=3D=3DFalse
+ Also: anyTranslated=3D=3DTrue is only allowed in SkFileV and SkAnon=
V
(viz, not allowed to make translations from non-client areas)
*/
typedef
struct {
MKind kind;
- Bool isClient;
- /* Extent (SkFree, SkAnon, SkFile, SkResvn) */
+ /* Extent (SkFree, SkAnon{C,V}, SkFile{C,V}, SkResvn) */
Addr start; // lowest address in range
Addr end; // highest address in range
/* Shrinkable? (SkResvn only) */
ShrinkMode smode;
- /* Associated file (SkFile only) */
+ /* Associated file (SkFile{C,V} only) */
UInt dev;
UInt ino;
ULong offset;
Int fnIdx; // file name table index, if name is known
- /* Permissions (SkAnon, SkFile only) */
+ /* Permissions (SkAnon{C,V}, SkFile{C,V} only) */
Bool hasR;
Bool hasW;
Bool hasX;
|
|
From: <sv...@va...> - 2005-09-13 11:57:54
|
Author: sewardj Date: 2005-09-13 12:57:51 +0100 (Tue, 13 Sep 2005) New Revision: 4638 Log: Include more headers to try and keep gcc happy. Modified: branches/ASPACEM/coregrind/m_launcher.c Modified: branches/ASPACEM/coregrind/m_launcher.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 --- branches/ASPACEM/coregrind/m_launcher.c 2005-09-13 11:52:09 UTC (rev = 4637) +++ branches/ASPACEM/coregrind/m_launcher.c 2005-09-13 11:57:51 UTC (rev = 4638) @@ -45,6 +45,11 @@ #include "pub_core_libcproc.h" // For VALGRINDLIB #include "pub_core_mallocfree.h" =20 +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + + /* Where we expect to find all our aux files */ static const char *valgrind_lib =3D VG_LIBDIR; =20 |
|
From: <sv...@va...> - 2005-09-13 11:52:12
|
Author: sewardj
Date: 2005-09-13 12:52:09 +0100 (Tue, 13 Sep 2005)
New Revision: 4637
Log:
Non-functional change: rename, reformat, comment, the new spacemgr
code so it no longer looks such a complete mess.
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/m_mallocfree.c
branches/ASPACEM/coregrind/m_signals.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c
branches/ASPACEM/coregrind/m_translate.c
branches/ASPACEM/coregrind/m_transtab.c
branches/ASPACEM/coregrind/m_ume.c
branches/ASPACEM/coregrind/pub_core_aspacemgr.h
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.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
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 11:13:4=
3 UTC (rev 4636)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 11:52:0=
9 UTC (rev 4637)
@@ -1346,6 +1346,94 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
=20
+
+/* Note: many of the exported functions implemented below are
+ described more fully in comments in pub_core_aspacemgr.h.
+*/
+
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- The Address Space Manager's state. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
+
+/* Array [0 .. nsegments_used-1] of all mappings. */
+/* Sorted by .addr field. */
+/* I: len may not be zero. */
+/* I: overlapping segments are not allowed. */
+/* I: the segments cover the entire address space precisely. */
+/* Each segment can optionally hold an index into the filename table. */
+
+static NSegment nsegments[VG_N_SEGMENTS];
+static Int nsegments_used =3D 0;
+
+#define Addr_MIN ((Addr)0)
+#define Addr_MAX ((Addr)(-1ULL))
+
+/* Limits etc */
+
+// The smallest address that aspacem will try to allocate
+static Addr aspacem_minAddr =3D 0;
+
+// The largest address that aspacem will try to allocate
+static Addr aspacem_maxAddr =3D 0;
+
+// Where aspacem will start looking for client space
+static Addr aspacem_cStart =3D 0;
+
+// Where aspacem will start looking for Valgrind space
+static Addr aspacem_vStart =3D 0;
+
+
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- Stuff to make aspacem almost completely independent of ---*/
+/*--- the rest of Valgrind. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
+
+//--------------------------------------------------------------
+// Simple assert and assert-like fns, which avoid dependence on
+// m_libcassert, and hence on the entire debug-info reader swamp
+
+static void aspacem_barf ( HChar* what )
+{
+ VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s\n", what);
+ VG_(debugLog)(0, "aspacem", "Exiting now.\n");
+ VG_(exit)(1);
+}
+
+static void aspacem_barf_toolow ( HChar* what )
+{
+ VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s is too low.\n", what)=
;
+ VG_(debugLog)(0, "aspacem", " Increase it and rebuild. "
+ "Exiting now.\n");
+ VG_(exit)(1);
+}
+
+static void aspacem_assert_fail( const HChar* expr,
+ const Char* file,
+ Int line,=20
+ const Char* fn )
+{
+ VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: aspacem assertion failed=
:\n");
+ VG_(debugLog)(0, "aspacem", " %s\n", expr);
+ VG_(debugLog)(0, "aspacem", " at %s:%d (%s)\n", file,line,fn);
+ VG_(debugLog)(0, "aspacem", "Exiting now.\n");
+ VG_(exit)(1);
+}
+
+#define aspacem_assert(expr) \
+ ((void) ((expr) ? 0 : \
+ (aspacem_assert_fail(#expr, \
+ __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__))))
+
+
+//--------------------------------------------------------------
+// A simple sprintf implementation, so as to avoid dependence on
+// m_libcprint.
+
static void add_to_aspacem_sprintf_buf ( HChar c, void *p )
{
HChar** aspacem_sprintf_ptr =3D p;
@@ -1380,10 +1468,12 @@
}
=20
=20
-/////////////////////////////////////////////////////////////////
+//--------------------------------------------------------------
+// Direct access to the kernel's mmap/munmap syscalls. This
+// avoids dependence on m_libcmman.
=20
-SysRes VG_(aspacem_do_mmap_NO_NOTIFY)( Addr start, SizeT length, UInt pr=
ot,=20
- UInt flags, UInt fd, OffT offset)
+SysRes VG_(am_do_mmap_NO_NOTIFY)( Addr start, SizeT length, UInt prot,=20
+ UInt flags, UInt fd, OffT offset)
{
SysRes res;
# if defined(VGP_x86_linux)
@@ -1402,7 +1492,7 @@
prot, flags, fd, offset);
# elif defined(VGP_ppc32_linux)
res =3D VG_(do_syscall6)(__NR_mmap, (UWord)(start), (length),
- prot, flags, fd, offset);
+ prot, flags, fd, offset);
# else
# error Unknown platform
# endif
@@ -1410,12 +1500,14 @@
}
=20
static
-SysRes do_munmap_NATIVE(Addr start, SizeT length)
+SysRes do_munmap_NO_NOTIFY(Addr start, SizeT length)
{
return VG_(do_syscall2)(__NR_munmap, (UWord)start, length );
}
=20
=20
+//--------------------------------------------------------------
+// Functions for extracting information about file descriptors.
=20
static=20
Bool get_inode_for_fd ( Int fd, /*OUT*/UInt* dev, /*OUT*/UInt* ino )
@@ -1430,57 +1522,54 @@
}
=20
=20
-/////////////////////////////////////////////////////////////////
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- Low level access / modification of the segment array. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
=20
-static void aspacem_barf ( HChar* what )
+/* Binary search the interval array for a given address. Since the
+ array covers the entire address space the search cannot fail. */
+static Int find_nsegment_idx ( Addr a )
{
- VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s\n", what);
- VG_(debugLog)(0, "aspacem", "Exiting now.\n");
- VG_(exit)(1);
-}
+ Addr a_mid_lo, a_mid_hi;
+ Int mid,
+ lo =3D 0,
+ hi =3D nsegments_used-1;
+ while (True) {
+ /* current unsearched space is from lo to hi, inclusive. */
+ if (lo > hi) {
+ /* Not found. This can't happen. */
+ aspacem_barf("find_nsegment_idx: not found");
+ }
+ mid =3D (lo + hi) / 2;
+ a_mid_lo =3D nsegments[mid].start;
+ a_mid_hi =3D nsegments[mid].end;
=20
-static void aspacem_barf_toolow ( HChar* what )
-{
- VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s is too low.\n", what)=
;
- VG_(debugLog)(0, "aspacem", " Increase it and rebuild. "
- "Exiting now.\n");
- VG_(exit)(1);
+ if (a < a_mid_lo) { hi =3D mid-1; continue; }
+ if (a > a_mid_hi) { lo =3D mid+1; continue; }
+ aspacem_assert(a >=3D a_mid_lo && a <=3D a_mid_hi);
+ aspacem_assert(0 <=3D mid && mid < nsegments_used);
+ return mid;
+ }
}
=20
-static void aspacem_assert_fail( const HChar* expr,
- const Char* file,
- Int line,=20
- const Char* fn )
+
+/* Finds the segment containing 'a'. Only returns file/anon/resvn
+ segments. */
+NSegment* VG_(am_find_nsegment) ( Addr a )
{
- VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: assertion failed:\n");
- VG_(debugLog)(0, "aspacem", " %s\n", expr);
- VG_(debugLog)(0, "aspacem", " at %s:%d (%s)\n", file,line,fn);
- VG_(debugLog)(0, "aspacem", "Exiting now.\n");
- VG_(exit)(1);
+ Int i =3D find_nsegment_idx(a);
+ aspacem_assert(i >=3D 0 && i < nsegments_used);
+ aspacem_assert(nsegments[i].start <=3D a);
+ aspacem_assert(a <=3D nsegments[i].end);
+ if (nsegments[i].kind =3D=3D SkFree)=20
+ return NULL;
+ else
+ return &nsegments[i];
}
=20
-#define aspacem_assert(expr) \
- ((void) ((expr) ? 0 : \
- (aspacem_assert_fail(#expr, \
- __FILE__, __LINE__, \
- __PRETTY_FUNCTION__))))
=20
-
-
-#define Addr_MIN ((Addr)0)
-#define Addr_MAX ((Addr)(-1ULL))
-
-
-/* Array [0 .. nsegments_used-1] of all mappings. */
-/* Sorted by .addr field. */
-/* I: len may not be zero. */
-/* I: overlapping segments are not allowed. */
-/* Each segment can optionally hold an index into the filename table. */
-
-static NSegment nsegments[VG_N_SEGMENTS];
-static Int nsegments_used =3D 0;
-
-
/* Given a pointer to a seg, tries to figure out which one it is in
nsegments[..]. Very paranoid. */
static Int segAddr_to_index ( NSegment* seg )
@@ -1496,9 +1585,10 @@
return -1;
}
=20
-/* Find the next segment along from HERE, if it is a file/anon/resvn
+
+/* Find the next segment along from 'here', if it is a file/anon/resvn
segment. */
-NSegment* VG_(next_nsegment) ( NSegment* here, Bool fwds )
+NSegment* VG_(am_next_nsegment) ( NSegment* here, Bool fwds )
{
Int i =3D segAddr_to_index(here);
if (i < 0 || i >=3D nsegments_used)
@@ -1515,96 +1605,491 @@
if (nsegments[i].kind =3D=3D SkFile=20
|| nsegments[i].kind =3D=3D SkAnon
|| nsegments[i].kind =3D=3D SkResvn)
- return &nsegments[i];
+ return &nsegments[i];
else=20
return NULL;
}
=20
=20
-ULong VG_(aspacem_get_anonsize_total)( void )
+/* Sanity checking: ensure the segment array covers the entire address
+ space exactly. */
+static void check_nsegments ( void )
{
- Int i;
- ULong total =3D 0;
- for (i =3D 0; i < nsegments_used; i++) {
- if (nsegments[i].kind !=3D SkAnon)
- continue;
- total +=3D (ULong)nsegments[i].end - (ULong)nsegments[i].start + 1UL=
L;
- }
- return total;
+ Int i;
+ aspacem_assert(nsegments_used > 0);
+ aspacem_assert(nsegments[0].start =3D=3D Addr_MIN);
+ aspacem_assert(nsegments[nsegments_used-1].end =3D=3D Addr_MAX);
+ for (i =3D 1; i < nsegments_used; i++)
+ aspacem_assert(nsegments[i-1].end+1 =3D=3D nsegments[i].start);
}
=20
-/* check the interval array */
-static void check_nsegments ( void )
+
+/* Trivial fn: return the total amount of space in anonymous mappings,
+ both for V and the client. Is used for printing stats in
+ out-of-memory messages. */
+ULong VG_(am_get_anonsize_total)( void )
{
- Int i;
- aspacem_assert(nsegments_used > 0);
- aspacem_assert(nsegments[0].start =3D=3D Addr_MIN);
- aspacem_assert(nsegments[nsegments_used-1].end =3D=3D Addr_MAX);
- for (i =3D 1; i < nsegments_used; i++)
- aspacem_assert(nsegments[i-1].end+1 =3D=3D nsegments[i].start);
+ Int i;
+ ULong total =3D 0;
+ for (i =3D 0; i < nsegments_used; i++) {
+ if (nsegments[i].kind !=3D SkAnon)
+ continue;
+ total +=3D (ULong)nsegments[i].end - (ULong)nsegments[i].start + 1=
ULL;
+ }
+ return total;
}
=20
=20
-/* Binary search the interval array for a given address. Since the
- array covers the entire address space the search cannot fail. */
-static Int find_nsegment_idx ( Addr a )
+/* Test if a piece of memory is addressable by the client with at
+ least the "prot" protection permissions by examining the underlying
+ segments.
+*/
+Bool VG_(am_is_valid_for_client)( Addr start, SizeT len, UInt prot )
{
- Addr a_mid_lo, a_mid_hi;
- Int mid,
- lo =3D 0,
- hi =3D nsegments_used-1;
- while (True) {
- /* current unsearched space is from lo to hi, inclusive. */
- if (lo > hi) {
- /* Not found. This can't happen. */
- aspacem_barf("find_nsegment_idx: not found");
+ Int i, iLo, iHi;
+ Bool needR, needW, needX;
+
+ if (len =3D=3D 0)
+ return True; /* somewhat dubious case */
+ if (start + len < start)
+ return False; /* reject wraparounds */
+
+ needR =3D toBool(prot & VKI_PROT_READ);
+ needW =3D toBool(prot & VKI_PROT_WRITE);
+ needX =3D toBool(prot & VKI_PROT_EXEC);
+
+ iLo =3D find_nsegment_idx(start);
+ iHi =3D find_nsegment_idx(start + len - 1);
+ for (i =3D iLo; i <=3D iHi; i++) {
+ if (nsegments[i].isClient
+ && (nsegments[i].kind =3D=3D SkFile || nsegments[i].kind =3D=3D=
SkAnon)
+ && (needR ? nsegments[i].hasR : True)
+ && (needW ? nsegments[i].hasW : True)
+ && (needX ? nsegments[i].hasX : True)) {
+ /* ok */
+ } else {
+ return False;
}
- mid =3D (lo + hi) / 2;
- a_mid_lo =3D nsegments[mid].start;
- a_mid_hi =3D nsegments[mid].end;
+ }
+ return True;
+}
=20
- if (a < a_mid_lo) { hi =3D mid-1; continue; }
- if (a > a_mid_hi) { lo =3D mid+1; continue; }
- aspacem_assert(a >=3D a_mid_lo && a <=3D a_mid_hi);
- aspacem_assert(0 <=3D mid && mid < nsegments_used);
- return mid;
+
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- Displaying the segment array. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
+
+static HChar* show_seg_kind ( NSegment* seg )
+{
+ switch (seg->kind) {
+ case SkFree: return " ";
+ case SkAnon: return seg->isClient ? "anon" : "ANON";
+ case SkFile: return seg->isClient ? "file" : "FILE";
+ case SkResvn: return "RSVN";
+ default: return "????";
}
}
=20
-/* Find a segment, not include free-space and ones, for outside use. */
-NSegment* VG_(find_nsegment) ( Addr a )
+static HChar* show_ShrinkMode ( ShrinkMode sm )
{
- Int i =3D find_nsegment_idx(a);
- aspacem_assert(i >=3D 0 && i < nsegments_used);
- aspacem_assert(nsegments[i].start <=3D a);
- aspacem_assert(a <=3D nsegments[i].end);
- if (nsegments[i].kind =3D=3D SkFree)=20
- return NULL;
- else
- return &nsegments[i];
+ switch (sm) {
+ case SmLower: return "SmLower";
+ case SmUpper: return "SmUpper";
+ case SmFixed: return "SmFixed";
+ default: return "Sm?????";
+ }
}
=20
+static void show_Addr_concisely ( /*OUT*/HChar* buf, Addr aA )
+{
+ HChar* fmt;
+ ULong a =3D (ULong)aA;
+ if (a >=3D 10000000ULL) {
+ fmt =3D "%6llum";
+ a /=3D 1024*1024ULL;
+ } else {
+ fmt =3D "%7llu";
+ }
+ aspacem_sprintf(buf, fmt, a);
+}
=20
+static void show_nsegment ( Int logLevel, Int segNo, NSegment* seg )
+{
+ HChar len_buf[20];
+ ULong len =3D ((ULong)seg->end) - ((ULong)seg->start) + 1;
+ show_Addr_concisely(len_buf, len);
=20
-/* Limits etc */
+ switch (seg->kind) {
=20
-// The smallest address that aspacem will try to allocate
-static Addr aspacem_minAddr;
+ case SkFree:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: %s %08llx-%08llx %s\n",
+ segNo, show_seg_kind(seg),
+ (ULong)seg->start, (ULong)seg->end, len_buf
+ );
+ break;
=20
-// The largest address that aspacem will try to allocate
-static Addr aspacem_maxAddr;
+ case SkAnon:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: %s %08llx-%08llx %s %c%c%c%c d=3D0x%03x i=3D%-7d o=3D%=
-7lld (%d)\n",
+ segNo, show_seg_kind(seg),
+ (ULong)seg->start, (ULong)seg->end, len_buf,
+ seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
+ seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',=20
+ seg->dev, seg->ino, (Long)seg->offset, seg->fnIdx
+ );
+ break;
=20
-// Where aspacem will start looking for client space
-static Addr aspacem_cStart;
+ case SkFile:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: %s %08llx-%08llx %s %c%c%c%c d=3D0x%03x i=3D%-7d o=3D%=
-7lld (%d)\n",
+ segNo, show_seg_kind(seg),
+ (ULong)seg->start, (ULong)seg->end, len_buf,
+ seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
+ seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',=20
+ seg->dev, seg->ino, (Long)seg->offset, seg->fnIdx
+ );
+ break;
=20
-// Where aspacem will start looking for Valgrind space
-static Addr aspacem_vStart;
+ case SkResvn:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: %s %08llx-%08llx %s %c%c%c%c %s\n",
+ segNo, show_seg_kind(seg),
+ (ULong)seg->start, (ULong)seg->end, len_buf,
+ seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',=20
+ seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',=20
+ show_ShrinkMode(seg->smode)
+ );
+ break;
=20
+ default:
+ VG_(debugLog)(
+ logLevel, "aspacem",
+ "%3d: ???? UNKNOWN SEGMENT KIND\n",=20
+ segNo=20
+ );
+ break;
+ }
+}
=20
-Bool VG_(aspacem_getAdvisory) ( MapRequest* req,=20
- Bool forClient,=20
- /*OUT*/Addr* result )
+/* Print out the segment array (debugging only!). */
+void VG_(am_show_nsegments) ( Int logLevel, HChar* who )
{
+ Int i;
+ VG_(debugLog)(logLevel, "aspacem",
+ "<<< SHOW_SEGMENTS: %s (%d segments, %d segnames)\n",=20
+ who, segments_used, segnames_used);
+ for (i =3D 0; i < segnames_used; i++) {
+ if (!segnames[i].inUse)
+ continue;
+ VG_(debugLog)(logLevel, "aspacem",
+ "(%2d) %s\n", i, segnames[i].fname);
+ }
+ for (i =3D 0; i < nsegments_used; i++)
+ show_nsegment( logLevel, i, &nsegments[i] );
+ VG_(debugLog)(logLevel, "aspacem",
+ ">>>\n");
+}
+
+
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- Modifying the segment array, and constructing segments. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
+
+/* Add SEG to the collection, deleting/truncating any it overlaps.
+ This deals with all the tricky cases of splitting up segments as
+ needed. */
+
+static void add_segment ( NSegment* seg )
+{
+ Int nDeld, i, j, k;
+ Addr iStart, iEnd;
+
+ Addr dStart =3D seg->start;
+ Addr dEnd =3D seg->end;
+
+ aspacem_assert(dStart <=3D dEnd);
+ aspacem_assert(VG_IS_PAGE_ALIGNED(dStart));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(dEnd+1));
+
+ nDeld =3D 0;
+
+ /* Iterate over all segments, considering how each interacts with
+ the new address range dStart .. dEnd. */
+
+ for (i =3D 0; i < nsegments_used; i++) {
+
+ nsegments[i].mark =3D False;
+
+ iStart =3D nsegments[i].start;
+ iEnd =3D nsegments[i].end;
+
+ /* no-overlap cases */
+ if (iEnd < dStart) continue;
+ if (dEnd < iStart) continue;
+
+ if (dStart <=3D iStart && iEnd <=3D dEnd) {
+ /* i is completely overlapped. Mark it for deletion. */
+ nsegments[i].mark =3D True;
+ nDeld++;
+ continue;
+ }
+
+ if (iStart < dStart && iEnd > dEnd) {
+ /* deleted interval is completely contained within i. This
+ means i has to be split into two pieces. As a result,
+ first move the following elements up by one place to make
+ space for the new part. */
+ if (nsegments_used >=3D VG_N_SEGMENTS)
+ aspacem_barf_toolow("VG_N_SEGMENTS");
+ for (j =3D nsegments_used-1; j > i; j--)
+ nsegments[j+1] =3D nsegments[j];
+ nsegments_used++;
+ nsegments[i+1] =3D nsegments[i];
+ nsegments[i].end =3D dStart-1;
+ nsegments[i+1].start =3D dEnd+1;
+ nsegments[i+1].offset +=3D (nsegments[i+1].start - nsegments[i]=
.start);
+ continue;
+ }
+
+ if (iStart < dStart && iEnd <=3D dEnd && iEnd >=3D dStart) {
+ /* interval to be deleted straddles upper boundary of i. */
+ nsegments[i].end =3D dStart-1;
+ continue;
+ }
+
+ if (iEnd > dEnd && iStart >=3D dStart && iStart <=3D dEnd) {
+ /* interval to be deleted straddles lower boundary of i. */
+ nsegments[i].offset +=3D (dEnd+1 - nsegments[i].start);
+ nsegments[i].start =3D dEnd+1;
+ continue;
+ }
+
+ /* I don't think we can get here. */
+ aspacem_assert(0);
+ }
+
+ /* Get rid of the intervals marked for deletion. */
+ if (nDeld > 0) {
+ j =3D 0;
+ for (i =3D 0; i < nsegments_used; i++) {
+ if (nsegments[i].mark)
+ continue;
+ nsegments[j] =3D nsegments[i];
+ j++;
+ }
+ nsegments_used -=3D nDeld;
+ }
+
+ /* At this point, there should be a gap dStart .. dEnd inclusive.
+ Find the gap and insert the new interval in it. Set k so that
+ all entries >=3D k must be moved up 1, and the new interval placed
+ at k. */
+ if (nsegments_used >=3D VG_N_SEGMENTS)
+ aspacem_barf_toolow("VG_N_SEGMENTS");
+ if (nsegments_used =3D=3D 0) {
+ k =3D 0;
+ } else {
+ for (i =3D 0; i < nsegments_used; i++) {
+ if (dEnd+1 =3D=3D nsegments[i].start=20
+ && /*guard against wraparound*/dEnd+1 > dEnd)
+ break;
+ }
+ k =3D i;
+ }
+
+ aspacem_assert(k >=3D 0 && k <=3D nsegments_used);
+ for (j =3D nsegments_used-1; j >=3D k; j--)
+ nsegments[j+1] =3D nsegments[j];
+ nsegments_used++;
+
+ nsegments[k] =3D *seg;
+
+ check_nsegments();
+}
+
+
+/* Clear out an NSegment record. */
+
+static void init_nsegment ( /*OUT*/NSegment* seg )
+{
+ seg->kind =3D SkAnon;
+ seg->isClient =3D False;
+ seg->start =3D 0;
+ seg->end =3D 0;
+ seg->smode =3D SmFixed;
+ seg->dev =3D 0;
+ seg->ino =3D 0;
+ seg->offset =3D 0;
+ seg->fnIdx =3D -1;
+ seg->hasR =3D seg->hasR =3D seg->hasW =3D seg->hasT =3D False;
+ seg->mark =3D False;
+}
+
+/* Make an NSegment which holds a reservation. */
+
+static void init_resvn ( /*OUT*/NSegment* seg, Addr start, Addr end )
+{
+ aspacem_assert(start < end);
+ aspacem_assert(VG_IS_PAGE_ALIGNED(start));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(end+1));
+ init_nsegment(seg);
+ seg->kind =3D SkResvn;
+ seg->start =3D start;
+ seg->end =3D end;
+}
+
+
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- Startup, including reading /proc/self/maps. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
+
+static void read_maps_callback ( Addr addr, SizeT len, UInt prot,
+ UInt dev, UInt ino, ULong offset,=20
+ const UChar* filename )
+{
+ NSegment seg;
+ init_nsegment( &seg );
+ seg.start =3D addr;
+ seg.end =3D addr+len-1;
+ seg.dev =3D dev;
+ seg.ino =3D ino;
+ seg.offset =3D offset;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ seg.hasT =3D False;
+
+ seg.kind =3D SkAnon;
+ if (filename) {=20
+ seg.kind =3D SkFile;
+ seg.fnIdx =3D allocate_segname( filename );
+ }
+
+ show_nsegment( 2,0, &seg );
+ add_segment( &seg );
+}
+
+/* Initialise the address space manager, setting up the initial
+ segment list, and reading /proc/self/maps into it. This must
+ be called before any other function.
+
+ Takes a pointer to the SP at the time V gained control. This is
+ taken to be the highest usable address (more or less). Based on
+ that (and general consultation of tea leaves, etc) return a
+ suggested end address for the client's stack. */
+
+Addr VG_(am_startup) ( Addr sp_at_startup )
+{
+ NSegment seg;
+ Addr suggested_clstack_top;
+
+ aspacem_assert(sizeof(Word) =3D=3D sizeof(void*));
+ aspacem_assert(sizeof(Addr) =3D=3D sizeof(void*));
+ aspacem_assert(sizeof(SizeT) =3D=3D sizeof(void*));
+ aspacem_assert(sizeof(SSizeT) =3D=3D sizeof(void*));
+
+ /* Add a single interval covering the entire address space. */
+ init_nsegment(&seg);
+ seg.kind =3D SkFree;
+ seg.start =3D Addr_MIN;
+ seg.end =3D Addr_MAX;
+ nsegments[0] =3D seg;
+ nsegments_used =3D 1;
+
+ /* Establish address limits and block out unusable parts
+ accordingly. */
+
+ VG_(debugLog)(2, "aspacem",=20
+ " sp_at_startup =3D 0x%llx (supplied)\n",=20
+ (ULong)sp_at_startup );
+
+ aspacem_minAddr =3D (Addr) 0x04000000; // 64M
+
+# if VG_WORDSIZE =3D=3D 8
+ aspacem_maxAddr =3D (Addr)0x400000000 - 1; // 16G
+# else
+ aspacem_maxAddr =3D VG_PGROUNDDN( sp_at_startup ) - 1;
+# endif
+
+ aspacem_cStart =3D aspacem_minAddr; // 64M
+ aspacem_vStart =3D VG_PGROUNDUP((aspacem_minAddr + aspacem_maxAddr + =
1) / 2);
+
+ suggested_clstack_top =3D aspacem_maxAddr - 16*1024*1024ULL
+ + VKI_PAGE_SIZE;
+
+ aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_minAddr));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_maxAddr + 1));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_cStart));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_vStart));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(suggested_clstack_top + 1));
+
+ VG_(debugLog)(2, "aspacem",=20
+ " minAddr =3D 0x%08llx (computed)\n",=20
+ (ULong)aspacem_minAddr);
+ VG_(debugLog)(2, "aspacem",=20
+ " maxAddr =3D 0x%08llx (computed)\n",=20
+ (ULong)aspacem_maxAddr);
+ VG_(debugLog)(2, "aspacem",=20
+ " cStart =3D 0x%08llx (computed)\n",=20
+ (ULong)aspacem_cStart);
+ VG_(debugLog)(2, "aspacem",=20
+ " vStart =3D 0x%08llx (computed)\n",=20
+ (ULong)aspacem_vStart);
+ VG_(debugLog)(2, "aspacem",=20
+ "suggested_clstack_top =3D 0x%08llx (computed)\n",=20
+ (ULong)suggested_clstack_top);
+
+ if (aspacem_cStart > Addr_MIN) {
+ init_resvn(&seg, Addr_MIN, aspacem_cStart-1);
+ add_segment(&seg);
+ }
+ if (aspacem_maxAddr < Addr_MAX) {
+ init_resvn(&seg, aspacem_maxAddr+1, Addr_MAX);
+ add_segment(&seg);
+ }
+
+ /* Create a 1-page reservation at the notional initial
+ client/valgrind boundary. This isn't strictly necessary, but
+ because the advisor does first-fit and starts searches for
+ valgrind allocations at the boundary, this is kind of necessary
+ in order to get it to start allocating in the right place. */
+ init_resvn(&seg, aspacem_vStart, aspacem_vStart + VKI_PAGE_SIZE - 1)=
;
+ add_segment(&seg);
+
+ VG_(am_show_nsegments)(2, "Initial layout");
+
+ VG_(debugLog)(2, "aspacem", "Reading /proc/self/maps\n");
+ VG_(parse_procselfmaps) ( read_maps_callback );
+
+ VG_(am_show_nsegments)(2, "With contents of /proc/self/maps");
+
+ return suggested_clstack_top;
+}
+
+
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- The core query-notify mechanism. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
+
+/* Query aspacem to ask where a mapping should go. */
+
+Bool VG_(am_get_advisory) ( MapRequest* req,=20
+ Bool forClient,=20
+ /*OUT*/Addr* result )
+{
/* This function implements allocation policy.
=20
The nature of the allocation request is determined by req, which
@@ -1660,9 +2145,11 @@
=20
aspacem_assert(nsegments_used > 0);
=20
- VG_(show_nsegments)(0,"getAdvisory");
- VG_(debugLog)(0,"aspacem", "getAdvisory 0x%llx %lld\n",=20
- (ULong)req->start, (ULong)req->len);
+ if (0) {
+ VG_(am_show_nsegments)(0,"getAdvisory");
+ VG_(debugLog)(0,"aspacem", "getAdvisory 0x%llx %lld\n",=20
+ (ULong)req->start, (ULong)req->len);
+ }
=20
/* Reject zero-length requests */
if (req->len =3D=3D 0)
@@ -1782,394 +2269,98 @@
}
=20
=20
+/* Notifies aspacem that the client completed an mmap successfully.
+ The segment array is updated accordingly. */
=20
-static void init_nsegment ( /*OUT*/NSegment* seg )
+void=20
+VG_(am_notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
+ Int fd, SizeT offset )
{
- seg->kind =3D SkAnon;
- seg->isClient =3D False;
- seg->start =3D 0;
- seg->end =3D 0;
- seg->smode =3D SmFixed;
- seg->dev =3D 0;
- seg->ino =3D 0;
- seg->offset =3D 0;
- seg->fnIdx =3D -1;
- seg->hasR =3D seg->hasR =3D seg->hasW =3D seg->hasT =3D False;
- seg->mark =3D False;
-}
+ HChar buf[VKI_PATH_MAX];
+ UInt dev, ino;
+ NSegment seg;
=20
-static void init_resvn ( /*OUT*/NSegment* seg, Addr start, Addr end )
-{
- aspacem_assert(start < end);
- aspacem_assert(VG_IS_PAGE_ALIGNED(start));
- aspacem_assert(VG_IS_PAGE_ALIGNED(end+1));
- init_nsegment(seg);
- seg->kind =3D SkResvn;
- seg->start =3D start;
- seg->end =3D end;
+ aspacem_assert(len > 0);
+ aspacem_assert(VG_IS_PAGE_ALIGNED(a));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(len));
+ init_nsegment( &seg );
+ seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnon : SkFile;
+ seg.isClient =3D True;
+ seg.start =3D a;
+ seg.end =3D a + len - 1;
+ seg.offset =3D offset;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ /* TODO: what about seg.hasT ? */
+ if (get_inode_for_fd(fd, &dev, &ino)) {
+ seg.dev =3D dev;
+ seg.ino =3D ino;
+ }
+ if (get_name_for_fd(fd, buf, VKI_PATH_MAX)) {
+ seg.fnIdx =3D allocate_segname( buf );
+ }
+ add_segment( &seg );
}
=20
-static HChar* show_seg_kind ( NSegment* seg )
-{
- switch (seg->kind) {
- case SkFree: return " ";
- case SkAnon: return seg->isClient ? "anon" : "ANON";
- case SkFile: return seg->isClient ? "file" : "FILE";
- case SkResvn: return "RSVN";
- default: return "????";
- }
-}
+/* Notifies aspacem that the client completed an mprotect
+ successfully. The segment array is updated accordingly. */
=20
-static HChar* show_ShrinkMode ( ShrinkMode sm )
+void VG_(am_notify_client_mprotect)( Addr start, SizeT len, UInt prot )
{
- switch (sm) {
- case SmLower: return "SmLower";
- case SmUpper: return "SmUpper";
- case SmFixed: return "SmFixed";
- default: return "Sm?????";
- }
-}
+ Int iLo, iHi;
=20
-static void show_Addr_concisely ( /*OUT*/HChar* buf, Addr aA )
-{
- HChar* fmt;
- ULong a =3D (ULong)aA;
- if (a >=3D 10000000ULL) {
- fmt =3D "%6llum";
-a /=3D 1024*1024ULL;
- } else {
- fmt =3D "%7llu";
- }
- aspacem_sprintf(buf, fmt, a);
-}
+ if (len =3D=3D 0)
+ return;
=20
-static void show_nsegment ( Int logLevel, Int segNo, NSegment* seg )
-{
- HChar len_buf[20];
- ULong len =3D ((ULong)seg->end) - ((ULong)seg->start) + 1;
- show_Addr_concisely(len_buf, len);
+ iLo =3D find_nsegment_idx(start);
+ iHi =3D find_nsegment_idx(start + len - 1);
=20
- switch (seg->kind) {
- case SkFree: {
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: %s %08llx-%08llx %s\n",
- segNo,
- show_seg_kind(seg),
- (ULong)seg->start,
- (ULong)seg->end,
- len_buf
- );
- break;
- }
-
- case SkAnon:
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: %s %08llx-%08llx %s %c%c%c%c d=3D0x%03x i=3D%-7d o=3D%-7lld (=
%d)\n",
- segNo,
- show_seg_kind(seg),
- (ULong)seg->start,
- (ULong)seg->end,
- len_buf,
- seg->hasR ? 'r' : '-',=20
- seg->hasW ? 'w' : '-',=20
- seg->hasX ? 'x' : '-',=20
- seg->hasT ? 'T' : '-',=20
- seg->dev,
- seg->ino,
- (Long)seg->offset,
- seg->fnIdx
- );
- break;
- case SkFile:
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: %s %08llx-%08llx %s %c%c%c%c d=3D0x%03x i=3D%-7d o=3D%-7lld (=
%d)\n",
- segNo,
- show_seg_kind(seg),
- (ULong)seg->start,
- (ULong)seg->end,
- len_buf,
- seg->hasR ? 'r' : '-',=20
- seg->hasW ? 'w' : '-',=20
- seg->hasX ? 'x' : '-',=20
- seg->hasT ? 'T' : '-',=20
- seg->dev,
- seg->ino,
- (Long)seg->offset,
- seg->fnIdx
- );
- break;
- case SkResvn:
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: %s %08llx-%08llx %s %c%c%c%c %s\n",
- segNo,
- show_seg_kind(seg),
- (ULong)seg->start,
- (ULong)seg->end,
- len_buf,
- seg->hasR ? 'r' : '-',=20
- seg->hasW ? 'w' : '-',=20
- seg->hasX ? 'x' : '-',=20
- seg->hasT ? 'T' : '-',=20
- show_ShrinkMode(seg->smode)
- );
- break;
-
- default:
- VG_(debugLog)(
- logLevel, "aspacem",
- "%3d: ???? UNKNOWN SEGMENT KIND\n",
-segNo );
- break;
- }
-}
-
-/* Print out the segment array (debugging only!). */
-void VG_(show_nsegments) ( Int logLevel, HChar* who )
-{
- Int i;
- VG_(debugLog)(logLevel, "aspacem",
- "<<< SHOW_SEGMENTS: %s (%d segments, %d segnames)\n",=20
- who, segments_used, segnames_used);
- for (i =3D 0; i < segnames_used; i++) {
- if (!segnames[i].inUse)
- continue;
- VG_(debugLog)(logLevel, "aspacem",
- "(%2d) %s\n", i, segnames[i].fname);
+ if (iLo =3D=3D iHi=20
+ && nsegments[iLo].start =3D=3D start=20
+ && nsegments[iLo].end+1 =3D=3D start+len
+ && (nsegments[iLo].kind =3D=3D SkFile || nsegments[iLo].kind =3D=3D=
SkAnon)) {
+ nsegments[iLo].hasR =3D toBool(prot & VKI_PROT_READ);
+ nsegments[iLo].hasW =3D toBool(prot & VKI_PROT_WRITE);
+ nsegments[iLo].hasX =3D toBool(prot & VKI_PROT_EXEC);
+ return;
}
- for (i =3D 0; i < nsegments_used; i++)
- show_nsegment( logLevel, i, &nsegments[i] );
- VG_(debugLog)(logLevel, "aspacem",
- ">>>\n");
-}
=20
-
-/* Add SEG to the collection, deleting/truncating any it overlaps */
-static void add_segment ( NSegment* seg )
-{
- Int nDeld, i, j, k;
- Addr iStart, iEnd;
-
- Addr dStart =3D seg->start;
- Addr dEnd =3D seg->end;
-
- aspacem_assert(dStart <=3D dEnd);
- aspacem_assert(VG_IS_PAGE_ALIGNED(dStart));
- aspacem_assert(VG_IS_PAGE_ALIGNED(dEnd+1));
-
- nDeld =3D 0;
-
- for (i =3D 0; i < nsegments_used; i++) {
-
- nsegments[i].mark =3D False;
-
- iStart =3D nsegments[i].start;
- iEnd =3D nsegments[i].end;
-
- /* no-overlap cases */
- if (iEnd < dStart) continue;
- if (dEnd < iStart) continue;
-
- if (dStart <=3D iStart && iEnd <=3D dEnd) {
- /* i is completely overlapped. Mark it for deletion. */
- nsegments[i].mark =3D True;
- nDeld++;
- continue;
- }
-
- if (iStart < dStart && iEnd > dEnd) {
- /* deleted interval is completely contained within i. This
- means i has to be split into two pieces. As a result, first
- move the following elements up by one place to make space for
- the new part. */
- if (nsegments_used >=3D VG_N_SEGMENTS)
- aspacem_barf_toolow("VG_N_SEGMENTS");
- for (j =3D nsegments_used-1; j > i; j--)
- nsegments[j+1] =3D nsegments[j];
- nsegments_used++;
- nsegments[i+1] =3D nsegments[i];
- nsegments[i].end =3D dStart-1;
- nsegments[i+1].start =3D dEnd+1;
- nsegments[i+1].offset +=3D (nsegments[i+1].start - nsegments[i].st=
art);
- continue;
- }
-
- if (iStart < dStart && iEnd <=3D dEnd && iEnd >=3D dStart) {
- /* interval to be deleted straddles upper boundary of i. */
- nsegments[i].end =3D dStart-1;
- continue;
- }
-
- if (iEnd > dEnd && iStart >=3D dStart && iStart <=3D dEnd) {
- /* interval to be deleted straddles lower boundary of i. */
- nsegments[i].offset +=3D (dEnd+1 - nsegments[i].start);
- nsegments[i].start =3D dEnd+1;
- continue;
- }
-
- /* I don't think we can get here. */
- aspacem_assert(0);
- }
-
- /* Get rid of the intervals marked for deletion. */
- if (nDeld > 0) {
- j =3D 0;
- for (i =3D 0; i < nsegments_used; i++) {
- if (nsegments[i].mark)
- continue;
- nsegments[j] =3D nsegments[i];
- j++;
- }
- nsegments_used -=3D nDeld;
- }
-
- /* At this point, there should be a gap dStart .. dEnd inclusive.
- Find the gap and insert the new interval in it. Set k so that
- all entries >=3D k must be moved up 1, and the new interval placed
- at k. */
- if (nsegments_used >=3D VG_N_SEGMENTS)
- aspacem_barf_toolow("VG_N_SEGMENTS");
- if (nsegments_used =3D=3D 0) {
- k =3D 0;
- } else {
- for (i =3D 0; i < nsegments_used; i++)
- if (dEnd+1 =3D=3D nsegments[i].start=20
- && /*guard against wraparound*/dEnd+1 > dEnd)
- break;
- k =3D i;
- }
-
- aspacem_assert(k >=3D 0 && k <=3D nsegments_used);
- for (j =3D nsegments_used-1; j >=3D k; j--)
- nsegments[j+1] =3D nsegments[j];
- nsegments_used++;
-
- nsegments[k] =3D *seg;
-
- check_nsegments();
+ /* FIXME: unhandled general case */
+ aspacem_barf("notify_mprotect general case");
}
=20
=20
+/* Notifies aspacem that the client completed an munmap successfully.
+ The segment array is updated accordingly. */
=20
-static void read_maps_callback (=20
- Addr addr, SizeT len, UInt prot,
- UInt dev, UInt ino, ULong foff, const UChar* filename )
+void VG_(am_notify_client_munmap)( Addr start, SizeT len )
{
- NSegment seg;
- init_nsegment( &seg );
- seg.start =3D addr;
- seg.end =3D addr+len-1;
- seg.dev =3D dev;
- seg.ino =3D ino;
- seg.offset =3D foff;
- seg.hasR =3D toBool(prot & VKI_PROT_READ);
- seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
- seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ NSegment seg;
=20
- seg.kind =3D SkAnon;
- if (filename) {=20
- seg.kind =3D SkFile;
- seg.fnIdx =3D allocate_segname( filename );
- }
+ if (len =3D=3D 0)
+ return;
=20
- show_nsegment( 2,0, &seg );
- add_segment( &seg );
+ init_nsegment( &seg );
+ seg.kind =3D SkFree;
+ seg.start =3D start;
+ seg.end =3D start + len - 1;
+ add_segment( &seg );
}
=20
-Addr VG_(new_aspacem_start) ( Addr sp_at_startup )
-{
- NSegment seg;
- Addr suggested_clstack_top;
=20
- aspacem_assert(sizeof(Word) =3D=3D sizeof(void*));
- aspacem_assert(sizeof(Addr) =3D=3D sizeof(void*));
- aspacem_assert(sizeof(SizeT) =3D=3D sizeof(void*));
- aspacem_assert(sizeof(SSizeT) =3D=3D sizeof(void*));
+/*-----------------------------------------------------------------*/
+/*--- ---*/
+/*--- Handling mappings which do not arise directly from the ---*/
+/*--- simulation of the client. ---*/
+/*--- ---*/
+/*-----------------------------------------------------------------*/
=20
- /* Add a single interval covering the entire address space. */
- init_nsegment(&seg);
- seg.kind =3D SkFree;
- seg.start =3D Addr_MIN;
- seg.end =3D Addr_MAX;
- nsegments[0] =3D seg;
- nsegments_used =3D 1;
+/* Map a file at a fixed address for the client, and update the
+ segment array accordingly. */
=20
- /* Establish address limits and block out unusable parts
- accordingly. */
-
- VG_(debugLog)(2, "aspacem",=20
- " sp_at_startup =3D 0x%llx (supplied)\n",=20
- (ULong)sp_at_startup );
-
- aspacem_minAddr =3D (Addr) 0x04000000; // 64M
-
-# if VG_WORDSIZE =3D=3D 8
- aspacem_maxAddr =3D (Addr)0x400000000 - 1; // 16G
-# else
- aspacem_maxAddr =3D VG_PGROUNDDN( sp_at_startup ) - 1;
-# endif
-
- aspacem_cStart =3D aspacem_minAddr; // 64M
- aspacem_vStart =3D VG_PGROUNDUP((aspacem_minAddr + aspacem_maxAddr + =
1) / 2);
-
- suggested_clstack_top =3D aspacem_maxAddr - 16*1024*1024ULL
- + VKI_PAGE_SIZE;
-
- aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_minAddr));
- aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_maxAddr + 1));
- aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_cStart));
- aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_vStart));
- aspacem_assert(VG_IS_PAGE_ALIGNED(suggested_clstack_top + 1));
-
- VG_(debugLog)(2, "aspacem",=20
- " minAddr =3D 0x%08llx (computed)\n",=20
- (ULong)aspacem_minAddr);
- VG_(debugLog)(2, "aspacem",=20
- " maxAddr =3D 0x%08llx (computed)\n",=20
- (ULong)aspacem_maxAddr);
- VG_(debugLog)(2, "aspacem",=20
- " cStart =3D 0x%08llx (computed)\n",=20
- (ULong)aspacem_cStart);
- VG_(debugLog)(2, "aspacem",=20
- " vStart =3D 0x%08llx (computed)\n",=20
- (ULong)aspacem_vStart);
- VG_(debugLog)(2, "aspacem",=20
- "suggested_clstack_top =3D 0x%08llx (computed)\n",=20
- (ULong)suggested_clstack_top);
-
- if (aspacem_cStart > Addr_MIN) {
- init_resvn(&seg, Addr_MIN, aspacem_cStart-1);
- add_segment(&seg);
- }
- if (aspacem_maxAddr < Addr_MAX) {
- init_resvn(&seg, aspacem_maxAddr+1, Addr_MAX);
- add_segment(&seg);
- }
-
- /* Create a 1-page reservation at the notional initial
- client/valgrind boundary. This isn't strictly necessary, but
- because the advisor does first-fit and starts searches for
- valgrind allocations at the boundary, this is kind of necessary
- in order to get it to start allocating in the right place. */
- init_resvn(&seg, aspacem_vStart, aspacem_vStart + VKI_PAGE_SIZE - 1)=
;
- add_segment(&seg);
-
- VG_(show_nsegments)(2, "Initial layout");
-
- VG_(debugLog)(2, "aspacem", "Reading /proc/self/maps\n");
- VG_(parse_procselfmaps) ( read_maps_callback );
-
- VG_(show_nsegments)(2, "With contents of /proc/self/maps");
-
- return suggested_clstack_top;
-}
-
-
-SysRes VG_(mmap_file_fixed_client)
- ( void* startV, SizeT length, Int prot, Int fd, SizeT offset )
+SysRes VG_(am_mmap_file_fixed_client)
+ ( Addr start, SizeT length, UInt prot, Int fd, SizeT offset )
{
SysRes sres;
NSegment seg;
@@ -2179,10 +2370,7 @@
UInt dev, ino;
HChar buf[VKI_PATH_MAX];
=20
- Addr start =3D (Addr)startV;=20
-=20
/* Not allowable. */
- /* Not allowable. */
if (length =3D=3D 0 || !VG_IS_PAGE_ALIGNED(start))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
@@ -2190,14 +2378,14 @@
req.rkind =3D MFixed;
req.start =3D start;
req.len =3D length;
- ok =3D VG_(aspacem_getAdvisory)( &req, True/*client*/, &advised );
+ ok =3D VG_(am_get_advisory)( &req, True/*client*/, &advised );
if (!ok || advised !=3D start)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(=20
start, length, prot,=20
VKI_MAP_FIXED|VKI_MAP_PRIVATE,=20
fd, offset=20
@@ -2209,7 +2397,7 @@
/* I don't think this can happen. It means the kernel made a
fixed map succeed but not at the requested location. Try to
repair the damage, then return saying the mapping failed. */
- (void)do_munmap_NATIVE( sres.val, length );
+ (void)do_munmap_NO_NOTIFY( sres.val, length );
return VG_(mk_SysRes_Error)( VKI_EINVAL );
}
=20
@@ -2236,8 +2424,10 @@
}
=20
=20
-SysRes VG_(mmap_anon_fixed_client)
- ( void* startV, SizeT length, Int prot )
+/* Map anonymously at a fixed address for the client, and update
+ the segment array accordingly. */
+
+SysRes VG_(am_mmap_anon_fixed_client) ( Addr start, SizeT length, UInt p=
rot )
{
SysRes sres;
NSegment seg;
@@ -2245,8 +2435,6 @@
Bool ok;
MapRequest req;
=20
- Addr start =3D (Addr)startV;=20
-=20
/* Not allowable. */
if (length =3D=3D 0 || !VG_IS_PAGE_ALIGNED(start))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
@@ -2255,14 +2443,14 @@
req.rkind =3D MFixed;
req.start =3D start;
req.len =3D length;
- ok =3D VG_(aspacem_getAdvisory)( &req, True/*client*/, &advised );
+ ok =3D VG_(am_get_advisory)( &req, True/*client*/, &advised );
if (!ok || advised !=3D start)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(=20
start, length, prot,=20
VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
0, 0=20
@@ -2274,7 +2462,7 @@
/* I don't think this can happen. It means the kernel made a
fixed map succeed but not at the requested location. Try to
repair the damage, then return saying the mapping failed. */
- (void)do_munmap_NATIVE( sres.val, length );
+ (void)do_munmap_NO_NOTIFY( sres.val, length );
return VG_(mk_SysRes_Error)( VKI_EINVAL );
}
=20
@@ -2293,8 +2481,10 @@
}
=20
=20
-SysRes VG_(mmap_anon_float_client)
- ( SizeT length, Int prot )
+/* Map anonymously at an unconstrained address for the client, and
+ update the segment array accordingly. */
+
+SysRes VG_(am_mmap_anon_float_client) ( SizeT length, Int prot )
{
SysRes sres;
NSegment seg;
@@ -2310,14 +2500,14 @@
req.rkind =3D MAny;
req.start =3D 0;
req.len =3D length;
- ok =3D VG_(aspacem_getAdvisory)( &req, True/*client*/, &advised );
+ ok =3D VG_(am_get_advisory)( &req, True/*client*/, &advised );
if (!ok)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* We have been advised that the mapping is allowable at the
advised address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(=20
advised, length, prot,=20
VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
0, 0=20
@@ -2329,7 +2519,7 @@
/* I don't think this can happen. It means the kernel made a
fixed map succeed but not at the requested location. Try to
repair the damage, then return saying the mapping failed. */
- (void)do_munmap_NATIVE( sres.val, length );
+ (void)do_munmap_NO_NOTIFY( sres.val, length );
return VG_(mk_SysRes_Error)( VKI_EINVAL );
}
=20
@@ -2348,7 +2538,11 @@
}
=20
=20
-SysRes VG_(map_anon_float_valgrind)( SizeT length )
+/* Map anonymously at an unconstrained address for V, and update the
+ segment array accordingly. This is fundamentally how V allocates
+ itself more address space when needed. */
+
+SysRes VG_(am_mmap_anon_float_valgrind)( SizeT length )
{
SysRes sres;
NSegment seg;
@@ -2364,14 +2558,14 @@
req.rkind =3D MAny;
req.start =3D 0;
req.len =3D length;
- ok =3D VG_(aspacem_getAdvisory)( &req, False/*valgrind*/, &advised );
+ ok =3D VG_(am_get_advisory)( &req, False/*valgrind*/, &advised );
if (!ok)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(=20
advised, length,=20
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,=20
VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
@@ -2384,7 +2578,7 @@
/* I don't think this can happen. It means the kernel made a
fixed map succeed but not at the requested location. Try to
repair the damage, then return saying the mapping failed. */
- (void)do_munmap_NATIVE( sres.val, length );
+ (void)do_munmap_NO_NOTIFY( sres.val, length );
return VG_(mk_SysRes_Error)( VKI_EINVAL );
}
=20
@@ -2403,32 +2597,11 @@
}
=20
=20
-SysRes VG_(munmap_client)( Addr base, SizeT length )
-{
- NSegment seg;
- SysRes sres;
-
- if (length =3D=3D 0 || !VG_IS_PAGE_ALIGNED(base))
- return VG_(mk_SysRes_Error)( VKI_EINVAL );
-
- sres =3D do_munmap_NATIVE( base, length );
- if (sres.isError)
- return sres;
-
- init_nsegment( &seg );
- seg.kind =3D SkFree;
- seg.start =3D base;
- seg.end =3D seg.start + VG_PGROUNDUP(length) - 1;
- add_segment( &seg );
-
- return sres;
-}
-
-
/* See comment on prototype in pub_core_aspacemgr.h for a description
of this. */
-Bool VG_(create_reservation) ( Addr start, SizeT length,=20
- ShrinkMode smode, SSizeT extra )
+
+Bool VG_(am_create_reservation) ( Addr start, SizeT length,=20
+ ShrinkMode smode, SSizeT extra )
{
Int startI, endI;
NSegment seg;
@@ -2467,9 +2640,9 @@
aspacem_assert(end2 <=3D nsegments[startI].end);
=20
init_nsegment( &seg );
- seg.kind =3D SkResvn;
+ seg.kind =3D SkResvn;
seg.start =3D start1; /* NB: extra space is not included in the rese=
rvation. */
- seg.end =3D end1;
+ seg.end =3D end1;
seg.smode =3D smode;
add_segment( &seg );
return True;
@@ -2478,7 +2651,8 @@
=20
/* See comment on prototype in pub_core_aspacemgr.h for a description
of this. */
-Bool VG_(extend_into_adjacent_reservation)( NSegment* seg, SSizeT delta =
)
+
+Bool VG_(am_extend_into_adjacent_reservation)( NSegment* seg, SSizeT del=
ta )
{
Int segA, segR;
UInt prot;
@@ -2510,10 +2684,10 @@
|| nsegments[segR].smode !=3D SmLower
|| nsegments[segR].start !=3D nsegments[segA].end + 1
|| delta > (nsegments[segR].end - nsegments[segR].start + 1))
- return False;
+ return False;
=20
/* Extend the kernel's mapping. */
- sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(=20
nsegments[segR].start, delta,
prot,
VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
@@ -2522,9 +2696,9 @@
if (sres.isError)
return False; /* kernel bug if this happens? */
if (sres.val !=3D nsegments[segR].start) {
- /* kernel bug if this happens? */
- do_munmap_NATIVE( sres.val, delta );
- return False;
+ /* kernel bug if this happens? */
+ do_munmap_NO_NOTIFY( sres.val, delta );
+ return False;
}
=20
/* Ok, success with the kernel. Update our structures. */
@@ -2544,10 +2718,10 @@
|| nsegments[segR].smode !=3D SmUpper
|| nsegments[segR].end + 1 !=3D nsegments[segA].start
|| delta > (nsegments[segR].end - nsegments[segR].start + 1))
- return False;
+ return False;
=20
/* Extend the kernel's mapping. */
- sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(=20
nsegments[segA].start-delta, delta,
prot,
VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
@@ -2556,9 +2730,9 @@
if (sres.isError)
return False; /* kernel bug if this happens? */
if (sres.val !=3D nsegments[segA].start-delta) {
- /* kernel bug if this happens? */
- do_munmap_NATIVE( sres.val, delta );
- return False;
+ /* kernel bug if this happens? */
+ do_munmap_NO_NOTIFY( sres.val, delta );
+ return False;
}
=20
/* Ok, success with the kernel. Update our structures. */
@@ -2571,113 +2745,6 @@
return True;
}
=20
-
-void=20
-VG_(notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
- Int fd, SizeT offset )
-{
- HChar buf[VKI_PATH_MAX];
- UInt dev, ino;
- NSegment seg;
- aspacem_assert(len > 0);
- aspacem_assert(VG_IS_PAGE_ALIGNED(a));
- aspacem_assert(VG_IS_PAGE_ALIGNED(len));
- init_nsegment( &seg );
- seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnon : SkFile;
- seg.isClient =3D True;
- seg.start =3D a;
- seg.end =3D a + len - 1;
- seg.offset =3D offset;
- seg.hasR =3D toBool(prot & VKI_PROT_READ);
- seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
- seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
- /* TODO: what about seg.hasT ? */
- if (get_inode_for_fd(fd, &dev, &ino)) {
- seg.dev =3D dev;
- seg.ino =3D ino;
- }
- if (get_name_for_fd(fd, buf, VKI_PATH_MAX)) {
- seg.fnIdx =3D allocate_segname( buf );
- }
- add_segment( &seg );
-}
-
-
-void VG_(notify_client_mprotect)( Addr start, SizeT len, UInt prot )
-{
- Int iLo, iHi;
-
- if (len =3D=3D 0)
- return;
-
- iLo =3D find_nsegment_idx(start);
- iHi =3D find_nsegment_idx(start + len - 1);
-
- if (iLo =3D=3D iHi=20
- && nsegments[iLo].start =3D=3D start=20
- && nsegments[iLo].end+1 =3D=3D start+len
- && (nsegments[iLo].kind =3D=3D SkFile || nsegments[iLo].kind =3D=3D=
SkAnon)) {
- nsegments[iLo].hasR =3D toBool(prot & VKI_PROT_READ);
- nsegments[iLo].hasW =3D toBool(prot & VKI_PROT_WRITE);
- nsegments[iLo].hasX =3D toBool(prot & VKI_PROT_EXEC);
- return;
- }
-
- /* FIXME: unhandled general case */
- aspacem_barf("notify_mprotect general case");
-}
-
-
-void VG_(notify_client_munmap)( Addr start, SizeT len )
-{
- NSegment seg;
-
- if (len =3D=3D 0)
- return;
-
- init_nsegment( &seg );
- seg.kind =3D SkFree;
- seg.start =3D start;
- seg.end =3D start + len - 1;
- add_segment( &seg );
-}
-
-
-/* Test if a piece of memory is addressable by the client with at
- least the "prot" protection permissions by examining the underlying
- segments.
-*/
-Bool VG_(aspacem_is_valid_for_client)( Addr start, SizeT len, UInt prot =
)
-{
- Int i, iLo, iHi;
- Bool needR, needW, needX;
-
- if (len =3D=3D 0)
- return True; /* somewhat dubious case */
- if (start + len < start)
- return False; /* reject wraparounds */
-
- needR =3D toBool(prot & VKI_PROT_READ);
- needW =3D toBool(prot & VKI_PROT_WRITE);
- needX =3D toBool(prot & VKI_PROT_EXEC);
-
- iLo =3D find_nsegment_idx(start);
- iHi =3D find_nsegment_idx(start + len - 1);
- for (i =3D iLo; i <=3D iHi; i++) {
- if (nsegments[i].isClient
- && (nsegments[i].kind =3D=3D SkFile || nsegments[i].kind =3D=3D=
SkAnon)
- && (needR ? nsegments[i].hasR : True)
- && (needW ? nsegments[i].hasW : True)
- && (needX ? nsegments[i].hasX : True)) {
- /* ok */
- } else {
- return False;
- }
- }
- return True;
-}
-
-
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/m_main.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
--- branches/ASPACEM/coregrind/m_main.c 2005-09-13 11:13:43 UTC (rev 4636=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-13 11:52:09 UTC (rev 4637=
)
@@ -607,7 +607,7 @@
=20
/* Create a shrinkable reservation followed by an anonymous
segment. Together these constitute a growdown stack. */
- Bool ok =3D VG_(create_reservation)(
+ Bool ok =3D VG_(am_create_reservation)(
resvn_start,
resvn_size,
SmUpper,=20
@@ -615,8 +615,8 @@
);
vg_assert(ok);
/* allocate a stack - mmap enough space for the stack */
- res =3D VG_(mmap_anon_fixed_client)(
- (void*)anon_start,
+ res =3D VG_(am_mmap_anon_fixed_client)(
+ anon_start,
anon_size,
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC
);
@@ -779,10 +779,16 @@
vg_assert(VG_IS_PAGE_ALIGNED(anon_start));
vg_assert(VG_IS_PAGE_ALIGNED(resvn_start));
=20
- ok =3D VG_(create_reservation)( resvn_start, resvn_size, SmLower, ano=
n_size );
+ ok =3D VG_(am_create_reservation)(=20
+ resvn_start,=20
+ resvn_size,=20
+ SmLower,=20
+ anon_size
+ );
vg_assert(ok);
- sres =3D VG_(mmap_anon_fixed_client)(=20
- (void*)anon_start, anon_size,=20
+ sres =3D VG_(am_mmap_anon_fixed_client)(=20
+ anon_start,=20
+ anon_size,=20
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC=20
);
vg_assert(!sres.isError);
@@ -2172,7 +2178,7 @@
// p: logging, plausible-stack
//--------------------------------------------------------------
VG_(debugLog)(1, "main", "Starting the address space manager\n");
- clstack_top =3D VG_(new_aspacem_start)( sp_at_startup_new );
+ clstack_top =3D VG_(am_startup)( sp_at_startup_new );
VG_(debugLog)(1, "main", "Address space manager is running\n");
=20
//--------------------------------------------------------------
@@ -2559,7 +2565,7 @@
//--------------------------------------------------------------
VG_(debugLog)(1, "main", "\n");
VG_(debugLog)(1, "main", "\n");
- VG_(show_nsegments)(1,"Memory layout at client startup");
+ VG_(am_show_nsegments)(1,"Memory layout at client startup");
VG_(debugLog)(1, "main", "\n");
VG_(debugLog)(1, "main", "\n");
=20
Modified: branches/ASPACEM/coregrind/m_mallocfree.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
--- branches/ASPACEM/coregrind/m_mallocfree.c 2005-09-13 11:13:43 UTC (re=
v 4636)
+++ branches/ASPACEM/coregrind/m_mallocfree.c 2005-09-13 11:52:09 UTC (re=
v 4637)
@@ -481,7 +481,7 @@
void VG_(out_of_memory_NORETURN) ( HChar* who, SizeT szB )
{
static Bool alreadyCrashing =3D False;
- ULong tot_alloc =3D VG_(aspacem_get_anonsize_total)();
+ ULong tot_alloc =3D VG_(am_get_anonsize_total)();
if (!alreadyCrashing) {
alreadyCrashing =3D True;
VG_(printf)("\n"
@@ -537,7 +537,7 @@
return 0;
} else {
// non-client allocation -- aborts if it fails
- sres =3D VG_(map_anon_float_valgrind)( cszB );
+ sres =3D VG_(am_mmap_anon_float_valgrind)( cszB );
if (sres.isError) {
VG_(out_of_memory_NORETURN)("newSuperblock", cszB);
/* NOTREACHED */
Modified: branches/ASPACEM/coregrind/m_signals.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
--- branches/ASPACEM/coregrind/m_signals.c 2005-09-13 11:13:43 UTC (rev 4=
636)
+++ branches/ASPACEM/coregrind/m_signals.c 2005-09-13 11:52:09 UTC (rev 4=
637)
@@ -1705,8 +1705,9 @@
SizeT udelta;
=20
/* Find the next Segment above addr */
- NSegment* seg =3D VG_(find_nsegment)(addr);
- NSegment* seg_next =3D seg ? VG_(next_nsegment)( seg, True/*fwds*/ ) =
: NULL;
+...
[truncated message content] |
|
From: <sv...@va...> - 2005-09-13 11:13:49
|
Author: cerion
Date: 2005-09-13 12:13:43 +0100 (Tue, 13 Sep 2005)
New Revision: 4636
Log:
setup new variable VG_(have_altivec) from auxv::AT_HWCAP
fixed default VSCR in dispatch-ppc32.S (non-java mode =3D 1)
Modified:
trunk/coregrind/m_dispatch/dispatch-ppc32.S
trunk/coregrind/m_machine.c
trunk/coregrind/m_main.c
trunk/coregrind/m_translate.c
trunk/coregrind/pub_core_machine.h
Modified: trunk/coregrind/m_dispatch/dispatch-ppc32.S
=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_dispatch/dispatch-ppc32.S 2005-09-13 08:42:48 UTC (=
rev 4635)
+++ trunk/coregrind/m_dispatch/dispatch-ppc32.S 2005-09-13 11:13:43 UTC (=
rev 4636)
@@ -92,9 +92,16 @@
=20
/* set host AltiVec control word to the default mode expected=20
by VEX-generated code. */
- vsubuwm 3,3,3 /* generate zero */
+ lis 3,VG_(have_altivec)@ha
+ lwz 3,VG_(have_altivec)@l(3)
+ cmplwi 3,0
+ beq L1
+ /* generate vector {0x0,0x0,0x0,0x00010000} */
+ vspltisw 3,0x1 /* 4x 0x00000001 */
+ vspltisw 4,0x0 /* generate zero */
+ vsldoi 3,4,3,0x6 /* v3 =3D v3 >> 10 bytes */
mtvscr 3
-
+L1:
/* make a stack frame for the code we are calling */
stwu 1,-16(1)
=20
Modified: trunk/coregrind/m_machine.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_machine.c 2005-09-13 08:42:48 UTC (rev 4635)
+++ trunk/coregrind/m_machine.c 2005-09-13 11:13:43 UTC (rev 4636)
@@ -214,11 +214,13 @@
//////////////////////////////////////////////////////////////////
// Architecture specifics
=20
+#if defined(VGA_ppc32)
// PPC: what is the cache line size (for dcbz etc) ? This info is
// harvested on Linux at startup from the AT_SYSINFO entries. 0 means
// not-yet-set.
-#if defined(VGA_ppc32)
Int VG_(cache_line_size_ppc32) =3D 0;
+// Altivec enabled? Harvested on startup from the AT_HWCAP entry
+Int VG_(have_altivec) =3D 0;
#endif
=20
// X86: set to 1 if the host is able to do {ld,st}mxcsr (load/store
Modified: trunk/coregrind/m_main.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_main.c 2005-09-13 08:42:48 UTC (rev 4635)
+++ trunk/coregrind/m_main.c 2005-09-13 11:13:43 UTC (rev 4636)
@@ -181,9 +181,10 @@
break;
=20
case AT_HWCAP:
- VG_(debugLog)(1, "main", "PPC32 hwcaps(1): 0x%x\n", (UInt)auxv-=
>u.a_val);
- auxv->u.a_val &=3D ~0x10000000; /* claim there is no Altivec su=
pport */
- VG_(debugLog)(1, "main", "PPC32 hwcaps(2): 0x%x\n", (UInt)auxv-=
>u.a_val);
+ VG_(debugLog)(1, "main", "PPC32 hwcaps: 0x%x\n", (UInt)auxv->u.=
a_val);
+ if ((auxv->u.a_val & 0x10000000) > 0)
+ VG_(have_altivec) =3D 1;
+ VG_(debugLog)(1, "main", "PPC32 AltiVec support: %u\n", VG_(hav=
e_altivec));
break;
# endif
=20
Modified: trunk/coregrind/m_translate.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_translate.c 2005-09-13 08:42:48 UTC (rev 4635)
+++ trunk/coregrind/m_translate.c 2005-09-13 11:13:43 UTC (rev 4636)
@@ -34,6 +34,7 @@
#include "pub_core_aspacemgr.h"
#include "pub_core_cpuid.h"
#include "pub_core_machine.h" // For VG_(cache_line_size_ppc32)
+ // and VG_(have_altivec)
// and VG_(get_SP)
// and VG_(have_mxcsr_x86)
#include "pub_core_libcbase.h"
@@ -112,7 +113,8 @@
=20
#elif defined(VGA_ppc32)
*vex_arch =3D VexArchPPC32;
- vai->subarch =3D VexSubArchPPC32_noAV;
+ vai->subarch =3D VG_(have_altivec) ? VexSubArchPPC32_AV
+ : VexSubArchPPC32_noAV;
vai->ppc32_cache_line_szB =3D VG_(cache_line_size_ppc32);
return True;
=20
Modified: trunk/coregrind/pub_core_machine.h
=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/pub_core_machine.h 2005-09-13 08:42:48 UTC (rev 4635)
+++ trunk/coregrind/pub_core_machine.h 2005-09-13 11:13:43 UTC (rev 4636)
@@ -78,11 +78,13 @@
=20
// Architecture specifics
=20
+#if defined(VGA_ppc32)
// PPC: what is the cache line size (for dcbz etc) ?
// This info is harvested on Linux at startup from the AT_SYSINFO
// entries.
-#if defined(VGA_ppc32)
extern Int VG_(cache_line_size_ppc32);
+// Altivec enabled? Harvested on startup from the AT_HWCAP entry
+extern Int VG_(have_altivec);
#endif
=20
// X86: set to 1 if the host is able to do {ld,st}mxcsr (load/store
|
|
From: <sv...@va...> - 2005-09-13 08:42:52
|
Author: tom
Date: 2005-09-13 09:42:48 +0100 (Tue, 13 Sep 2005)
New Revision: 4635
Log:
Add some new bugs to the bug status file.
Modified:
trunk/docs/internals/3_0_BUGSTATUS.txt
Modified: trunk/docs/internals/3_0_BUGSTATUS.txt
=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/docs/internals/3_0_BUGSTATUS.txt 2005-09-13 08:22:06 UTC (rev 4=
634)
+++ trunk/docs/internals/3_0_BUGSTATUS.txt 2005-09-13 08:42:48 UTC (rev 4=
635)
@@ -124,6 +124,12 @@
FIXED-30BRANCH: 4597, 4601
=20
----------------------------------------------------------------
+111829 vex x86->IR: unhandled instruction bytes: sbb Al, Ib
+
+FIXED-TRUNK: TODO
+FIXED-30BRANCH: TODO
+
+----------------------------------------------------------------
111851 vex x86->IR: unhandled instruction bytes: 0x9F 0x89
(lahf/sahf)
=20
@@ -136,7 +142,20 @@
FIXED-TRUNK: TODO
FIXED-30BRANCH: TODO
=20
+----------------------------------------------------------------
+112152 code generation for Xin_MFence on x86 with SSE0 subarch
+112167 ditto
=20
+FIXED-TRUNK: TODO
+FIXED-30BRANCH: TODO
+
+----------------------------------------------------------------
+112501 vex x86->IR: movq (0xF 0x7F 0xC1 0xF)
+
+FIXED-TRUNK: TODO
+FIXED-30BRANCH: TODO
+
+
=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=3D=3D=3D=3D=3D
=3D=3D=3D Bugs targeted for 3.1.0 and 3.0.1 =
=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=3D=3D=3D=3D=3D=3D=3D=3D
|
|
From: <sv...@va...> - 2005-09-13 08:22:15
|
Author: tom
Date: 2005-09-13 09:22:06 +0100 (Tue, 13 Sep 2005)
New Revision: 4634
Log:
Hook up sys_mmap2 to the new address space manager mmap machinery in
the same way as the old_mmap system call.
Modified:
branches/ASPACEM/coregrind/m_syswrap/syswrap-amd64-linux.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-ppc32-linux.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-amd64-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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-amd64-linux.c 2005-09-13=
04:10:45 UTC (rev 4633)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-amd64-linux.c 2005-09-13=
08:22:06 UTC (rev 4634)
@@ -246,7 +246,7 @@
{
VG_(debugLog)(1, "syswrap-amd64-linux",=20
"entering VG_(main_thread_wrapper_NORETURN)\n");
-
+#if 0
UWord* rsp =3D allocstack(tid);
=20
/* shouldn't be any other threads around yet */
@@ -258,7 +258,10 @@
run_a_thread_NORETURN, /* fn to call */
(Word)tid /* arg to give it */
);
+#endif
=20
+ run_a_thread_NORETURN( tid );
+
/*NOTREACHED*/
vg_assert(0);
}
@@ -1186,7 +1189,7 @@
GENXY(__NR_lstat, sys_newlstat), // 6=20
GENXY(__NR_poll, sys_poll), // 7=20
GENX_(__NR_lseek, sys_lseek), // 8=20
- GENXY(__NR_mmap, sys_mmap2), // 9=20
+ GENX_(__NR_mmap, sys_mmap2), // 9=20
=20
GENXY(__NR_mprotect, sys_mprotect), // 10=20
GENXY(__NR_munmap, sys_munmap), // 11=20
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-13 04:=
10:45 UTC (rev 4633)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-13 08:=
22:06 UTC (rev 4634)
@@ -4529,6 +4529,11 @@
=20
PRE(sys_mmap2)
{
+ MapRequest mreq;
+ Addr advised;
+ Bool mreq_ok;
+ SysRes sres;
+
// Exactly like old_mmap() in x86-linux except:
// - all 6 args are passed in regs, rather than in a memory-block.
// - the file offset is specified in pagesize units rather than byte=
s,
@@ -4555,7 +4560,52 @@
return;
}
=20
+ /* Figure out what kind of allocation constraints there are
+ (fixed/hint/any), and ask aspacem what we should do. */
+ mreq.start =3D ARG1;
+ mreq.len =3D ARG2;
if (ARG4 & VKI_MAP_FIXED) {
+ mreq.rkind =3D MFixed;
+ } else=20
+ if (ARG1 !=3D 0) {
+ mreq.rkind =3D MHint;
+ } else {
+ mreq.rkind =3D MAny;
+ }
+
+ /* Enquire ... */
+ mreq_ok =3D VG_(aspacem_getAdvisory)( &mreq, True/*client*/, &advised=
);
+ if (!mreq_ok) {
+ /* Our request was bounced, so we'd better fail. */
+ SET_STATUS_Failure( VKI_EINVAL );
+ return;
+ }
+
+ vg_assert(! FAILURE);
+
+ /* Otherwise we're OK (so far). Install aspacem's choice of
+ address, and let the mmap go through. */
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(advised, ARG2, ARG3,
+ ARG4 | VKI_MAP_FIXED,
+ ARG5, ARG6);
+ SET_STATUS_from_SysRes(sres);
+
+ if (!sres.isError) {
+ /* Notify aspacem and the tool. */
+ ML_(notify_aspacem_and_tool_of_mmap)(=20
+ (Addr)sres.val, /* addr kernel actually assigned */
+ ARG2, ARG3,=20
+ ARG4, /* the original flags value */
+ ARG5, ARG6=20
+ );
+ }
+
+ /* Stay sane */
+ if (SUCCESS && (ARG4 & VKI_MAP_FIXED))
+ vg_assert(RES =3D=3D ARG1);
+
+#if 0
+ if (ARG4 & VKI_MAP_FIXED) {
if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mmap2"))
SET_STATUS_Failure( VKI_ENOMEM );
} else {
@@ -4569,16 +4619,9 @@
ARG4 |=3D VKI_MAP_FIXED;
}
}
+#endif
}
=20
-POST(sys_mmap2)
-{
- vg_assert(SUCCESS);
- vg_assert(ML_(valid_client_addr)(RES, ARG2, tid, "mmap2"));
- ML_(notify_aspacem_and_tool_of_mmap)( (Addr)RES, ARG2, ARG3, ARG4, AR=
G5,
- ARG6 * (ULong)VKI_PAGE_SIZE );
-}
-
PRE(sys_mprotect)
{
PRINT("sys_mprotect ( %p, %llu, %d )", ARG1,(ULong)ARG2,ARG3);
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-ppc32-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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-ppc32-linux.c 2005-09-13=
04:10:45 UTC (rev 4633)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-ppc32-linux.c 2005-09-13=
08:22:06 UTC (rev 4634)
@@ -2065,7 +2065,7 @@
//.. // (__NR_reboot, sys_reboot), // 88 */Li=
nux
//.. // (__NR_readdir, old_readdir), // 89 -- s=
uperseded
=20
- GENXY(__NR_mmap, sys_mmap2), // 90
+ GENX_(__NR_mmap, sys_mmap2), // 90
GENXY(__NR_munmap, sys_munmap), // 91
//.. GENX_(__NR_truncate, sys_truncate), // 92
GENX_(__NR_ftruncate, sys_ftruncate), // 93
@@ -2191,7 +2191,7 @@
GENX_(__NR_vfork, sys_fork), // 189
GENXY(__NR_ugetrlimit, sys_getrlimit), // 190
//__NR_readahead // 191 ppc/Linux only?
- GENXY(__NR_mmap2, sys_mmap2), // 192
+ GENX_(__NR_mmap2, sys_mmap2), // 192
//.. GENX_(__NR_truncate64, sys_truncate64), // 193
//.. GENX_(__NR_ftruncate64, sys_ftruncate64), // 194
//.. =20
Modified: branches/ASPACEM/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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c 2005-09-13 0=
4:10:45 UTC (rev 4633)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c 2005-09-13 0=
8:22:06 UTC (rev 4634)
@@ -2227,7 +2227,7 @@
// Nb: we treat vfork as fork
GENX_(__NR_vfork, sys_fork), // 190
GENXY(__NR_ugetrlimit, sys_getrlimit), // 191
- GENXY(__NR_mmap2, sys_mmap2), // 192
+ GENX_(__NR_mmap2, sys_mmap2), // 192
GENX_(__NR_truncate64, sys_truncate64), // 193
GENX_(__NR_ftruncate64, sys_ftruncate64), // 194
=20
|
|
From: <sv...@va...> - 2005-09-13 04:10:49
|
Author: njn
Date: 2005-09-13 05:10:45 +0100 (Tue, 13 Sep 2005)
New Revision: 4633
Log:
Fix "make distcheck".
Modified:
trunk/docs/Makefile.am
trunk/docs/internals/Makefile.am
trunk/docs/xml/Makefile.am
Modified: trunk/docs/Makefile.am
=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/docs/Makefile.am 2005-09-13 01:00:51 UTC (rev 4632)
+++ trunk/docs/Makefile.am 2005-09-13 04:10:45 UTC (rev 4633)
@@ -24,13 +24,13 @@
##-------------------------------------------------------------------
## Below here is more ordinary make stuff...
##-------------------------------------------------------------------
-docdir =3D ./
-xmldir =3D $(docdir)xml
-imgdir =3D $(docdir)images
-libdir =3D $(docdir)lib
-htmldir =3D $(docdir)html
-printdir =3D $(docdir)print
+myxmldir =3D $(top_srcdir)/docs/xml
+myimgdir =3D $(top_srcdir)/docs/images
+mylibdir =3D $(top_srcdir)/docs/lib
=20
+myhtmldir =3D $(top_builddir)/docs/html
+myprintdir =3D $(top_builddir)/docs/print
+
XML_CATALOG_FILES =3D /etc/xml/catalog
=20
# file to log print output to
@@ -47,40 +47,40 @@
XSLTPROC_FLAGS =3D --nonet --xinclude=20
=20
# stylesheets
-XSL_HTML_CHUNK_STYLE =3D $(libdir)/vg-html-chunk.xsl
-XSL_HTML_SINGLE_STYLE =3D $(libdir)/vg-html-single.xsl
-XSL_FO_STYLE =3D $(libdir)/vg-fo.xsl
+XSL_HTML_CHUNK_STYLE =3D $(mylibdir)/vg-html-chunk.xsl
+XSL_HTML_SINGLE_STYLE =3D $(mylibdir)/vg-html-single.xsl
+XSL_FO_STYLE =3D $(mylibdir)/vg-fo.xsl
=20
all-docs: html-docs print-docs
=20
valid:
- $(XMLLINT) $(XMLLINT_FLAGS) $(xmldir)/index.xml
+ $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml
=20
# chunked html
html-docs:
@echo "Generating html files..."
export XML_CATALOG_FILES=3D$(XML_CATALOG_FILES) && \
- mkdir -p $(htmldir) && \
- /bin/rm -fr $(htmldir)/ && \
- mkdir -p $(htmldir)/ && \
- mkdir -p $(htmldir)/images && \
- cp $(libdir)/vg_basic.css $(htmldir)/ && \
- cp $(imgdir)/*.png $(htmldir)/images && \
- $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(htmldir)/ $(XSL_HTML_CHUNK_STYLE) $(=
xmldir)/index.xml
+ mkdir -p $(myhtmldir) && \
+ /bin/rm -fr $(myhtmldir)/ && \
+ mkdir -p $(myhtmldir)/ && \
+ mkdir -p $(myhtmldir)/images && \
+ cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \
+ cp $(myimgdir)/*.png $(myhtmldir)/images && \
+ $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) =
$(myxmldir)/index.xml
=20
# pdf and postscript
print-docs:
- @echo "Generating PDF file: $(printdir)/index.pdf (please be patient)..=
.";
+ @echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)=
...";
export XML_CATALOG_FILES=3D$(XML_CATALOG_FILES) && \
- mkdir -p $(printdir) && \
- mkdir -p $(printdir)/images && \
- cp $(imgdir)/massif-graph-sm.png $(printdir)/images && \
- $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(printdir)/index.fo $(XSL_FO_STYLE) $=
(xmldir)/index.xml && \
- (cd $(printdir) && \
+ mkdir -p $(myprintdir) && \
+ mkdir -p $(myprintdir)/images && \
+ cp $(myimgdir)/massif-graph-sm.png $(myprintdir)/images && \
+ $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myprintdir)/index.fo $(XSL_FO_STYLE)=
$(myxmldir)/index.xml && \
+ (cd $(myprintdir) && \
( pdfxmltex index.fo && \
pdfxmltex index.fo && \
pdfxmltex index.fo ) &> $(LOGFILE) && \
- echo "Generating PS file: $(printdir)/index.ps ..." && \
+ echo "Generating PS file: $(myprintdir)/index.ps ..." && \
pdftops index.pdf && \
rm -f *.log *.aux *.fo *.out)
=20
Modified: trunk/docs/internals/Makefile.am
=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/docs/internals/Makefile.am 2005-09-13 01:00:51 UTC (rev 4632)
+++ trunk/docs/internals/Makefile.am 2005-09-13 04:10:45 UTC (rev 4633)
@@ -1,5 +1,5 @@
EXTRA_DIST =3D \
- 3_0_BUGSTATUS 64-bit-cleanness.txt \
+ 3_0_BUGSTATUS.txt 64-bit-cleanness.txt \
darwin-notes.txt darwin-syscalls.txt \
directory-structure.txt \
m_replacemalloc.txt \
Modified: trunk/docs/xml/Makefile.am
=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/docs/xml/Makefile.am 2005-09-13 01:00:51 UTC (rev 4632)
+++ trunk/docs/xml/Makefile.am 2005-09-13 04:10:45 UTC (rev 4633)
@@ -1,10 +1,11 @@
EXTRA_DIST =3D \
+ FAQ.xml \
+ dist-docs.xml \
index.xml \
- FAQ.xml \
+ licenses.xml \
manual.xml manual-intro.xml manual-core.xml \
+ quick-start-guide.xml \
writing-tools.xml \
- dist-docs.xml \
tech-docs.xml \
- licenses.xml \
vg-entities.xml \
xml_help.txt
|
|
From: Tom H. <th...@cy...> - 2005-09-13 03:21:23
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2005-09-13 03:00:03 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 164 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_fcntl (stderr) none/tests/tls (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 165 tests, 8 stderr failures, 2 stdout failures ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_fcntl (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) none/tests/tls (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:45:06 2005 --- new.short Tue Sep 13 04:21:01 2005 *************** *** 8,10 **** ! == 165 tests, 8 stderr failures, 2 stdout failures ================= memcheck/tests/sigprocmask (stderr) --- 8,10 ---- ! == 164 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/sigprocmask (stderr) *************** *** 16,19 **** none/tests/fdleak_fcntl (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) none/tests/tls (stdout) --- 16,17 ---- |
|
From: <js...@ac...> - 2005-09-13 02:56:51
|
Nightly build on phoenix ( SuSE 9.1 ) started at 2005-09-13 03:30:00 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 185 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 186 tests, 3 stderr failures, 1 stdout failure ================= none/tests/faultstatus (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:43:19 2005 --- new.short Tue Sep 13 03:56:26 2005 *************** *** 10,15 **** ! == 186 tests, 3 stderr failures, 1 stdout failure ================= none/tests/faultstatus (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) --- 10,13 ---- ! == 185 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: <js...@ac...> - 2005-09-13 02:44:45
|
Nightly build on g5 ( YDL 4.0, ppc970 ) started at 2005-09-13 04:40:00 CEST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 158 tests, 18 stderr failures, 1 stdout failure ================= memcheck/tests/badjump (stderr) memcheck/tests/badjump2 (stderr) memcheck/tests/fprw (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigaltstack (stderr) memcheck/tests/supp1 (stderr) memcheck/tests/supp_unknown (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) cachegrind/tests/chdir (stderr) cachegrind/tests/dlclose (stdout) cachegrind/tests/dlclose (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/fdleak_ipv4 (stderr) |
|
From: Tom H. <to...@co...> - 2005-09-13 02:41:17
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-09-13 03:30:04 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 187 tests, 5 stderr failures, 0 stdout failures ================= memcheck/tests/leak-tree (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 188 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:35:40 2005 --- new.short Tue Sep 13 03:41:10 2005 *************** *** 8,10 **** ! == 188 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) --- 8,10 ---- ! == 187 tests, 5 stderr failures, 0 stdout failures ================= memcheck/tests/leak-tree (stderr) *************** *** 13,16 **** none/tests/faultstatus (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) --- 13,14 ---- |
|
From: Tom H. <th...@cy...> - 2005-09-13 02:27:49
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2005-09-13 03:15:05 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 186 tests, 14 stderr failures, 0 stdout failures ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 187 tests, 15 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/faultstatus (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:21:49 2005 --- new.short Tue Sep 13 03:27:40 2005 *************** *** 8,10 **** ! == 187 tests, 15 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) --- 8,10 ---- ! == 186 tests, 14 stderr failures, 0 stdout failures ================= memcheck/tests/addressable (stderr) *************** *** 22,25 **** none/tests/faultstatus (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) --- 22,23 ---- |
|
From: Tom H. <th...@cy...> - 2005-09-13 02:26:01
|
Nightly build on ginetta ( i686, Red Hat 8.0 ) started at 2005-09-13 03:10:06 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 186 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 187 tests, 3 stderr failures, 1 stdout failure ================= none/tests/faultstatus (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:19:31 2005 --- new.short Tue Sep 13 03:25:26 2005 *************** *** 8,13 **** ! == 187 tests, 3 stderr failures, 1 stdout failure ================= none/tests/faultstatus (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) none/tests/x86/int (stderr) --- 8,11 ---- ! == 186 tests, 2 stderr failures, 0 stdout failures ================= none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-09-13 02:21:14
|
Nightly build on dellow ( x86_64, Fedora Core 4 ) started at 2005-09-13 03:10:06 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 164 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 165 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:17:18 2005 --- new.short Tue Sep 13 03:21:07 2005 *************** *** 8,10 **** ! == 165 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/sigprocmask (stderr) --- 8,10 ---- ! == 164 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) *************** *** 15,18 **** none/tests/faultstatus (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) --- 15,16 ---- |
|
From: Tom H. <th...@cy...> - 2005-09-13 02:18:58
|
Nightly build on aston ( x86_64, Fedora Core 3 ) started at 2005-09-13 03:05:12 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 164 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 165 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/sigprocmask (stderr) memcheck/tests/strchr (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/weirdioctl (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/ppc32/lsw (stdout) none/tests/ppc32/lsw (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Tue Sep 13 03:13:08 2005 --- new.short Tue Sep 13 03:18:52 2005 *************** *** 8,10 **** ! == 165 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/sigprocmask (stderr) --- 8,10 ---- ! == 164 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/sigprocmask (stderr) *************** *** 15,18 **** none/tests/faultstatus (stderr) - none/tests/ppc32/lsw (stdout) - none/tests/ppc32/lsw (stderr) --- 15,16 ---- |
|
From: <sv...@va...> - 2005-09-13 01:00:53
|
Author: sewardj
Date: 2005-09-13 02:00:51 +0100 (Tue, 13 Sep 2005)
New Revision: 4632
Log:
Many fixes, most particularly, add support for client
mmap/munmap/mprotect. These make it possible to successfully run
simple programs (date, ls, xedit).
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
branches/ASPACEM/coregrind/m_syswrap/priv_syswrap-generic.h
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c
branches/ASPACEM/coregrind/m_ume.c
branches/ASPACEM/coregrind/pub_core_aspacemgr.h
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.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
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 00:58:1=
9 UTC (rev 4631)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 01:00:5=
1 UTC (rev 4632)
@@ -1382,9 +1382,8 @@
=20
/////////////////////////////////////////////////////////////////
=20
-static
-SysRes do_mmap_NATIVE( Addr start, SizeT length, UInt prot, UInt flags,
- UInt fd, OffT offset)
+SysRes VG_(aspacem_do_mmap_NO_NOTIFY)( Addr start, SizeT length, UInt pr=
ot,=20
+ UInt flags, UInt fd, OffT offset)
{
SysRes res;
# if defined(VGP_x86_linux)
@@ -1602,113 +1601,184 @@
static Addr aspacem_vStart;
=20
=20
-Bool VG_(aspacem_getAdvisory)
- ( MapRequest* req, Bool forClient, /*OUT*/Addr* result )
+Bool VG_(aspacem_getAdvisory) ( MapRequest* req,=20
+ Bool forClient,=20
+ /*OUT*/Addr* result )
{
+ /* This function implements allocation policy.
=20
- /* Iterate over all holes in the address space, twice. In the first
- pass, find the first hole which is not below the search start
- point. */
- Addr holeStart, holeEnd, holeLen;
- Int i, j;
- Bool fixed_not_required;
+ The nature of the allocation request is determined by req, which
+ specifies the start and length of the request and indicates
+ whether the start address is mandatory, a hint, or irrelevant,
+ and by forClient, which says whether this is for the client or
+ for V.=20
=20
- Addr startPoint =3D forClient ? aspacem_cStart : aspacem_vStart;
+ Return values: the request can be vetoed (return False), in
+ which case the caller should not attempt to proceed with making
+ the mapping. Otherwise, the caller may proceed, and the
+ preferred address at which the mapping should happen is written
+ in *result.
=20
- Addr reqStart =3D req->rkind=3D=3DMAny ? 0 : req->start;
- Addr reqEnd =3D reqStart + req->len - 1;
- Addr reqLen =3D req->len;
+ Note that this is an advisory system only: the kernel can in
+ fact do whatever it likes as far as placement goes, and we have
+ no absolute control over it.
=20
- /* These hold indices for segments found during search, or -1 if not
- found. */
- Int floatIdx =3D -1;
- Int fixedIdx =3D -1;
+ Allocations will never be granted in a reserved area.
=20
- /* Don't waste time looking for a fixed match if not requested to. */
- aspacem_assert(nsegments_used > 0);
- fixed_not_required =3D req->rkind =3D=3D MAny;
+ The Default Policy is:
=20
- i =3D find_nsegment_idx(startPoint);
+ Search the address space for two free intervals: one of them
+ big enough to contain the request without regard to the
+ specified address (viz, as if it was a floating request) and
+ the other being able to contain the request at the specified
+ address (viz, as if were a fixed request). Then, depending on
+ the outcome of the search and the kind of request made, decide
+ whether the request is allowable and what address to advise.
=20
- /* Now examine holes from index i back round to i-1. Record the
- index first fixed hole and the first floating hole which would
- satisfy the request. */
- for (j =3D 0; j < nsegments_used; j++) {
+ The Default Policy is overriden by Policy Exception #1:
=20
- if (nsegments[i].kind !=3D SkFree) {
- i++;
- if (i >=3D nsegments_used) i =3D 0;
- continue;
- }
+ If the request is for a fixed client map, we are prepared to
+ grant it providing all areas inside the request are either
+ free or are file mappings belonging to the client. In other
+ words we are prepared to let the client trash its own mappings
+ if it wants to. =20
+ */
+ Int i, j;
+ Addr holeStart, holeEnd, holeLen;
+ Bool fixed_not_required;
=20
- holeStart =3D nsegments[i].start;
- holeEnd =3D nsegments[i].end;
+ Addr startPoint =3D forClient ? aspacem_cStart : aspacem_vStart;
=20
- /* Stay sane .. */
- aspacem_assert(holeStart <=3D holeEnd);
- aspacem_assert(aspacem_minAddr <=3D holeStart);
- aspacem_assert(holeEnd <=3D aspacem_maxAddr);
+ Addr reqStart =3D req->rkind=3D=3DMAny ? 0 : req->start;
+ Addr reqEnd =3D reqStart + req->len - 1;
+ Addr reqLen =3D req->len;
=20
- /* See if it's any use to us. */
- holeLen =3D holeEnd - holeStart + 1;
+ /* These hold indices for segments found during search, or -1 if not
+ found. */
+ Int floatIdx =3D -1;
+ Int fixedIdx =3D -1;
=20
- if (fixedIdx =3D=3D -1=20
- && holeStart <=3D reqStart && reqEnd <=3D holeEnd) {
- fixedIdx =3D i;
+ aspacem_assert(nsegments_used > 0);
+
+ VG_(show_nsegments)(0,"getAdvisory");
+ VG_(debugLog)(0,"aspacem", "getAdvisory 0x%llx %lld\n",=20
+ (ULong)req->start, (ULong)req->len);
+
+ /* Reject zero-length requests */
+ if (req->len =3D=3D 0)
+ return False;
+
+ /* Reject wraparounds */
+ if ((req->rkind=3D=3DMFixed || req->rkind=3D=3DMHint)
+ && req->start + req->len < req->start)
+ return False;
+
+ /* ------ Implement Policy Exception #1 ------ */
+
+ if (forClient && req->rkind =3D=3D MFixed) {
+ Int iLo =3D find_nsegment_idx(reqStart);
+ Int iHi =3D find_nsegment_idx(reqEnd);
+ Bool allow =3D True;
+ for (i =3D iLo; i <=3D iHi; i++) {
+ if (nsegments[i].kind =3D=3D SkFree
+ || (nsegments[i].kind =3D=3D SkFile && nsegments[i].isClien=
t)) {
+ /* ok */
+ } else {
+ allow =3D False;
+ break;
+ }
}
+ if (allow) {
+ *result =3D reqStart;
+ return True;
+ }
+ return False;
+ }
=20
- if (floatIdx =3D=3D -1
- && holeLen >=3D reqLen) {
- floatIdx =3D i;
+ /* ------ Implement the Default Policy ------ */
+
+ /* Don't waste time looking for a fixed match if not requested to. */
+ fixed_not_required =3D req->rkind =3D=3D MAny;
+
+ i =3D find_nsegment_idx(startPoint);
+
+ /* Examine holes from index i back round to i-1. Record the
+ index first fixed hole and the first floating hole which would
+ satisfy the request. */
+ for (j =3D 0; j < nsegments_used; j++) {
+
+ if (nsegments[i].kind !=3D SkFree) {
+ i++;
+ if (i >=3D nsegments_used) i =3D 0;
+ continue;
}
+
+ holeStart =3D nsegments[i].start;
+ holeEnd =3D nsegments[i].end;
+
+ /* Stay sane .. */
+ aspacem_assert(holeStart <=3D holeEnd);
+ aspacem_assert(aspacem_minAddr <=3D holeStart);
+ aspacem_assert(holeEnd <=3D aspacem_maxAddr);
+
+ /* See if it's any use to us. */
+ holeLen =3D holeEnd - holeStart + 1;
+
+ if (fixedIdx =3D=3D -1 && holeStart <=3D reqStart && reqEnd <=3D h=
oleEnd)
+ fixedIdx =3D i;
+
+ if (floatIdx =3D=3D -1 && holeLen >=3D reqLen)
+ floatIdx =3D i;
=20
- /* Don't waste time searching once we've found what we wanted. */
- if ((fixed_not_required || fixedIdx >=3D 0) && floatIdx >=3D 0)
- break;
+ /* Don't waste time searching once we've found what we wanted. */
+ if ((fixed_not_required || fixedIdx >=3D 0) && floatIdx >=3D 0)
+ break;
=20
- i++;
- if (i >=3D nsegments_used) i =3D 0;
- }
+ i++;
+ if (i >=3D nsegments_used) i =3D 0;
+ }
=20
-aspacem_assert(fixedIdx >=3D -1 && fixedIdx < nsegments_used);
-aspacem_assert(floatIdx >=3D -1 && floatIdx < nsegments_used);
-if (fixedIdx >=3D 0)=20
-aspacem_assert(nsegments[fixedIdx].kind =3D=3D SkFree);
-if (floatIdx >=3D 0)=20
-aspacem_assert(nsegments[floatIdx].kind =3D=3D SkFree);
+ aspacem_assert(fixedIdx >=3D -1 && fixedIdx < nsegments_used);
+ if (fixedIdx >=3D 0)=20
+ aspacem_assert(nsegments[fixedIdx].kind =3D=3D SkFree);
=20
- /* Now see if we found anything which can satisfy the request. */
- switch (req->rkind) {
- case MFixed:
- if (fixedIdx >=3D 0) {
- *result =3D req->start;
- return True;
- } else {
- return False;
- }
- break;
- case MHint:
- if (fixedIdx >=3D 0) {
- *result =3D req->start;
- return True;
- }
- if (floatIdx >=3D 0) {
- *result =3D nsegments[floatIdx].start;
- return True;
- }
- return False;
- case MAny:
- if (floatIdx >=3D 0) {
- *result =3D nsegments[floatIdx].start;
- return True;
- }
- return False;
+ aspacem_assert(floatIdx >=3D -1 && floatIdx < nsegments_used);
+ if (floatIdx >=3D 0)=20
+ aspacem_assert(nsegments[floatIdx].kind =3D=3D SkFree);
=20
- default: break;
- }
- /*NOTREACHED*/
- aspacem_barf("getAdvisory: unknown request kind");
- return False;
+ /* Now see if we found anything which can satisfy the request. */
+ switch (req->rkind) {
+ case MFixed:
+ if (fixedIdx >=3D 0) {
+ *result =3D req->start;
+ return True;
+ } else {
+ return False;
+ }
+ break;
+ case MHint:
+ if (fixedIdx >=3D 0) {
+ *result =3D req->start;
+ return True;
+ }
+ if (floatIdx >=3D 0) {
+ *result =3D nsegments[floatIdx].start;
+ return True;
+ }
+ return False;
+ case MAny:
+ if (floatIdx >=3D 0) {
+ *result =3D nsegments[floatIdx].start;
+ return True;
+ }
+ return False;
+ default:=20
+ break;
+ }
+
+ /*NOTREACHED*/
+ aspacem_barf("getAdvisory: unknown request kind");
+ return False;
}
=20
=20
@@ -1940,7 +2010,7 @@
continue;
}
=20
- /* I don't think we can get here */
+ /* I don't think we can get here. */
aspacem_assert(0);
}
=20
@@ -2127,8 +2197,11 @@
/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D do_mmap_NATIVE( start, length, prot,=20
- VKI_MAP_FIXED|VKI_MAP_PRIVATE, fd, offset );
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ start, length, prot,=20
+ VKI_MAP_FIXED|VKI_MAP_PRIVATE,=20
+ fd, offset=20
+ );
if (sres.isError)
return sres;
=20
@@ -2189,9 +2262,11 @@
/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D do_mmap_NATIVE( start, length, prot,=20
- VKI_MAP_FIXED|VKI_MAP_PRIVATE
- |VKI_MAP_ANONYMOUS, 0, 0 );
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ start, length, prot,=20
+ VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
+ 0, 0=20
+ );
if (sres.isError)
return sres;
=20
@@ -2242,9 +2317,11 @@
/* We have been advised that the mapping is allowable at the
advised address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D do_mmap_NATIVE( advised, length, prot,=20
- VKI_MAP_FIXED|VKI_MAP_PRIVATE
- |VKI_MAP_ANONYMOUS, 0, 0 );
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ advised, length, prot,=20
+ VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
+ 0, 0=20
+ );
if (sres.isError)
return sres;
=20
@@ -2294,11 +2371,12 @@
/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
- sres =3D do_mmap_NATIVE( advised, length,=20
- VKI_PROT_READ|VKI_PROT_WRITE
- |VKI_PROT_EXEC,=20
- VKI_MAP_FIXED|VKI_MAP_PRIVATE
- |VKI_MAP_ANONYMOUS, 0, 0 );
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ advised, length,=20
+ VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,=20
+ VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
+ 0, 0=20
+ );
if (sres.isError)
return sres;
=20
@@ -2435,10 +2513,12 @@
return False;
=20
/* Extend the kernel's mapping. */
- sres =3D do_mmap_NATIVE( nsegments[segR].start, delta,
- prot,
- VKI_MAP_FIXED|VKI_MAP_PRIVATE
- |VKI_MAP_ANONYMOUS, 0, 0 );
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ nsegments[segR].start, delta,
+ prot,
+ VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
+ 0, 0=20
+ );
if (sres.isError)
return False; /* kernel bug if this happens? */
if (sres.val !=3D nsegments[segR].start) {
@@ -2467,10 +2547,12 @@
return False;
=20
/* Extend the kernel's mapping. */
- sres =3D do_mmap_NATIVE( nsegments[segA].start-delta, delta,
- prot,
- VKI_MAP_FIXED|VKI_MAP_PRIVATE
- |VKI_MAP_ANONYMOUS, 0, 0 );
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(=20
+ nsegments[segA].start-delta, delta,
+ prot,
+ VKI_MAP_FIXED|VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,=20
+ 0, 0=20
+ );
if (sres.isError)
return False; /* kernel bug if this happens? */
if (sres.val !=3D nsegments[segA].start-delta) {
@@ -2490,6 +2572,112 @@
}
=20
=20
+void=20
+VG_(notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
+ Int fd, SizeT offset )
+{
+ HChar buf[VKI_PATH_MAX];
+ UInt dev, ino;
+ NSegment seg;
+ aspacem_assert(len > 0);
+ aspacem_assert(VG_IS_PAGE_ALIGNED(a));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(len));
+ init_nsegment( &seg );
+ seg.kind =3D (flags & VKI_MAP_ANONYMOUS) ? SkAnon : SkFile;
+ seg.isClient =3D True;
+ seg.start =3D a;
+ seg.end =3D a + len - 1;
+ seg.offset =3D offset;
+ seg.hasR =3D toBool(prot & VKI_PROT_READ);
+ seg.hasW =3D toBool(prot & VKI_PROT_WRITE);
+ seg.hasX =3D toBool(prot & VKI_PROT_EXEC);
+ /* TODO: what about seg.hasT ? */
+ if (get_inode_for_fd(fd, &dev, &ino)) {
+ seg.dev =3D dev;
+ seg.ino =3D ino;
+ }
+ if (get_name_for_fd(fd, buf, VKI_PATH_MAX)) {
+ seg.fnIdx =3D allocate_segname( buf );
+ }
+ add_segment( &seg );
+}
+
+
+void VG_(notify_client_mprotect)( Addr start, SizeT len, UInt prot )
+{
+ Int iLo, iHi;
+
+ if (len =3D=3D 0)
+ return;
+
+ iLo =3D find_nsegment_idx(start);
+ iHi =3D find_nsegment_idx(start + len - 1);
+
+ if (iLo =3D=3D iHi=20
+ && nsegments[iLo].start =3D=3D start=20
+ && nsegments[iLo].end+1 =3D=3D start+len
+ && (nsegments[iLo].kind =3D=3D SkFile || nsegments[iLo].kind =3D=3D=
SkAnon)) {
+ nsegments[iLo].hasR =3D toBool(prot & VKI_PROT_READ);
+ nsegments[iLo].hasW =3D toBool(prot & VKI_PROT_WRITE);
+ nsegments[iLo].hasX =3D toBool(prot & VKI_PROT_EXEC);
+ return;
+ }
+
+ /* FIXME: unhandled general case */
+ aspacem_barf("notify_mprotect general case");
+}
+
+
+void VG_(notify_client_munmap)( Addr start, SizeT len )
+{
+ NSegment seg;
+
+ if (len =3D=3D 0)
+ return;
+
+ init_nsegment( &seg );
+ seg.kind =3D SkFree;
+ seg.start =3D start;
+ seg.end =3D start + len - 1;
+ add_segment( &seg );
+}
+
+
+/* Test if a piece of memory is addressable by the client with at
+ least the "prot" protection permissions by examining the underlying
+ segments.
+*/
+Bool VG_(aspacem_is_valid_for_client)( Addr start, SizeT len, UInt prot =
)
+{
+ Int i, iLo, iHi;
+ Bool needR, needW, needX;
+
+ if (len =3D=3D 0)
+ return True; /* somewhat dubious case */
+ if (start + len < start)
+ return False; /* reject wraparounds */
+
+ needR =3D toBool(prot & VKI_PROT_READ);
+ needW =3D toBool(prot & VKI_PROT_WRITE);
+ needX =3D toBool(prot & VKI_PROT_EXEC);
+
+ iLo =3D find_nsegment_idx(start);
+ iHi =3D find_nsegment_idx(start + len - 1);
+ for (i =3D iLo; i <=3D iHi; i++) {
+ if (nsegments[i].isClient
+ && (nsegments[i].kind =3D=3D SkFile || nsegments[i].kind =3D=3D=
SkAnon)
+ && (needR ? nsegments[i].hasR : True)
+ && (needW ? nsegments[i].hasW : True)
+ && (needX ? nsegments[i].hasX : True)) {
+ /* ok */
+ } else {
+ return False;
+ }
+ }
+ return True;
+}
+
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/m_syswrap/priv_syswrap-generic.h
=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
--- branches/ASPACEM/coregrind/m_syswrap/priv_syswrap-generic.h 2005-09-1=
3 00:58:19 UTC (rev 4631)
+++ branches/ASPACEM/coregrind/m_syswrap/priv_syswrap-generic.h 2005-09-1=
3 01:00:51 UTC (rev 4632)
@@ -56,9 +56,12 @@
Bool ML_(do_sigkill)(Int pid, Int tgid);
=20
/* So that it can be seen from syswrap-x86-linux.c. */
+/* When a client mmap has been successfully done, both aspacem and the
+ tool need to be notified of the new mapping. Hence this fn. */
extern=20
-void ML_(mmap_segment) ( Addr a, SizeT len, UInt prot,=20
- UInt mm_flags, Int fd, ULong offset );
+void=20
+ML_(notify_aspacem_and_tool_of_mmap) ( Addr a, SizeT len, UInt prot,=20
+ UInt mm_flags, Int fd, ULong offs=
et );
=20
=20
DECL_TEMPLATE(generic, sys_ni_syscall); // * P -- unimplement=
ed
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-13 00:=
58:19 UTC (rev 4631)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-13 01:=
00:51 UTC (rev 4632)
@@ -72,14 +72,11 @@
if (0 && cl_base < 0x10000)
cl_base =3D 0x10000;
=20
- ret =3D
- (end >=3D start) &&=20
- start >=3D cl_base && start < VG_(client_end) &&
- (end <=3D VG_(client_end));
+ ret =3D VG_(aspacem_is_valid_for_client)(start,size,VKI_PROT_NONE);
=20
if (0)
VG_(printf)("%s: test=3D%p-%p client=3D%p-%p ret=3D%d\n",
- syscallname, start, end, cl_base, VG_(client_end), ret);
+ syscallname, start, end, cl_base, VG_(client_end), (Int)ret);
=20
if (!ret && syscallname !=3D NULL) {
VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried "
@@ -94,6 +91,7 @@
return ret;
}
=20
+
Bool ML_(client_signal_OK)(Int sigNo)
{
/* signal 0 is OK for kill */
@@ -122,7 +120,7 @@
idea of addressible memory diverges from that of the
kernel's, which causes the leak detector to crash. */
static=20
-void mash_addr_and_len( Addr* a, SizeT* len)
+void page_align_addr_and_len( Addr* a, SizeT* len)
{
Addr ra;
=20
@@ -131,26 +129,27 @@
*a =3D ra;
}
=20
-void ML_(mmap_segment) ( Addr a, SizeT len, UInt prot,=20
- UInt mm_flags, Int fd, ULong offset )
+/* When a client mmap has been successfully done, this function must
+ be called. It notifies both aspacem and the tool of the new
+ mapping.
+*/
+void=20
+ML_(notify_aspacem_and_tool_of_mmap) ( Addr a, SizeT len, UInt prot,=20
+ UInt flags, Int fd, ULong offset =
)
{
Bool rr, ww, xx;
- UInt flags;
=20
- flags =3D SF_MMAP;
- =20
- if (!(mm_flags & VKI_MAP_PRIVATE))
- flags |=3D SF_SHARED;
+ /* 'a' is the return value from a real kernel mmap, hence: */
+ vg_assert(VG_IS_PAGE_ALIGNED(a));
+ /* whereas len is whatever the syscall supplied. So: */
+ len =3D VG_PGROUNDUP(len);
=20
- if (fd !=3D -1)
- flags |=3D SF_FILE;
+ VG_(notify_client_mmap)( a, len, prot, flags, fd, offset );
=20
- VG_(map_fd_segment)(a, len, prot, flags, fd, offset, NULL);
+ rr =3D toBool(prot & VKI_PROT_READ);
+ ww =3D toBool(prot & VKI_PROT_WRITE);
+ xx =3D toBool(prot & VKI_PROT_EXEC);
=20
- rr =3D prot & VKI_PROT_READ;
- ww =3D prot & VKI_PROT_WRITE;
- xx =3D prot & VKI_PROT_EXEC;
-
VG_TRACK( new_mem_mmap, a, len, rr, ww, xx );
}
=20
@@ -801,12 +800,12 @@
=20
static Addr do_brk ( Addr newbrk )
{
- Addr ret =3D VG_(brk_limit);
- static const Bool debug =3D False;
- Segment *seg;
- Addr current, newaddr;
+ NSegment *aseg, *rseg;
+ Addr newbrkP;
+ SizeT delta;
+ Bool ok;
+ Bool debug =3D False;
=20
-
if (debug)
VG_(printf)("\ndo_brk: brk_base=3D%p brk_limit=3D%p newbrk=3D%p\n"=
,
VG_(brk_base), VG_(brk_limit), newbrk);
@@ -817,66 +816,53 @@
=20
if (newbrk < VG_(brk_base))
/* Clearly impossible. */
- return VG_(brk_limit);
+ goto bad;
=20
-vg_assert(0);
+ if (newbrk >=3D VG_(brk_base) && newbrk < VG_(brk_limit)) {
+ /* shrinking the data segment. Be lazy and don't munmap the
+ excess area. */
+ VG_(brk_limit) =3D newbrk;
+ return newbrk;
+ }
=20
- /* brk isn't allowed to grow over anything else */
- seg =3D VG_(find_segment)(VG_(brk_limit) -1);
+ /* otherwise we're expanding the brk segment. */
+ aseg =3D VG_(find_nsegment)( VG_(brk_base) );
+ rseg =3D VG_(next_nsegment)( aseg, True/*forwards*/ );
=20
- vg_assert(seg !=3D NULL);
+ /* These should be assured by setup_client_dataseg in m_main. */
+ vg_assert(aseg);
+ vg_assert(rseg);
+ vg_assert(aseg->kind =3D=3D SkAnon);
+ vg_assert(rseg->kind =3D=3D SkResvn);
+ vg_assert(aseg->end+1 =3D=3D rseg->start);
=20
- if (0)
- VG_(printf)("brk_limit=3D%p seg->addr=3D%p seg->end=3D%p\n",=20
- VG_(brk_limit), seg->addr, seg->addr+seg->len);
- vg_assert(VG_(brk_limit) >=3D seg->addr && VG_(brk_limit)=20
- <=3D (seg->addr + seg->len));
+ vg_assert(newbrk >=3D VG_(brk_base));
+ if (newbrk < aseg->end+1) {
+ /* still fits within the anon segment. */
+ VG_(brk_limit) =3D newbrk;
+ return newbrk;
+ }
=20
- seg =3D VG_(find_segment_above_mapped)(VG_(brk_limit)-1);
- if (0 && seg)=20
- VG_(printf)("NEXT addr =3D %p\n", seg->addr);
- if (seg !=3D NULL && newbrk > seg->addr)
- return VG_(brk_limit);
+ if (newbrk >=3D rseg->end+1 - VKI_PAGE_SIZE) {
+ /* request is too large -- the resvn would fall below 1 page,
+ which isn't allowed. */
+ goto bad;
+ }
=20
- current =3D VG_PGROUNDUP(VG_(brk_limit));
- newaddr =3D VG_PGROUNDUP(newbrk);
- if (newaddr !=3D current) {
+ newbrkP =3D VG_PGROUNDUP(newbrk);
+ vg_assert(newbrkP > rseg->start && newbrkP < rseg->end+1 - VKI_PAGE_S=
IZE);
+ delta =3D newbrkP - rseg->start;
+ vg_assert(delta > 0);
+ vg_assert(VG_IS_PAGE_ALIGNED(delta));
+ =20
+ ok =3D VG_(extend_into_adjacent_reservation)( aseg, delta );
+ if (!ok) goto bad;
=20
- /* new brk in a new page - fix the mappings */
- if (newbrk > VG_(brk_limit)) {
- =20
- if (debug)
- VG_(printf)(" extending brk: current=3D%p newaddr=3D%p delta=3D%d\=
n",
- current, newaddr, newaddr-current);
+ VG_(brk_limit) =3D newbrk;
+ return newbrk;
=20
- if (newaddr =3D=3D current) {
- ret =3D newbrk;
- } else if ((void*)-1 !=3D VG_(mmap)((void*)current, newaddr-cur=
rent,
- VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,
- VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS|VKI_MAP_FIXED|VKI_MAP_C=
LIENT,
- 0, -1, 0))=20
- {
- ret =3D newbrk;
- }
- } else {
- vg_assert(newbrk < VG_(brk_limit));
-
- if (debug)
- VG_(printf)(" shrinking brk: current=3D%p newaddr=3D%p delta=3D%d\=
n",
- current, newaddr, current-newaddr);
-
- if (newaddr !=3D current) {
- Int res =3D VG_(munmap)((void *)newaddr, current - newaddr);
- vg_assert(0 =3D=3D res);
- }
- ret =3D newbrk;
- }
- } else
- ret =3D newbrk;
-
- VG_(brk_limit) =3D ret;
-
- return ret;
+ bad:
+ return VG_(brk_limit);
}
=20
=20
@@ -4589,7 +4575,7 @@
{
vg_assert(SUCCESS);
vg_assert(ML_(valid_client_addr)(RES, ARG2, tid, "mmap2"));
- ML_(mmap_segment)( (Addr)RES, ARG2, ARG3, ARG4, ARG5,
+ ML_(notify_aspacem_and_tool_of_mmap)( (Addr)RES, ARG2, ARG3, ARG4, AR=
G5,
ARG6 * (ULong)VKI_PAGE_SIZE );
}
=20
@@ -4608,12 +4594,12 @@
Addr a =3D ARG1;
SizeT len =3D ARG2;
Int prot =3D ARG3;
- Bool rr =3D prot & VKI_PROT_READ;
- Bool ww =3D prot & VKI_PROT_WRITE;
- Bool xx =3D prot & VKI_PROT_EXEC;
+ Bool rr =3D toBool(prot & VKI_PROT_READ);
+ Bool ww =3D toBool(prot & VKI_PROT_WRITE);
+ Bool xx =3D toBool(prot & VKI_PROT_EXEC);
=20
- mash_addr_and_len(&a, &len);
- VG_(mprotect_range)(a, len, prot);
+ page_align_addr_and_len(&a, &len);
+ VG_(notify_client_mprotect)(a, len, prot);
VG_TRACK( change_mem_mprotect, a, len, rr, ww, xx );
}
=20
@@ -4632,8 +4618,8 @@
Addr a =3D ARG1;
SizeT len =3D ARG2;
=20
- mash_addr_and_len(&a, &len);
- VG_(unmap_range)(a, len);
+ page_align_addr_and_len(&a, &len);
+ VG_(notify_client_munmap)(a, len);
VG_TRACK( die_mem_munmap, a, len );
}
=20
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c 2005-09-13 00:58=
:19 UTC (rev 4631)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-linux.c 2005-09-13 01:00=
:51 UTC (rev 4632)
@@ -416,7 +416,7 @@
args =3D (struct __vki_sysctl_args *)ARG1;
PRE_REG_READ1(long, "sysctl", struct __sysctl_args *, args);
PRE_MEM_WRITE( "sysctl(args)", ARG1, sizeof(struct __vki_sysctl_args)=
);
- if (!VG_(is_addressable)(ARG1, sizeof(struct __vki_sysctl_args), VKI_=
PROT_READ)) {
+ if (!VG_(aspacem_is_valid_for_client)(ARG1, sizeof(struct __vki_sysct=
l_args), VKI_PROT_READ)) {
SET_STATUS_Failure( VKI_EFAULT );
return;
}
Modified: branches/ASPACEM/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
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c 2005-09-13 0=
0:58:19 UTC (rev 4631)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-x86-linux.c 2005-09-13 0=
1:00:51 UTC (rev 4632)
@@ -1486,17 +1486,21 @@
unsigned long offset;
}; */
UWord a1, a2, a3, a4, a5, a6;
+ MapRequest mreq;
+ Addr advised;
+ Bool mreq_ok;
+ SysRes sres;
=20
UWord* args =3D (UWord*)ARG1;
PRE_REG_READ1(long, "old_mmap", struct mmap_arg_struct *, args);
PRE_MEM_READ( "old_mmap(args)", (Addr)args, 6*sizeof(UWord) );
=20
- a1 =3D args[0];
- a2 =3D args[1];
- a3 =3D args[2];
- a4 =3D args[3];
- a5 =3D args[4];
- a6 =3D args[5];
+ a1 =3D args[1-1];
+ a2 =3D args[2-1];
+ a3 =3D args[3-1];
+ a4 =3D args[4-1];
+ a5 =3D args[5-1];
+ a6 =3D args[6-1];
=20
PRINT("old_mmap ( %p, %llu, %d, %d, %d, %d )",
a1, (ULong)a2, a3, a4, a5, a6 );
@@ -1508,13 +1512,59 @@
return;
}
=20
- if (/*(a4 & VKI_MAP_FIXED) &&*/ (0 !=3D (a1 & (VKI_PAGE_SIZE-1)))) {
+ if (/*(a4 & VKI_MAP_FIXED) &&*/ !VG_IS_PAGE_ALIGNED(a1)) {
/* zap any misaligned addresses. */
SET_STATUS_Failure( VKI_EINVAL );
return;
}
=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) {
+ mreq.rkind =3D MFixed;
+ } else=20
+ if (a1 !=3D 0) {
+ mreq.rkind =3D MHint;
+ } else {
+ mreq.rkind =3D MAny;
+ }
+
+ /* Enquire ... */
+ mreq_ok =3D VG_(aspacem_getAdvisory)( &mreq, True/*client*/, &advised=
);
+ 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;
+
+ vg_assert(! FAILURE);
+
+ sres =3D VG_(aspacem_do_mmap_NO_NOTIFY)(a1, a2, a3, a4, a5, a6);
+ SET_STATUS_from_SysRes(sres);
+
+ if (!sres.isError) {
+ /* Notify aspacem and the tool. */
+ ML_(notify_aspacem_and_tool_of_mmap)(=20
+ (Addr)sres.val, /* addr kernel actually assigned */
+ a2, a3,=20
+ args[4-1], /* the original flags value */
+ a5, a6=20
+ );
+ }
+
+ /* Stay sane */
+ if (SUCCESS && (args[4-1] & VKI_MAP_FIXED))
+ vg_assert(RES =3D=3D args[0]);
+
+#if 0
+ if (a4 & VKI_MAP_FIXED) {
if (!ML_(valid_client_addr)(a1, a2, tid, "old_mmap")) {
PRINT("old_mmap failing: %p-%p\n", a1, a1+a2);
SET_STATUS_Failure( VKI_ENOMEM );
@@ -1551,6 +1601,7 @@
/* Stay sane */
if (SUCCESS && (args[3] & VKI_MAP_FIXED))
vg_assert(RES =3D=3D args[0]);
+#endif
}
=20
// XXX: lstat64/fstat64/stat64 are generic, but not necessarily
Modified: branches/ASPACEM/coregrind/m_ume.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
--- branches/ASPACEM/coregrind/m_ume.c 2005-09-13 00:58:19 UTC (rev 4631)
+++ branches/ASPACEM/coregrind/m_ume.c 2005-09-13 01:00:51 UTC (rev 4632)
@@ -403,10 +403,14 @@
bytes =3D VG_PGROUNDUP(brkaddr)-VG_PGROUNDUP(bss);
if (bytes > 0) {
VG_(debugLog)(0,"ume","mmap_native 2\n");
- res =3D VG_(mmap_native)(
+ //res =3D VG_(mmap_native)(
+ // (Char *)VG_PGROUNDUP(bss), bytes,
+ // prot, VKI_MAP_FIXED|VKI_MAP_ANONYMOUS|VKI_MAP_PRIVATE,=20
+ // -1, 0
+ // );
+ res =3D VG_(mmap_anon_fixed_client)(
(Char *)VG_PGROUNDUP(bss), bytes,
- prot, VKI_MAP_FIXED|VKI_MAP_ANONYMOUS|VKI_MAP_PRIVATE,=20
- -1, 0
+ prot
);
check_mmap(res, (char*)VG_PGROUNDUP(bss), bytes);
}
Modified: branches/ASPACEM/coregrind/pub_core_aspacemgr.h
=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
--- branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-13 00:58:19 U=
TC (rev 4631)
+++ branches/ASPACEM/coregrind/pub_core_aspacemgr.h 2005-09-13 01:00:51 U=
TC (rev 4632)
@@ -247,6 +247,9 @@
MapRequest;
=20
extern
+Bool VG_(aspacem_is_valid_for_client)( Addr start, SizeT len, UInt prot =
);
+
+extern
Bool VG_(aspacem_getAdvisory)
( MapRequest* req, Bool forClient, /*OUT*/Addr* result );
=20
@@ -269,6 +272,24 @@
=20
extern SysRes VG_(munmap_client)( Addr base, SizeT length );
=20
+/* This function is dangerous -- it can cause aspacem's view of the
+ address space to diverge from that of the kernel. DO NOT USE IT
+ UNLESS YOU UNDERSTAND the request-notify model used by aspacem. */
+extern
+SysRes VG_(aspacem_do_mmap_NO_NOTIFY)( Addr start, SizeT length, UInt pr=
ot,=20
+ UInt flags, UInt fd, OffT offset)=
;
+
+extern=20
+void VG_(notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
+ Int fd, SizeT offset );
+
+extern
+void VG_(notify_client_mprotect)( Addr a, SizeT len, UInt prot );
+
+extern
+void VG_(notify_client_munmap)( Addr start, SizeT len );
+
+
/* Finds the segment containing 'a'. Only returns file/anon/resvn
segments. */
extern NSegment* VG_(find_nsegment) ( Addr a );
|
|
From: <sv...@va...> - 2005-09-13 00:58:29
|
Author: njn Date: 2005-09-13 01:58:19 +0100 (Tue, 13 Sep 2005) New Revision: 4631 Log: Clarify comment. No functional change. Modified: trunk/Makefile.am Modified: trunk/Makefile.am =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/Makefile.am 2005-09-13 00:49:49 UTC (rev 4630) +++ trunk/Makefile.am 2005-09-13 00:58:19 UTC (rev 4631) @@ -11,12 +11,15 @@ none =20 ## addrcheck \ +## helgrind \ =20 -# Temporary: we want to compile Helgrind and Addrcheck, but not regtest = it. -# And we want to include Addrcheck in the distro, but not compile/test i= t. +# Temporary: we want to compile Helgrind and Addrcheck and include them = in +# the distro, but not regtest them. So they are in $TOOLS but not in +# $SUBDIRS. +# # Put docs last because building the HTML is slow and we want to get # everything else working before we try it. -SUBDIRS =3D include coregrind . tests auxprogs $(TOOLS) helgrind addrch= eck docs +SUBDIRS =3D include coregrind . tests auxprogs $(TOOLS) helgrind addrche= ck docs =20 SUPP_FILES =3D \ glibc-2.2.supp glibc-2.3.supp glibc-2.4.supp \ |
|
From: <sv...@va...> - 2005-09-13 00:49:52
|
Author: njn Date: 2005-09-13 01:49:49 +0100 (Tue, 13 Sep 2005) New Revision: 4630 Log: Remove unnecessary filter_* files for ppc32. Removed: trunk/none/tests/ppc32/filter_cpuid trunk/none/tests/ppc32/filter_int Modified: trunk/none/tests/ppc32/Makefile.am Modified: trunk/none/tests/ppc32/Makefile.am =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/none/tests/ppc32/Makefile.am 2005-09-13 00:46:27 UTC (rev 4629) +++ trunk/none/tests/ppc32/Makefile.am 2005-09-13 00:49:49 UTC (rev 4630) @@ -1,8 +1,6 @@ =20 -noinst_SCRIPTS =3D filter_cpuid filter_stderr filter_int +noinst_SCRIPTS =3D filter_stderr =20 -CLEANFILES =3D $(addsuffix .c,$(INSN_TESTS)) - EXTRA_DIST =3D $(noinst_SCRIPTS) \ lsw.stderr.exp lsw.stdout.exp lsw.vgtest =20 Deleted: trunk/none/tests/ppc32/filter_cpuid =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/none/tests/ppc32/filter_cpuid 2005-09-13 00:46:27 UTC (rev 4629= ) +++ trunk/none/tests/ppc32/filter_cpuid 2005-09-13 00:49:49 UTC (rev 4630= ) @@ -1,5 +0,0 @@ -#! /bin/sh - -dir=3D`dirname $0` - -$dir/filter_stderr Deleted: trunk/none/tests/ppc32/filter_int =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/none/tests/ppc32/filter_int 2005-09-13 00:46:27 UTC (rev 4629) +++ trunk/none/tests/ppc32/filter_int 2005-09-13 00:49:49 UTC (rev 4630) @@ -1,6 +0,0 @@ -#! /bin/sh - -dir=3D`dirname $0` - -$dir/filter_stderr | $dir/../../../tests/filter_addresses - |
|
From: <sv...@va...> - 2005-09-13 00:46:32
|
Author: njn
Date: 2005-09-13 01:46:27 +0100 (Tue, 13 Sep 2005)
New Revision: 4629
Log:
Don't print the client's argv[i] if it's null, and related changes.
Modified:
trunk/cachegrind/cg_main.c
trunk/include/pub_tool_libcproc.h
trunk/massif/ms_main.c
Modified: trunk/cachegrind/cg_main.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/cachegrind/cg_main.c 2005-09-13 00:45:14 UTC (rev 4628)
+++ trunk/cachegrind/cg_main.c 2005-09-13 00:46:27 UTC (rev 4629)
@@ -896,10 +896,10 @@
VG_(strcpy)(buf, "cmd:");
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
for (i =3D 0; i < VG_(client_argc); i++) {
- if (VG_(client_argv)[i] =3D=3D NULL)
- continue;
- VG_(write)(fd, " ", 1);
- VG_(write)(fd, VG_(client_argv)[i], VG_(strlen)(VG_(client_argv)[=
i]));
+ if (VG_(client_argv)[i]) {
+ VG_(write)(fd, " ", 1);
+ VG_(write)(fd, VG_(client_argv)[i], VG_(strlen)(VG_(client_arg=
v)[i]));
+ }
}
// "events:" line
VG_(sprintf)(buf, "\nevents: Ir I1mr I2mr Dr D1mr D2mr Dw D1mw D2mw\n=
");
Modified: trunk/include/pub_tool_libcproc.h
=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/include/pub_tool_libcproc.h 2005-09-13 00:45:14 UTC (rev 4628)
+++ trunk/include/pub_tool_libcproc.h 2005-09-13 00:46:27 UTC (rev 4629)
@@ -35,7 +35,9 @@
Command-line and environment stuff
------------------------------------------------------------------ */
=20
-/* Client args and environment (which can be inspected with VG_(getenv)(=
). */
+/* Client args and environment. Note that VG_(client_argv)[] can be wri=
tten
+ to by the client, so you should check each entry is non-NULL before
+ printing. VG_(client_envp) can be inspected with VG_(getenv)(). */
extern Int VG_(client_argc);
extern Char** VG_(client_argv);
extern Char** VG_(client_envp);
Modified: trunk/massif/ms_main.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/massif/ms_main.c 2005-09-13 00:45:14 UTC (rev 4628)
+++ trunk/massif/ms_main.c 2005-09-13 00:46:27 UTC (rev 4629)
@@ -1341,8 +1341,10 @@
=20
// File header, including command line
SPRINTF(buf, "JOB \"");
- for (i =3D 0; i < VG_(client_argc); i++)
- SPRINTF(buf, "%s ", VG_(client_argv)[i]);
+ for (i =3D 0; i < VG_(client_argc); i++) {
+ if (VG_(client_argv)[i])
+ SPRINTF(buf, "%s ", VG_(client_argv)[i]);
+ }
SPRINTF(buf, /*" (%d ms/sample)\"\n"*/ "\"\n"
"DATE \"\"\n"
"SAMPLE_UNIT \"ms\"\n"
@@ -1664,8 +1666,10 @@
=20
// Command line
SPRINTF(buf, "Command: ");
- for (i =3D 0; i < VG_(client_argc); i++)
- SPRINTF(buf, "%s ", VG_(client_argv)[i]);
+ for (i =3D 0; i < VG_(client_argc); i++) {
+ if (VG_(client_argv)[i])
+ SPRINTF(buf, "%s ", VG_(client_argv)[i]);
+ }
SPRINTF(buf, "\n%s\n", maybe_p);
=20
if (clo_heap)
|
|
From: <sv...@va...> - 2005-09-13 00:45:40
|
Author: njn
Date: 2005-09-13 01:45:14 +0100 (Tue, 13 Sep 2005)
New Revision: 4628
Log:
Fix ppc32 regtest execution. Thanks to Jeroen Witmond for spotting it.
Modified:
trunk/tests/cputest.c
Modified: trunk/tests/cputest.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/tests/cputest.c 2005-09-12 22:53:39 UTC (rev 4627)
+++ trunk/tests/cputest.c 2005-09-13 00:45:14 UTC (rev 4628)
@@ -16,7 +16,7 @@
=20
char* all_archs[] =3D {
"amd64",
- "ppc",
+ "ppc32",
"x86",
NULL
};
|