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
(16) |
2
(23) |
3
(15) |
|
4
(19) |
5
(21) |
6
(27) |
7
(18) |
8
(17) |
9
(15) |
10
(11) |
|
11
(9) |
12
(18) |
13
(26) |
14
(28) |
15
(26) |
16
(20) |
17
(27) |
|
18
(16) |
19
(40) |
20
(2) |
21
(11) |
22
(27) |
23
(24) |
24
(16) |
|
25
(10) |
26
(12) |
27
(16) |
28
(7) |
29
(6) |
30
(15) |
31
(5) |
|
From: Tom H. <to...@co...> - 2005-12-29 03:43:17
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-12-29 03:30:05 GMT 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 == 210 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/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 == 210 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Thu Dec 29 03:36:43 2005 --- new.short Thu Dec 29 03:43:13 2005 *************** *** 8,12 **** ! == 210 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/stack_switch (stderr) --- 8,13 ---- ! == 210 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) + memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) |
|
From: <sv...@va...> - 2005-12-28 15:19:43
|
Author: sewardj
Date: 2005-12-28 15:19:39 +0000 (Wed, 28 Dec 2005)
New Revision: 5456
Log:
Tentative fix for #117332: No line numbers printed by Valgrind 3.1.0
for programs compiled with Intel compiler.
Modified:
trunk/coregrind/m_debuginfo/symtab.c
Modified: trunk/coregrind/m_debuginfo/symtab.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_debuginfo/symtab.c 2005-12-28 04:18:20 UTC (rev 545=
5)
+++ trunk/coregrind/m_debuginfo/symtab.c 2005-12-28 15:19:39 UTC (rev 545=
6)
@@ -127,6 +127,15 @@
symbols from the rwx segment -- which overlaps the r-x segment in the
file -- causes the redirection mechanism to redirect to addresses in
that third segment, which is wrong and causes crashes.
+
+ ------
+ JRS 28 Dec 05: unfortunately icc 8.1 on x86 has been seen to
+ produce executables with a single rwx segment rather than a
+ (r-x,rw-) pair. That means the rules have to be modified thusly:
+
+ x86-linux: consider if r and x
+ all others: consider if r and x and NOT w
+
*/
=20
static void nuke_syms_in_range ( Addr start, SizeT length )
@@ -144,7 +153,8 @@
curr =3D segInfo_list;
while (True) {
if (curr =3D=3D NULL) break;
- if (start+length-1 < curr->start || curr->start+curr->size-1 < =
start) {
+ if (start+length-1 < curr->start=20
+ || curr->start+curr->size-1 < start) {
/* no overlap */
} else {
found =3D True;
@@ -155,7 +165,6 @@
=20
if (!found) break;
unload_symbols( curr->start, curr->size );
-
}
}
=20
@@ -172,6 +181,14 @@
HChar* filename;
Bool ok;
=20
+ /* See comment at start of section for explanation of this do/don't
+ logic. */
+# if defined(VGP_x86_linux)
+ Bool require_no_W =3D False;
+# else
+ Bool require_no_W =3D True;
+# endif
+
seg =3D VG_(am_find_nsegment)(a);
vg_assert(seg);
=20
@@ -186,7 +203,7 @@
&& seg->fnIdx !=3D -1
&& seg->hasR
&& seg->hasX
- && !seg->hasW
+ && (require_no_W ? (!seg->hasW) : True)
&& is_elf_object_file( (const void*)seg->start );
=20
if (!ok) {
|
|
From: <sv...@va...> - 2005-12-28 04:18:25
|
Author: sewardj
Date: 2005-12-28 04:18:20 +0000 (Wed, 28 Dec 2005)
New Revision: 5455
Log:
In fbench, compute sin/cos/sqrt from "first principles", so that the
program more uniformly measures the speed of FP +/-/* load/store
across different architectures.
Modified:
trunk/perf/Makefile.am
trunk/perf/fbench.c
Modified: trunk/perf/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/perf/Makefile.am 2005-12-28 00:57:48 UTC (rev 5454)
+++ trunk/perf/Makefile.am 2005-12-28 04:18:20 UTC (rev 5455)
@@ -21,6 +21,6 @@
AM_CXXFLAGS =3D $(AM_CFLAGS)
=20
# Extra stuff
-fbench_LDADD =3D -lm
+fbench_CFLAGS =3D -g -O2
+fbench_LDADD =3D=20
ffbench_LDADD =3D -lm
-
Modified: trunk/perf/fbench.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/perf/fbench.c 2005-12-28 00:57:48 UTC (rev 5454)
+++ trunk/perf/fbench.c 2005-12-28 04:18:20 UTC (rev 5455)
@@ -8,7 +8,17 @@
// site is in the public domain and may be used in any manner without
// permission, restriction, attribution, or compensation."
=20
+/* This program can be used in two ways. If INTRIG is undefined, sin,
+ cos, tan, etc, will be used as supplied by <math.h>. If it is
+ defined, then the program calculates all this stuff from first
+ principles (so to speak) and does not use the libc facilities. For
+ benchmarking purposes it seems better to avoid the libc stuff, so
+ that the inner loops (sin, sqrt) present a workload independent of
+ libc implementations on different platforms. Hence: */
=20
+#define INTRIG 1
+
+
/*
=20
John Walker's Floating Point Benchmark, derived from...
@@ -238,6 +248,7 @@
=20
*/
=20
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -289,7 +300,7 @@
tracing code. */
=20
#ifndef ITERATIONS
-#define ITERATIONS /*1000*/ /*500000*/ 125000
+#define ITERATIONS /*1000*/ /*500000*/ 80000
#endif
int niter =3D ITERATIONS; /* Iteration counter */
=20
|
|
From: <js...@ac...> - 2005-12-28 04:14:28
|
Nightly build on phoenix ( SuSE 10.0 ) started at 2005-12-28 03:30:02 GMT 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 == 208 tests, 5 stderr failures, 2 stdout failures ================= memcheck/tests/leak-tree (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/tls (stdout) none/tests/x86/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 == 208 tests, 5 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Wed Dec 28 03:45:30 2005 --- new.short Wed Dec 28 04:14:38 2005 *************** *** 10,12 **** ! == 208 tests, 5 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) --- 10,12 ---- ! == 208 tests, 5 stderr failures, 2 stdout failures ================= memcheck/tests/leak-tree (stderr) *************** *** 15,16 **** --- 15,17 ---- none/tests/mremap2 (stdout) + none/tests/tls (stdout) none/tests/x86/faultstatus (stderr) |
|
From: <js...@ac...> - 2005-12-28 03:54:36
|
Nightly build on g5 ( YDL 4.0, ppc970 ) started at 2005-12-28 04:40:01 CET Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 176 tests, 15 stderr failures, 1 stdout failure ================= memcheck/tests/badjump (stderr) memcheck/tests/badjump2 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/leakotron (stdout) memcheck/tests/mempool (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/supp1 (stderr) memcheck/tests/supp_unknown (stderr) memcheck/tests/toobig-allocs (stderr) memcheck/tests/xml1 (stderr) massif/tests/toobig-allocs (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) |
|
From: Tom H. <to...@co...> - 2005-12-28 03:43:24
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-12-28 03:30:06 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 210 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: <sv...@va...> - 2005-12-28 00:57:52
|
Author: sewardj
Date: 2005-12-28 00:57:48 +0000 (Wed, 28 Dec 2005)
New Revision: 5454
Log:
Use new "Special" instruction support in vex to provide a fast
implementation of function wrapping, that does not require any client
requests. The dynamic net overhead of a function wrap is now two
extra basic blocks (of client code), which means we should be able to
do wrapping of frequently-called functions (eg pthread_mutex_lock)
without excessive (baseline) overheads.
Massively tidy up/restructure valgrind.h as a side effect.
Modified:
branches/FNWRAP/coregrind/coregrind.h
branches/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.c
branches/FNWRAP/coregrind/m_scheduler/scheduler.c
branches/FNWRAP/coregrind/vg_preloaded.c
branches/FNWRAP/include/valgrind.h
branches/FNWRAP/memcheck/mac_replace_strmem.c
branches/FNWRAP/memcheck/memcheck.h
Modified: branches/FNWRAP/coregrind/coregrind.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/FNWRAP/coregrind/coregrind.h 2005-12-27 16:40:35 UTC (rev 54=
53)
+++ branches/FNWRAP/coregrind/coregrind.h 2005-12-28 00:57:48 UTC (rev 54=
54)
@@ -66,8 +66,10 @@
unsigned long _qzz_res =3D 0;
va_list vargs;
va_start(vargs, format);
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF,
- (unsigned long)format, (unsigned long)vargs, =
0, 0);
+ VALGRIND_DO_CLIENT_REQUEST(
+ _qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF,
+ (unsigned long)format, (unsigned long)vargs, 0, 0
+ );
va_end(vargs);
return _qzz_res;
}
Modified: branches/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.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/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.c 2005-12=
-27 16:40:35 UTC (rev 5453)
+++ branches/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.c 2005-12=
-28 00:57:48 UTC (rev 5454)
@@ -461,8 +461,8 @@
=20
init_done =3D 1;
=20
- VALGRIND_MAGIC_SEQUENCE(res, -1, VG_USERREQ__GET_MALLOCFUNCS, &info,
- 0, 0, 0);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__GET_MALLOCFUNCS, &inf=
o,
+ 0, 0, 0);
}
=20
/*--------------------------------------------------------------------*/
Modified: branches/FNWRAP/coregrind/m_scheduler/scheduler.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/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-27 16:40:35=
UTC (rev 5453)
+++ branches/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-28 00:57:48=
UTC (rev 5454)
@@ -1033,28 +1033,7 @@
zztid, O_CLREQ_RET, sizeof(UWord), f); \
} while (0)
=20
-#define SET_CLIENT_NRFLAG(zztid, zzflag) \
- do { VG_(threads)[zztid].arch.vex.guest_NRFLAG =3D (zzflag); \
- VG_TRACK( post_reg_write, \
- Vg_CoreClientReq, zztid, \
- offsetof(VexGuestArchState,guest_NRFLAG), \
- sizeof(UWord) ); \
- } while (0)
=20
-#define SET_CLIENT_NRADDR(zztid, zzaddr) \
- do { VG_(threads)[zztid].arch.vex.guest_NRADDR =3D (zzaddr); \
- VG_TRACK( post_reg_write, \
- Vg_CoreClientReq, zztid, \
- offsetof(VexGuestArchState,guest_NRADDR), \
- sizeof(UWord) ); \
- } while (0)
-
-#define GET_CLIENT_NRFLAG(zztid) \
- VG_(threads)[zztid].arch.vex.guest_NRFLAG
-#define GET_CLIENT_NRADDR(zztid) \
- VG_(threads)[zztid].arch.vex.guest_NRADDR
-
-
/* ---------------------------------------------------------------------
Handle client requests.
------------------------------------------------------------------ */
@@ -1099,10 +1078,6 @@
VG_(printf)("req no =3D 0x%llx, arg =3D %p\n", (ULong)req_no, arg)=
;
switch (req_no) {
=20
- case VG_USERREQ__GET_NRADDR:
- SET_CLREQ_RETVAL(tid, VG_(threads)[tid].arch.vex.guest_NRADDR);
- break;
-
case VG_USERREQ__CLIENT_CALL0: {
UWord (*f)(ThreadId) =3D (void*)arg[1];
if (f =3D=3D NULL)
Modified: branches/FNWRAP/coregrind/vg_preloaded.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/FNWRAP/coregrind/vg_preloaded.c 2005-12-27 16:40:35 UTC (rev=
5453)
+++ branches/FNWRAP/coregrind/vg_preloaded.c 2005-12-28 00:57:48 UTC (rev=
5454)
@@ -61,8 +61,8 @@
extern void __libc_freeres(void);
__libc_freeres();
#endif
- VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
- VG_USERREQ__LIBC_FREERES_DONE, 0, 0, 0, 0);
+ VALGRIND_DO_CLIENT_REQUEST(res, 0 /* default */,
+ VG_USERREQ__LIBC_FREERES_DONE, 0, 0, 0, 0)=
;
/*NOTREACHED*/
*(int *)0 =3D 'x';
}
@@ -71,25 +71,26 @@
/*--- end ---*/
/*--------------------------------------------------------------------*/
=20
-#if 0
+#if 1
=20
#define PTH_FUNC(ret_ty, f, args...) \
- ret_ty VG_REDIRECT_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
- ret_ty VG_REDIRECT_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
+ ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
+ ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
=20
#include <stdio.h>
#include <pthread.h>
=20
-// pthread_create@GLIBC_2.0 - making it match this too causes loops.??
-// pthread_create@@GLIBC_2.1
-PTH_FUNC(int, pthreadZucreateZAZAGLIBCZu2Zd1, // pthread_create@@GLIBC_2=
.1
+// pthread_create
+PTH_FUNC(int, pthreadZucreateZAZa, // pthread_create@*
pthread_t *thread, const pthread_attr_t *attr,
void *(*start) (void *), void *arg)
{
- int ret;
+ int ret;
+ void* fn;
+ VALGRIND_GET_NRADDR(fn);
fprintf(stderr, "<< pthread_create wrapper"); fflush(stderr);
=20
- CALL_ORIG_FN_4_UNCHECKED(ret, pthread_create, thread,attr,start,arg);
+ CALL_FN_W_WWWW(ret, fn, thread,attr,start,arg);
=20
fprintf(stderr, " -> %d >>\n", ret);
return ret;
@@ -99,10 +100,12 @@
PTH_FUNC(int, pthreadZumutexZulock, // pthread_mutex_lock
pthread_mutex_t *mutex)
{
- int ret;
+ int ret;
+ void* fn;
+ VALGRIND_GET_ORIG_FN(fn);
fprintf(stderr, "<< pthread_mxlock %p", mutex); fflush(stderr);
=20
- CALL_ORIG_FN_1_UNCHECKED(ret, pthread_mutex_lock, mutex);
+ CALL_FN_W_W(ret, fn, mutex);
=20
fprintf(stderr, " -> %d >>\n", ret);
return ret;
@@ -113,9 +116,12 @@
pthread_mutex_t *mutex)
{
int ret;
+ void* fn;
+ VALGRIND_GET_ORIG_FN(fn);
+
fprintf(stderr, "<< pthread_mxunlk %p", mutex); fflush(stderr);
=20
- CALL_ORIG_FN_1_UNCHECKED(ret, pthread_mutex_unlock, mutex);
+ CALL_FN_W_W(ret, fn, mutex);
=20
fprintf(stderr, " -> %d >>\n", ret);
return ret;
Modified: branches/FNWRAP/include/valgrind.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/FNWRAP/include/valgrind.h 2005-12-27 16:40:35 UTC (rev 5453)
+++ branches/FNWRAP/include/valgrind.h 2005-12-28 00:57:48 UTC (rev 5454)
@@ -63,7 +63,7 @@
The resulting executables will still run without Valgrind, just a
little bit more slowly than they otherwise would, but otherwise
unchanged. When not running on valgrind, each client request
- consumes very few (eg. < 10) instructions, so the resulting performan=
ce
+ consumes very few (eg. 7) instructions, so the resulting performance
loss is negligible unless you plan to execute client requests
millions of times per second. Nevertheless, if that is still a
problem, you can compile with the NVALGRIND symbol defined (gcc
@@ -78,41 +78,69 @@
we can't use C++ style "//" comments nor the "asm" keyword (instead
use "__asm__"). */
=20
+/* Derive some tags indicating what the target architecture is. Note
+ that in this file we're using the compiler's CPP symbols for
+ identifying architectures, which are different to the ones we use
+ within the rest of Valgrind. Note, __powerpc__ is active for both
+ 32 and 64-bit PPC, whereas __powerpc64__ is only active for the
+ latter. */
+#undef ARCH_x86
+#undef ARCH_amd64
+#undef ARCH_ppc32
+#undef ARCH_ppc64
+
+#if defined(__i386__)
+# define ARCH_x86 1
+#elif defined(__x86_64__)
+# define ARCH_amd64 1
+#elif defined(__powerpc__) && !defined(__powerpc64__)
+# define ARCH_ppc32 1
+#elif defined(__powerpc__) && defined(__powerpc64__)
+# define ARCH_ppc64 1
+#endif
+
/* If we're not compiling for our target architecture, don't generate
- any inline asms. Note that in this file we're using the compiler's
- CPP symbols for identifying architectures, which are different to
- the ones we use within the rest of Valgrind. Note, __powerpc__ is
- active for both 32 and 64-bit PPC, whereas __powerpc64__ is only
- active for the latter. */
-#if !defined(__i386__) && !defined(__x86_64__) && !defined(__powerpc__)
-# ifndef NVALGRIND
-# define NVALGRIND 1
-# endif /* NVALGRIND */
+ any inline asms. */
+#if !defined(ARCH_x86) && !defined(ARCH_amd64) \
+ && !defined(ARCH_ppc32) && !defined(ARCH_ppc64)
+# if !defined(NVALGRIND)
+# define NVALGRIND 1
+# endif
#endif
=20
+
/* ------------------------------------------------------------------ */
-/* The architecture-specific part */
+/* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS. There is nothing */
+/* in here of use to end-users -- skip to the next section. */
/* ------------------------------------------------------------------ */
=20
-#ifdef NVALGRIND
+#if defined(NVALGRIND)
=20
/* Define NVALGRIND to completely remove the Valgrind magic sequence
- from the compiled code (analogous to NDEBUG's effects on assert()) */
-#define VALGRIND_MAGIC_SEQUENCE( \
- _zzq_rlval, _zzq_default, _zzq_request, =
\
- _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) =
\
- { \
- (_zzq_rlval) =3D (_zzq_default); \
+ from the compiled code (analogous to NDEBUG's effects on
+ assert()) */
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
+ { \
+ (_zzq_rlval) =3D (_zzq_default); \
}
=20
-#else /* NVALGRIND */
+#else /* ! NVALGRIND */
=20
-/* The following defines the magic code sequences which the JITter spots=
and
- handles magically. Don't look too closely at them; they will rot
- your brain. We must ensure that the default value gets put in the re=
turn
- slot, so that everything works when this is executed not under Valgri=
nd.
- Args are passed in a memory block, and so there's no intrinsic limit =
to
- the number that could be passed, but it's currently four.
+/* The following defines the magic code sequences which the JITter
+ spots and handles magically. Don't look too closely at them as
+ they will rot your brain.
+
+ The assembly code sequences for all architectures is in this one
+ file. This is because this file must be stand-alone, and we don't
+ want to have multiple files.
+
+ For VALGRIND_DO_CLIENT_REQUEST, we must ensure that the default
+ value gets put in the return slot, so that everything works when
+ this is executed not under Valgrind. Args are passed in a memory
+ block, and so there's no intrinsic limit to the number that could
+ be passed, but it's currently four.
=20
The macro args are:=20
_zzq_rlval result lvalue
@@ -120,126 +148,359 @@
_zzq_request request code
_zzq_arg1..4 request params
=20
- Nb: we put the assembly code sequences for all architectures in this =
one
- file. This is because this file must be stand-alone, and we don't wa=
nt
- to have multiple files.
+ The other two macros are used to support function wrapping, and are
+ a lot simpler. VALGRIND_GET_NRADDR returns the value of the
+ guest's NRADDR pseudo-register. VALGRIND_CALL_NOREDIR_* behaves
+ the same as the following on the guest, but guarantees that the
+ branch instruction will not be redirected: x86: call *%eax, amd64:
+ call *%rax, ppc32/ppc64: bctrl. VALGRIND_CALL_NOREDIR is just
+ text, not a complete inline asm, since it needs to be combined with
+ more magic inline asm stuff to be useful.
*/
=20
-#ifdef __x86_64__
-#define VALGRIND_MAGIC_SEQUENCE( \
- _zzq_rlval, _zzq_default, _zzq_request, \
- _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
- \
- { volatile unsigned long long _zzq_args[5]; \
- _zzq_args[0] =3D (volatile unsigned long long)(_zzq_request); \
- _zzq_args[1] =3D (volatile unsigned long long)(_zzq_arg1); \
- _zzq_args[2] =3D (volatile unsigned long long)(_zzq_arg2); \
- _zzq_args[3] =3D (volatile unsigned long long)(_zzq_arg3); \
- _zzq_args[4] =3D (volatile unsigned long long)(_zzq_arg4); \
- __asm__ volatile("roll $29, %%eax ; roll $3, %%eax\n\t" \
- "rorl $27, %%eax ; rorl $5, %%eax\n\t" \
- "roll $13, %%eax ; roll $19, %%eax" \
- : "=3Dd" (_zzq_rlval) \
- : "a" (&_zzq_args[0]), "0" (_zzq_default) \
- : "cc", "memory" \
- ); \
+/* ---------------------------- x86 ---------------------------- */
+
+#if defined(ARCH_x86)
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
+ { unsigned int _zzq_args[5]; \
+ _zzq_args[0] =3D (unsigned int)(_zzq_request); \
+ _zzq_args[1] =3D (unsigned int)(_zzq_arg1); \
+ _zzq_args[2] =3D (unsigned int)(_zzq_arg2); \
+ _zzq_args[3] =3D (unsigned int)(_zzq_arg3); \
+ _zzq_args[4] =3D (unsigned int)(_zzq_arg4); \
+ __asm__ volatile(/* "Special" instruction preamble */ \
+ "roll $3, %%edi ; roll $13, %%edi\n\t" \
+ "roll $29, %%edi ; roll $19, %%edi\n\t" \
+ /* %EDX =3D client_request ( %EAX ) */ \
+ "xchgl %%ebx,%%ebx" \
+ : "=3Dd" (_zzq_rlval) \
+ : "a" (&_zzq_args[0]), "0" (_zzq_default) \
+ : "cc", "memory" \
+ ); \
}
-#endif /* __x86_64__ */
=20
-#ifdef __i386__
-#define VALGRIND_MAGIC_SEQUENCE( \
- _zzq_rlval, _zzq_default, _zzq_request, \
- _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
- \
- { unsigned int _zzq_args[5]; \
- _zzq_args[0] =3D (unsigned int)(_zzq_request); \
- _zzq_args[1] =3D (unsigned int)(_zzq_arg1); \
- _zzq_args[2] =3D (unsigned int)(_zzq_arg2); \
- _zzq_args[3] =3D (unsigned int)(_zzq_arg3); \
- _zzq_args[4] =3D (unsigned int)(_zzq_arg4); \
- __asm__ volatile("roll $29, %%eax ; roll $3, %%eax\n\t" \
- "rorl $27, %%eax ; rorl $5, %%eax\n\t" \
- "roll $13, %%eax ; roll $19, %%eax" \
- : "=3Dd" (_zzq_rlval) \
- : "a" (&_zzq_args[0]), "0" (_zzq_default) \
- : "cc", "memory" \
- ); \
+#define VALGRIND_GET_NRADDR(_zzq_rlval) \
+ { unsigned int __addr; \
+ __asm__ volatile("movl $0, %%eax\n\t" \
+ /* "Special" instruction preamble */ \
+ "roll $3, %%edi ; roll $13, %%edi\n\t" \
+ "roll $29, %%edi ; roll $19, %%edi\n\t" \
+ /* %EAX =3D guest_NRADDR */ \
+ "xchgl %%ecx,%%ecx" \
+ : "=3Da" (__addr) \
+ : \
+ : "cc", "memory" \
+ ); \
+ _zzq_rlval =3D (void*)__addr; \
}
-#endif /* __i386__ */
=20
-#if defined(__powerpc__) && !defined(__powerpc64__)
-#define VALGRIND_MAGIC_SEQUENCE( =
\
- _zzq_rlval, _zzq_default, _zzq_request, =
\
- _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) =
\
- =
\
- { volatile unsigned int _zzq_args[5]; =
\
- register unsigned int _zzq_tmp __asm__("r3"); =
\
- register volatile unsigned int *_zzq_ptr __asm__("r4"); =
\
- _zzq_args[0] =3D (volatile unsigned int)(_zzq_request); =
\
- _zzq_args[1] =3D (volatile unsigned int)(_zzq_arg1); =
\
- _zzq_args[2] =3D (volatile unsigned int)(_zzq_arg2); =
\
- _zzq_args[3] =3D (volatile unsigned int)(_zzq_arg3); =
\
- _zzq_args[4] =3D (volatile unsigned int)(_zzq_arg4); =
\
- _zzq_ptr =3D _zzq_args; =
\
- __asm__ volatile("tw 0,3,27\n\t" =
\
- "rlwinm 0,0,29,0,0\n\t" =
\
- "rlwinm 0,0,3,0,0\n\t" =
\
- "rlwinm 0,0,13,0,0\n\t" =
\
- "rlwinm 0,0,19,0,0\n\t" =
\
- "nop\n\t" =
\
- : "=3Dr" (_zzq_tmp) =
\
- : "0" (_zzq_default), "r" (_zzq_ptr) =
\
- : "memory"); =
\
- _zzq_rlval =3D (__typeof__(_zzq_rlval)) _zzq_tmp; =
\
+#define VALGRIND_CALL_NOREDIR_EAX \
+ /* "Special" instruction preamble */ \
+ "roll $3, %%edi ; roll $13, %%edi\n\t" \
+ "roll $29, %%edi ; roll $19, %%edi\n\t" \
+ /* call-noredir *%EAX */ \
+ "xchgl %%edx,%%edx\n\t"
+#endif /* ARCH_x86 */
+
+/* --------------------------- amd64 --------------------------- */
+
+#if defined(ARCH_amd64)
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
+ \
+ { volatile unsigned long long _zzq_args[5]; \
+ _zzq_args[0] =3D (volatile unsigned long long)(_zzq_request); \
+ _zzq_args[1] =3D (volatile unsigned long long)(_zzq_arg1); \
+ _zzq_args[2] =3D (volatile unsigned long long)(_zzq_arg2); \
+ _zzq_args[3] =3D (volatile unsigned long long)(_zzq_arg3); \
+ _zzq_args[4] =3D (volatile unsigned long long)(_zzq_arg4); \
+ __asm__ volatile("roll $29, %%eax ; roll $3, %%eax\n\t" \
+ "rorl $27, %%eax ; rorl $5, %%eax\n\t" \
+ "roll $13, %%eax ; roll $19, %%eax" \
+ : "=3Dd" (_zzq_rlval) \
+ : "a" (&_zzq_args[0]), "0" (_zzq_default) \
+ : "cc", "memory" \
+ ); \
}
-#endif /* __powerpc__ 32-bit only */
+#endif /* ARCH_amd64 */
=20
-#if defined(__powerpc__) && defined(__powerpc64__)
-#define VALGRIND_MAGIC_SEQUENCE( =
\
- _zzq_rlval, _zzq_default, _zzq_request, =
\
- _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) =
\
- =
\
- { volatile unsigned long long int _zzq_args[5]; =
\
- register unsigned long long int _zzq_tmp __asm__("r3"); =
\
- register volatile unsigned long long int *_zzq_ptr __asm__("r4"); =
\
- _zzq_args[0] =3D (volatile unsigned long long int)(_zzq_request); =
\
- _zzq_args[1] =3D (volatile unsigned long long int)(_zzq_arg1); =
\
- _zzq_args[2] =3D (volatile unsigned long long int)(_zzq_arg2); =
\
- _zzq_args[3] =3D (volatile unsigned long long int)(_zzq_arg3); =
\
- _zzq_args[4] =3D (volatile unsigned long long int)(_zzq_arg4); =
\
- _zzq_ptr =3D _zzq_args; =
\
- __asm__ volatile("tw 0,3,27\n\t" =
\
- "rotldi 0,0,61\n\t" =
\
- "rotldi 0,0,3\n\t" =
\
- "rotldi 0,0,13\n\t" =
\
- "rotldi 0,0,51\n\t" =
\
- "nop\n\t" =
\
- : "=3Dr" (_zzq_tmp) =
\
- : "0" (_zzq_default), "r" (_zzq_ptr) =
\
- : "memory"); =
\
- _zzq_rlval =3D (__typeof__(_zzq_rlval)) _zzq_tmp; =
\
+/* --------------------------- ppc32 --------------------------- */
+
+#if defined(ARCH_ppc32)
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
+ \
+ { volatile unsigned int _zzq_args[5]; \
+ register unsigned int _zzq_tmp __asm__("r3"); \
+ register volatile unsigned int *_zzq_ptr __asm__("r4"); \
+ _zzq_args[0] =3D (volatile unsigned int)(_zzq_request); \
+ _zzq_args[1] =3D (volatile unsigned int)(_zzq_arg1); \
+ _zzq_args[2] =3D (volatile unsigned int)(_zzq_arg2); \
+ _zzq_args[3] =3D (volatile unsigned int)(_zzq_arg3); \
+ _zzq_args[4] =3D (volatile unsigned int)(_zzq_arg4); \
+ _zzq_ptr =3D _zzq_args; \
+ __asm__ volatile("tw 0,3,27\n\t" \
+ "rlwinm 0,0,29,0,0\n\t" \
+ "rlwinm 0,0,3,0,0\n\t" \
+ "rlwinm 0,0,13,0,0\n\t" \
+ "rlwinm 0,0,19,0,0\n\t" \
+ "nop\n\t" \
+ : "=3Dr" (_zzq_tmp) \
+ : "0" (_zzq_default), "r" (_zzq_ptr) \
+ : "memory"); \
+ _zzq_rlval =3D (__typeof__(_zzq_rlval)) _zzq_tmp; \
}
-#endif /* __powerpc__ 64-bit only */
+#endif /* ARCH_ppc32 */
=20
+/* --------------------------- ppc64 --------------------------- */
+
+#if defined(ARCH_ppc64)
+#define VALGRIND_DO_CLIENT_REQUEST( \
+ _zzq_rlval, _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \
+ \
+ { volatile unsigned long long int _zzq_args[5]; \
+ register unsigned long long int _zzq_tmp __asm__("r3"); \
+ register volatile unsigned long long int *_zzq_ptr __asm__("r4"); \
+ _zzq_args[0] =3D (volatile unsigned long long int)(_zzq_request); =
\
+ _zzq_args[1] =3D (volatile unsigned long long int)(_zzq_arg1); \
+ _zzq_args[2] =3D (volatile unsigned long long int)(_zzq_arg2); \
+ _zzq_args[3] =3D (volatile unsigned long long int)(_zzq_arg3); \
+ _zzq_args[4] =3D (volatile unsigned long long int)(_zzq_arg4); \
+ _zzq_ptr =3D _zzq_args; \
+ __asm__ volatile("tw 0,3,27\n\t" \
+ "rotldi 0,0,61\n\t" \
+ "rotldi 0,0,3\n\t" \
+ "rotldi 0,0,13\n\t" \
+ "rotldi 0,0,51\n\t" \
+ "nop\n\t" \
+ : "=3Dr" (_zzq_tmp) \
+ : "0" (_zzq_default), "r" (_zzq_ptr) \
+ : "memory"); \
+ _zzq_rlval =3D (__typeof__(_zzq_rlval)) _zzq_tmp; \
+ }
+#endif /* ARCH_ppc64 */
+
/* Insert assembly code for other architectures here... */
=20
#endif /* NVALGRIND */
=20
=20
/* ------------------------------------------------------------------ */
-/* The architecture-independent part */
+/* ARCHITECTURE SPECIFICS for FUNCTION WRAPPING. This is all very */
+/* ugly. It's the least-worst tradeoff I can think of. */
/* ------------------------------------------------------------------ */
=20
+/* This section defines magic (a.k.a appalling-hack) macros for doing
+ guaranteed-no-redirection macros, so as to get from function
+ wrappers to the functions they are wrapping. The whole point is to
+ construct standard call sequences, but to do the call itself with a
+ special no-redirect call pseudo-instruction that the JIT
+ understands and handles specially. This section is long and
+ repetitious, and I can't see a way to make it shorter.
+
+ The naming scheme is as follows:
+
+ CALL_FN_{W,v}_{v,W,WW,WWW,WWWW,WWWWW,WWWWWW,etc}
+
+ 'W' stands for "word" and 'v' for "void". Hence there are
+ different macros for calling arity 0, 1, 2, 3, 4, etc, functions,
+ and for each, the possibility of returning a word-typed result, or
+ no result.
+*/
+
+/* Use these to write the name of your wrapper. NOTE: duplicates
+ VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+
+#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
+ _vgwZU_##soname##_##fnname
+
+#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
+ _vgwZZ_##soname##_##fnname
+
+/* Use this macro from within a wrapper function to get the address of
+ the original function. Once you have that you can then use it in
+ one of the CALL_FN_ macros. */
+#define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NRADDR(_lval)
+
+/* ---------------------------- x86 ---------------------------- */
+
+#if defined(ARCH_x86)
+
+/* These regs are trashed by the hidden call. No need to mention eax
+ as gcc can already see that, plus causes gcc to bomb. */
+#define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx"
+
+#define CALL_FN_W_v(lval, fnptr) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[1]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ __asm__ volatile( \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_v_v(fnptr) \
+ do { long _junk; CALL_FN_W_v(_junk,fnptr); } while (0)
+
+#define CALL_FN_W_W(lval, fnptr, arg1) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[2]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ __asm__ volatile( \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $4, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, fnptr, arg1,arg2) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[3]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ __asm__ volatile( \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $8, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, fnptr, arg1,arg2,arg3,arg4) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[5]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ _argvec[3] =3D (long)(arg3); \
+ _argvec[4] =3D (long)(arg4); \
+ __asm__ volatile( \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $16, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWWW(lval, fnptr, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[6]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ _argvec[3] =3D (long)(arg3); \
+ _argvec[4] =3D (long)(arg4); \
+ _argvec[5] =3D (long)(arg5); \
+ __asm__ volatile( \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $20, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWWWWW(lval, fnptr, arg1,arg2,arg3,arg4,arg5,arg6,arg=
7) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[8]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ _argvec[3] =3D (long)(arg3); \
+ _argvec[4] =3D (long)(arg4); \
+ _argvec[5] =3D (long)(arg5); \
+ _argvec[6] =3D (long)(arg6); \
+ _argvec[7] =3D (long)(arg7); \
+ __asm__ volatile( \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ VALGRIND_CALL_NOREDIR_EAX \
+ "addl $28, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* ARCH_x86 */
+
+/* --------------------------- amd64 --------------------------- */
+
+/* --------------------------- ppc32 --------------------------- */
+
+/* --------------------------- ppc64 --------------------------- */
+
+
+/* ------------------------------------------------------------------ */
+/* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS. */
+/* */
+/* ------------------------------------------------------------------ */
+
/* Some request codes. There are many more of these, but most are not
exposed to end-user view. These are the public ones, all of the
form 0x1000 + small_number.
=20
- Core ones are in the range 0x00000000--0x0000ffff. The non-public on=
es
- start at 0x2000.
+ Core ones are in the range 0x00000000--0x0000ffff. The non-public
+ ones start at 0x2000.
*/
=20
-/* These macros are used by tools -- they must be public, but don't embe=
d them
- * into other programs. */
+/* These macros are used by tools -- they must be public, but don't
+ embed them into other programs. */
#define VG_USERREQ_TOOL_BASE(a,b) \
((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))
#define VG_IS_TOOL_USERREQ(a, b, v) \
@@ -248,24 +509,24 @@
typedef
enum { VG_USERREQ__RUNNING_ON_VALGRIND =3D 0x1001,
VG_USERREQ__DISCARD_TRANSLATIONS =3D 0x1002,
- VG_USERREQ__GET_NRADDR =3D 0x1003,
=20
- /* These allow any function to be called from the
- simulated CPU but run on the real CPU.
- Nb: the first arg passed to the function is always the Thre=
adId of
- the running thread! So CLIENT_CALL0 actually requires a 1 =
arg
+ /* These allow any function to be called from the simulated
+ CPU but run on the real CPU. Nb: the first arg passed to
+ the function is always the ThreadId of the running
+ thread! So CLIENT_CALL0 actually requires a 1 arg
function, etc. */
VG_USERREQ__CLIENT_CALL0 =3D 0x1101,
VG_USERREQ__CLIENT_CALL1 =3D 0x1102,
VG_USERREQ__CLIENT_CALL2 =3D 0x1103,
VG_USERREQ__CLIENT_CALL3 =3D 0x1104,
=20
- /* Can be useful in regression testing suites -- eg. can send
- Valgrind's output to /dev/null and still count errors. */
+ /* Can be useful in regression testing suites -- eg. can
+ send Valgrind's output to /dev/null and still count
+ errors. */
VG_USERREQ__COUNT_ERRORS =3D 0x1201,
=20
- /* These are useful and can be interpreted by any tool that tr=
acks
- malloc() et al, by using vg_replace_malloc.c. */
+ /* These are useful and can be interpreted by any tool that
+ tracks malloc() et al, by using vg_replace_malloc.c. */
VG_USERREQ__MALLOCLIKE_BLOCK =3D 0x1301,
VG_USERREQ__FREELIKE_BLOCK =3D 0x1302,
/* Memory pool support. */
@@ -284,19 +545,20 @@
VG_USERREQ__STACK_CHANGE =3D 0x1503,
} Vg_ClientRequest;
=20
-#ifndef __GNUC__
-#define __extension__
+#if !defined(__GNUC__)
+# define __extension__ /* */
#endif
=20
-/* Returns the number of Valgrinds this code is running under. That is,
- 0 if running natively, 1 if running under Valgrind, 2 if running unde=
r
- Valgrind which is running under another Valgrind, etc. */
-#define RUNNING_ON_VALGRIND __extension__ \
- ({unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* returned if not */, \
- VG_USERREQ__RUNNING_ON_VALGRIND, \
- 0, 0, 0, 0); \
- _qzz_res; \
+/* Returns the number of Valgrinds this code is running under. That
+ is, 0 if running natively, 1 if running under Valgrind, 2 if
+ running under Valgrind which is running under another Valgrind,
+ etc. */
+#define RUNNING_ON_VALGRIND __extension__ \
+ ({unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* if not */, \
+ VG_USERREQ__RUNNING_ON_VALGRIND, \
+ 0, 0, 0, 0); \
+ _qzz_res; \
})
=20
=20
@@ -304,30 +566,22 @@
_qzz_len - 1]. Useful if you are debugging a JITter or some such,
since it provides a way to make sure valgrind will retranslate the
invalidated area. Returns no value. */
-#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__DISCARD_TRANSLATIONS, \
- _qzz_addr, _qzz_len, 0, 0); \
+#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__DISCARD_TRANSLATIONS, \
+ _qzz_addr, _qzz_len, 0, 0); \
}
=20
-/* Push an address onto this thread's stack of noredir addresses, so
- that the next entry by this thread into a redirected translation
- whose address is on top of the stack will instead to jump to the
- non-redirected version. Returns 0 if success, 1 if failure. */
-#define VALGRIND_GET_NRADDR __extension__ \
- ({unsigned long _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0/*native result*/, \
- VG_USERREQ__GET_NRADDR, \
- 0, 0, 0, 0); \
- (void*)_qzz_res; \
- })
=20
-#ifdef NVALGRIND
+/* These requests are for getting Valgrind itself to print something.
+ Possibly with a backtrace. This is a really ugly hack. */
=20
-#define VALGRIND_PRINTF(...)
-#define VALGRIND_PRINTF_BACKTRACE(...)
+#if defined(NVALGRIND)
=20
+# define VALGRIND_PRINTF(...)
+# define VALGRIND_PRINTF_BACKTRACE(...)
+
#else /* NVALGRIND */
=20
int VALGRIND_PRINTF(const char *format, ...)
@@ -339,7 +593,7 @@
unsigned long _qzz_res;
va_list vargs;
va_start(vargs, format);
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__PRINTF,
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF,
(unsigned long)format, (unsigned long)vargs, =
0, 0);
va_end(vargs);
return (int)_qzz_res;
@@ -354,7 +608,7 @@
unsigned long _qzz_res;
va_list vargs;
va_start(vargs, format);
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE,
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE,
(unsigned long)format, (unsigned long)vargs, =
0, 0);
va_end(vargs);
return (int)_qzz_res;
@@ -362,54 +616,55 @@
=20
#endif /* NVALGRIND */
=20
+
/* These requests allow control to move from the simulated CPU to the
real CPU, calling an arbitary function */
-#define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
- ({unsigned long _qyy_res; \
- VALGRIND_MAGIC_SEQUENCE(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL0, \
- _qyy_fn, \
- 0, 0, 0); \
- _qyy_res; \
+#define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL0, \
+ _qyy_fn, \
+ 0, 0, 0); \
+ _qyy_res; \
})
=20
-#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
- ({unsigned long _qyy_res; \
- VALGRIND_MAGIC_SEQUENCE(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL1, \
- _qyy_fn, \
- _qyy_arg1, 0, 0); \
- _qyy_res; \
+#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL1, \
+ _qyy_fn, \
+ _qyy_arg1, 0, 0); \
+ _qyy_res; \
})
=20
-#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
- ({unsigned long _qyy_res; \
- VALGRIND_MAGIC_SEQUENCE(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL2, \
- _qyy_fn, \
- _qyy_arg1, _qyy_arg2, 0); \
- _qyy_res; \
+#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL2, \
+ _qyy_fn, \
+ _qyy_arg1, _qyy_arg2, 0); \
+ _qyy_res; \
})
=20
-#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3=
) \
- ({unsigned long _qyy_res; \
- VALGRIND_MAGIC_SEQUENCE(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL3, \
- _qyy_fn, \
- _qyy_arg1, _qyy_arg2, _qyy_arg3); \
- _qyy_res; \
+#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3=
) \
+ ({unsigned long _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL3, \
+ _qyy_fn, \
+ _qyy_arg1, _qyy_arg2, _qyy_arg3); \
+ _qyy_res; \
})
=20
=20
/* Counts the number of errors that have been recorded by a tool. Nb:
the tool must record the errors with VG_(maybe_record_error)() or
VG_(unique_error)() for them to be counted. */
-#define VALGRIND_COUNT_ERRORS =
\
- ({unsigned int _qyy_res; =
\
- VALGRIND_MAGIC_SEQUENCE(_qyy_res, 0 /* default return */, =
\
- VG_USERREQ__COUNT_ERRORS, =
\
- 0, 0, 0, 0); =
\
- _qyy_res; =
\
+#define VALGRIND_COUNT_ERRORS \
+ ({unsigned int _qyy_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ VG_USERREQ__COUNT_ERRORS, \
+ 0, 0, 0, 0); \
+ _qyy_res; \
})
=20
/* Mark a block of memory as having been allocated by a malloc()-like
@@ -432,293 +687,86 @@
=20
Nb: block must be freed via a free()-like function specified
with VALGRIND_FREELIKE_BLOCK or mismatch errors will occur. */
-#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__MALLOCLIKE_BLOCK, \
- addr, sizeB, rzB, is_zeroed); \
+#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MALLOCLIKE_BLOCK, \
+ addr, sizeB, rzB, is_zeroed); \
}
=20
/* Mark a block of memory as having been freed by a free()-like function=
.
`rzB' is redzone size; it must match that given to
VALGRIND_MALLOCLIKE_BLOCK. Memory not freed will be detected by the =
leak
checker. Put it immediately after the point where the block is freed=
. */
-#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__FREELIKE_BLOCK, \
- addr, rzB, 0, 0); \
+#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__FREELIKE_BLOCK, \
+ addr, rzB, 0, 0); \
}
=20
/* Create a memory pool. */
-#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__CREATE_MEMPOOL, \
- pool, rzB, is_zeroed, 0); \
+#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__CREATE_MEMPOOL, \
+ pool, rzB, is_zeroed, 0); \
}
=20
/* Destroy a memory pool. */
-#define VALGRIND_DESTROY_MEMPOOL(pool) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__DESTROY_MEMPOOL, \
- pool, 0, 0, 0); \
+#define VALGRIND_DESTROY_MEMPOOL(pool) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__DESTROY_MEMPOOL, \
+ pool, 0, 0, 0); \
}
=20
/* Associate a piece of memory with a memory pool. */
-#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__MEMPOOL_ALLOC, \
- pool, addr, size, 0); \
+#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_ALLOC, \
+ pool, addr, size, 0); \
}
=20
/* Disassociate a piece of memory from a memory pool. */
-#define VALGRIND_MEMPOOL_FREE(pool, addr) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__MEMPOOL_FREE, \
- pool, addr, 0, 0); \
+#define VALGRIND_MEMPOOL_FREE(pool, addr) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__MEMPOOL_FREE, \
+ pool, addr, 0, 0); \
}
=20
/* Mark a piece of memory as being a stack. Returns a stack id. */
-#define VALGRIND_STACK_REGISTER(start, end) \
- ({unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__STACK_REGISTER, \
- start, end, 0, 0); \
- _qzz_res; \
+#define VALGRIND_STACK_REGISTER(start, end) \
+ ({unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__STACK_REGISTER, \
+ start, end, 0, 0); \
+ _qzz_res; \
})
=20
/* Unmark the piece of memory associated with a stack id as being a
stack. */
-#define VALGRIND_STACK_DEREGISTER(id) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__STACK_DEREGISTER, \
- id, 0, 0, 0); \
+#define VALGRIND_STACK_DEREGISTER(id) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__STACK_DEREGISTER, \
+ id, 0, 0, 0); \
}
=20
/* Change the start and end address of the stack id. */
-#define VALGRIND_STACK_CHANGE(id, start, end) \
- {unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__STACK_CHANGE, \
- id, start, end, 0); \
+#define VALGRIND_STACK_CHANGE(id, start, end) \
+ {unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VG_USERREQ__STACK_CHANGE, \
+ id, start, end, 0); \
}
=20
-/* ---------------------------------------------------------- */
-/* --- Hacky macros for writing function wrappers. --- */
-/* --- XXXXXXX DANGEROUS. DO NOT USE. XXXXXXXXXX --- */
-/* ---------------------------------------------------------- */
=20
-#define CALL_ORIG_FN_1_UNCHECKED(lval,fn,arg1) \
- do { \
- __typeof__(&(fn)) _fn =3D &(fn); \
- __typeof__(lval) _lval; \
- __typeof__(arg1) _arg1 =3D (arg1); \
- VALGRIND_PUSH_NRADDR_NO_CHECK(_fn); \
- _lval =3D (*_fn)(_arg1); \
- lval =3D _lval; \
- } while (0)
+#undef ARCH_x86
+#undef ARCH_amd64
+#undef ARCH_ppc32
+#undef ARCH_ppc64
=20
-#define CALL_ORIG_FN_4_UNCHECKED(lval,fn,arg1,arg2,arg3,arg4) \
- do { \
- __typeof__(&(fn)) _fn =3D &(fn); \
- __typeof__(lval) _lval; \
- __typeof__(arg1) _arg1 =3D (arg1); \
- __typeof__(arg2) _arg2 =3D (arg2); \
- __typeof__(arg3) _arg3 =3D (arg3); \
- __typeof__(arg4) _arg4 =3D (arg4); \
- VALGRIND_PUSH_NRADDR_NO_CHECK(_fn); \
- _lval =3D (*_fn)(_arg1,_arg2,_arg3,_arg4); \
- lval =3D _lval; \
- } while (0)
-
-/* ---------------------------------------------------------- */
-/* --- End-user functions for writing function wrappers. --- */
-/* ---------------------------------------------------------- */
-
-/* Use these to write the name of your wrapper. NOTE: duplicates
- VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
-
-#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
- _vgwZU_##soname##_##fnname
-
-#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
- _vgwZZ_##soname##_##fnname
-
-/* Use these inside the wrapper, to make calls to the function you are
- wrapping. You must use these - calling originals directly will get
- you a redirect-stack overflow in short order. Also, these force
- evaluation of all args before pushing the noredir-address, which is
- needed to make things work reliably.*/
-
-/* returns void, takes zero args */
-#define CALL_ORIG_VOIDFN_0(fn) \
- do { \
- __typeof__(&(fn)) _fn =3D &(fn); \
- VALGRIND_PUSH_NRADDR_AND_CHECK(_fn); \
- (*_fn)(); \
- } while (0)
-
-/* returns a value, takes one arg */
-#define CALL_ORIG_FN_1(lval,fn,arg1) \
- do { \
- __typeof__(&(fn)) _fn =3D &(fn); \
- __typeof__(lval) _lval; \
- __typeof__(arg1) _arg1 =3D (arg1); \
- VALGRIND_PUSH_NRADDR_AND_CHECK(_fn); \
- _lval =3D (*_fn)(_arg1); \
- lval =3...
[truncated message content] |
|
From: <sv...@va...> - 2005-12-28 00:55:08
|
Author: sewardj
Date: 2005-12-28 00:54:57 +0000 (Wed, 28 Dec 2005)
New Revision: 1518
Log:
x86 front end only: generalise the client-request idea so as to create
a whole family of "Special" instructions, which are no-ops when run
natively, but mean something special to the JIT.
Modified:
branches/FNWRAP/priv/guest-x86/toIR.c
Modified: branches/FNWRAP/priv/guest-x86/toIR.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/FNWRAP/priv/guest-x86/toIR.c 2005-12-27 16:39:36 UTC (rev 15=
17)
+++ branches/FNWRAP/priv/guest-x86/toIR.c 2005-12-28 00:54:57 UTC (rev 15=
18)
@@ -122,6 +122,30 @@
way through bbs as usual.
*/
=20
+/* "Special" instructions.
+
+ This instruction decoder can decode three special instructions
+ which mean nothing natively (are no-ops as far as regs/mem are
+ concerned) but have meaning for supporting Valgrind. A special
+ instruction is flagged by the 12-byte preamble C1C703 C1C70D C1C71D
+ C1C713 (in the standard interpretation, that means: roll $3, %edi;
+ roll $13, %edi; roll $29, %edi; roll $19, %edi). Following that,
+ one of the following 3 are allowed (standard interpretation in
+ parentheses):
+
+ 87DB (xchgl %ebx,%ebx) %EDX =3D client_request ( %EAX )
+ 87C9 (xchgl %ecx,%ecx) %EAX =3D guest_NRADDR
+ 87D2 (xchgl %edx,%edx) call-noredir *%EAX
+
+ Any other bytes following the 12-byte preamble are illegal and
+ constitute a failure in instruction decoding. This all assumes
+ that the preamble will never occur except in specific code
+ fragments designed for Valgrind to catch.
+
+ No prefixes may precede a "Special" instruction.
+*/
+
+
/* Translates x86 code to IR. */
=20
#include "libvex_basictypes.h"
@@ -227,7 +251,9 @@
=20
#define OFFB_TISTART offsetof(VexGuestX86State,guest_TISTART)
#define OFFB_TILEN offsetof(VexGuestX86State,guest_TILEN)
+#define OFFB_NRADDR offsetof(VexGuestX86State,guest_NRADDR)
=20
+
/*------------------------------------------------------------*/
/*--- Helper bits and pieces for deconstructing the ---*/
/*--- x86 insn stream. ---*/
@@ -7005,68 +7031,58 @@
if (put_IP)
stmt( IRStmt_Put( OFFB_EIP, mkU32(guest_EIP_curr_instr)) );
=20
- /* Spot the client-request magic sequence. */
+ /* Spot "Special" instructions (see comment at top of file). */
{
UChar* code =3D (UChar*)(guest_code + delta);
- /* Spot this:
- C1C01D roll $29, %eax
- C1C003 roll $3, %eax
- C1C81B rorl $27, %eax
- C1C805 rorl $5, %eax
- C1C00D roll $13, %eax
- C1C013 roll $19, %eax =20
+ /* Spot the 12-byte preamble:
+ C1C703 roll $3, %edi
+ C1C70D roll $13, %edi
+ C1C71D roll $29, %edi
+ C1C713 roll $19, %edi
*/
- if (code[ 0] =3D=3D 0xC1 && code[ 1] =3D=3D 0xC0 && code[ 2] =3D=3D=
0x1D &&
- code[ 3] =3D=3D 0xC1 && code[ 4] =3D=3D 0xC0 && code[ 5] =3D=3D=
0x03 &&
- code[ 6] =3D=3D 0xC1 && code[ 7] =3D=3D 0xC8 && code[ 8] =3D=3D=
0x1B &&
- code[ 9] =3D=3D 0xC1 && code[10] =3D=3D 0xC8 && code[11] =3D=3D=
0x05 &&
- code[12] =3D=3D 0xC1 && code[13] =3D=3D 0xC0 && code[14] =3D=3D=
0x0D &&
- code[15] =3D=3D 0xC1 && code[16] =3D=3D 0xC0 && code[17] =3D=3D=
0x13
- ) {
- DIP("%%edx =3D client_request ( %%eax )\n"); =20
- delta +=3D 18;
- jmp_lit(Ijk_ClientReq, guest_EIP_bbstart+delta);
- dres.whatNext =3D Dis_StopHere;
- goto decode_success;
+ if (code[ 0] =3D=3D 0xC1 && code[ 1] =3D=3D 0xC7 && code[ 2] =3D=3D=
0x03 &&
+ code[ 3] =3D=3D 0xC1 && code[ 4] =3D=3D 0xC7 && code[ 5] =3D=3D=
0x0D &&
+ code[ 6] =3D=3D 0xC1 && code[ 7] =3D=3D 0xC7 && code[ 8] =3D=3D=
0x1D &&
+ code[ 9] =3D=3D 0xC1 && code[10] =3D=3D 0xC7 && code[11] =3D=3D=
0x13) {
+ /* Got a "Special" instruction preamble. Which one is it? */
+ if (code[12] =3D=3D 0x87 && code[13] =3D=3D 0xDB /* xchgl %ebx,=
%ebx */) {
+ /* %EDX =3D client_request ( %EAX ) */
+ DIP("%%edx =3D client_request ( %%eax )\n");
+ delta +=3D 14;
+ jmp_lit(Ijk_ClientReq, guest_EIP_bbstart+delta);
+ dres.whatNext =3D Dis_StopHere;
+ goto decode_success;
+ }
+ else
+ if (code[12] =3D=3D 0x87 && code[13] =3D=3D 0xC9 /* xchgl %ecx,=
%ecx */) {
+ /* %EAX =3D guest_NRADDR */
+ DIP("%%eax =3D guest_NRADDR\n");
+ delta +=3D 14;
+ putIReg(4, R_EAX, IRExpr_Get( OFFB_NRADDR, Ity_I32 ));
+ goto decode_success;
+ }
+ else
+ if (code[12] =3D=3D 0x87 && code[13] =3D=3D 0xD2 /* xchgl %edx,=
%edx */) {
+ /* call-noredir *%EAX */
+ DIP("call-noredir *%%eax\n");
+ delta +=3D 14;
+ t1 =3D newTemp(Ity_I32);
+ assign(t1, getIReg(4,R_EAX));
+ t2 =3D newTemp(Ity_I32);
+ assign(t2, binop(Iop_Sub32, getIReg(4,R_ESP), mkU32(4)));
+ putIReg(4, R_ESP, mkexpr(t2));
+ storeLE( mkexpr(t2), mkU32(guest_EIP_bbstart+delta));
+ jmp_treg(Ijk_NoRedir,t1);
+ dres.whatNext =3D Dis_StopHere;
+ goto decode_success;
+ }
+ /* We don't know what it is. */
+ goto decode_failure;
+ /*NOTREACHED*/
}
}
=20
- /* Spot the even-more-magical "call-noredir *%eax" sequence, and
- treat it as a normal "call *%eax", except that the jump itself
- is marked NoRedir. */
- {
- UChar* code =3D (UChar*)(guest_code + delta);
- /* Spot this:
- C1C81C rorl $28, %eax
- C1C804 rorl $4, %eax
- C1C01A roll $26, %eax
- C1C006 roll $6, %eax
- C1C80C rorl $12, %eax
- C1C814 rorl $20, %eax
- FFD0 call *%eax
- */
- if (code[ 0] =3D=3D 0xC1 && code[ 1] =3D=3D 0xC8 && code[ 2] =3D=3D=
0x1C &&
- code[ 3] =3D=3D 0xC1 && code[ 4] =3D=3D 0xC8 && code[ 5] =3D=3D=
0x04 &&
- code[ 6] =3D=3D 0xC1 && code[ 7] =3D=3D 0xC0 && code[ 8] =3D=3D=
0x1A &&
- code[ 9] =3D=3D 0xC1 && code[10] =3D=3D 0xC0 && code[11] =3D=3D=
0x06 &&
- code[12] =3D=3D 0xC1 && code[13] =3D=3D 0xC8 && code[14] =3D=3D=
0x0C &&
- code[15] =3D=3D 0xC1 && code[16] =3D=3D 0xC8 && code[17] =3D=3D=
0x14 &&
- code[18] =3D=3D 0xFF && code[19] =3D=3D 0xD0
- ) {
- DIP("call-noredir *%%eax\n");
- delta +=3D 20;
- t1 =3D newTemp(Ity_I32);
- assign(t1, getIReg(4,R_EAX));
- t2 =3D newTemp(Ity_I32);
- assign(t2, binop(Iop_Sub32, getIReg(4,R_ESP), mkU32(4)));
- putIReg(4, R_ESP, mkexpr(t2));
- storeLE( mkexpr(t2), mkU32(guest_EIP_bbstart+delta));
- jmp_treg(Ijk_NoRedir,t1);
- dres.whatNext =3D Dis_StopHere;
- goto decode_success;
- }
- }
-
+ /* Deal with prefixes. */
/* Skip a LOCK prefix. */
/* 2005 Jan 06: the following insns are observed to sometimes
have a LOCK prefix:
|
|
From: <sv...@va...> - 2005-12-27 16:40:42
|
Author: sewardj
Date: 2005-12-27 16:40:35 +0000 (Tue, 27 Dec 2005)
New Revision: 5453
Log:
Redesign and simplify function-wrapping support.
Modified:
branches/FNWRAP/coregrind/m_demangle/demangle.c
branches/FNWRAP/coregrind/m_redir.c
branches/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.c
branches/FNWRAP/coregrind/m_scheduler/scheduler.c
branches/FNWRAP/coregrind/m_translate.c
branches/FNWRAP/coregrind/pub_core_demangle.h
branches/FNWRAP/coregrind/pub_core_redir.h
branches/FNWRAP/include/pub_tool_redir.h
branches/FNWRAP/include/valgrind.h
branches/FNWRAP/memcheck/mac_replace_strmem.c
Modified: branches/FNWRAP/coregrind/m_demangle/demangle.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/FNWRAP/coregrind/m_demangle/demangle.c 2005-12-27 15:02:50 U=
TC (rev 5452)
+++ branches/FNWRAP/coregrind/m_demangle/demangle.c 2005-12-27 16:40:35 U=
TC (rev 5453)
@@ -72,7 +72,7 @@
Z-demangling (with NULL soname buffer, since we're not
interested in that). */
if (VG_(maybe_Z_demangle)( orig, NULL,0,/*soname*/
- z_demangled, N_ZBUF)) {
+ z_demangled, N_ZBUF, NULL)) {
orig =3D z_demangled;
}
=20
@@ -113,7 +113,8 @@
=20
Bool VG_(maybe_Z_demangle) ( const HChar* sym,=20
/*OUT*/HChar* so, Int soLen,
- /*OUT*/HChar* fn, Int fnLen )
+ /*OUT*/HChar* fn, Int fnLen,
+ /*OUT*/Bool* isWrap )
{
# define EMITSO(ch) \
do { \
@@ -147,7 +148,7 @@
valid =3D sym[0] =3D=3D '_'
&& sym[1] =3D=3D 'v'
&& sym[2] =3D=3D 'g'
- && (sym[3] =3D=3D 'r' || sym[3] =3D=3D 'n')
+ && (sym[3] =3D=3D 'r' || sym[3] =3D=3D 'w' || sym[3] =3D=3D '=
n')
&& sym[4] =3D=3D 'Z'
&& (sym[5] =3D=3D 'Z' || sym[5] =3D=3D 'U')
&& sym[6] =3D=3D '_';
@@ -156,6 +157,9 @@
=20
fn_is_encoded =3D sym[5] =3D=3D 'Z';
=20
+ if (isWrap)
+ *isWrap =3D sym[3] =3D=3D 'w';
+
/* Now scan the Z-encoded soname. */
i =3D 7;
while (True) {
@@ -244,12 +248,12 @@
=20
if (error) {
/* Something's wrong. Give up. */
- VG_(message)(Vg_UserMsg, "m_redir: error demangling: %s", sym);
+ VG_(message)(Vg_UserMsg, "m_demangle: error Z-demangling: %s", sym=
);
return False;
}
if (oflow) {
/* It didn't fit. Give up. */
- VG_(message)(Vg_UserMsg, "m_debuginfo: oflow demangling: %s", sym)=
;
+ VG_(message)(Vg_UserMsg, "m_demangle: oflow Z-demangling: %s", sym=
);
return False;
}
=20
Modified: branches/FNWRAP/coregrind/m_redir.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/FNWRAP/coregrind/m_redir.c 2005-12-27 15:02:50 UTC (rev 5452=
)
+++ branches/FNWRAP/coregrind/m_redir.c 2005-12-27 16:40:35 UTC (rev 5453=
)
@@ -98,7 +98,7 @@
/* The redirector holds two pieces of state:
=20
Specs - a set of (soname pattern, fnname pattern) -> redir addr
- Active - a set of orig addr -> redir addr
+ Active - a set of orig addr -> (bool, redir addr)
=20
Active is the currently active set of bindings that the translator
consults. Specs is the current set of specifications as harvested
@@ -210,6 +210,7 @@
HChar* from_sopatt; /* from soname pattern */
HChar* from_fnpatt; /* from fnname pattern */
Addr to_addr; /* where redirecting to */
+ Bool isWrap; /* wrap or replacement? */
Bool mark; /* transient temporary used during matching */
}
Spec;
@@ -249,6 +250,7 @@
Addr to_addr; /* where redirecting to */
TopSpec* parent_spec; /* the TopSpec which supplied the Spec */
TopSpec* parent_sym; /* the TopSpec which supplied the symbol */
+ Bool isWrap; /* wrap or replacement? */
}
Active;
=20
@@ -296,7 +298,7 @@
=20
void VG_(redir_notify_new_SegInfo)( SegInfo* newsi )
{
- Bool ok;
+ Bool ok, isWrap;
Int i, nsyms;
Spec* specList;
Spec* spec;
@@ -323,7 +325,7 @@
for (i =3D 0; i < nsyms; i++) {
VG_(seginfo_syms_getidx)( newsi, i, &sym_addr, NULL, &sym_name );
ok =3D VG_(maybe_Z_demangle)( sym_name, demangled_sopatt, N_DEMANG=
LED,
- demangled_fnpatt, N_DEMANGLED );
+ demangled_fnpatt, N_DEMANGLED, &isWrap );
if (!ok) {
/* It's not a full-scale redirect, but perhaps it is a load-not=
ify
fn? Let the load-notify department see it. */
@@ -337,6 +339,7 @@
vg_assert(spec->from_sopatt);
vg_assert(spec->from_fnpatt);
spec->to_addr =3D sym_addr;
+ spec->isWrap =3D isWrap;
/* check we're not adding manifestly stupid destinations */
vg_assert(is_plausible_guest_addr(sym_addr));
spec->next =3D specList;
@@ -447,6 +450,7 @@
act.to_addr =3D sp->to_addr;
act.parent_spec =3D parent_spec;
act.parent_sym =3D parent_sym;
+ act.isWrap =3D sp->isWrap;
maybe_add_active( act );
}
}
@@ -619,13 +623,15 @@
/* This is the crucial redirection function. It answers the question:
should this code address be redirected somewhere else? It's used
just before translating a basic block. */
-Addr VG_(redir_do_lookup) ( Addr orig )
+Addr VG_(redir_do_lookup) ( Addr orig, Bool* isWrap )
{
Active* r =3D VG_(OSet_Lookup)(activeSet, &orig);
if (r =3D=3D NULL)
return orig;
=20
vg_assert(r->to_addr !=3D 0);
+ if (isWrap)
+ *isWrap =3D r->isWrap;
return r->to_addr;
}
=20
@@ -644,6 +650,7 @@
act.to_addr =3D to;
act.parent_spec =3D NULL;
act.parent_sym =3D NULL;
+ act.isWrap =3D False;
maybe_add_active( act );
}
=20
@@ -676,6 +683,7 @@
spec->from_sopatt =3D sopatt;
spec->from_fnpatt =3D fnpatt;
spec->to_addr =3D to_addr;
+ spec->isWrap =3D False;
spec->mark =3D False; /* not significant */
=20
spec->next =3D topSpecs->specs;
@@ -814,9 +822,10 @@
static void show_spec ( HChar* left, Spec* spec )
{
VG_(message)(Vg_DebugMsg,=20
- "%s%18s %30s -> 0x%08llx",
+ "%s%18s %30s %s-> 0x%08llx",
left,
spec->from_sopatt, spec->from_fnpatt,
+ spec->isWrap ? "W" : "R",
(ULong)spec->to_addr );
}
=20
@@ -831,9 +840,10 @@
ok =3D VG_(get_fnname_w_offset)(act->to_addr, name2, 64);
if (!ok) VG_(strcpy)(name2, "???");
=20
- VG_(message)(Vg_DebugMsg, "%s0x%08llx (%10s) -> 0x%08llx %s",=20
+ VG_(message)(Vg_DebugMsg, "%s0x%08llx (%10s) %s-> 0x%08llx %s",=20
left,=20
(ULong)act->from_addr, name1,
+ act->isWrap ? "W" : "R",
(ULong)act->to_addr, name2 );
}
=20
Modified: branches/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.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/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.c 2005-12=
-27 15:02:50 UTC (rev 5452)
+++ branches/FNWRAP/coregrind/m_replacemalloc/vg_replace_malloc.c 2005-12=
-27 16:40:35 UTC (rev 5453)
@@ -103,8 +103,8 @@
*/
#define ALLOC_or_NULL(soname, fnname, vg_replacement) \
\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (SizeT n); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (SizeT n) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (SizeT n); \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (SizeT n) \
{ \
void* v; \
\
@@ -123,8 +123,8 @@
*/
#define ALLOC_or_BOMB(soname, fnname, vg_replacement) \
\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (SizeT n); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (SizeT n) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (SizeT n); \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (SizeT n) \
{ \
void* v; \
\
@@ -221,8 +221,8 @@
*/
#define FREE(soname, fnname, vg_replacement) \
\
- void VG_REDIRECT_FUNCTION_ZU(soname,fnname) (void *p); \
- void VG_REDIRECT_FUNCTION_ZU(soname,fnname) (void *p) \
+ void VG_REPLACE_FUNCTION_ZU(soname,fnname) (void *p); \
+ void VG_REPLACE_FUNCTION_ZU(soname,fnname) (void *p) \
{ \
MALLOC_TRACE(#vg_replacement "(%p)", p ); \
if (p =3D=3D NULL) \
@@ -264,8 +264,8 @@
=20
#define CALLOC(soname, fnname) \
\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( SizeT nmemb, SizeT siz=
e ); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( SizeT nmemb, SizeT siz=
e ) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( SizeT nmemb, SizeT size=
); \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( SizeT nmemb, SizeT size=
) \
{ \
void* v; \
\
@@ -282,8 +282,8 @@
=20
#define REALLOC(soname, fnname) \
\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( void* ptrV, SizeT new_=
size );\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( void* ptrV, SizeT new_=
size ) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( void* ptrV, SizeT new_s=
ize );\
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( void* ptrV, SizeT new_s=
ize ) \
{ \
void* v; \
\
@@ -292,9 +292,9 @@
if (ptrV =3D=3D NULL) \
/* We need to call a malloc-like function; so let's use \
one which we know exists. */ \
- return VG_REDIRECT_FUNCTION_ZU(libcZdsoZa,malloc) (new_size); \
+ return VG_REPLACE_FUNCTION_ZU(libcZdsoZa,malloc) (new_size); \
if (new_size <=3D 0) { \
- VG_REDIRECT_FUNCTION_ZU(libcZdsoZa,free)(ptrV); \
+ VG_REPLACE_FUNCTION_ZU(libcZdsoZa,free)(ptrV); \
MALLOC_TRACE(" =3D 0"); \
return NULL; \
} \
@@ -309,8 +309,8 @@
=20
#define MEMALIGN(soname, fnname) \
\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( SizeT alignment, SizeT=
n ); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( SizeT alignment, SizeT=
n ) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( SizeT alignment, SizeT =
n ); \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( SizeT alignment, SizeT =
n ) \
{ \
void* v; \
\
@@ -335,10 +335,10 @@
=20
#define VALLOC(soname, fnname) \
\
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( SizeT size ); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( SizeT size ) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( SizeT size ); \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( SizeT size ) \
{ \
- return VG_REDIRECT_FUNCTION_ZU(libcZdsoZa,memalign)(VKI_PAGE_SIZE,=
size); \
+ return VG_REPLACE_FUNCTION_ZU(libcZdsoZa,memalign)(VKI_PAGE_SIZE, =
size); \
}
=20
VALLOC(m_libc_dot_so_star, valloc);
@@ -348,8 +348,8 @@
=20
#define MALLOPT(soname, fnname) \
\
- int VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( int cmd, int value ); \
- int VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( int cmd, int value ) \
+ int VG_REPLACE_FUNCTION_ZU(soname, fnname) ( int cmd, int value ); \
+ int VG_REPLACE_FUNCTION_ZU(soname, fnname) ( int cmd, int value ) \
{ \
/* In glibc-2.2.4, 1 denotes a successful return value for \
mallopt */ \
@@ -361,9 +361,9 @@
=20
#define POSIX_MEMALIGN(soname, fnname) \
\
- int VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void **memptr, \
+ int VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void **memptr, \
SizeT alignment, SizeT =
size ); \
- int VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void **memptr, \
+ int VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void **memptr, \
SizeT alignment, SizeT =
size ) \
{ \
void *mem; \
@@ -374,7 +374,7 @@
|| (alignment & (alignment - 1)) !=3D 0) \
return VKI_EINVAL; \
\
- mem =3D VG_REDIRECT_FUNCTION_ZU(libcZdsoZa,memalign)(alignment, si=
ze); \
+ mem =3D VG_REPLACE_FUNCTION_ZU(libcZdsoZa,memalign)(alignment, siz=
e); \
\
if (mem !=3D NULL) { \
*memptr =3D mem; \
@@ -389,8 +389,8 @@
=20
#define MALLOC_USABLE_SIZE(soname, fnname) \
\
- int VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void* p ); \
- int VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void* p ) \
+ int VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void* p ); \
+ int VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void* p ) \
{ \
SizeT pszB; \
\
@@ -420,8 +420,8 @@
=20
#define PANIC(soname, fnname) \
\
- void VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void ); \
- void VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void ) \
+ void VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void ); \
+ void VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void ) \
{ \
panic(#fnname); \
}
@@ -437,8 +437,8 @@
// doesn't know that the call to mallinfo fills in mi.
#define MALLINFO(soname, fnname) \
\
- struct vg_mallinfo VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void ); =
\
- struct vg_mallinfo VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( void ) =
\
+ struct vg_mallinfo VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void ); \
+ struct vg_mallinfo VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void ) \
{ \
static struct vg_mallinfo mi; \
MALLOC_TRACE("mallinfo()"); \
Modified: branches/FNWRAP/coregrind/m_scheduler/scheduler.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/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-27 15:02:50=
UTC (rev 5452)
+++ branches/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-27 16:40:35=
UTC (rev 5453)
@@ -1099,54 +1099,9 @@
VG_(printf)("req no =3D 0x%llx, arg =3D %p\n", (ULong)req_no, arg)=
;
switch (req_no) {
=20
- case VG_USERREQ__PUSH_NRADDR: {
- Addr nraddr =3D arg[1];
- UWord do_check =3D arg[2];
-
- if (do_check) {
-
- /* This is the normal (safe) case. */
- switch (GET_CLIENT_NRFLAG(tid)) {
- case 0:
- SET_CLIENT_NRFLAG(tid, 1);
- SET_CLIENT_NRADDR(tid, nraddr);
- SET_CLREQ_RETVAL(tid, 0);
- break;
- case 1:=20
- case 2:
- /* The 1-entry stack is full, so we must fail
- (return 1). */
- SET_CLREQ_RETVAL(tid, 1);
- break;
- default:
- vg_assert2(0, "VG_USERREQ__PUSH_NRADDR(checked):"
- " bogus value");
- }
-
- } else {
-
- /* This is the not-normal (unsafe) case. */
- switch (GET_CLIENT_NRFLAG(tid)) {
- case 0:
- SET_CLIENT_NRFLAG(tid, 1);
- SET_CLIENT_NRADDR(tid, nraddr);
- break;
- case 1:=20
- SET_CLIENT_NRFLAG(tid, 2);
- break;
- case 2:
- break;
- default:
- vg_assert2(0, "VG_USERREQ__PUSH_NRADDR(***unchecked***=
):"
- " bogus value");
- }
- /* Unchecked case always succeeds */
- SET_CLREQ_RETVAL(tid, 0);
-
- }
-
+ case VG_USERREQ__GET_NRADDR:
+ SET_CLREQ_RETVAL(tid, VG_(threads)[tid].arch.vex.guest_NRADDR);
break;
- }
=20
case VG_USERREQ__CLIENT_CALL0: {
UWord (*f)(ThreadId) =3D (void*)arg[1];
Modified: branches/FNWRAP/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/FNWRAP/coregrind/m_translate.c 2005-12-27 15:02:50 UTC (rev =
5452)
+++ branches/FNWRAP/coregrind/m_translate.c 2005-12-27 16:40:35 UTC (rev =
5453)
@@ -426,7 +426,7 @@
}
=20
/* Destination is redirected? */
- if (addr !=3D VG_(redir_do_lookup)(addr))
+ if (addr !=3D VG_(redir_do_lookup)(addr, NULL))
goto dontchase;
=20
/* well, ok then. go on and chase. */
@@ -453,7 +453,8 @@
{
Addr64 redir, orig_addr_noredir =3D orig_addr;
Int tmpbuf_used, verbosity, i;
- Bool notrace_until_done, do_self_check, did_redirect;
+ Bool notrace_until_done, do_self_check;
+ Bool did_redirect, isWrap;
UInt notrace_until_limit =3D 0;
NSegment* seg;
VexArch vex_arch;
@@ -478,14 +479,17 @@
=20
/* Look in the code redirect table to see if we should
translate an alternative address for orig_addr. */
+ isWrap =3D False;
if (allow_redirection) {
- redir =3D VG_(redir_do_lookup)(orig_addr);
+ redir =3D VG_(redir_do_lookup)(orig_addr, &isWrap);
did_redirect =3D redir !=3D orig_addr;
} else {
redir =3D orig_addr;
did_redirect =3D False;
}
=20
+ if (did_redirect =3D=3D False) vg_assert(isWrap =3D=3D False);
+
if (redir !=3D orig_addr=20
&& (VG_(clo_verbosity) >=3D 2 || VG_(clo_trace_redir))) {
Bool ok;
@@ -605,9 +609,9 @@
NULL,
verbosity,
/* If this translation started at a redirected address,
- then we need to ask the JIT to put in the
- guest_NOREDIR preamble. */
- did_redirect =20
+ then we need to ask the JIT to generate code to put the
+ non-redirected guest address into guest_NRADDR. */
+ isWrap =20
);
=20
vg_assert(tres =3D=3D VexTransOK);
Modified: branches/FNWRAP/coregrind/pub_core_demangle.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/FNWRAP/coregrind/pub_core_demangle.h 2005-12-27 15:02:50 UTC=
(rev 5452)
+++ branches/FNWRAP/coregrind/pub_core_demangle.h 2005-12-27 16:40:35 UTC=
(rev 5453)
@@ -56,9 +56,9 @@
extern=20
Bool VG_(maybe_Z_demangle) ( const HChar* sym,=20
/*OUT*/HChar* so, Int soLen,
- /*OUT*/HChar* fn, Int fnLen );
+ /*OUT*/HChar* fn, Int fnLen,
+ /*OUT*/Bool* isWrap );
=20
-
#endif // __PUB_CORE_DEMANGLE_H
=20
/*--------------------------------------------------------------------*/
Modified: branches/FNWRAP/coregrind/pub_core_redir.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/FNWRAP/coregrind/pub_core_redir.h 2005-12-27 15:02:50 UTC (r=
ev 5452)
+++ branches/FNWRAP/coregrind/pub_core_redir.h 2005-12-27 16:40:35 UTC (r=
ev 5453)
@@ -65,8 +65,10 @@
=20
/* This is the crucial redirection function. It answers the question:
should this code address be redirected somewhere else? It's used
- just before translating a basic block. */
-extern Addr VG_(redir_do_lookup) ( Addr orig );
+ just before translating a basic block. If a redir is found,
+ *isWrap allows to distinguish wrap- from replace- style
+ redirections. */
+extern Addr VG_(redir_do_lookup) ( Addr orig, Bool* isWrap );
=20
=20
//--------------------------------------------------------------------
Modified: branches/FNWRAP/include/pub_tool_redir.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/FNWRAP/include/pub_tool_redir.h 2005-12-27 15:02:50 UTC (rev=
5452)
+++ branches/FNWRAP/include/pub_tool_redir.h 2005-12-27 16:40:35 UTC (rev=
5453)
@@ -31,12 +31,32 @@
#ifndef __PUB_TOOL_REDIR_H
#define __PUB_TOOL_REDIR_H
=20
-/* The following macros facilitate function redirection (redirects).
+/* The following macros facilitate function replacement and wrapping.
=20
- The general idea is: you can write a function like this:
+ Function wrapping and function replacement are similar but not
+ identical.
=20
+ A replacement for some function F simply diverts all calls to F
+ to the stated replacement. There is no way to get back to F itself
+ from the replacement.
+
+ A wrapper for a function F causes all calls to F to instead go to
+ the wrapper. However, from inside the wrapper, it is possible
+ (with some difficulty) to get to F itself.
+
+ You may notice that replacement is a special case of wrapping, in
+ which the call to the original is omitted. For implementation
+ reasons, though, it is important to use the following macros
+ correctly: in particular, if you want to write a replacement, make
+ sure you use the VG_REPLACE_FN_ macros and not the VG_WRAP_FN_
+ macros.
+
+ Replacement
+ ~~~~~~~~~~~
+ To write a replacement function, do this:
+
ret_type=20
- VG_REDIRECT_FUNCTION_ZU(zEncodedSoname,fnname) ( .. args .. )
+ VG_REPLACE_FUNCTION_ZU(zEncodedSoname,fnname) ( .. args .. )
{
... body ...
}
@@ -51,7 +71,7 @@
It is also possible to write
=20
ret_type=20
- VG_REDIRECT_FUNCTION_ZZ(zEncodedSoname,zEncodedFnname) ( .. args .=
. )
+ VG_REPLACE_FUNCTION_ZZ(zEncodedSoname,zEncodedFnname) ( .. args ..=
)
{
... body ...
}
@@ -92,6 +112,18 @@
underscores, since the intercept-handlers in m_redir.c detect the
end of the soname by looking for the first trailing underscore.
=20
+ Wrapping
+ ~~~~~~~~
+ This is identical to replacement, except that you should use the
+ macro names
+
+ VG_WRAP_FUNCTION_ZU
+ VG_WRAP_FUNCTION_ZZ
+
+ instead.
+
+ Z-encoding
+ ~~~~~~~~~~
Z-encoding details: the scheme is like GHC's. It is just about
readable enough to make a preprocessor unnecessary. First the
"_vgrZU_" or "_vgrZZ_" prefix is added, and then the following
@@ -112,11 +144,14 @@
=20
/* If you change these, the code in VG_(maybe_Z_demangle) needs to be
changed accordingly. NOTE: duplicates
- I_REPLACE_SONAME_FNNAME_Z{U,Z} in valgrind.h. */
-#define VG_REDIRECT_FUNCTION_ZU(soname,fnname) _vgrZU_##soname##_##fnnam=
e
-#define VG_REDIRECT_FUNCTION_ZZ(soname,fnname) _vgrZZ_##soname##_##fnnam=
e
+ I_{WRAP,REPLACE}_SONAME_FNNAME_Z{U,Z} in valgrind.h. */
=20
+#define VG_REPLACE_FUNCTION_ZU(soname,fnname) _vgrZU_##soname##_##fnname
+#define VG_REPLACE_FUNCTION_ZZ(soname,fnname) _vgrZZ_##soname##_##fnname
=20
+#define VG_WRAP_FUNCTION_ZU(soname,fnname) _vgwZU_##soname##_##fnname
+#define VG_WRAP_FUNCTION_ZZ(soname,fnname) _vgwZZ_##soname##_##fnname
+
#endif // __PUB_TOOL_REDIR_H
=20
/*--------------------------------------------------------------------*/
Modified: branches/FNWRAP/include/valgrind.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/FNWRAP/include/valgrind.h 2005-12-27 15:02:50 UTC (rev 5452)
+++ branches/FNWRAP/include/valgrind.h 2005-12-27 16:40:35 UTC (rev 5453)
@@ -138,8 +138,8 @@
_zzq_args[4] =3D (volatile unsigned long long)(_zzq_arg4); \
__asm__ volatile("roll $29, %%eax ; roll $3, %%eax\n\t" \
"rorl $27, %%eax ; rorl $5, %%eax\n\t" \
- "roll $13, %%eax ; roll $19, %%eax" \
- : "=3Dd" (_zzq_rlval) \
+ "roll $13, %%eax ; roll $19, %%eax" \
+ : "=3Dd" (_zzq_rlval) \
: "a" (&_zzq_args[0]), "0" (_zzq_default) \
: "cc", "memory" \
); \
@@ -248,7 +248,7 @@
typedef
enum { VG_USERREQ__RUNNING_ON_VALGRIND =3D 0x1001,
VG_USERREQ__DISCARD_TRANSLATIONS =3D 0x1002,
- VG_USERREQ__PUSH_NRADDR =3D 0x1003,
+ VG_USERREQ__GET_NRADDR =3D 0x1003,
=20
/* These allow any function to be called from the
simulated CPU but run on the real CPU.
@@ -315,33 +315,14 @@
that the next entry by this thread into a redirected translation
whose address is on top of the stack will instead to jump to the
non-redirected version. Returns 0 if success, 1 if failure. */
-#define VALGRIND_PUSH_NRADDR(_qzz_addr,_qzz_check) __extension__ \
+#define VALGRIND_GET_NRADDR __extension__ \
({unsigned long _qzz_res; \
VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0/*native result*/, \
- VG_USERREQ__PUSH_NRADDR, \
- _qzz_addr, _qzz_check, 0, 0); \
- _qzz_res; \
+ VG_USERREQ__GET_NRADDR, \
+ 0, 0, 0, 0); \
+ (void*)_qzz_res; \
})
=20
-#define VALGRIND_PUSH_NRADDR_AND_CHECK(_addr) \
- /* Always use this one -- it's safer. */ \
- do { \
- extern void exit(int); \
- long _r =3D VALGRIND_PUSH_NRADDR(_addr,1); \
- if (_r) { \
- VALGRIND_PRINTF_BACKTRACE( \
- "Valgrind: function wrapping: " \
- "redirect stack is full. Program halted."); \
- exit(1); \
- } \
- } while (0)
-#define VALGRIND_PUSH_NRADDR_NO_CHECK(_addr) \
- /* Don't use this. This is a horrible kludge for libpthread. */ \
- do { \
- (void) VALGRIND_PUSH_NRADDR(_addr,0); \
- } while (0)
-
-
#ifdef NVALGRIND
=20
#define VALGRIND_PRINTF(...)
@@ -560,13 +541,13 @@
/* ---------------------------------------------------------- */
=20
/* Use these to write the name of your wrapper. NOTE: duplicates
- VG_REDIRECT_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+ VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
=20
-#define I_REPLACE_SONAME_FNNAME_ZU(soname,fnname) \
- _vgrZU_##soname##_##fnname
+#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
+ _vgwZU_##soname##_##fnname
=20
-#define I_REPLACE_SONAME_FNNAME_ZZ(soname,fnname) \
- _vgrZZ_##soname##_##fnname
+#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
+ _vgwZZ_##soname##_##fnname
=20
/* Use these inside the wrapper, to make calls to the function you are
wrapping. You must use these - calling originals directly will get
@@ -607,4 +588,137 @@
lval =3D _lval; \
} while (0)
=20
+/* Generates a magic call-noredir *%eax "insn" */
+#define __CALL_NOREDIR_EAX \
+ /* "call-noredir *%eax" */ \
+ "rorl $28, %%eax ; rorl $4, %%eax\n\t" \
+ "roll $26, %%eax ; roll $6, %%eax\n\t" \
+ "rorl $12, %%eax ; rorl $20, %%eax\n\t" \
+ "call *%%eax\n\t" \
+
+/* x86: regs trashed by the hidden call. No need to mention eax as
+ gcc can already see that, plus causes gcc to bomb. */
+#define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx"
+
+/* Rename _GET_NRADDR to something that is meaningful to people
+ writing wrappers. Used within a wrapper function, gets the address
+ of the original function, which needs to be supplied the CALL_FN_
+ macros below. */
+#define VALGRIND_GET_ORIG_FN VALGRIND_GET_NRADDR
+
+#define CALL_FN_W_v(lval, fnptr) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[1]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ __asm__ volatile( \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ __CALL_NOREDIR_EAX \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, fnptr, arg1) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[2]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ __asm__ volatile( \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ __CALL_NOREDIR_EAX \
+ "addl $4, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, fnptr, arg1,arg2) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[3]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ __asm__ volatile( \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ __CALL_NOREDIR_EAX \
+ "addl $8, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWWW(lval, fnptr, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[6]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ _argvec[3] =3D (long)(arg3); \
+ _argvec[4] =3D (long)(arg4); \
+ _argvec[5] =3D (long)(arg5); \
+ __asm__ volatile( \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ __CALL_NOREDIR_EAX \
+ "addl $20, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWWWWW(lval, fnptr, arg1,arg2,arg3,arg4,arg5,arg6,arg=
7) \
+ do { \
+ void* _fnptr =3D (fnptr); \
+ long _argvec[8]; \
+ long _res; \
+ _argvec[0] =3D (long)_fnptr; \
+ _argvec[1] =3D (long)(arg1); \
+ _argvec[2] =3D (long)(arg2); \
+ _argvec[3] =3D (long)(arg3); \
+ _argvec[4] =3D (long)(arg4); \
+ _argvec[5] =3D (long)(arg5); \
+ _argvec[6] =3D (long)(arg6); \
+ _argvec[7] =3D (long)(arg7); \
+ __asm__ volatile( \
+ "pushl 28(%%eax)\n\t" \
+ "pushl 24(%%eax)\n\t" \
+ "pushl 20(%%eax)\n\t" \
+ "pushl 16(%%eax)\n\t" \
+ "pushl 12(%%eax)\n\t" \
+ "pushl 8(%%eax)\n\t" \
+ "pushl 4(%%eax)\n\t" \
+ "movl (%%eax), %%eax\n\t" /* target->%eax */ \
+ __CALL_NOREDIR_EAX \
+ "addl $28, %%esp\n" \
+ : /*out*/ "=3Da" (_res) \
+ : /*in*/ "a" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ ); \
+ lval =3D (__typeof__(lval)) _res; \
+ } while (0)
+
+
#endif /* __VALGRIND_H */
Modified: branches/FNWRAP/memcheck/mac_replace_strmem.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/FNWRAP/memcheck/mac_replace_strmem.c 2005-12-27 15:02:50 UTC=
(rev 5452)
+++ branches/FNWRAP/memcheck/mac_replace_strmem.c 2005-12-27 16:40:35 UTC=
(rev 5453)
@@ -124,8 +124,8 @@
=20
=20
#define STRRCHR(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname)( const char* s, int c );=
\
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname)( const char* s, int c ) =
\
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* s, int c ); =
\
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* s, int c ) \
{ \
UChar ch =3D (UChar)((UInt)c); \
UChar* p =3D (UChar*)s; \
@@ -144,8 +144,8 @@
=20
=20
#define STRCHR(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( const char* s, int c )=
; \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( const char* s, int c )=
\
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c );=
\
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ) =
\
{ \
UChar ch =3D (UChar)((UInt)c); \
UChar* p =3D (UChar*)s; \
@@ -166,8 +166,8 @@
=20
=20
#define STRCAT(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( char* dst, const char*=
src ); \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( char* dst, const char*=
src ) \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( char* dst, const char* =
src ); \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( char* dst, const char* =
src ) \
{ \
const Char* src_orig =3D src; \
Char* dst_orig =3D dst; \
@@ -190,9 +190,9 @@
=20
=20
#define STRNCAT(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( char* dst, const char* src, SizeT n ); \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( char* dst, const char* src, SizeT n ) \
{ \
const Char* src_orig =3D src; \
@@ -218,8 +218,8 @@
=20
=20
#define STRNLEN(soname, fnname) \
- SizeT VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT=
n ); \
- SizeT VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT=
n ) \
+ SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT =
n ); \
+ SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT =
n ) \
{ \
SizeT i =3D 0; \
while (i < n && str[i] !=3D 0) i++; \
@@ -234,8 +234,8 @@
// confusing if you aren't expecting it. Other small functions in this =
file
// may also be inline by gcc.
#define STRLEN(soname, fnname) \
- SizeT VG_REDIRECT_FUNCTION_ZU(soname,fnname)( const char* str ); \
- SizeT VG_REDIRECT_FUNCTION_ZU(soname,fnname)( const char* str ) \
+ SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* str ); \
+ SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* str ) \
{ \
SizeT i =3D 0; \
while (str[i] !=3D 0) i++; \
@@ -248,8 +248,8 @@
=20
=20
#define STRCPY(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( char* dst, const char=
* src ); \
- char* VG_REDIRECT_FUNCTION_ZU(soname, fnname) ( char* dst, const char=
* src ) \
+ char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char*=
src ); \
+ char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char*=
src ) \
{ \
const Char* src_orig =3D src; \
Char* dst_orig =3D dst; \
@@ -272,9 +272,9 @@
=20
=20
#define STRNCPY(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname, fnname) \
+ char* VG_REPLACE_FUNCTION_ZU(soname, fnname) \
( char* dst, const char* src, SizeT n ); \
- char* VG_REDIRECT_FUNCTION_ZU(soname, fnname) \
+ char* VG_REPLACE_FUNCTION_ZU(soname, fnname) \
( char* dst, const char* src, SizeT n ) \
{ \
const Char* src_orig =3D src; \
@@ -295,9 +295,9 @@
=20
=20
#define STRNCMP(soname, fnname) \
- int VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const char* s1, const char* s2, SizeT nmax ); \
- int VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const char* s1, const char* s2, SizeT nmax ) \
{ \
SizeT n =3D 0; \
@@ -318,9 +318,9 @@
=20
=20
#define STRCMP(soname, fnname) \
- int VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const char* s1, const char* s2 ); \
- int VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const char* s1, const char* s2 ) \
{ \
register unsigned char c1; \
@@ -342,8 +342,8 @@
=20
=20
#define MEMCHR(soname, fnname) \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (const void *s, int c, S=
izeT n); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (const void *s, int c, S=
izeT n) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const void *s, int c, Si=
zeT n); \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const void *s, int c, Si=
zeT n) \
{ \
SizeT i; \
UChar c0 =3D (UChar)c; \
@@ -357,9 +357,9 @@
=20
=20
#define MEMCPY(soname, fnname) \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( void *dst, const void *src, SizeT len ); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( void *dst, const void *src, SizeT len ) \
{ \
register char *d; \
@@ -405,9 +405,9 @@
=20
=20
#define MEMCMP(soname, fnname) \
- int VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const void *s1V, const void *s2V, SizeT n ); \
- int VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const void *s1V, const void *s2V, SizeT n ) \
{ \
int res; \
@@ -436,8 +436,8 @@
/* Copy SRC to DEST, returning the address of the terminating '\0' in
DEST. (minor variant of strcpy) */
#define STPCPY(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( char* dst, const char*=
src ); \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) ( char* dst, const char*=
src ) \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( char* dst, const char* =
src ); \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( char* dst, const char* =
src ) \
{ \
const Char* src_orig =3D src; \
Char* dst_orig =3D dst; \
@@ -462,8 +462,8 @@
=20
=20
#define MEMSET(soname, fnname) \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname)(void *s, Int c, SizeT n)=
; \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname)(void *s, Int c, SizeT n)=
\
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname)(void *s, Int c, SizeT n);=
\
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname)(void *s, Int c, SizeT n) =
\
{ \
unsigned char *cp =3D s; \
\
@@ -477,9 +477,9 @@
=20
=20
#define MEMMOVE(soname, fnname) \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(void *dstV, const void *srcV, SizeT n); \
- void* VG_REDIRECT_FUNCTION_ZU(soname,fnname) \
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(void *dstV, const void *srcV, SizeT n) \
{ \
SizeT i; \
@@ -502,8 +502,8 @@
=20
/* Find the first occurrence of C in S or the final NUL byte. */
#define GLIBC232_STRCHRNUL(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (const char* s, int c_in=
); \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (const char* s, int c_in=
) \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const char* s, int c_in)=
; \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const char* s, int c_in)=
\
{ \
unsigned char c =3D (unsigned char) c_in; \
unsigned char* char_ptr =3D (unsigned char *)s; \
@@ -519,8 +519,8 @@
=20
/* Find the first occurrence of C in S. */
#define GLIBC232_RAWMEMCHR(soname, fnname) \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (const char* s, int c_in=
); \
- char* VG_REDIRECT_FUNCTION_ZU(soname,fnname) (const char* s, int c_in=
) \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const char* s, int c_in)=
; \
+ char* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const char* s, int c_in)=
\
{ \
unsigned char c =3D (unsigned char) c_in; \
unsigned char* char_ptr =3D (unsigned char *)s; \
|
|
From: <sv...@va...> - 2005-12-27 16:39:41
|
Author: sewardj
Date: 2005-12-27 16:39:36 +0000 (Tue, 27 Dec 2005)
New Revision: 1517
Log:
Redesign and simplify function-wrapping support.
Modified:
branches/FNWRAP/priv/guest-amd64/ghelpers.c
branches/FNWRAP/priv/guest-generic/bb_to_IR.c
branches/FNWRAP/priv/guest-generic/bb_to_IR.h
branches/FNWRAP/priv/guest-ppc32/ghelpers.c
branches/FNWRAP/priv/guest-x86/ghelpers.c
branches/FNWRAP/priv/guest-x86/toIR.c
branches/FNWRAP/priv/main/vex_main.c
branches/FNWRAP/pub/libvex.h
branches/FNWRAP/pub/libvex_guest_amd64.h
branches/FNWRAP/pub/libvex_guest_ppc32.h
branches/FNWRAP/pub/libvex_guest_ppc64.h
branches/FNWRAP/pub/libvex_guest_x86.h
Modified: branches/FNWRAP/priv/guest-amd64/ghelpers.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/FNWRAP/priv/guest-amd64/ghelpers.c 2005-12-27 14:35:15 UTC (=
rev 1516)
+++ branches/FNWRAP/priv/guest-amd64/ghelpers.c 2005-12-27 16:39:36 UTC (=
rev 1517)
@@ -1931,7 +1931,6 @@
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- vex_state->guest_NRFLAG =3D 0;
vex_state->guest_NRADDR =3D 0;
}
=20
Modified: branches/FNWRAP/priv/guest-generic/bb_to_IR.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/FNWRAP/priv/guest-generic/bb_to_IR.c 2005-12-27 14:35:15 UTC=
(rev 1516)
+++ branches/FNWRAP/priv/guest-generic/bb_to_IR.c 2005-12-27 16:39:36 UTC=
(rev 1517)
@@ -61,37 +61,6 @@
=20
static Bool const_False ( Addr64 a ) { return False; }
=20
-static IRExpr* mkAnd1 ( IRType ty, IRExpr* x, IRExpr* y )
-{
- vassert(ty =3D=3D Ity_I32 || ty =3D=3D Ity_I64);
- return=20
- ty =3D=3D Ity_I32
- ? IRExpr_Unop(Iop_32to1,
- IRExpr_Binop(Iop_And32,
- IRExpr_Unop(Iop_1Uto32,x),
- IRExpr_Unop(Iop_1Uto32,y)))
- : IRExpr_Unop(Iop_64to1,
- IRExpr_Binop(Iop_And64,
- IRExpr_Unop(Iop_1Uto64,x),
- IRExpr_Unop(Iop_1Uto64,y)));
-}
-
-static IRExpr* mkOr1 ( IRType ty, IRExpr* x, IRExpr* y )
-{
- vassert(ty =3D=3D Ity_I32 || ty =3D=3D Ity_I64);
- return=20
- ty =3D=3D Ity_I32
- ? IRExpr_Unop(Iop_32to1,
- IRExpr_Binop(Iop_Or32,
- IRExpr_Unop(Iop_1Uto32,x),
- IRExpr_Unop(Iop_1Uto32,y)))
- : IRExpr_Unop(Iop_64to1,
- IRExpr_Binop(Iop_Or64,
- IRExpr_Unop(Iop_1Uto64,x),
- IRExpr_Unop(Iop_1Uto64,y)));
-}
-
-
/* Disassemble a complete basic block, starting at guest_IP_start,=20
returning a new IRBB. The disassembler may chase across basic
block boundaries if it wishes and if chase_into_ok allows it.
@@ -121,10 +90,9 @@
/*IN*/ VexArchInfo* archinfo_guest,
/*IN*/ IRType guest_word_type,
/*IN*/ Bool do_self_check,
- /*IN*/ Bool do_noredir_check,
+ /*IN*/ Bool do_set_NRADDR,
/*IN*/ Int offB_TISTART,
/*IN*/ Int offB_TILEN,
- /*IN*/ Int offB_NRFLAG,
/*IN*/ Int offB_NRADDR )
{
Long delta;
@@ -179,68 +147,13 @@
: IRConst_U64(guest_IP_bbstart);
}
=20
- if (do_noredir_check) {
+ if (do_set_NRADDR) {
guest_IP_bbstart_noredir_IRConst
=3D guest_word_type=3D=3DIty_I32=20
? IRConst_U32(toUInt(guest_IP_bbstart_noredir))
: IRConst_U64(guest_IP_bbstart_noredir);
}
=20
- /* If asked to make a noredir-check, put it before the self-check.
- The noredir-check checks whether we should be running code at
- this guest address at all, whereas the self-check establishes
- whether the translation is still valid once we've decided we
- should be here. So the noredir check comes first. */
- if (do_noredir_check) {
- /* Create this:
- tmp =3D _NRFLAG;
- _NRFLAG =3D tmp-1;
- if ( (tmp =3D=3D 1 && _NRADDR =3D=3D guest_IP_bbstart_noredir=
)
- || tmp =3D=3D 2)
- exit, request noredir xfer to guest_IP_bbstart_noredir
- _NRFLAG =3D tmp -- restores _NRFLAG to whatever it was
- */
- IRTemp tmp =3D newIRTemp(irbb->tyenv, guest_word_type);
- IRExpr* one =3D guest_word_type=3D=3DIty_I32=20
- ? IRExpr_Const(IRConst_U32(1))=20
- : IRExpr_Const(IRConst_U64(1));
- IRExpr* two =3D guest_word_type=3D=3DIty_I32=20
- ? IRExpr_Const(IRConst_U32(2))=20
- : IRExpr_Const(IRConst_U64(2));
- IROp cmpEQ =3D guest_word_type=3D=3DIty_I32 ? Iop_CmpEQ32 : Iop_Cm=
pEQ64;
- IROp opSUB =3D guest_word_type=3D=3DIty_I32 ? Iop_Sub32 : Iop_Sub6=
4;
-
- /* fetch old flag */
- addStmtToIRBB( irbb,=20
- IRStmt_Tmp( tmp,=20
- IRExpr_Get(offB_NRFLAG, guest_word_type)));
- /* flag-- */
- addStmtToIRBB( irbb,
- IRStmt_Put( offB_NRFLAG, IRExpr_Binop(opSUB, IRExpr_Tmp(tmp), o=
ne) ));
- /* exit, maybe */
- addStmtToIRBB( irbb,
- IRStmt_Exit(
- mkOr1(
- guest_word_type,
- mkAnd1( guest_word_type,
- IRExpr_Binop( cmpEQ, IRExpr_Tmp(tmp), one ),
- IRExpr_Binop(=20
- cmpEQ,=20
- IRExpr_Get(offB_NRADDR, guest_word_type),
- IRExpr_Const(guest_IP_bbstart_noredir_IRConst)
- )
- ),
- IRExpr_Binop( cmpEQ, IRExpr_Tmp(tmp), two )
- ),
- Ijk_NoRedir,
- guest_IP_bbstart_noredir_IRConst=20
- ));
- /* if we didn't exit, now need to restore the flag */
- addStmtToIRBB( irbb,
- IRStmt_Put( offB_NRFLAG, IRExpr_Tmp(tmp) ));
-
- }
-
/* If asked to make a self-checking translation, leave 5 spaces
in which to put the check statements. We'll fill them in later
when we know the length and adler32 of the area to check. */
@@ -253,6 +166,18 @@
addStmtToIRBB( irbb, IRStmt_NoOp() );
}
=20
+ /* Set guest_NRADDR if asked to. This records the unredirected
+ guest address of this bb, so that it can later be read (and so
+ used by a function wrapper to get to the function itself. */
+ if (do_set_NRADDR) {
+ /* set guest_NRADDR to guest_IP_bbstart_noredir */
+ addStmtToIRBB(=20
+ irbb,
+ IRStmt_Put( offB_NRADDR,=20
+ IRExpr_Const(guest_IP_bbstart_noredir_IRConst))
+ );
+ }
+
/* Process instructions. */
while (True) {
vassert(n_instrs < vex_control.guest_max_insns);
@@ -307,7 +232,7 @@
vassert(dres.whatNext =3D=3D Dis_StopHere
|| dres.whatNext =3D=3D Dis_Continue
|| dres.whatNext =3D=3D Dis_Resteer);
- vassert(dres.len >=3D 0 && dres.len <=3D 18);
+ vassert(dres.len >=3D 0 && dres.len <=3D 20);
if (dres.whatNext !=3D Dis_Resteer)
vassert(dres.continueAt =3D=3D 0);
=20
Modified: branches/FNWRAP/priv/guest-generic/bb_to_IR.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/FNWRAP/priv/guest-generic/bb_to_IR.h 2005-12-27 14:35:15 UTC=
(rev 1516)
+++ branches/FNWRAP/priv/guest-generic/bb_to_IR.h 2005-12-27 16:39:36 UTC=
(rev 1517)
@@ -160,10 +160,9 @@
/*IN*/ VexArchInfo* archinfo_guest,
/*IN*/ IRType guest_word_type,
/*IN*/ Bool do_self_check,
- /*IN*/ Bool do_noredir_check,
+ /*IN*/ Bool do_set_NRADDR,
/*IN*/ Int offB_TISTART,
/*IN*/ Int offB_TILEN,
- /*IN*/ Int offB_NRFLAG,
/*IN*/ Int offB_NRADDR );
=20
=20
Modified: branches/FNWRAP/priv/guest-ppc32/ghelpers.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/FNWRAP/priv/guest-ppc32/ghelpers.c 2005-12-27 14:35:15 UTC (=
rev 1516)
+++ branches/FNWRAP/priv/guest-ppc32/ghelpers.c 2005-12-27 16:39:36 UTC (=
rev 1517)
@@ -418,7 +418,6 @@
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- vex_state->guest_NRFLAG =3D 0;
vex_state->guest_NRADDR =3D 0;
}
=20
@@ -569,8 +568,7 @@
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- // vex_state->guest_NRFLAG =3D 0;
- //vex_state->guest_NRADDR =3D 0;
+ vex_state->guest_NRADDR =3D 0;
}
=20
=20
Modified: branches/FNWRAP/priv/guest-x86/ghelpers.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/FNWRAP/priv/guest-x86/ghelpers.c 2005-12-27 14:35:15 UTC (re=
v 1516)
+++ branches/FNWRAP/priv/guest-x86/ghelpers.c 2005-12-27 16:39:36 UTC (re=
v 1517)
@@ -2226,7 +2226,6 @@
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- vex_state->guest_NRFLAG =3D 0;
vex_state->guest_NRADDR =3D 0;
}
=20
Modified: branches/FNWRAP/priv/guest-x86/toIR.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/FNWRAP/priv/guest-x86/toIR.c 2005-12-27 14:35:15 UTC (rev 15=
16)
+++ branches/FNWRAP/priv/guest-x86/toIR.c 2005-12-27 16:39:36 UTC (rev 15=
17)
@@ -7031,6 +7031,42 @@
}
}
=20
+ /* Spot the even-more-magical "call-noredir *%eax" sequence, and
+ treat it as a normal "call *%eax", except that the jump itself
+ is marked NoRedir. */
+ {
+ UChar* code =3D (UChar*)(guest_code + delta);
+ /* Spot this:
+ C1C81C rorl $28, %eax
+ C1C804 rorl $4, %eax
+ C1C01A roll $26, %eax
+ C1C006 roll $6, %eax
+ C1C80C rorl $12, %eax
+ C1C814 rorl $20, %eax
+ FFD0 call *%eax
+ */
+ if (code[ 0] =3D=3D 0xC1 && code[ 1] =3D=3D 0xC8 && code[ 2] =3D=3D=
0x1C &&
+ code[ 3] =3D=3D 0xC1 && code[ 4] =3D=3D 0xC8 && code[ 5] =3D=3D=
0x04 &&
+ code[ 6] =3D=3D 0xC1 && code[ 7] =3D=3D 0xC0 && code[ 8] =3D=3D=
0x1A &&
+ code[ 9] =3D=3D 0xC1 && code[10] =3D=3D 0xC0 && code[11] =3D=3D=
0x06 &&
+ code[12] =3D=3D 0xC1 && code[13] =3D=3D 0xC8 && code[14] =3D=3D=
0x0C &&
+ code[15] =3D=3D 0xC1 && code[16] =3D=3D 0xC8 && code[17] =3D=3D=
0x14 &&
+ code[18] =3D=3D 0xFF && code[19] =3D=3D 0xD0
+ ) {
+ DIP("call-noredir *%%eax\n");
+ delta +=3D 20;
+ t1 =3D newTemp(Ity_I32);
+ assign(t1, getIReg(4,R_EAX));
+ t2 =3D newTemp(Ity_I32);
+ assign(t2, binop(Iop_Sub32, getIReg(4,R_ESP), mkU32(4)));
+ putIReg(4, R_ESP, mkexpr(t2));
+ storeLE( mkexpr(t2), mkU32(guest_EIP_bbstart+delta));
+ jmp_treg(Ijk_NoRedir,t1);
+ dres.whatNext =3D Dis_StopHere;
+ goto decode_success;
+ }
+ }
+
/* Skip a LOCK prefix. */
/* 2005 Jan 06: the following insns are observed to sometimes
have a LOCK prefix:
Modified: branches/FNWRAP/priv/main/vex_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/FNWRAP/priv/main/vex_main.c 2005-12-27 14:35:15 UTC (rev 151=
6)
+++ branches/FNWRAP/priv/main/vex_main.c 2005-12-27 16:39:36 UTC (rev 151=
7)
@@ -208,8 +208,8 @@
Bool (*byte_accessible) ( Addr64 ),
/* IN: debug: trace vex activity at various points */
Int traceflags,
- /* IN: should this translation do a check of guest_NOREDIR ? */
- Bool do_noredir_check
+ /* IN: should this translation set guest_NRADDR? */
+ Bool do_set_NRADDR
)
{
/* This the bundle of functions we need to do the back-end stuff
@@ -237,8 +237,7 @@
HInstrArray* vcode;
HInstrArray* rcode;
Int i, j, k, out_used, guest_sizeB;
- Int offB_TISTART, offB_TILEN;
- Int offB_NRFLAG, offB_NRADDR;
+ Int offB_TISTART, offB_TILEN, offB_NRADDR;
UChar insn_bytes[32];
IRType guest_word_type;
IRType host_word_type;
@@ -262,7 +261,6 @@
host_word_type =3D Ity_INVALID;
offB_TISTART =3D 0;
offB_TILEN =3D 0;
- offB_NRFLAG =3D 0;
offB_NRADDR =3D 0;
=20
vex_traceflags =3D traceflags;
@@ -347,7 +345,6 @@
guest_layout =3D &x86guest_layout;
offB_TISTART =3D offsetof(VexGuestX86State,guest_TISTART);
offB_TILEN =3D offsetof(VexGuestX86State,guest_TILEN);
- offB_NRFLAG =3D offsetof(VexGuestX86State,guest_NRFLAG);
offB_NRADDR =3D offsetof(VexGuestX86State,guest_NRADDR);
vassert(archinfo_guest->subarch =3D=3D VexSubArchX86_sse0
|| archinfo_guest->subarch =3D=3D VexSubArchX86_sse1
@@ -355,7 +352,6 @@
vassert(0 =3D=3D sizeof(VexGuestX86State) % 8);
vassert(sizeof( ((VexGuestX86State*)0)->guest_TISTART) =3D=3D 4=
);
vassert(sizeof( ((VexGuestX86State*)0)->guest_TILEN ) =3D=3D 4=
);
- vassert(sizeof( ((VexGuestX86State*)0)->guest_NRFLAG ) =3D=3D 4=
);
vassert(sizeof( ((VexGuestX86State*)0)->guest_NRADDR ) =3D=3D 4=
);
break;
=20
@@ -368,13 +364,11 @@
guest_layout =3D &amd64guest_layout;
offB_TISTART =3D offsetof(VexGuestAMD64State,guest_TISTART)=
;
offB_TILEN =3D offsetof(VexGuestAMD64State,guest_TILEN);
- offB_NRFLAG =3D offsetof(VexGuestAMD64State,guest_NRFLAG);
offB_NRADDR =3D offsetof(VexGuestAMD64State,guest_NRADDR);
vassert(archinfo_guest->subarch =3D=3D VexSubArch_NONE);
vassert(0 =3D=3D sizeof(VexGuestAMD64State) % 8);
vassert(sizeof( ((VexGuestAMD64State*)0)->guest_TISTART ) =3D=3D=
8);
vassert(sizeof( ((VexGuestAMD64State*)0)->guest_TILEN ) =3D=3D=
8);
- vassert(sizeof( ((VexGuestAMD64State*)0)->guest_NRFLAG ) =3D=3D=
8);
vassert(sizeof( ((VexGuestAMD64State*)0)->guest_NRADDR ) =3D=3D=
8);
break;
=20
@@ -387,7 +381,6 @@
guest_layout =3D &armGuest_layout;
offB_TISTART =3D 0; /* hack ... arm has bitrot */
offB_TILEN =3D 0; /* hack ... arm has bitrot */
- offB_NRFLAG =3D 0; /* hack ... arm has bitrot */
offB_NRADDR =3D 0; /* hack ... arm has bitrot */
vassert(archinfo_guest->subarch =3D=3D VexSubArchARM_v4);
break;
@@ -401,7 +394,6 @@
guest_layout =3D &ppc32Guest_layout;
offB_TISTART =3D offsetof(VexGuestPPC32State,guest_TISTART)=
;
offB_TILEN =3D offsetof(VexGuestPPC32State,guest_TILEN);
- offB_NRFLAG =3D offsetof(VexGuestPPC32State,guest_NRFLAG);
offB_NRADDR =3D offsetof(VexGuestPPC32State,guest_NRADDR);
vassert(archinfo_guest->subarch =3D=3D VexSubArchPPC32_I
|| archinfo_guest->subarch =3D=3D VexSubArchPPC32_FI
@@ -409,7 +401,6 @@
vassert(0 =3D=3D sizeof(VexGuestPPC32State) % 8);
vassert(sizeof( ((VexGuestPPC32State*)0)->guest_TISTART ) =3D=3D=
4);
vassert(sizeof( ((VexGuestPPC32State*)0)->guest_TILEN ) =3D=3D=
4);
- vassert(sizeof( ((VexGuestPPC32State*)0)->guest_NRFLAG ) =3D=3D=
4);
vassert(sizeof( ((VexGuestPPC32State*)0)->guest_NRADDR ) =3D=3D=
4);
break;
=20
@@ -442,10 +433,9 @@
archinfo_guest,
guest_word_type,
do_self_check,
- do_noredir_check,
+ do_set_NRADDR,
offB_TISTART,
offB_TILEN,
- offB_NRFLAG,
offB_NRADDR );
=20
vexAllocSanityCheck();
Modified: branches/FNWRAP/pub/libvex.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/FNWRAP/pub/libvex.h 2005-12-27 14:35:15 UTC (rev 1516)
+++ branches/FNWRAP/pub/libvex.h 2005-12-27 16:39:36 UTC (rev 1517)
@@ -338,8 +338,8 @@
Bool (*byte_accessible) ( Addr64 ),
/* IN: debug: trace vex activity at various points */
Int traceflags,
- /* IN: should this translation do a check of guest_NOREDIR ? */
- Bool do_noredir_check
+ /* IN: should this translation set guest_NRADDR? */
+ Bool do_set_NRADDR
);
=20
/* A subtlety re interaction between self-checking translations and
@@ -396,18 +396,19 @@
=20
ALL GUEST ARCHITECTURES
~~~~~~~~~~~~~~~~~~~~~~~
- The architecture must contain two pseudo-registers, guest_TISTART
+ The guest state must contain two pseudo-registers, guest_TISTART
and guest_TILEN. These are used to pass the address of areas of
guest code, translations of which are to be invalidated, back to
the despatcher. Both pseudo-regs must have size equal to the guest
word size.
=20
- The architecture must contain a two more pseudo-registers,
- guest_NRFLAG and guest_NRADDR, which are both guest-word-sized.
- These are tested and zeroed at the start of translations of
- redirected blocks (under LibVEX's client's control). If _NRFLAG is
- nonzero and _NRADDR equals the unredirected guest address of the
- block, then _NRFLAG is zeroed, and the block immediately exited.
+ The architecture must a third pseudo-register, guest_NRADDR, also
+ guest-word-sized. This is used to record the unredirected guest
+ address at the start of a translation whose start has been
+ redirected. By reading this pseudo-register shortly afterwards,
+ the translation can find out what the corresponding no-redirection
+ address was. Note, this is only set for wrap-style redirects, not
+ for replace-style ones.
*/
#endif /* ndef __LIBVEX_H */
=20
Modified: branches/FNWRAP/pub/libvex_guest_amd64.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/FNWRAP/pub/libvex_guest_amd64.h 2005-12-27 14:35:15 UTC (rev=
1516)
+++ branches/FNWRAP/pub/libvex_guest_amd64.h 2005-12-27 16:39:36 UTC (rev=
1517)
@@ -145,14 +145,12 @@
ULong guest_TISTART;
ULong guest_TILEN;
=20
- /* Affects behaviour on entry to redirected translations: if
- _NRFLAG ("NR", no-redirect) is nonzero and _NRADDR equals the
- unredirected guest address for this translation, will cause
- an immediate exit, requesting to execute the unredirected
- version instead. Such an exit "uses up" the setting, in that
- _NRFLAG must be reset to zero if the exit occurs, and
- unchanged if it doesn't. */
- ULong guest_NRFLAG;
+ /* Used to record the unredirected guest address at the start of
+ a translation whose start has been redirected. By reading
+ this pseudo-register shortly afterwards, the translation can
+ find out what the corresponding no-redirection address was.
+ Note, this is only set for wrap-style redirects, not for
+ replace-style ones. */
ULong guest_NRADDR;
=20
/* Padding to make it have an 8-aligned size */
Modified: branches/FNWRAP/pub/libvex_guest_ppc32.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/FNWRAP/pub/libvex_guest_ppc32.h 2005-12-27 14:35:15 UTC (rev=
1516)
+++ branches/FNWRAP/pub/libvex_guest_ppc32.h 2005-12-27 16:39:36 UTC (rev=
1517)
@@ -207,15 +207,13 @@
/* 948 */ UInt guest_TISTART;
/* 952 */ UInt guest_TILEN;
=20
- /* Affects behaviour on entry to redirected translations: if
- _NRFLAG ("NR", no-redirect) is nonzero and _NRADDR equals the
- unredirected guest address for this translation, will cause
- an immediate exit, requesting to execute the unredirected
- version instead. Such an exit "uses up" the setting, in that
- _NRFLAG must be reset to zero if the exit occurs, and
- unchanged if it doesn't. */
- /* 956 */ UInt guest_NRFLAG;
- /* 960 */ UInt guest_NRADDR;
+ /* Used to record the unredirected guest address at the start of
+ a translation whose start has been redirected. By reading
+ this pseudo-register shortly afterwards, the translation can
+ find out what the corresponding no-redirection address was.
+ Note, this is only set for wrap-style redirects, not for
+ replace-style ones. */
+ /* 956 */ UInt guest_NRADDR;
=20
/* Padding to make it have an 8-aligned size */
UInt padding;
Modified: branches/FNWRAP/pub/libvex_guest_ppc64.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/FNWRAP/pub/libvex_guest_ppc64.h 2005-12-27 14:35:15 UTC (rev=
1516)
+++ branches/FNWRAP/pub/libvex_guest_ppc64.h 2005-12-27 16:39:36 UTC (rev=
1517)
@@ -243,8 +243,16 @@
=20
/* For lwarx/stwcx.: 0 =3D=3D no reservation exists, non-0 =3D=3D =
a
reservation exists. */
- /* 2000 */ ULong guest_RESVN;
+ /* 1100 */ ULong guest_RESVN;
=20
+ /* Used to record the unredirected guest address at the start of
+ a translation whose start has been redirected. By reading
+ this pseudo-register shortly afterwards, the translation can
+ find out what the corresponding no-redirection address was.
+ Note, this is only set for wrap-style redirects, not for
+ replace-style ones. */
+ /* 1108 */ ULong guest_NRADDR;
+
/* Padding to make it have an 8-aligned size */
//UInt padding;
}
Modified: branches/FNWRAP/pub/libvex_guest_x86.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/FNWRAP/pub/libvex_guest_x86.h 2005-12-27 14:35:15 UTC (rev 1=
516)
+++ branches/FNWRAP/pub/libvex_guest_x86.h 2005-12-27 16:39:36 UTC (rev 1=
517)
@@ -208,28 +208,20 @@
/* Emulation warnings */
UInt guest_EMWARN;
=20
- /* Translation-invalidation area description. Not used on x86
- (there is no invalidate-icache insn), but needed so as to
- allow users of the library to uniformly assume that the guest
- state contains these two fields -- otherwise there is
- compilation breakage. On x86, these two fields are set to
- zero by LibVEX_GuestX86_initialise and then should be ignored
- forever thereafter. */
+ /* For clflush: record start and length of area to invalidate */
UInt guest_TISTART;
UInt guest_TILEN;
=20
- /* Affects behaviour on entry to redirected translations: if
- _NRFLAG ("NR", no-redirect) is nonzero and _NRADDR equals the
- unredirected guest address for this translation, will cause
- an immediate exit, requesting to execute the unredirected
- version instead. Such an exit "uses up" the setting, in that
- _NRFLAG must be reset to zero if the exit occurs, and
- unchanged if it doesn't. */
- UInt guest_NRFLAG;
+ /* Used to record the unredirected guest address at the start of
+ a translation whose start has been redirected. By reading
+ this pseudo-register shortly afterwards, the translation can
+ find out what the corresponding no-redirection address was.
+ Note, this is only set for wrap-style redirects, not for
+ replace-style ones. */
UInt guest_NRADDR;
=20
/* Padding to make it have an 8-aligned size */
- /*UInt padding;*/
+ UInt padding;
}
VexGuestX86State;
=20
|
|
From: <sv...@va...> - 2005-12-27 15:02:54
|
Author: sewardj
Date: 2005-12-27 15:02:50 +0000 (Tue, 27 Dec 2005)
New Revision: 5452
Log:
Update.
Modified:
trunk/docs/internals/3_1_BUGSTATUS.txt
Modified: trunk/docs/internals/3_1_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_1_BUGSTATUS.txt 2005-12-27 15:00:25 UTC (rev 5=
451)
+++ trunk/docs/internals/3_1_BUGSTATUS.txt 2005-12-27 15:02:50 UTC (rev 5=
452)
@@ -6,15 +6,15 @@
=20
TRUNK 31BRANCH BUG# WHAT
=20
-v5262 pending n-i-bz fsub 3,3,3 in ppc32 dispatcher doesn't clea=
r NaNs
-v5270 pending n-i-bz ppc32: __NR_setpriority (97)
+v5262 v5446 n-i-bz fsub 3,3,3 in ppc32 dispatcher doesn't clea=
r NaNs
+v5270 v5447 n-i-bz ppc32: __NR_{set,get}priority
pending pending 117332 missing line info with icc 8.1 (x86)
pending pending 117362 partially defined equality
pending pending 117366 amd64: 0xDD 0x7C fnstsw
pending pending 117367 amd64: 0xD9 0xF4 fxtract
-v5256 v5260 117369 amd64: __NR_getpriority (140)
-vx1482 pending 117419 ppc32: lfsu f5, -4(r11)
-vx1492 pending 117419 ppc32: fsqrt
+v5256 v5260 117369 amd64: __NR_getpriority (140)
+vx1482 vx1514 117419 ppc32: lfsu f5, -4(r11) (TODO: VERIFY 31BRA=
NCH)
+vx1492 vx1515 117419 ppc32: fsqrt (TODO: VERIFY 31BRA=
NCH)
pending wontfix n-i-bz ppc32: jm-insns doesn't do FP tests
pending wontfix 117564 __NR_clone param test (w/ partial patch)
pending pending 117936 yet another stabs-reader segfault
@@ -23,12 +23,14 @@
pending pending 118274 amd64: 0xDD #7 (fnsave)
pending pending 118466 add %r,%r mishandled by memcheck
pending pending n-i-bz VALGRIND_COUNT_LEAKS arg types (Olly Betts)
-v5429 pending n-i-bz memcheck/tests/mempool reads freed memory
+v5429 v5450 n-i-bz memcheck/tests/mempool reads freed memory
v5366/67/70 pending n-i-bz AshleyP's custom-allocator assertion
-vx1501 pending n-i-bz Dirk strict-aliasing stuff
-v5368 pending n-i-bz More space for debugger cmd line (Dan Thale=
r)
+vx1501 vx1516 n-i-bz Dirk strict-aliasing stuff
+v5368 v5448 n-i-bz More space for debugger cmd line (Dan Thale=
r)
v5378/80 v5379/81 n-i-bz Clarified leak checker output message
v5382 pending n-i-bz AshleyP's --gen-suppressions output fix
v5384 wontfix 117096 Weird errors when --log-fd=3D has invalid v=
alue
-v5396 pending n-i-bz cg_annotate's --sort option broken
+v5396 v5449 n-i-bz cg_annotate's --sort option broken=20
+ (TODO: VERIFY 31BRANCH)
+v5427 v5451 n-i-bz OSet 64-bit fastcmp bug
v5445 pending n-i-bz VG_(getgroups) fix (Shinichi Noda)
|
|
From: <sv...@va...> - 2005-12-27 15:00:34
|
Author: sewardj
Date: 2005-12-27 15:00:25 +0000 (Tue, 27 Dec 2005)
New Revision: 5451
Log:
Merge r5427 (OSet 64-bit fastcmp bug)
Modified:
branches/VALGRIND_3_1_BRANCH/cachegrind/cg_main.c
branches/VALGRIND_3_1_BRANCH/coregrind/m_oset.c
branches/VALGRIND_3_1_BRANCH/include/pub_tool_oset.h
Modified: branches/VALGRIND_3_1_BRANCH/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
--- branches/VALGRIND_3_1_BRANCH/cachegrind/cg_main.c 2005-12-27 14:52:02=
UTC (rev 5450)
+++ branches/VALGRIND_3_1_BRANCH/cachegrind/cg_main.c 2005-12-27 15:00:25=
UTC (rev 5451)
@@ -104,9 +104,9 @@
};
=20
// First compare file, then fn, then line.
-static Int cmp_CodeLoc_LineCC(void *vloc, void *vcc)
+static Word cmp_CodeLoc_LineCC(void *vloc, void *vcc)
{
- Int res;
+ Word res;
CodeLoc* a =3D (CodeLoc*)vloc;
CodeLoc* b =3D &(((LineCC*)vcc)->loc);
=20
@@ -174,7 +174,7 @@
/*--- String table operations ---*/
/*------------------------------------------------------------*/
=20
-static Int stringCmp( void* key, void* elem )
+static Word stringCmp( void* key, void* elem )
{
return VG_(strcmp)(*(Char**)key, *(Char**)elem);
}
Modified: branches/VALGRIND_3_1_BRANCH/coregrind/m_oset.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/VALGRIND_3_1_BRANCH/coregrind/m_oset.c 2005-12-27 14:52:02 U=
TC (rev 5450)
+++ branches/VALGRIND_3_1_BRANCH/coregrind/m_oset.c 2005-12-27 15:00:25 U=
TC (rev 5451)
@@ -170,13 +170,13 @@
}
=20
// Compare the first word of each element. Inlining is *crucial*.
-static inline Int fast_cmp(void* k, AvlNode* n)
+static inline Word fast_cmp(void* k, AvlNode* n)
{
- return ( *(Int*)k - *(Int*)elem_of_node(n) );
+ return ( *(Word*)k - *(Word*)elem_of_node(n) );
}
=20
// Compare a key and an element. Inlining is *crucial*.
-static inline Int slow_cmp(AvlTree* t, void* k, AvlNode* n)
+static inline Word slow_cmp(AvlTree* t, void* k, AvlNode* n)
{
return t->cmp(k, elem_of_node(n));
}
@@ -347,7 +347,7 @@
/*--- Insertion ---*/
/*--------------------------------------------------------------------*/
=20
-static inline Int cmp_key_root(AvlTree* t, AvlNode* n)
+static inline Word cmp_key_root(AvlTree* t, AvlNode* n)
{
return t->cmp
? slow_cmp(t, slow_key_of_node(t, n), t->root)
@@ -358,7 +358,7 @@
// Returns True if the depth of the tree has grown.
static Bool avl_insert(AvlTree* t, AvlNode* n)
{
- Int cmpres =3D cmp_key_root(t, n);
+ Word cmpres =3D cmp_key_root(t, n);
=20
if (cmpres < 0) {
// Insert into the left subtree.
@@ -462,7 +462,7 @@
// Find the *node* in t matching k, or NULL if not found.
static AvlNode* avl_lookup(AvlTree* t, void* k)
{
- Int cmpres;
+ Word cmpres;
AvlNode* curr =3D t->root;
=20
if (t->cmp) {
@@ -479,10 +479,10 @@
// elem_of_node because it saves about 10% on lookup time. This
// shouldn't be very dangerous because each node will have been
// checked on insertion.
- Int kk =3D *(Int*)k;
+ Word kk =3D *(Word*)k;
while (True) {
if (curr =3D=3D NULL) return NULL;
- cmpres =3D kk - *(Int*)elem_of_node_no_check(curr);
+ cmpres =3D kk - *(Word*)elem_of_node_no_check(curr);
if (cmpres < 0) curr =3D curr->left; else
if (cmpres > 0) curr =3D curr->right; else
return curr;
@@ -531,7 +531,7 @@
static Bool avl_remove(AvlTree* t, AvlNode* n)
{
Bool ch;
- Int cmpres =3D cmp_key_root(t, n);
+ Word cmpres =3D cmp_key_root(t, n);
=20
if (cmpres < 0) {
AvlTree left_subtree;
@@ -614,7 +614,7 @@
// Returns True if the depth of the tree has shrunk.
static Bool avl_removeroot(AvlTree* t)
{
- Int ch;
+ Bool ch;
AvlNode* n;
=20
if (!t->root->left) {
Modified: branches/VALGRIND_3_1_BRANCH/include/pub_tool_oset.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/VALGRIND_3_1_BRANCH/include/pub_tool_oset.h 2005-12-27 14:52=
:02 UTC (rev 5450)
+++ branches/VALGRIND_3_1_BRANCH/include/pub_tool_oset.h 2005-12-27 15:00=
:25 UTC (rev 5451)
@@ -65,9 +65,9 @@
typedef struct _OSet OSet;
typedef struct _OSetNode OSetNode;
=20
-typedef Int (*OSetCmp_t) ( void* key, void* elem );
-typedef void* (*OSetAlloc_t) ( SizeT szB );
-typedef void (*OSetFree_t) ( void* p );
+typedef Word (*OSetCmp_t) ( void* key, void* elem );
+typedef void* (*OSetAlloc_t) ( SizeT szB );
+typedef void (*OSetFree_t) ( void* p );
=20
/*--------------------------------------------------------------------*/
/*--- Creating and destroying OSets and OSet members ---*/
|
|
From: <sv...@va...> - 2005-12-27 14:52:06
|
Author: sewardj
Date: 2005-12-27 14:52:02 +0000 (Tue, 27 Dec 2005)
New Revision: 5450
Log:
Merge r5429 (fix for: memcheck/tests/mempool reads freed memory)
Modified:
branches/VALGRIND_3_1_BRANCH/coregrind/m_hashtable.c
Modified: branches/VALGRIND_3_1_BRANCH/coregrind/m_hashtable.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/VALGRIND_3_1_BRANCH/coregrind/m_hashtable.c 2005-12-27 14:46=
:50 UTC (rev 5449)
+++ branches/VALGRIND_3_1_BRANCH/coregrind/m_hashtable.c 2005-12-27 14:52=
:02 UTC (rev 5450)
@@ -234,11 +234,12 @@
=20
void VG_(HT_destruct)(VgHashTable table)
{
- UInt i;
- VgHashNode* node;
+ UInt i;
+ VgHashNode *node, *node_next;
=20
for (i =3D 0; i < table->n_chains; i++) {
- for (node =3D table->chains[i]; node !=3D NULL; node =3D node->nex=
t) {
+ for (node =3D table->chains[i]; node !=3D NULL; node =3D node_next=
) {
+ node_next =3D node->next;
VG_(free)(node);
}
}
|
|
From: <sv...@va...> - 2005-12-27 14:46:55
|
Author: sewardj
Date: 2005-12-27 14:46:50 +0000 (Tue, 27 Dec 2005)
New Revision: 5449
Log:
Merge r5396 (fix for: cg_annotate's --sort option broken). Needs check.
Modified:
branches/VALGRIND_3_1_BRANCH/cachegrind/cg_annotate.in
Modified: branches/VALGRIND_3_1_BRANCH/cachegrind/cg_annotate.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/VALGRIND_3_1_BRANCH/cachegrind/cg_annotate.in 2005-12-27 14:=
43:31 UTC (rev 5448)
+++ branches/VALGRIND_3_1_BRANCH/cachegrind/cg_annotate.in 2005-12-27 14:=
46:50 UTC (rev 5449)
@@ -1,9 +1,7 @@
-#! @PERL@ -w
+#! @PERL@
=20
##--------------------------------------------------------------------##
-##--- The cache simulation framework: instrumentation, recording ---##
-##--- and results printing. ---##
-##--- cg_annotate.in ---##
+##--- Cachegrind's annotator. cg_annotate.in ---##
##--------------------------------------------------------------------##
=20
# This file is part of Cachegrind, a Valgrind tool for cache
@@ -30,10 +28,53 @@
# The GNU General Public License is contained in the file COPYING.
=20
#-----------------------------------------------------------------------=
-----
-# Annotator for cachegrind.=20
-#
-# File format is described in /docs/techdocs.html.
-#
+# The file format is simple, basically printing the cost centre for ever=
y
+# source line, grouped by files and functions:
+#=20
+# file ::=3D desc_line* cmd_line events_line data_line+ summar=
y_line
+# desc_line ::=3D "desc:" ws? non_nl_string
+# cmd_line ::=3D "cmd:" ws? cmd
+# events_line ::=3D "events:" ws? (event ws)+
+# data_line ::=3D file_line | fn_line | count_line
+# file_line ::=3D ("fl=3D" | "fi=3D" | "fe=3D") filename
+# fn_line ::=3D "fn=3D" fn_name
+# count_line ::=3D line_num ws? (count ws)+
+# summary_line ::=3D "summary:" ws? (count ws)+
+# count ::=3D num | "."
+#=20
+# where
+# 'non_nl_string' is any string not containing a newline.
+# 'cmd' is a string holding the command line of the profiled program.
+# 'filename' and 'fn_name' are strings.
+# 'num' and 'line_num' are decimal integers.
+# 'ws' is whitespace.
+#=20
+# The contents of the "desc:" lines are printed out at the top
+# of the summary. This is a generic way of providing simulation
+# specific information, eg. for giving the cache configuration for
+# cache simulation.
+#=20
+# Counts can be "." to represent "N/A", eg. the number of write misses f=
or an
+# instruction that doesn't write to memory.
+#=20
+# The number of counts in each 'line' and the 'summary_line' should not =
exceed
+# the number of events in the 'event_line'. If the number in each 'line=
' is
+# less, cg_annotate treats those missing as though they were a "." entry=
.
+#=20
+# A 'file_line' changes the current file name. A 'fn_line' changes the
+# current function name. A 'count_line' contains counts that pertain to=
the
+# current filename/fn_name. A 'file_line' and a 'fn_line' must appear
+# before any 'count_line's to give the context of the first 'count_line'=
.
+#=20
+# Each 'file_line' should be immediately followed by a 'fn_line'. "fi=3D=
"
+# 'file_lines' are used to switch filenames for inlined functions; "fe=3D=
"
+# 'file_lines' are similar, but are put at the end of a basic block in w=
hich
+# the file name hasn't been switched back to the original file name. (f=
i
+# and fe lines behave the same, they are only distinguished to help
+# debugging.) [Nb: "fi=3D" and "fe=3D" have not been produced by Cacheg=
rind for
+# some time, they are no longer necessary.]
+
+#-----------------------------------------------------------------------=
-----
# Performance improvements record, using cachegrind.out for cacheprof, d=
oing no
# source annotation (irrelevant ones removed):
# user tim=
e
@@ -57,6 +98,7 @@
#16. Finding count lengths by int((length-1)/3), not by
# commifying (halves the number of commify calls) 1.68s --=
> 1.47s
=20
+use warnings;
use strict;
=20
#-----------------------------------------------------------------------=
-----
@@ -187,19 +229,26 @@
@show_events =3D split(/,/, $1);
=20
# --sort=3DA,B,C
+ # Nb: You can specify thresholds individually, eg.
+ # --sort=3DA:99,B:95,C:90. These will override any --thre=
shold
+ # argument.
} elsif ($arg =3D~ /^--sort=3D(.*)$/) {
@sort_events =3D split(/,/, $1);
+ my $th_specified =3D 0;
foreach my $i (0 .. scalar @sort_events - 1) {
- if ($sort_events[$i] =3D~#/.*:(\d+)$/) {
- /.*:([\d\.]+)%?$/) {
+ if ($sort_events[$i] =3D~ /.*:([\d\.]+)%?$/) {
my $th =3D $1;
($th >=3D 0 && $th <=3D 100) or die($usage);
$sort_events[$i] =3D~ s/:.*//;
$thresholds[$i] =3D $th;
+ $th_specified =3D 1;
} else {
$thresholds[$i] =3D 0;
}
}
+ if (not $th_specified) {
+ @thresholds =3D ();
+ }
=20
# --threshold=3DX (tolerates a trailing '%')
} elsif ($arg =3D~ /^--threshold=3D([\d\.]+)%?$/) {
|
|
From: <sv...@va...> - 2005-12-27 14:43:34
|
Author: sewardj
Date: 2005-12-27 14:43:31 +0000 (Tue, 27 Dec 2005)
New Revision: 5448
Log:
Merge r5368 (More space for debugger cmd line (Dan Thaler))
Modified:
branches/VALGRIND_3_1_BRANCH/coregrind/m_debugger.c
Modified: branches/VALGRIND_3_1_BRANCH/coregrind/m_debugger.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/VALGRIND_3_1_BRANCH/coregrind/m_debugger.c 2005-12-27 14:06:=
03 UTC (rev 5447)
+++ branches/VALGRIND_3_1_BRANCH/coregrind/m_debugger.c 2005-12-27 14:43:=
31 UTC (rev 5448)
@@ -36,6 +36,7 @@
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
#include "pub_core_libcsignal.h"
+#include "pub_core_libcassert.h"
#include "pub_core_options.h"
=20
=20
@@ -142,9 +143,10 @@
continue, quit the debugger. */
void VG_(start_debugger) ( ThreadId tid )
{
- Int pid;
+# define N_BUF 4096
+ Int pid;
=20
- if ((pid =3D VG_(fork)()) =3D=3D 0) {
+ if ((pid =3D VG_(fork)()) =3D=3D 0) {
VG_(ptrace)(VKI_PTRACE_TRACEME, 0, NULL, NULL);
VG_(kill)(VG_(getpid)(), VKI_SIGSTOP);
=20
@@ -159,8 +161,8 @@
VG_(ptrace)(VKI_PTRACE_DETACH, pid, NULL, 0) =3D=3D 0)
{
Char pidbuf[15];
- Char file[30];
- Char buf[100];
+ Char file[50];
+ Char buf[N_BUF];
Char *bufptr;
Char *cmdptr;
=20
@@ -171,6 +173,10 @@
cmdptr =3D VG_(clo_db_command);
=20
while (*cmdptr) {
+ /* each iteration can advance bufptr by at most the length
+ of file[], so the following assertion is generously
+ over-paranoid. */
+ vg_assert(bufptr - buf < N_BUF-15-50-10/*paranoia*/);
switch (*cmdptr) {
case '%':
switch (*++cmdptr) {
@@ -179,20 +185,21 @@
bufptr +=3D VG_(strlen)(file);
cmdptr++;
break;
- case 'p':
- VG_(memcpy)(bufptr, pidbuf, VG_(strlen)(pidbuf));
- bufptr +=3D VG_(strlen)(pidbuf);
- cmdptr++;
- break;
- default:
- *bufptr++ =3D *cmdptr++;
- break;
+ case 'p':
+ VG_(memcpy)(bufptr, pidbuf, VG_(strlen)(pidbuf))=
;
+ bufptr +=3D VG_(strlen)(pidbuf);
+ cmdptr++;
+ break;
+ default:
+ *bufptr++ =3D *cmdptr++;
+ break;
}
break;
default:
*bufptr++ =3D *cmdptr++;
break;
}
+ vg_assert(bufptr - buf < N_BUF-15-50-10/*paranoia*/);
}
=20
*bufptr++ =3D '\0';
@@ -212,6 +219,7 @@
VG_(kill)(pid, VKI_SIGKILL);
VG_(waitpid)(pid, &status, 0);
}
+# undef N_BUF
}
=20
=20
|
|
From: <sv...@va...> - 2005-12-27 14:35:18
|
Author: sewardj
Date: 2005-12-27 14:35:15 +0000 (Tue, 27 Dec 2005)
New Revision: 1516
Log:
Merge vx1501 (strict-aliasing fix)
Modified:
branches/VEX_3_1_BRANCH/priv/ir/irdefs.c
Modified: branches/VEX_3_1_BRANCH/priv/ir/irdefs.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/VEX_3_1_BRANCH/priv/ir/irdefs.c 2005-12-27 14:30:46 UTC (rev=
1515)
+++ branches/VEX_3_1_BRANCH/priv/ir/irdefs.c 2005-12-27 14:35:15 UTC (rev=
1516)
@@ -75,13 +75,16 @@
=20
void ppIRConst ( IRConst* con )
{
+ vassert(sizeof(ULong) =3D=3D sizeof(Double));
+ union { ULong i64; Double f64; } u;
switch (con->tag) {
case Ico_U1: vex_printf( "%d:I1", con->Ico.U1 ? 1 : 0); b=
reak;
case Ico_U8: vex_printf( "0x%x:I8", (UInt)(con->Ico.U8)); b=
reak;
case Ico_U16: vex_printf( "0x%x:I16", (UInt)(con->Ico.U16)); =
break;
case Ico_U32: vex_printf( "0x%x:I32", (UInt)(con->Ico.U32)); =
break;
case Ico_U64: vex_printf( "0x%llx:I64", (ULong)(con->Ico.U64));=
break;
- case Ico_F64: vex_printf( "F64{0x%llx}", *(ULong*)(&con->Ico.F64=
));
+ case Ico_F64: u.f64 =3D con->Ico.F64;
+ vex_printf( "F64{0x%llx}", u.i64);
break;
case Ico_F64i: vex_printf( "F64i{0x%llx}", con->Ico.F64i); break;
case Ico_V128: vex_printf( "V128{0x%04x}", (UInt)(con->Ico.V128));=
break;
|
|
From: <sv...@va...> - 2005-12-27 14:30:49
|
Author: sewardj
Date: 2005-12-27 14:30:46 +0000 (Tue, 27 Dec 2005)
New Revision: 1515
Log:
Merge vx1492 (fix for: ppc32: fsqrt). Needs verification.
Modified:
branches/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.c
Modified: branches/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.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/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.c 2005-12-27 14:22:25 U=
TC (rev 1514)
+++ branches/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.c 2005-12-27 14:30:46 U=
TC (rev 1515)
@@ -4340,6 +4340,16 @@
binop(Iop_AddF64, mkexpr(frA), mkexpr(frB)) ));
break;
=20
+ case 0x16: // fsqrt (Floating SqRt (Double-Precision), PPC32 p427)
+ if (frA_addr !=3D 0 || frC_addr !=3D 0) {
+ vex_printf("dis_fp_arith(PPC32)(instr,fsqrt)\n");
+ return False;
+ }
+ DIP("fsqrt%s fr%u,fr%u\n", flag_rC ? "." : "",
+ frD_addr, frB_addr);
+ assign( frD, unop( Iop_SqrtF64, mkexpr(frB) ) );
+ break;
+
//zz case 0x16: // fsqrts (Floating SqRt (Single-Precision), PPC32=
p428)
//zz if (frA_addr !=3D 0 || frC_addr !=3D 0) {
//zz vex_printf("dis_fp_arith(PPC32)(instr,fsqrts)\n");
|
|
From: <sv...@va...> - 2005-12-27 14:22:34
|
Author: sewardj
Date: 2005-12-27 14:22:25 +0000 (Tue, 27 Dec 2005)
New Revision: 1514
Log:
Merge vx1482 (fix for: ppc32: lfsu f5, -4(r11) and various others)
Modified:
branches/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.c
Modified: branches/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.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/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.c 2005-12-26 19:33:55 U=
TC (rev 1513)
+++ branches/VEX_3_1_BRANCH/priv/guest-ppc32/toIR.c 2005-12-27 14:22:25 U=
TC (rev 1514)
@@ -54,6 +54,12 @@
- lvxl,stvxl: load/store with 'least recently used' hint
- vexptefp, vlogefp
=20
+ Floating Point
+ - Single precision stores are rounded twice - once by F64toF32,
+ and then again by the backend for storeBE( F32 ), giving a loss
+ of precision.
+
+
LIMITATIONS:
=20
Various, including:
@@ -4062,16 +4068,16 @@
putFReg( frD_addr, unop(Iop_F32toF64, loadBE(Ity_F32, mkexpr(EA)))=
);
break;
=20
-//zz case 0x31: // lfsu (Load Float Single with Update, PPC32 p442)
-//zz if (rA_addr =3D=3D 0) {
-//zz vex_printf("dis_fp_load(PPC32)(instr,lfsu)\n");
-//zz return False;
-//zz }
-//zz DIP("lfsu fr%d,%d(r%d)\n", frD_addr, d_simm16, rA_addr);
-//zz assign( EA, binop(Iop_Add32, mkU32(d_simm16), mkexpr(rA)) );
-//zz putFReg( frD_addr, unop(Iop_F32toF64, loadBE(Ity_F32, mkexpr(=
EA))) );
-//zz putIReg( rA_addr, mkexpr(EA) );
-//zz break;
+ case 0x31: // lfsu (Load Float Single with Update, PPC32 p442)
+ if (rA_addr =3D=3D 0) {
+ vex_printf("dis_fp_load(PPC32)(instr,lfsu)\n");
+ return False;
+ }
+ DIP("lfsu fr%u,%d(r%u)\n", frD_addr, d_simm16, rA_addr);
+ assign( EA, binop(Iop_Add32, mkU32(d_simm16), mkexpr(rA_or_0)) );
+ putFReg( frD_addr, unop(Iop_F32toF64, loadBE(Ity_F32, mkexpr(EA)))=
);
+ putIReg( rA_addr, mkexpr(EA) );
+ break;
=20
case 0x32: // lfd (Load Float Double, PPC32 p437)
DIP("lfd fr%d,%d(r%d)\n", frD_addr, d_simm16, rA_addr);
@@ -4181,17 +4187,17 @@
binop(Iop_F64toF32, get_roundingmode(), mkexpr(frS)) );
break;
=20
-//zz case 0x35: // stfsu (Store Float Single with Update, PPC32 p519)
-//zz if (rA_addr =3D=3D 0) {
-//zz vex_printf("dis_fp_store(PPC32)(instr,stfsu)\n");
-//zz return False;
-//zz }
-//zz DIP("stfsu fr%d,%d(r%d)\n", frS_addr, d_simm16, rA_addr);
-//zz assign( EA, binop(Iop_Add32, mkU32(d_simm16), mkexpr(rA)) );
-//zz storeBE( mkexpr(EA),
-//zz binop(Iop_F64toF32, get_roundingmode(), mkexpr(frS))=
);
-//zz putIReg( rA_addr, mkexpr(EA) );
-//zz break;
+ case 0x35: // stfsu (Store Float Single with Update, PPC32 p519)
+ if (rA_addr =3D=3D 0) {
+ vex_printf("dis_fp_store(PPC32)(instr,stfsu)\n");
+ return False;
+ }
+ DIP("stfsu fr%u,%d(r%u)\n", frS_addr, d_simm16, rA_addr);
+ assign( EA, binop(Iop_Add32, mkU32(d_simm16), mkexpr(rA_or_0)) );
+ storeBE( mkexpr(EA),
+ binop(Iop_F64toF32, get_roundingmode(), mkexpr(frS)) );
+ putIReg( rA_addr, mkexpr(EA) );
+ break;
=20
case 0x36: // stfd (Store Float Double, PPC32 p513)
DIP("stfd fr%d,%d(r%d)\n", frS_addr, d_simm16, rA_addr);
@@ -4217,25 +4223,25 @@
}
=20
switch(opc2) {
- case 0x297: // stfsx (Store Float Single Indexed, PPC32 p521)
- DIP("stfsx fr%d,r%d,r%d\n", frS_addr, rA_addr, rB_addr);
- assign( EA, binop(Iop_Add32, mkexpr(rB), mkexpr(rA_or_0)) );
- storeBE( mkexpr(EA),
- binop(Iop_F64toF32, get_roundingmode(), mkexpr(frS)=
) );
- break;
+ case 0x297: // stfsx (Store Float Single Indexed, PPC32 p521)
+ DIP("stfsx fr%u,r%u,r%u\n", frS_addr, rA_addr, rB_addr);
+ assign( EA, binop(Iop_Add32, mkexpr(rB), mkexpr(rA_or_0)) );
+ storeBE( mkexpr(EA),
+ binop(Iop_F64toF32, get_roundingmode(), mkexpr(frS)) )=
;
+ break;
+ =20
+ case 0x2B7: // stfsux (Store Float Single with Update Indexed, PPC=
32 p520)
+ if (rA_addr =3D=3D 0) {
+ vex_printf("dis_fp_store(PPC32)(instr,stfsux)\n");
+ return False;
+ }
+ DIP("stfsux fr%u,r%u,r%u\n", frS_addr, rA_addr, rB_addr);
+ assign( EA, binop(Iop_Add32, mkexpr(rB), mkexpr(rA)) );
+ storeBE( mkexpr(EA),
+ binop(Iop_F64toF32, get_roundingmode(), mkexpr(frS)) )=
;
+ putIReg( rA_addr, mkexpr(EA) );
+ break;
=20
-//zz case 0x2B7: // stfsux (Store Float Single with Update Indexed=
, PPC32 p520)
-//zz if (rA_addr =3D=3D 0) {
-//zz vex_printf("dis_fp_store(PPC32)(instr,stfsux)\n");
-//zz return False;
-//zz }
-//zz DIP("stfsux fr%d,r%d,r%d\n", frS_addr, rA_addr, rB_addr);
-//zz assign( EA, binop(Iop_Add32, mkexpr(rB), mkexpr(rA)) );
-//zz storeBE( mkexpr(EA),
-//zz binop(Iop_F64toF32, get_roundingmode(), mkexpr(fr=
S)) );
-//zz putIReg( rA_addr, mkexpr(EA) );
-//zz break;
-
case 0x2D7: // stfdx (Store Float Double Indexed, PPC32 p516)
DIP("stfdx fr%d,r%d,r%d\n", frS_addr, rA_addr, rB_addr);
assign( EA, binop(Iop_Add32, mkexpr(rB), mkexpr(rA_or_0)) );
|
|
From: <sv...@va...> - 2005-12-27 14:06:14
|
Author: sewardj
Date: 2005-12-27 14:06:03 +0000 (Tue, 27 Dec 2005)
New Revision: 5447
Log:
Merge r5270 (fix for: ppc32: __NR_{set,get}priority)
Modified:
branches/VALGRIND_3_1_BRANCH/coregrind/m_syswrap/syswrap-ppc32-linux.c
branches/VALGRIND_3_1_BRANCH/coregrind/vki_unistd-ppc32-linux.h
Modified: branches/VALGRIND_3_1_BRANCH/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/VALGRIND_3_1_BRANCH/coregrind/m_syswrap/syswrap-ppc32-linux.=
c 2005-12-27 14:03:47 UTC (rev 5446)
+++ branches/VALGRIND_3_1_BRANCH/coregrind/m_syswrap/syswrap-ppc32-linux.=
c 2005-12-27 14:06:03 UTC (rev 5447)
@@ -1560,8 +1560,8 @@
GENX_(__NR_fchmod, sys_fchmod), // 94
=20
LINX_(__NR_fchown, sys_fchown16), // 95
-//.. GENX_(__NR_getpriority, sys_getpriority), // 96
-//.. GENX_(__NR_setpriority, sys_setpriority), // 97
+ GENX_(__NR_getpriority, sys_getpriority), // 96
+ GENX_(__NR_setpriority, sys_setpriority), // 97
//.. GENX_(__NR_profil, sys_ni_syscall), // 98
//.. GENXY(__NR_statfs, sys_statfs), // 99
//..=20
Modified: branches/VALGRIND_3_1_BRANCH/coregrind/vki_unistd-ppc32-linux.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/VALGRIND_3_1_BRANCH/coregrind/vki_unistd-ppc32-linux.h 2005-=
12-27 14:03:47 UTC (rev 5446)
+++ branches/VALGRIND_3_1_BRANCH/coregrind/vki_unistd-ppc32-linux.h 2005-=
12-27 14:06:03 UTC (rev 5447)
@@ -125,8 +125,8 @@
#define __NR_ftruncate 93
#define __NR_fchmod 94
#define __NR_fchown 95
-//#define __NR_getpriority 96
-//#define __NR_setpriority 97
+#define __NR_getpriority 96
+#define __NR_setpriority 97
//#define __NR_profil 98
//#define __NR_statfs 99
//#define __NR_fstatfs 100
|
|
From: <sv...@va...> - 2005-12-27 14:04:00
|
Author: sewardj
Date: 2005-12-27 14:03:47 +0000 (Tue, 27 Dec 2005)
New Revision: 5446
Log:
Merge r5262 (fix for: fsub 3,3,3 in ppc32 dispatcher doesn't clear NaNs)
Modified:
branches/VALGRIND_3_1_BRANCH/coregrind/m_dispatch/dispatch-ppc32-linux=
.S
Modified: branches/VALGRIND_3_1_BRANCH/coregrind/m_dispatch/dispatch-ppc3=
2-linux.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
--- branches/VALGRIND_3_1_BRANCH/coregrind/m_dispatch/dispatch-ppc32-linu=
x.S 2005-12-27 02:08:03 UTC (rev 5445)
+++ branches/VALGRIND_3_1_BRANCH/coregrind/m_dispatch/dispatch-ppc32-linu=
x.S 2005-12-27 14:03:47 UTC (rev 5446)
@@ -163,8 +163,8 @@
stw 3,28(1) /* spill orig guest_state ptr */
=20
/* 24(sp) used later to stop ctr reg being clobbered */
-
- /* 8:20(sp) free */
+ /* 20(sp) used later to load fpscr with zero */
+ /* 8:16(sp) free */
=09
/* Linkage Area (reserved)
4(sp) : LR
@@ -190,7 +190,14 @@
cmplwi 3,0
beq LafterFP2
=20
- fsub 3,3,3 /* generate zero */
+ /* get zero into f3 (tedious) */
+ /* note: fsub 3,3,3 is not a reliable way to do this,=20
+ since if f3 holds a NaN or similar then we don't necessarily
+ wind up with zero. */
+ li 3,0
+ stw 3,20(1)
+ lfs 3,20(1)
+ /* load f3 to fpscr (0xFF =3D all bit fields) */
mtfsf 0xFF,3
LafterFP2:
=20
|
|
From: <js...@ac...> - 2005-12-27 04:21:48
|
Nightly build on phoenix ( SuSE 10.0 ) started at 2005-12-27 03:30:02 GMT 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 == 208 tests, 5 stderr failures, 2 stdout failures ================= memcheck/tests/leak-tree (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/tls (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <to...@co...> - 2005-12-27 03:43:18
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-12-27 03:30:05 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 210 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: <sv...@va...> - 2005-12-27 02:08:08
|
Author: sewardj
Date: 2005-12-27 02:08:03 +0000 (Tue, 27 Dec 2005)
New Revision: 5445
Log:
VG_(getgroups) fix (Shinichi Noda)
Modified:
trunk/coregrind/m_libcproc.c
trunk/docs/internals/3_1_BUGSTATUS.txt
Modified: trunk/coregrind/m_libcproc.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_libcproc.c 2005-12-27 01:44:33 UTC (rev 5444)
+++ trunk/coregrind/m_libcproc.c 2005-12-27 02:08:03 UTC (rev 5445)
@@ -400,17 +400,17 @@
# if defined(VGP_x86_linux) || defined(VGP_ppc32_linux)
Int i;
SysRes sres;
- UShort list16[32];
+ UShort list16[64];
if (size < 0) return -1;
- if (size > 32) size =3D 32;
+ if (size > 64) size =3D 64;
sres =3D VG_(do_syscall2)(__NR_getgroups, size, (Addr)list16);
if (sres.isError)
return -1;
- if (sres.val !=3D size)
+ if (sres.val > size)
return -1;
- for (i =3D 0; i < size; i++)
+ for (i =3D 0; i < sres.val; i++)
list[i] =3D (UInt)list16[i];
- return size;
+ return sres.val;
=20
# elif defined(VGP_amd64_linux) || defined(VGP_ppc64_linux)
SysRes sres;
Modified: trunk/docs/internals/3_1_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_1_BUGSTATUS.txt 2005-12-27 01:44:33 UTC (rev 5=
444)
+++ trunk/docs/internals/3_1_BUGSTATUS.txt 2005-12-27 02:08:03 UTC (rev 5=
445)
@@ -31,3 +31,4 @@
v5382 pending n-i-bz AshleyP's --gen-suppressions output fix
v5384 wontfix 117096 Weird errors when --log-fd=3D has invalid v=
alue
v5396 pending n-i-bz cg_annotate's --sort option broken
+v5445 pending n-i-bz VG_(getgroups) fix (Shinichi Noda)
|
|
From: <sv...@va...> - 2005-12-27 01:44:37
|
Author: sewardj
Date: 2005-12-27 01:44:33 +0000 (Tue, 27 Dec 2005)
New Revision: 5444
Log:
Check that the two sigprocmasks haven't failed.
Modified:
trunk/coregrind/m_syswrap/syscall-amd64-linux.S
Modified: trunk/coregrind/m_syswrap/syscall-amd64-linux.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_syswrap/syscall-amd64-linux.S 2005-12-26 21:01:31 U=
TC (rev 5443)
+++ trunk/coregrind/m_syswrap/syscall-amd64-linux.S 2005-12-27 01:44:33 U=
TC (rev 5444)
@@ -109,67 +109,83 @@
=20
PUSH_di_si_dx_cx_8
=20
- movq $__NR_rt_sigprocmask, %rax // syscall #
- movq $VKI_SIG_SETMASK, %rdi // how
- movq %rdx, %rsi // sysmask
- movq %rcx, %rdx // postmask
- movq %r8, %r10 // nsigwords
- syscall
+ movq $__NR_rt_sigprocmask, %rax // syscall #
+ movq $VKI_SIG_SETMASK, %rdi // how
+ movq %rdx, %rsi // sysmask
+ movq %rcx, %rdx // postmask
+ movq %r8, %r10 // nsigwords
+ syscall
=20
POP_di_si_dx_cx_8
=09
- testl %eax, %eax
- js 5f /* sigprocmask failed */
+ testq %rax, %rax
+ js 7f /* sigprocmask failed */
=20
/* OK, that worked. Now do the syscall proper. */
=09
PUSH_di_si_dx_cx_8
=20
- movq %rsi, %rax /* rax --> VexGuestAMD64State * */
- pushq %rdi /* syscallno -> stack */
- movq OFFSET_amd64_RDI(%rax), %rdi
- movq OFFSET_amd64_RSI(%rax), %rsi
- movq OFFSET_amd64_RDX(%rax), %rdx
- movq OFFSET_amd64_R10(%rax), %r10
- movq OFFSET_amd64_R8(%rax), %r8
- movq OFFSET_amd64_R9(%rax), %r9
- popq %rax /* syscallno -> %rax */
+ movq %rsi, %rax /* rax --> VexGuestAMD64State * */
+ pushq %rdi /* syscallno -> stack */
+ movq OFFSET_amd64_RDI(%rax), %rdi
+ movq OFFSET_amd64_RSI(%rax), %rsi
+ movq OFFSET_amd64_RDX(%rax), %rdx
+ movq OFFSET_amd64_R10(%rax), %r10
+ movq OFFSET_amd64_R8(%rax), %r8
+ movq OFFSET_amd64_R9(%rax), %r9
+ popq %rax /* syscallno -> %rax */
=09
- /* If rip=3D=3D2, then the syscall was either just about
- to start, or was interrupted and the kernel was=20
- restarting it. */
-2: syscall
-3: /* In the range [3, 4), the syscall result is in %rax,=20
- but hasn't been committed to RAX. */
+ /* If rip=3D=3D2, then the syscall was either just about
+ to start, or was interrupted and the kernel was=20
+ restarting it. */
+2: syscall
+3: /* In the range [3, 4), the syscall result is in %rax,=20
+ but hasn't been committed to RAX. */
=20
POP_di_si_dx_cx_8
=20
movq %rax, OFFSET_amd64_RAX(%rsi) /* save back to RAX */
=20
-4: /* Re-block signals. If eip is in [4,5), then the syscall is complet=
e and=20
- we needn't worry about it. */
+4: /* Re-block signals. If eip is in [4,5), then the syscall=20
+ is complete and we needn't worry about it. */
+
PUSH_di_si_dx_cx_8
=20
- movq $__NR_rt_sigprocmask, %rax // syscall #
- movq $VKI_SIG_SETMASK, %rdi // how
- movq %rcx, %rsi // postmask
- xorq %rdx, %rdx // NULL
- movq %r8, %r10 // nsigwords
- syscall
+ movq $__NR_rt_sigprocmask, %rax // syscall #
+ movq $VKI_SIG_SETMASK, %rdi // how
+ movq %rcx, %rsi // postmask
+ xorq %rdx, %rdx // NULL
+ movq %r8, %r10 // nsigwords
+ syscall
=20
POP_di_si_dx_cx_8
=20
+ testq %rax, %rax
+ js 7f /* sigprocmask failed */
+
5: /* now safe from signals */
- =09
+ movq $0, %rax /* SUCCESS */
popq %r15
popq %r14
popq %r13
popq %r12
popq %rbp
popq %rbx
-#undef FSZ
ret
=20
+7: /* failure: return 0x8000 | error code */
+ negq %rax
+ andq $0x7FFF, %rax
+ orq $0x8000, %rax
+ popq %r15
+ popq %r14
+ popq %r13
+ popq %r12
+ popq %rbp
+ popq %rbx
+ ret
+#undef FSZ
+
.section .rodata
/* export the ranges so that
VG_(fixup_guest_state_after_syscall_interrupted) can do the
|
|
From: Ivan N. <in...@fa...> - 2005-12-26 22:18:05
|
Hi, I am running on a Gentoo AMD64 machine in 64 bit mode. uname -a Linux gibraltar 2.6.14-gentoo-r2 #1 Sat Dec 17 21:23:41 GMT 2005 x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux When I run make regtest I get many more errors than I used to get when I was running 32 bit mode. I was wondering if you think my configuration is wrong or if this is the expected number of errors in make regtest. I had similar results with trunk, so decided to try version 3.1 and the results are below, Thanks, Ivan > == 227 tests, 99 stderr failures, 2 stdout failures ================= > memcheck/tests/addressable (stderr) > memcheck/tests/amd64/insn_basic (stderr) > memcheck/tests/amd64/insn_fpu (stderr) > memcheck/tests/amd64/insn_mmx (stderr) > memcheck/tests/amd64/insn_sse (stderr) > memcheck/tests/amd64/insn_sse2 (stderr) > memcheck/tests/badaddrvalue (stderr) > memcheck/tests/badfree-2trace (stderr) > memcheck/tests/badfree (stderr) > memcheck/tests/badjump (stderr) > memcheck/tests/badjump2 (stderr) > memcheck/tests/badloop (stderr) > memcheck/tests/badpoll (stderr) > memcheck/tests/badrw (stderr) > memcheck/tests/brk (stderr) > memcheck/tests/brk2 (stderr) > memcheck/tests/buflen_check (stderr) > memcheck/tests/clientperm (stderr) > memcheck/tests/custom_alloc (stderr) > memcheck/tests/describe-block (stderr) > memcheck/tests/doublefree (stderr) > memcheck/tests/erringfds (stderr) > memcheck/tests/error_counts (stdout) > memcheck/tests/errs1 (stderr) > memcheck/tests/execve (stderr) > memcheck/tests/execve2 (stderr) > memcheck/tests/exitprog (stderr) > memcheck/tests/fprw (stderr) > memcheck/tests/fwrite (stderr) > memcheck/tests/inits (stderr) > memcheck/tests/inline (stderr) > memcheck/tests/leak-0 (stderr) > memcheck/tests/leak-cycle (stderr) > memcheck/tests/leak-regroot (stderr) > memcheck/tests/leak-tree (stderr) > memcheck/tests/malloc1 (stderr) > memcheck/tests/malloc2 (stderr) > memcheck/tests/malloc3 (stderr) > memcheck/tests/malloc_usable (stderr) > memcheck/tests/manuel1 (stderr) > memcheck/tests/manuel2 (stderr) > memcheck/tests/manuel3 (stderr) > memcheck/tests/match-overrun (stderr) > memcheck/tests/memalign2 (stderr) > memcheck/tests/memalign_test (stderr) > memcheck/tests/memcmptest (stderr) > memcheck/tests/mempool (stderr) > memcheck/tests/mismatches (stderr) > memcheck/tests/mmaptest (stderr) > memcheck/tests/nanoleak (stderr) > memcheck/tests/nanoleak_supp (stderr) > memcheck/tests/new_nothrow (stderr) > memcheck/tests/new_override (stderr) > memcheck/tests/null_socket (stderr) > memcheck/tests/oset_test (stderr) > memcheck/tests/overlap (stderr) > memcheck/tests/partial_load_dflt (stderr) > memcheck/tests/partial_load_ok (stderr) > memcheck/tests/partiallydefinedeq (stderr) > memcheck/tests/pipe (stderr) > memcheck/tests/pointer-trace (stderr) > memcheck/tests/post-syscall (stderr) > memcheck/tests/realloc1 (stderr) > memcheck/tests/realloc2 (stderr) > memcheck/tests/realloc3 (stderr) > memcheck/tests/sigaltstack (stderr) > memcheck/tests/sigkill (stderr) > memcheck/tests/signal2 (stderr) > memcheck/tests/sigprocmask (stderr) > memcheck/tests/stack_changes (stderr) > memcheck/tests/stack_switch (stderr) > memcheck/tests/str_tester (stderr) > memcheck/tests/strchr (stderr) > memcheck/tests/supp1 (stderr) > memcheck/tests/supp2 (stderr) > memcheck/tests/supp_unknown (stderr) > memcheck/tests/suppfree (stderr) > memcheck/tests/toobig-allocs (stderr) > memcheck/tests/trivialleak (stderr) > memcheck/tests/writev (stderr) > memcheck/tests/x86/fpeflags (stderr) > memcheck/tests/x86/insn_basic (stderr) > memcheck/tests/x86/insn_cmov (stderr) > memcheck/tests/x86/insn_fpu (stderr) > memcheck/tests/x86/insn_mmx (stderr) > memcheck/tests/x86/insn_mmxext (stderr) > memcheck/tests/x86/insn_sse (stderr) > memcheck/tests/x86/insn_sse2 (stderr) > memcheck/tests/x86/pushfpopf (stderr) > memcheck/tests/x86/scalar (stderr) > memcheck/tests/x86/scalar_exit_group (stderr) > memcheck/tests/x86/scalar_fork (stderr) > memcheck/tests/x86/scalar_supp (stderr) > memcheck/tests/x86/scalar_vfork (stderr) > memcheck/tests/x86/tronical (stderr) > memcheck/tests/xml1 (stderr) > memcheck/tests/zeropage (stderr) > none/tests/amd64/faultstatus (stderr) > none/tests/x86/faultstatus (stderr) > none/tests/x86/int (stderr) > none/tests/x86/yield (stdout) |