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: <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
|