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
(21) |
2
(18) |
3
(19) |
4
(17) |
|
5
(6) |
6
(5) |
7
(9) |
8
(21) |
9
(16) |
10
(21) |
11
(22) |
|
12
(19) |
13
(19) |
14
(8) |
15
(16) |
16
(17) |
17
(16) |
18
(33) |
|
19
(33) |
20
(34) |
21
(32) |
22
(26) |
23
(23) |
24
(16) |
25
(21) |
|
26
(19) |
27
(7) |
28
(29) |
29
(27) |
30
(55) |
|
|
|
From: <sv...@va...> - 2005-06-09 23:59:34
|
Author: sewardj
Date: 2005-06-10 00:58:36 +0100 (Fri, 10 Jun 2005)
New Revision: 3864
Log:
When printing XML, partially escape the output so that <, > and & in
C++ function names do not totally screw up XML parsers.
Modified:
trunk/coregrind/m_debuginfo/symtab.c
Modified: trunk/coregrind/m_debuginfo/symtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/symtab.c 2005-06-09 21:31:55 UTC (rev 386=
3)
+++ trunk/coregrind/m_debuginfo/symtab.c 2005-06-09 23:58:36 UTC (rev 386=
4)
@@ -2435,17 +2435,41 @@
#endif /* TEST */
=20
/* Print into buf info on code address, function name and filename */
+
+static Int putStr ( Int n, Int n_buf, Char* buf, Char* str )=20
+{
+ for (; n < n_buf-1 && *str !=3D 0; n++,str++)
+ buf[n] =3D *str;
+ buf[n] =3D '\0';
+ return n;
+}
+static Int putStrEsc ( Int n, Int n_buf, Char* buf, Char* str )=20
+{
+ Char alt[2];
+ for (; *str !=3D 0; str++) {
+ switch (*str) {
+ case '&': n =3D putStr( n, n_buf, buf, "&"); break;
+ case '<': n =3D putStr( n, n_buf, buf, "<"); break;
+ case '>': n =3D putStr( n, n_buf, buf, ">"); break;
+ default: alt[0] =3D *str;
+ alt[1] =3D 0;
+ n =3D putStr( n, n_buf, buf, alt );
+ break;
+ }
+ }
+ return n;
+}
+
Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf)
{
-#define APPEND(str) \
- { UChar* sss; \
- for (sss =3D str; n < n_buf-1 && *sss !=3D 0; n++,sss++) \
- buf[n] =3D *sss; \
- buf[n] =3D '\0'; \
- }
+# define APPEND(_str) \
+ n =3D putStr(n, n_buf, buf, _str);
+# define APPEND_ESC(_str) \
+ n =3D putStrEsc(n, n_buf, buf, _str);
+
UInt lineno;=20
UChar ibuf[50];
- UInt n =3D 0;
+ Int n =3D 0;
static UChar buf_fn[VG_ERRTXT_LEN];
static UChar buf_obj[VG_ERRTXT_LEN];
static UChar buf_srcloc[VG_ERRTXT_LEN];
@@ -2468,19 +2492,19 @@
if (know_objname) {
APPEND(maybe_newline);
APPEND("<obj>");
- APPEND(buf_obj);
+ APPEND_ESC(buf_obj);
APPEND("</obj>");
}
if (know_fnname) {
APPEND(maybe_newline);
APPEND("<fn>");
- APPEND(buf_fn);
+ APPEND_ESC(buf_fn);
APPEND("</fn>");
}
if (know_srcloc) {
APPEND(maybe_newline);
APPEND("<file>");
- APPEND(buf_srcloc);
+ APPEND_ESC(buf_srcloc);
APPEND("</file>");
APPEND(maybe_newline);
APPEND("<line>");
@@ -2522,7 +2546,8 @@
}
return buf;
=20
-#undef APPEND
+# undef APPEND
+# undef APPEND_ESC
}
=20
/* Returns True if OK. If not OK, *{ip,sp,fp}P are not changed. */
|
|
From: <sv...@va...> - 2005-06-09 21:32:31
|
Author: sewardj
Date: 2005-06-09 22:31:55 +0100 (Thu, 09 Jun 2005)
New Revision: 3863
Log:
Handle Clz64 and Ctz64.
Modified:
trunk/memcheck/mc_translate.c
Modified: trunk/memcheck/mc_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/mc_translate.c 2005-06-09 19:30:18 UTC (rev 3862)
+++ trunk/memcheck/mc_translate.c 2005-06-09 21:31:55 UTC (rev 3863)
@@ -1828,6 +1828,8 @@
case Iop_SqrtF64:
case Iop_AbsF64:
case Iop_2xm1F64:
+ case Iop_Clz64:
+ case Iop_Ctz64:
return mkPCastTo(mce, Ity_I64, vatom);
=20
case Iop_Clz32:
|
|
From: <sv...@va...> - 2005-06-09 19:30:23
|
Author: sewardj
Date: 2005-06-09 20:30:18 +0100 (Thu, 09 Jun 2005)
New Revision: 3862
Log:
Disable debugging printing. Duh.
Modified:
trunk/coregrind/m_debuginfo/dwarf.c
Modified: trunk/coregrind/m_debuginfo/dwarf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/dwarf.c 2005-06-09 19:27:25 UTC (rev 3861=
)
+++ trunk/coregrind/m_debuginfo/dwarf.c 2005-06-09 19:30:18 UTC (rev 3862=
)
@@ -1839,7 +1839,7 @@
Int this_CIE;
=20
/* --------- CIE --------- */
- if (1||VG_(clo_trace_cfi))=20
+ if (VG_(clo_trace_cfi))=20
VG_(printf)("------ new CIE (#%d of 0 .. %d) ------\n",=20
n_CIEs, N_CIEs - 1);
=20
|
|
From: <sv...@va...> - 2005-06-09 19:28:53
|
Author: sewardj
Date: 2005-06-09 20:27:25 +0100 (Thu, 09 Jun 2005)
New Revision: 3861
Log:
More CFI-reader hacking. Thus far the reader has assumed that each
FDE refers to the immediately preceding CIE, and gives up if that
isn't so. Well, that isn't so, and this commit fixes it. Now FDEs
may refer to CIEs seen arbitrarily far back. This fixes some missing
stack traces on AMD64.
Also add some comments giving a top-level sketch of how the CFI reader
works.
Modified:
trunk/coregrind/m_debuginfo/dwarf.c
Modified: trunk/coregrind/m_debuginfo/dwarf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/dwarf.c 2005-06-09 14:17:47 UTC (rev 3860=
)
+++ trunk/coregrind/m_debuginfo/dwarf.c 2005-06-09 19:27:25 UTC (rev 3861=
)
@@ -947,8 +947,10 @@
=20
=20
/* RegRule and UnwindContext are used temporarily to do the unwinding.
- The result is then summarised into a CfiSI, if possible. */
-
+ The result is then summarised into a sequence of CfiSIs, if
+ possible. UnwindContext effectively holds the state of the
+ abstract machine whilst it is running.
+*/
typedef
struct {
enum { RR_Undef, RR_Same, RR_CFAoff, RR_Reg, RR_Arch, RR_Expr } ta=
g;
@@ -1719,26 +1721,50 @@
=20
/* ------------ Main entry point for CFI reading ------------ */
=20
+typedef
+ struct {
+ /* This gives the CIE an identity to which FDEs will refer. */
+ UInt offset;
+ /* Code, data factors. */
+ Int code_a_f;
+ Int data_a_f;
+ /* Return-address pseudo-register. */
+ Int ra_reg;
+ UChar address_encoding;
+ /* Where are the instrs? Note, this are simply pointers back to
+ the transiently-mapped-in section. */
+ UChar* instrs;
+ Int ilen;
+ /* God knows .. don't ask */
+ Bool saw_z_augmentation;
+ }
+ CIE;
+
+static void init_CIE ( CIE* cie )
+{
+ cie->offset =3D 0;
+ cie->code_a_f =3D 0;
+ cie->data_a_f =3D 0;
+ cie->ra_reg =3D 0;
+ cie->address_encoding =3D 0;
+ cie->instrs =3D NULL;
+ cie->ilen =3D 0;
+ cie->saw_z_augmentation =3D False;
+}
+
+#define N_CIEs 200
+static CIE the_CIEs[N_CIEs];
+
+
void VG_(read_callframe_info_dwarf2)=20
( /*OUT*/SegInfo* si,=20
UChar* ehframe, Int ehframe_sz, Addr ehframe_addr )
{
- UnwindContext ctx, restore_ctx;
- Int nbytes;
+ Int nbytes;
HChar* how =3D NULL;
- Int cie_codeaf =3D 0;
- Int cie_dataaf =3D 0;
- Int cie_rareg =3D 0;
- Bool ok;
-
- UChar* current_cie =3D NULL;
+ Int n_CIEs =3D 0;
UChar* data =3D ehframe;
=20
- UChar* cie_instrs =3D NULL;
- Int cie_ilen =3D 0;
- Bool saw_z_augmentation =3D False;
- UChar address_encoding =3D default_Addr_encoding();
-
if (VG_(clo_trace_cfi)) {
VG_(printf)("\n-----------------------------------------------\n")=
;
VG_(printf)("CFI info: ehframe %p, ehframe_sz %d\n",
@@ -1749,6 +1775,25 @@
=20
/* Loop over CIEs/FDEs */
=20
+ /* Conceptually, the frame info is a sequence of FDEs, one for each
+ function. Inside an FDE is a miniature program for a special
+ state machine, which, when run, produces the stack-unwinding
+ info for that function.
+
+ Because the FDEs typically have much in common, and because the
+ DWARF designers appear to have been fanatical about space
+ saving, the common parts are factored out into so-called CIEs.
+ That means that what we traverse is a sequence of structs, each
+ of which is either a FDE (usually) or a CIE (occasionally).
+ Each FDE has a field indicating which CIE is the one pertaining
+ to it.
+
+ The following loop traverses the sequence. FDEs are dealt with
+ immediately; once we harvest the useful info in an FDE, it is
+ then forgotten about. By contrast, CIEs are validated and
+ dumped into an array, because later FDEs may refer to any
+ previously-seen CIE.
+ */
while (True) {
=20
/* Are we done? */
@@ -1774,8 +1819,8 @@
VG_(printf)("cie/fde.length =3D %d\n", ciefde_len);
=20
/* Apparently, if the .length field is zero, we are at the end
- of the sequence. ?? Neither the DWARF2 spec not the AMD64
- ABI spec say this, though. */
+ of the sequence. ?? Neither the DWARF2 spec not the AMD64
+ ABI spec say this, though. */
if (ciefde_len =3D=3D 0) {
if (data =3D=3D ehframe + ehframe_sz)
return;
@@ -1783,20 +1828,36 @@
goto bad;
}
=20
- UInt cie_pointer =3D read_UInt(data); data +=3D sizeof(UInt);
+ UInt cie_pointer =3D read_UInt(data);=20
+ data +=3D sizeof(UInt); /* XXX see XXX below */
if (VG_(clo_trace_cfi))=20
VG_(printf)("cie.pointer =3D %d\n", cie_pointer);
=20
/* If cie_pointer is zero, we've got a CIE; else it's an FDE. */
if (cie_pointer =3D=3D 0) {
=20
- /* Remember the start proper of the current CIE */
- current_cie =3D ciefde_start + sizeof(UInt);
+ Int this_CIE;
=20
/* --------- CIE --------- */
- if (VG_(clo_trace_cfi))=20
- VG_(printf)("------ new CIE ------\n");
+ if (1||VG_(clo_trace_cfi))=20
+ VG_(printf)("------ new CIE (#%d of 0 .. %d) ------\n",=20
+ n_CIEs, N_CIEs - 1);
=20
+ /* Allocate a new CIE record. */
+ vg_assert(n_CIEs >=3D 0 && n_CIEs <=3D N_CIEs);
+ if (n_CIEs =3D=3D N_CIEs) {
+ how =3D "N_CIEs is too low. Increase and recompile.";
+ goto bad;
+ }
+
+ this_CIE =3D n_CIEs;
+ n_CIEs++;
+ init_CIE( &the_CIEs[this_CIE] );
+
+ /* Record its offset. This is how we will find it again
+ later when looking at an FDE. */
+ the_CIEs[this_CIE].offset =3D ciefde_start - ehframe;
+
UChar cie_version =3D read_UChar(data); data +=3D sizeof(UChar)=
;
if (VG_(clo_trace_cfi))
VG_(printf)("cie.version =3D %d\n", (Int)cie_version);
@@ -1815,35 +1876,41 @@
cie_augmentation +=3D 2;
}
=20
- cie_codeaf =3D read_leb128( data, &nbytes, 0);
+ the_CIEs[this_CIE].code_a_f =3D read_leb128( data, &nbytes, 0);
data +=3D nbytes;
if (VG_(clo_trace_cfi))=20
- VG_(printf)("cie.code_af =3D %d\n", cie_codeaf);
+ VG_(printf)("cie.code_af =3D %d\n",=20
+ the_CIEs[this_CIE].code_a_f);
=20
- cie_dataaf =3D read_leb128( data, &nbytes, 1);
+ the_CIEs[this_CIE].data_a_f =3D read_leb128( data, &nbytes, 1);
data +=3D nbytes;
if (VG_(clo_trace_cfi))=20
- VG_(printf)("cie.data_af =3D %d\n", cie_dataaf);
+ VG_(printf)("cie.data_af =3D %d\n",
+ the_CIEs[this_CIE].data_a_f);
=20
- cie_rareg =3D read_UChar(data); data +=3D sizeof(UChar);
+ the_CIEs[this_CIE].ra_reg =3D (Int)read_UChar(data);=20
+ data +=3D sizeof(UChar);
if (VG_(clo_trace_cfi))=20
- VG_(printf)("cie.ra_reg =3D %d\n", (Int)cie_rareg);
- if (cie_rareg < 0 || cie_rareg >=3D N_CFI_REGS) {
+ VG_(printf)("cie.ra_reg =3D %d\n",=20
+ the_CIEs[this_CIE].ra_reg);
+ if (the_CIEs[this_CIE].ra_reg < 0=20
+ || the_CIEs[this_CIE].ra_reg >=3D N_CFI_REGS) {
how =3D "cie.ra_reg has implausible value";
goto bad;
}
=20
- saw_z_augmentation =3D *cie_augmentation =3D=3D 'z';
- if (saw_z_augmentation) {
+ the_CIEs[this_CIE].saw_z_augmentation=20
+ =3D *cie_augmentation =3D=3D 'z';
+ if (the_CIEs[this_CIE].saw_z_augmentation) {
UInt length =3D read_leb128( data, &nbytes, 0);
data +=3D nbytes;
- cie_instrs =3D data + length;
+ the_CIEs[this_CIE].instrs =3D data + length;
cie_augmentation++;
} else {
- cie_instrs =3D NULL;
+ the_CIEs[this_CIE].instrs =3D NULL;
}
=20
- address_encoding =3D default_Addr_encoding();
+ the_CIEs[this_CIE].address_encoding =3D default_Addr_encoding()=
;
=20
while (*cie_augmentation) {
switch (*cie_augmentation) {
@@ -1852,7 +1919,8 @@
cie_augmentation++;
break;
case 'R':
- address_encoding =3D read_UChar(data); data +=3D sizeo=
f(UChar);
+ the_CIEs[this_CIE].address_encoding=20
+ =3D read_UChar(data); data +=3D sizeof(UChar);
cie_augmentation++;
break;
case 'P':
@@ -1861,11 +1929,11 @@
cie_augmentation++;
break;
default:
- if (cie_instrs =3D=3D NULL) {
+ if (the_CIEs[this_CIE].instrs =3D=3D NULL) {
how =3D "unhandled cie.augmentation";
goto bad;
}
- data =3D cie_instrs;
+ data =3D the_CIEs[this_CIE].instrs;
goto done_augmentation;
}
}
@@ -1873,55 +1941,72 @@
done_augmentation:
=20
if (VG_(clo_trace_cfi))=20
- VG_(printf)("cie.encoding =3D 0x%x\n", address_encoding);
+ VG_(printf)("cie.encoding =3D 0x%x\n",=20
+ the_CIEs[this_CIE].address_encoding);
=20
- cie_instrs =3D data;
- cie_ilen =3D ciefde_start + ciefde_len + sizeof(UInt) - data;
+ the_CIEs[this_CIE].instrs =3D data;
+ the_CIEs[this_CIE].ilen
+ =3D ciefde_start + ciefde_len + sizeof(UInt) - data;
if (VG_(clo_trace_cfi)) {
- VG_(printf)("cie.instrs =3D %p\n", cie_instrs);
- VG_(printf)("cie.ilen =3D %d\n", (Int)cie_ilen);
+ VG_(printf)("cie.instrs =3D %p\n", the_CIEs[this_CIE].i=
nstrs);
+ VG_(printf)("cie.ilen =3D %d\n", the_CIEs[this_CIE].i=
len);
}
=20
- if (cie_ilen < 0 || cie_ilen > ehframe_sz) {
+ if (the_CIEs[this_CIE].ilen < 0
+ || the_CIEs[this_CIE].ilen > ehframe_sz) {
how =3D "implausible # cie initial insns";
goto bad;
}
=20
- data +=3D cie_ilen;
+ data +=3D the_CIEs[this_CIE].ilen;
=20
if (VG_(clo_trace_cfi))=20
- show_CF_instructions(cie_instrs, cie_ilen);
+ show_CF_instructions(the_CIEs[this_CIE].instrs,=20
+ the_CIEs[this_CIE].ilen);
=20
} else {
=20
+ UnwindContext ctx, restore_ctx;
+ Int cie;
+ UInt look_for;
+ Bool ok;
+
/* --------- FDE --------- */
=20
- /* Ensure that (1) we have a valid CIE, and (2) that it is
- indeed the CIE referred to by this FDE. */
- if (current_cie =3D=3D NULL) {
- how =3D "FDE with no preceding CIE";
+ /* Find the relevant CIE. The CIE we want is located
+ cie_pointer bytes back from here. */
+
+ /* re sizeof(UInt), matches XXX above. For 64-bit dwarf this
+ will have to be a ULong instead. */
+ look_for =3D (data - sizeof(UInt) - ehframe) - cie_pointer;
+
+ for (cie =3D 0; cie < n_CIEs; cie++) {
+ if (0) VG_(printf)("look for %d %d\n",
+ look_for, the_CIEs[cie].offset );
+ if (the_CIEs[cie].offset =3D=3D look_for)
+ break;
+ }
+ vg_assert(cie >=3D 0 && cie <=3D n_CIEs);
+ if (cie =3D=3D n_CIEs) {
+ how =3D "FDE refers to not-findable CIE";
goto bad;
- }
- if (cie_pointer !=3D data - current_cie) {
- how =3D "FDE does not refer to preceding CIE";
- goto bad;
- }
+ }
=20
Addr fde_initloc=20
- =3D read_encoded_Addr(data, address_encoding,
+ =3D read_encoded_Addr(data, the_CIEs[cie].address_encoding,
&nbytes, ehframe, ehframe_addr);
data +=3D nbytes;
if (VG_(clo_trace_cfi))=20
VG_(printf)("fde.initloc =3D %p\n", (void*)fde_initloc);
=20
UWord fde_arange=20
- =3D read_encoded_Addr(data, address_encoding & 0xf,
+ =3D read_encoded_Addr(data, the_CIEs[cie].address_encoding &=
0xf,
&nbytes, ehframe, ehframe_addr);
data +=3D nbytes;
if (VG_(clo_trace_cfi))=20
VG_(printf)("fde.arangec =3D %p\n", (void*)fde_arange);
=20
- if (saw_z_augmentation) {
+ if (the_CIEs[cie].saw_z_augmentation) {
data +=3D read_leb128( data, &nbytes, 0);
data +=3D nbytes;
}
@@ -1944,15 +2029,16 @@
show_CF_instructions(fde_instrs, fde_ilen);
=20
initUnwindContext(&ctx);
- ctx.code_a_f =3D cie_codeaf;
- ctx.data_a_f =3D cie_dataaf;
+ ctx.code_a_f =3D the_CIEs[cie].code_a_f;
+ ctx.data_a_f =3D the_CIEs[cie].data_a_f;
ctx.initloc =3D fde_initloc;
- ctx.ra_reg =3D cie_rareg;
+ ctx.ra_reg =3D the_CIEs[cie].ra_reg;
=20
initUnwindContext(&restore_ctx);
=20
ok =3D run_CF_instructions(
- NULL, &ctx, cie_instrs, cie_ilen, 0, NULL);
+ NULL, &ctx, the_CIEs[cie].instrs,=20
+ the_CIEs[cie].ilen, 0, NULL);
if (ok) {
restore_ctx =3D ctx;
ok =3D run_CF_instructions(
|
|
From: <sv...@va...> - 2005-06-09 14:17:49
|
Author: sewardj
Date: 2005-06-09 15:17:47 +0100 (Thu, 09 Jun 2005)
New Revision: 3860
Log:
Move some #define-d constants into the VKI department, where I should
have put them in the first place.
Modified:
trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
trunk/include/vki-amd64-linux.h
Modified: trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-06-09 13:56:07=
UTC (rev 3859)
+++ trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-06-09 14:17:47=
UTC (rev 3860)
@@ -48,13 +48,7 @@
=20
#include "vki_unistd.h" /* for the __NR_* constants */
=20
-/* COPIED FROM /usr/include/asm-i386/prctl.h (amd64-linux) */
-#define ARCH_SET_GS 0x1001
-#define ARCH_SET_FS 0x1002
-#define ARCH_GET_FS 0x1003
-#define ARCH_GET_GS 0x1004
=20
-
/* ---------------------------------------------------------------------
Stacks, thread wrappers
Note. Why is this stuff here?
@@ -682,7 +676,7 @@
// PRE_MEM_READs/PRE_MEM_WRITEs as necessary...
=20
/* "do" the syscall ourselves; the kernel never sees it */
- vg_assert(ARG1 =3D=3D ARCH_SET_FS);
+ vg_assert(ARG1 =3D=3D VKI_ARCH_SET_FS);
tst =3D VG_(get_ThreadState)(tid);
tst->arch.vex.guest_FS_ZERO =3D ARG2;
=20
Modified: trunk/include/vki-amd64-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
--- trunk/include/vki-amd64-linux.h 2005-06-09 13:56:07 UTC (rev 3859)
+++ trunk/include/vki-amd64-linux.h 2005-06-09 14:17:47 UTC (rev 3860)
@@ -483,6 +483,13 @@
#define VKI_GDT_ENTRY_TLS_MIN 11
#define VKI_GDT_ENTRY_TLS_MAX 13
=20
+// These are actually from linux-???/include/asm-i386/prctl.h.
+// But they appear to be needed on amd64.
+#define VKI_ARCH_SET_GS 0x1001
+#define VKI_ARCH_SET_FS 0x1002
+#define VKI_ARCH_GET_FS 0x1003
+#define VKI_ARCH_GET_GS 0x1004
+
//----------------------------------------------------------------------
// From linux-2.6.9/include/asm-x86_64/ldt.h
//----------------------------------------------------------------------
|
|
From: <sv...@va...> - 2005-06-09 13:56:14
|
Author: sewardj
Date: 2005-06-09 14:56:07 +0100 (Thu, 09 Jun 2005)
New Revision: 3859
Log:
Increase the number of auxmaps from 500 to 20000. This should be
enough to cover 1.25GB of auxiliary address space. This is all still
a hack until such time as the address space manager is rewritten, but
should make things work more reliably on amd64-linux for now.
Modified:
trunk/memcheck/mc_main.c
Modified: trunk/memcheck/mc_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/mc_main.c 2005-06-09 13:23:56 UTC (rev 3858)
+++ trunk/memcheck/mc_main.c 2005-06-09 13:56:07 UTC (rev 3859)
@@ -206,7 +206,7 @@
AuxMapEnt;
=20
/* An expanding array of AuxMapEnts. */
-#define N_AUXMAPS 500 /* HACK */
+#define N_AUXMAPS 20000 /* HACK */
static AuxMapEnt hacky_auxmaps[N_AUXMAPS];
static Int auxmap_size =3D N_AUXMAPS;
static Int auxmap_used =3D 0;
|
|
From: <sv...@va...> - 2005-06-09 13:25:42
|
Author: sewardj
Date: 2005-06-09 14:21:58 +0100 (Thu, 09 Jun 2005)
New Revision: 3857
Log:
Fix some socket-related functionality on amd64. This means file
descriptor leak checks now work on amd64.
Modified:
trunk/coregrind/m_libcfile.c
Modified: trunk/coregrind/m_libcfile.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_libcfile.c 2005-06-09 12:43:42 UTC (rev 3856)
+++ trunk/coregrind/m_libcfile.c 2005-06-09 13:21:58 UTC (rev 3857)
@@ -360,34 +360,44 @@
=20
Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen)
{
+ SysRes res;
+
# if defined(VGP_x86_linux)
- SysRes res;
UWord args[3];
args[0] =3D sd;
args[1] =3D (UWord)name;
args[2] =3D (UWord)namelen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETSOCKNAME, (UWord=
)&args);
return res.isError ? -1 : res.val;
+
+# elif defined(VGP_amd64_linux)
+ res =3D VG_(do_syscall3)( __NR_getsockname,
+ (UWord)sd, (UWord)name, (UWord)namelen );
+ return res.isError ? -1 : res.val;
+
# else
- // AMD64/Linux doesn't define __NR_socketcall... see comment above
- // VG_(sigpending)() for more details.
I_die_here;
# endif
}
=20
Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen)
{
+ SysRes res;
+
# if defined(VGP_x86_linux)
- SysRes res;
UWord args[3];
args[0] =3D sd;
args[1] =3D (UWord)name;
args[2] =3D (UWord)namelen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETPEERNAME, (UWord=
)&args);
return res.isError ? -1 : res.val;
+
+# elif defined(VGP_amd64_linux)
+ res =3D VG_(do_syscall3)( __NR_getpeername,
+ (UWord)sd, (UWord)name, (UWord)namelen );
+ return res.isError ? -1 : res.val;
+
# else
- // AMD64/Linux doesn't define __NR_socketcall... see comment above
- // VG_(sigpending)() for more details.
I_die_here;
# endif
}
@@ -395,8 +405,9 @@
Int VG_(getsockopt) ( Int sd, Int level, Int optname, void *optval,
Int *optlen)
{
+ SysRes res;
+
# if defined(VGP_x86_linux)
- SysRes res;
UWord args[5];
args[0] =3D sd;
args[1] =3D level;
@@ -405,10 +416,15 @@
args[4] =3D (UWord)optlen;
res =3D VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETSOCKOPT, (UWord)=
&args);
return res.isError ? -1 : res.val;
+
+# elif defined(VGP_amd64_linux)
+ res =3D VG_(do_syscall5)( __NR_getsockopt,
+ (UWord)sd, (UWord)level, (UWord)optname,=20
+ (UWord)optval, (UWord)optlen );
+ return res.isError ? -1 : res.val;
+
# else
I_die_here;
- // AMD64/Linux doesn't define __NR_socketcall... see comment above
- // VG_(sigpending)() for more details.
# endif
}
=20
|
|
From: <sv...@va...> - 2005-06-09 13:24:34
|
Author: sewardj Date: 2005-06-09 14:23:56 +0100 (Thu, 09 Jun 2005) New Revision: 3858 Log: Alternate expected outputs with better stack traces. CFI based stack unwinding may have been a giant pain to implement, but it does appear to be better at not missing stack frames and generally being consistent then the old x86-linux follow-the-%ebp scheme. Added: trunk/corecheck/tests/fdleak_dup.stderr.exp3 trunk/corecheck/tests/fdleak_dup2.stderr.exp3 trunk/corecheck/tests/fdleak_pipe.stderr.exp2 Modified: trunk/corecheck/tests/Makefile.am Modified: trunk/corecheck/tests/Makefile.am =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/corecheck/tests/Makefile.am 2005-06-09 13:21:58 UTC (rev 3857) +++ trunk/corecheck/tests/Makefile.am 2005-06-09 13:23:56 UTC (rev 3858) @@ -13,15 +13,17 @@ fdleak_cmsg.stderr.exp fdleak_cmsg.stderr.exp2 fdleak_cmsg.vgtest \ fdleak_creat.stderr.exp fdleak_creat.stderr.exp2 \ fdleak_creat.stderr.exp3 fdleak_creat.vgtest \ - fdleak_dup.stderr.exp fdleak_dup.stderr.exp2 fdleak_dup.vgtest \ - fdleak_dup2.stderr.exp fdleak_dup2.stderr.exp2 fdleak_dup2.vgtest \ + fdleak_dup.stderr.exp fdleak_dup.stderr.exp2 \ + fdleak_dup.stderr.exp3 fdleak_dup.vgtest \ + fdleak_dup2.stderr.exp fdleak_dup2.stderr.exp2 \ + fdleak_dup2.stderr.exp3 fdleak_dup2.vgtest \ fdleak_fcntl.stderr.exp fdleak_fcntl.stderr.exp2 \ fdleak_fcntl.stderr.exp3 fdleak_fcntl.stderr.exp4 \ fdleak_fcntl.vgtest \ fdleak_ipv4.stderr.exp fdleak_ipv4.stderr.exp2 \ fdleak_ipv4.stdout.exp fdleak_ipv4.vgtest \ fdleak_open.stderr.exp fdleak_open.stderr.exp2 fdleak_open.vgtest \ - fdleak_pipe.stderr.exp fdleak_pipe.vgtest \ + fdleak_pipe.stderr.exp fdleak_pipe.stderr.exp2 fdleak_pipe.vgtest \ fdleak_socketpair.stderr.exp fdleak_socketpair.stderr.exp2 \ fdleak_socketpair.vgtest \ pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \ Added: trunk/corecheck/tests/fdleak_dup.stderr.exp3 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/corecheck/tests/fdleak_dup.stderr.exp3 2005-06-09 13:21:58 UTC = (rev 3857) +++ trunk/corecheck/tests/fdleak_dup.stderr.exp3 2005-06-09 13:23:56 UTC = (rev 3858) @@ -0,0 +1,22 @@ + + +FILE DESCRIPTORS: 5 open at exit. +Open file descriptor .: /dev/null + at 0x........: dup (in /...libc...) + by 0x........: main (fdleak_dup.c:17) + +Open file descriptor .: /dev/null + at 0x........: open (in /...libc...) + by 0x........: main (fdleak_dup.c:16) + +Open file descriptor .: . + <inherited from parent> + +Open file descriptor .: . + <inherited from parent> + +Open file descriptor .: /dev/null + <inherited from parent> + + +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Added: trunk/corecheck/tests/fdleak_dup2.stderr.exp3 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/corecheck/tests/fdleak_dup2.stderr.exp3 2005-06-09 13:21:58 UTC= (rev 3857) +++ trunk/corecheck/tests/fdleak_dup2.stderr.exp3 2005-06-09 13:23:56 UTC= (rev 3858) @@ -0,0 +1,26 @@ + + +FILE DESCRIPTORS: 6 open at exit. +Open file descriptor .: /dev/null + at 0x........: dup2 (in /...libc...) + by 0x........: main (fdleak_dup2.c:20) + +Open file descriptor .: /dev/null + at 0x........: dup2 (in /...libc...) + by 0x........: main (fdleak_dup2.c:21) + +Open file descriptor .: /dev/null + at 0x........: open (in /...libc...) + by 0x........: main (fdleak_dup2.c:17) + +Open file descriptor .: . + <inherited from parent> + +Open file descriptor .: . + <inherited from parent> + +Open file descriptor .: /dev/null + <inherited from parent> + + +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Added: trunk/corecheck/tests/fdleak_pipe.stderr.exp2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/corecheck/tests/fdleak_pipe.stderr.exp2 2005-06-09 13:21:58 UTC= (rev 3857) +++ trunk/corecheck/tests/fdleak_pipe.stderr.exp2 2005-06-09 13:23:56 UTC= (rev 3858) @@ -0,0 +1,22 @@ + + +FILE DESCRIPTORS: 5 open at exit. +Open file descriptor .: + at 0x........: pipe (in /...libc...) + by 0x........: main (fdleak_pipe.c:15) + +Open file descriptor .: + at 0x........: pipe (in /...libc...) + by 0x........: main (fdleak_pipe.c:15) + +Open file descriptor .: . + <inherited from parent> + +Open file descriptor .: . + <inherited from parent> + +Open file descriptor .: /dev/null + <inherited from parent> + + +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) |
|
From: <sv...@va...> - 2005-06-09 12:43:52
|
Author: sewardj
Date: 2005-06-09 13:43:42 +0100 (Thu, 09 Jun 2005)
New Revision: 3856
Log:
Clean up after m_syscalls changes: unbreak amd64-linux.
Modified:
trunk/NOTES.txt
trunk/coregrind/amd64/state.c
trunk/coregrind/m_debuginfo/symtab.c
trunk/coregrind/m_libcbase.c
trunk/coregrind/m_signals.c
trunk/coregrind/m_syscalls/priv_syscalls-amd64-linux.h
trunk/coregrind/m_syscalls/priv_syscalls-generic.h
trunk/coregrind/m_syscalls/syscall-amd64-linux.S
trunk/coregrind/m_syscalls/syscall-x86-linux.S
trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
trunk/coregrind/m_syscalls/syscalls-generic.c
trunk/coregrind/m_syscalls/syscalls-main.c
trunk/coregrind/m_syscalls/syscalls-x86-linux.c
trunk/coregrind/pub_core_libcbase.h
Modified: trunk/NOTES.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/NOTES.txt 2005-06-09 09:18:01 UTC (rev 3855)
+++ trunk/NOTES.txt 2005-06-09 12:43:42 UTC (rev 3856)
@@ -5,7 +5,7 @@
9 June 05 (after major syscalls overhaul)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
corecheck/m_syscalls/syscalls-x86-linux.h is now empty. Should it be
-deleted?
+deleted? Ditto corecheck/m_syscalls/syscalls-amd64-linux.h.
=20
23 Apr 05 (memcheck-on-amd64 notes)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: trunk/coregrind/amd64/state.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/amd64/state.c 2005-06-09 09:18:01 UTC (rev 3855)
+++ trunk/coregrind/amd64/state.c 2005-06-09 12:43:42 UTC (rev 3856)
@@ -76,11 +76,12 @@
VG_(memset)(&arch->vex_shadow, 0, sizeof(VexGuestAMD64State));
=20
/* Put essential stuff into the new state. */
- if (0)=20
- VG_(printf)("startup rsp 0x%llx rip 0x%llx\n",=20
- rsp_at_startup, client_rip);
+
arch->vex.guest_RSP =3D rsp_at_startup;
arch->vex.guest_RIP =3D client_rip;
+
+ VG_TRACK( post_reg_write, Vg_CoreStartup, /*tid*/1, /*offset*/0,
+ sizeof(VexGuestArchState));
}
=20
=20
Modified: trunk/coregrind/m_debuginfo/symtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/symtab.c 2005-06-09 09:18:01 UTC (rev 385=
5)
+++ trunk/coregrind/m_debuginfo/symtab.c 2005-06-09 12:43:42 UTC (rev 385=
6)
@@ -1718,12 +1718,16 @@
VG_(read_callframe_info_dwarf2) ( si, ehframe, ehframe_sz, ehfr=
ame_addr );
}
=20
- /* Read the stabs and/or dwarf2 debug information, if any. */
+ /* Read the stabs and/or dwarf2 debug information, if any. It
+ appears reading stabs stuff on amd64-linux doesn't work, so
+ we ignore it. */
+# if !defined(VGP_amd64_linux)
if (stab !=3D NULL && stabstr !=3D NULL) {
has_debuginfo =3D True;
VG_(read_debuginfo_stabs) ( si, stab, stab_sz,=20
stabstr, stabstr_sz );
}
+# endif
if (debug_line) {
has_debuginfo =3D True;
VG_(read_debuginfo_dwarf2) ( si, debug_line, debug_line_sz );
Modified: trunk/coregrind/m_libcbase.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_libcbase.c 2005-06-09 09:18:01 UTC (rev 3855)
+++ trunk/coregrind/m_libcbase.c 2005-06-09 12:43:42 UTC (rev 3856)
@@ -504,6 +504,44 @@
#endif
=20
=20
+#if defined(VGP_amd64_linux)
+/* Perform a Linux syscall with the "syscall" instruction.
+=09
+ Incoming args (syscall number + up to 6 args) come in %rdi, %rsi,
+ %rdx, %rcx, %r8, %r9, and the last one on the stack (ie. the C
+ calling convention).
+
+ They are passed to the syscall in the regs %rdi, %rsi, %rdx, %r10,
+ %r8, %r9 (yes, really %r10, not %rcx), ie. the kernel's syscall
+ calling convention.
+
+ %rax holds the syscall number and gets the return value. %rcx and
+ %r11 are clobbered by the syscall; no matter, they are caller-save
+ (the syscall clobbers no callee-save regs, so we don't have to do
+ any register saving/restoring).
+*/
+extern ULong do_syscall_amd64_linux_WRK (
+ ULong syscall_no,=20
+ ULong a1, ULong a2, ULong a3,
+ ULong a4, ULong a5, ULong a6
+ );
+asm(
+"do_syscall_amd64_linux_WRK:\n"
+ /* Convert function calling convention --> syscall calling
+ convention */
+" movq %rdi, %rax\n"
+" movq %rsi, %rdi\n"
+" movq %rdx, %rsi\n"
+" movq %rcx, %rdx\n"
+" movq %r8, %r10\n"
+" movq %r9, %r8\n"
+" movq 8(%rsp), %r9\n" /* last arg from stack */
+" syscall\n"
+" ret\n"
+);
+#endif
+
+
SysRes VG_(do_syscall) ( UWord sysno, UWord a1, UWord a2, UWord a3,=20
UWord a4, UWord a5, UWord a6 )
{
@@ -514,9 +552,15 @@
res =3D VG_(mk_SysRes_x86_linux)( eax );
# else
=20
+# if defined(VGP_amd64_linux)
+ ULong rax =3D do_syscall_amd64_linux_WRK(sysno,a1,a2,a3,a4,a5,a6);
+ res =3D VG_(mk_SysRes_amd64_linux)( rax );
+# else
+
# error VG_(do_syscall): unimplemented on this platform
=20
# endif
+# endif
=20
return res;
}
Modified: trunk/coregrind/m_signals.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_signals.c 2005-06-09 09:18:01 UTC (rev 3855)
+++ trunk/coregrind/m_signals.c 2005-06-09 12:43:42 UTC (rev 3856)
@@ -127,18 +127,23 @@
# define VGP_UCONTEXT_SYSCALL_SYSRES(uc) \
/* Convert the value in uc_mcontext.eax into a SysRes. */ \
VG_(mk_SysRes_x86_linux)( (uc)->uc_mcontext.eax )
+
#elif defined(VGP_amd64_linux)
# define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.rip)
# define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.rsp)
# define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.rbp)
# define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.rax)
-# define VGP_UCONTEXT_SYSCALL_RET(uc) ((uc)->uc_mcontext.rax)
+# define VGP_UCONTEXT_SYSCALL_SYSRES(uc) \
+ /* Convert the value in uc_mcontext.rax into a SysRes. */ \
+ VG_(mk_SysRes_amd64_linux)( (uc)->uc_mcontext.rax )
+
#elif defined(VGP_arm_linux)
# define VGP_UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.arm_pc)
# define VGP_UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.arm_sp)
# define VGP_UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.arm_fp)
# define VGP_UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.arm_r0)
# error VGP_UCONTEXT_SYSCALL_RET undefined for ARM/Linux
+
#else
# error Unknown platform
#endif
Modified: trunk/coregrind/m_syscalls/priv_syscalls-amd64-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
--- trunk/coregrind/m_syscalls/priv_syscalls-amd64-linux.h 2005-06-09 09:=
18:01 UTC (rev 3855)
+++ trunk/coregrind/m_syscalls/priv_syscalls-amd64-linux.h 2005-06-09 12:=
43:42 UTC (rev 3856)
@@ -32,23 +32,6 @@
#ifndef __PRIV_SYSCALLS_AMD64_LINUX_H
#define __PRIV_SYSCALLS_AMD64_LINUX_H
=20
-// Accessors for the ThreadArchState
-#define VGP_SYSCALL_NUM guest_RAX
-#define VGP_SYSCALL_ARG1 guest_RDI
-#define VGP_SYSCALL_ARG2 guest_RSI
-#define VGP_SYSCALL_ARG3 guest_RDX
-#define VGP_SYSCALL_ARG4 guest_R10
-#define VGP_SYSCALL_ARG5 guest_R8
-#define VGP_SYSCALL_ARG6 guest_R9
-#define VGP_SYSCALL_RET guest_RAX
-
-// Setting a syscall result
-#define VGP_SET_SYSCALL_RESULT(regs, val) ((regs).vex.guest_RAX =3D (=
val))
-
-// For informing tools that a syscall result has been set.
-#define VGP_TRACK_SYSCALL_RETVAL(zztid) \
- VG_TRACK( post_reg_write, Vg_CoreSysCall, zztid, O_SYSCALL_RET, sizeo=
f(UWord) );
-
#endif // __PRIV_SYSCALLS_AMD64_LINUX_H
=20
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syscalls/priv_syscalls-generic.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/priv_syscalls-generic.h 2005-06-09 09:18:0=
1 UTC (rev 3855)
+++ trunk/coregrind/m_syscalls/priv_syscalls-generic.h 2005-06-09 12:43:4=
2 UTC (rev 3856)
@@ -319,4 +319,3 @@
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
-
Modified: trunk/coregrind/m_syscalls/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_syscalls/syscall-amd64-linux.S 2005-06-09 09:18:01 =
UTC (rev 3855)
+++ trunk/coregrind/m_syscalls/syscall-amd64-linux.S 2005-06-09 12:43:42 =
UTC (rev 3856)
@@ -32,101 +32,8 @@
#include "vki_unistd.h"
#include "libvex_guest_offsets.h"
=20
-/*
- Perform a Linux syscall with the "syscall" instruction.
-=09
- Incoming args (syscall number + up to 6 args) come in=20
- %rdi, %rsi, %rdx, %rcx, %r8, %r9, and the last one on the stack
- (ie. the C calling convention).
=20
- They are passed to the syscall in the regs
- %rdi, %rsi, %rdx, %r10, %r8, %r9 (yes, really %r10, not %rcx), ie. the
- kernel's syscall calling convention.
-
- %rax holds the syscall number and gets the return value.
- %rcx and %r11 are clobbered by the syscall; no matter, they
- are caller-save (the syscall clobbers no callee-save regs, so
- we don't have to do any register saving/restoring).
-
- This has no effect on the virtual machine; the expectation is
- that the syscall mechanism makes no useful changes to any
- register except %rax, which is returned.
-*/
-.globl VG_(do_syscall)
-VG_(do_syscall):
- # Convert function calling convention --> syscall calling convention
- movq %rdi, %rax
- movq %rsi, %rdi
- movq %rdx, %rsi
- movq %rcx, %rdx
- movq %r8, %r10
- movq %r9, %r8
- movq 8(%rsp), %r9 # last arg from stack
- syscall
- ret
-
-
-/*
- Perform a clone system call. clone is strange because it has
- fork()-like return-twice semantics, so it needs special
- handling here.
-
- Upon entry, we have:
-
- int (*fn)(void*) in %rdi
- void* child_stack in %rsi
- int flags in %rdx
- void* arg in %rcx
- pid_t* child_tid in %r8
- pid_t* parent_tid in %r9
- void* tls_ptr at 8(%rsp)
-
- System call requires:
-
- int $__NR_clone in %rax
- int flags in %rdi
- void* child_stack in %rsi
- pid_t* parent_tid in %rdx
- pid_t* child_tid in %r10
- void* tls_ptr in %r8
- */
-.globl VG_(clone)
-VG_(clone):
- // set up child stack, temporarily preserving fn and arg
- subq $16, %rsi // make space on stack
- movq %rcx, 8(%rsi) // save arg
- movq %rdi, 0(%rsi) // save fn=20
- =20
- // setup syscall
- movq $__NR_clone, %rax // syscall number
- movq %rdx, %rdi // syscall arg1: flags
- // %rsi already setup // syscall arg2: child_stack
- movq %r9, %rdx // syscall arg3: parent_tid
- movq %r8, %r10 // syscall arg4: child_tid
- movq 8(%rsp), %r8 // syscall arg5: tls_ptr
-
- syscall // clone()
-
- testq %rax, %rax // child if retval =3D=3D 0
- jnz 1f
-
- // CHILD - call thread function
- pop %rax // pop fn
- pop %rdi // pop fn arg1: arg
- call *%rax // call fn
-
- // exit with result
- movq %rax, %rdi // arg1: return value from fn
- movq $__NR_exit, %rax
-
- syscall
-
- // Exit returned?!
- ud2
-
-1: // PARENT or ERROR
- ret
-
+/*----------------------------------------------------------------*/
.globl VG_(sigreturn)
VG_(sigreturn):
movq $__NR_rt_sigreturn, %rax
@@ -159,7 +66,8 @@
=09
Prototype:
=20
- Int VGA_(_client_syscall)(Int syscallno, // rdi
+ Int VGA_(do_syscall_for_client_WRK(
+ Int syscallno, // rdi
void* guest_state, // rsi
const vki_sigset_t *sysmask, // rdx
const vki_sigset_t *postmask, // rcx
@@ -170,8 +78,8 @@
/* from vki_arch.h */=09
#define VKI_SIG_SETMASK 2
=09
-.globl VGA_(_client_syscall)
-VGA_(_client_syscall):
+.globl VGA_(do_syscall_for_client_WRK)
+VGA_(do_syscall_for_client_WRK):
/* save callee-saved regs */
pushq %rbx
pushq %rbp
Modified: trunk/coregrind/m_syscalls/syscall-x86-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_syscalls/syscall-x86-linux.S 2005-06-09 09:18:01 UT=
C (rev 3855)
+++ trunk/coregrind/m_syscalls/syscall-x86-linux.S 2005-06-09 12:43:42 UT=
C (rev 3856)
@@ -33,12 +33,13 @@
#include "libvex_guest_offsets.h"
=09
=09
+/*----------------------------------------------------------------*/
.globl VG_(sigreturn)
VG_(sigreturn):
movl $__NR_rt_sigreturn, %eax
int $0x80
=20
-
+/*----------------------------------------------------------------*/
/*
Perform a syscall for the client. This will run a syscall
with the client's specific per-thread signal mask.
Modified: trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-06-09 09:18:01=
UTC (rev 3855)
+++ trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-06-09 12:43:42=
UTC (rev 3856)
@@ -32,14 +32,22 @@
#include "ume.h" /* for jmp_with_stack */
#include "pub_core_debuglog.h"
#include "pub_core_aspacemgr.h"
+#include "pub_core_options.h"
+#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
#include "pub_core_sigframe.h"
#include "pub_core_syscalls.h"
#include "pub_core_tooliface.h"
-#include "priv_syscalls.h"
+#include "pub_core_signals.h"
=20
+#include "priv_types_n_macros.h"
+#include "priv_syscalls-generic.h" /* for decls of generic wrappers */
+#include "priv_syscalls-linux.h" /* for decls of linux-ish wrappers =
*/
+#include "priv_syscalls-main.h"
=20
+#include "vki_unistd.h" /* for the __NR_* constants */
+
/* COPIED FROM /usr/include/asm-i386/prctl.h (amd64-linux) */
#define ARCH_SET_GS 0x1001
#define ARCH_SET_FS 0x1002
@@ -52,137 +60,7 @@
Note. Why is this stuff here?
------------------------------------------------------------------ */
=20
-/* These are addresses within VGA_(client_syscall). See syscall.S for d=
etails. */
-extern const Addr VGA_(blksys_setup);
-extern const Addr VGA_(blksys_restart);
-extern const Addr VGA_(blksys_complete);
-extern const Addr VGA_(blksys_committed);
-extern const Addr VGA_(blksys_finished);
-
-// Back up to restart a system call.
-static void restart_syscall(ThreadArchState *arch)
-{
- arch->vex.guest_RIP -=3D 2; // sizeof(syscall)
-
- /* Make sure our caller is actually sane, and we're really backing
- back over a syscall.
-
- syscall =3D=3D 0F 05=20
- */
- {
- UChar *p =3D (UChar *)arch->vex.guest_RIP;
- =20
- if (p[0] !=3D 0x0F || p[1] !=3D 0x05)
- VG_(message)(Vg_DebugMsg,
- "?! restarting over syscall at %p %02x %02x\n",
- arch->vex.guest_RIP, p[0], p[1]);=20
-
- vg_assert(p[0] =3D=3D 0x0F && p[1] =3D=3D 0x05);
- }
-}
-
/*=20
- Fix up the VCPU state when a syscall is interrupted by a signal.
-
- To do this, we determine the precise state of the syscall by
- looking at the (real) rip at the time the signal happened. The
- syscall sequence looks like:
-
- 1. unblock signals
- 2. perform syscall
- 3. save result to RAX
- 4. re-block signals
-
- If a signal
- happens at Then Why?
- [1-2) restart nothing has happened (restart syscall)
- [2] restart syscall hasn't started, or kernel wants to r=
estart
- [2-3) save syscall complete, but results not saved
- [3-4) syscall complete, results saved
-
- Sometimes we never want to restart an interrupted syscall (because
- sigaction says not to), so we only restart if "restart" is True.
-
- This will also call VG_(post_syscall)() if the syscall has actually
- completed (either because it was interrupted, or because it
- actually finished). It will not call VG_(post_syscall)() if the
- syscall is set up for restart, which means that the pre-wrapper may
- get called multiple times.
- */
-/* NB: this is identical to the x86 version */
-void VGP_(interrupted_syscall)(ThreadId tid,=20
- Word ip, UWord sysnum, UWord sysret,
- Bool restart)
-{
- static const Bool debug =3D 0;
-
- ThreadState *tst =3D VG_(get_ThreadState)(tid);
- ThreadArchState *th_regs =3D &tst->arch;
-
- if (debug)
- VG_(printf)("interrupted_syscall: ip=3D%p; restart=3D%d eax=3D%d\n=
",=20
- ip, restart, sysnum);
-
- if (ip < VGA_(blksys_setup) || ip >=3D VGA_(blksys_finished)) {
- VG_(printf)(" not in syscall (%p - %p)\n", VGA_(blksys_setup), VG=
A_(blksys_finished));
- vg_assert(tst->syscallno =3D=3D -1);
- return;
- }
-
- vg_assert(tst->syscallno !=3D -1);
-
- if (ip >=3D VGA_(blksys_setup) && ip < VGA_(blksys_restart)) {
- /* syscall hasn't even started; go around again */
- if (debug)
- VG_(printf)(" not started: restart\n");
- restart_syscall(th_regs);
- } else if (ip =3D=3D VGA_(blksys_restart)) {
- /* We're either about to run the syscall, or it was interrupted
- and the kernel restarted it. Restart if asked, otherwise
- EINTR it. */
- if (restart)
- restart_syscall(th_regs);
- else {
- th_regs->vex.VGP_SYSCALL_RET =3D -VKI_EINTR;
- VG_(post_syscall)(tid);
- }
- } else if (ip >=3D VGA_(blksys_complete) && ip < VGA_(blksys_committe=
d)) {
- /* Syscall complete, but result hasn't been written back yet.
- The saved real CPU %rax has the result, which we need to move
- to RAX. */
- if (debug)
- VG_(printf)(" completed: ret=3D%d\n", sysret);
- th_regs->vex.VGP_SYSCALL_RET =3D sysret;
- VG_(post_syscall)(tid);
- } else if (ip >=3D VGA_(blksys_committed) && ip < VGA_(blksys_finishe=
d)) {
- /* Result committed, but the signal mask has not been restored;
- we expect our caller (the signal handler) will have fixed
- this up. */
- if (debug)
- VG_(printf)(" all done\n");
- VG_(post_syscall)(tid);
- } else
- VG_(core_panic)("?? strange syscall interrupt state?");
- =20
- tst->syscallno =3D -1;
-}
-
-extern void VGA_(_client_syscall)(Int syscallno,=20
- void* guest_state,
- const vki_sigset_t *syscall_mask,
- const vki_sigset_t *restore_mask,
- Int nsigwords);
-
-void VGA_(client_syscall)(Int syscallno, ThreadState *tst,
- const vki_sigset_t *syscall_mask)
-{
- vki_sigset_t saved;
- VGA_(_client_syscall)(syscallno, &tst->arch.vex,=20
- syscall_mask, &saved, _VKI_NSIG_WORDS * sizeof(=
UWord));
-}
-
-
-/*=20
Allocate a stack for this thread.
=20
They're allocated lazily, but never freed.
@@ -256,7 +134,7 @@
{
ThreadId tid =3D (ThreadId)tidW;
=20
- VG_(debugLog)(1, "syscalls-x86-linux",=20
+ VG_(debugLog)(1, "syscalls-amd64-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
"VGO_(thread_wrapper) called\n",
(ULong)tidW);
@@ -264,7 +142,7 @@
/* Run the thread all the way through. */
VgSchedReturnCode src =3D VGO_(thread_wrapper)(tid); =20
=20
- VG_(debugLog)(1, "syscalls-x86-linux",=20
+ VG_(debugLog)(1, "syscalls-amd64-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
"VGO_(thread_wrapper) done\n",
(ULong)tidW);
@@ -274,7 +152,7 @@
=20
if (c =3D=3D 1) {
=20
- VG_(debugLog)(1, "syscalls-x86-linux",=20
+ VG_(debugLog)(1, "syscalls-amd64-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
"last one standing\n",
(ULong)tidW);
@@ -285,7 +163,7 @@
=20
} else {
=20
- VG_(debugLog)(1, "syscalls-x86-linux",=20
+ VG_(debugLog)(1, "syscalls-amd64-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
"not last one standing\n",
(ULong)tidW);
@@ -347,7 +225,7 @@
}
=20
=20
-static Int start_thread_NORETURN ( void* arg )
+static Long start_thread_NORETURN ( void* arg )
{
ThreadState* tst =3D (ThreadState*)arg;
ThreadId tid =3D tst->tid;
@@ -362,6 +240,90 @@
clone() handling
------------------------------------------------------------------ */
=20
+/*
+ Perform a clone system call. clone is strange because it has
+ fork()-like return-twice semantics, so it needs special
+ handling here.
+
+ Upon entry, we have:
+
+ int (*fn)(void*) in %rdi
+ void* child_stack in %rsi
+ int flags in %rdx
+ void* arg in %rcx
+ pid_t* child_tid in %r8
+ pid_t* parent_tid in %r9
+ void* tls_ptr at 8(%rsp)
+
+ System call requires:
+
+ int $__NR_clone in %rax
+ int flags in %rdi
+ void* child_stack in %rsi
+ pid_t* parent_tid in %rdx
+ pid_t* child_tid in %r10
+ void* tls_ptr in %r8
+
+ Returns a Long encoded in the linux-amd64 way, not a SysRes.
+ */
+#define STRINGIFZ(__str) #__str
+#define STRINGIFY(__str) STRINGIFZ(__str)
+#define __NR_CLONE STRINGIFY(__NR_clone)
+#define __NR_EXIT STRINGIFY(__NR_exit)
+
+extern
+Long do_syscall_clone_amd64_linux ( Long (*fn)(void *),=20
+ void* stack,=20
+ Long flags,=20
+ void* arg,
+ Long* child_tid,=20
+ Long* parent_tid,=20
+ vki_modify_ldt_t * );
+asm(
+"\n"
+"do_syscall_clone_amd64_linux:\n"
+ // set up child stack, temporarily preserving fn and arg
+" subq $16, %rsi\n" // make space on stack
+" movq %rcx, 8(%rsi)\n" // save arg
+" movq %rdi, 0(%rsi)\n" // save fn=20
+ =20
+ // setup syscall
+" movq $"__NR_CLONE", %rax\n" // syscall number
+" movq %rdx, %rdi\n" // syscall arg1: flags
+ // %rsi already setup // syscall arg2: child_stack
+" movq %r9, %rdx\n" // syscall arg3: parent_tid
+" movq %r8, %r10\n" // syscall arg4: child_tid
+" movq 8(%rsp), %r8\n" // syscall arg5: tls_ptr
+
+" syscall\n" // clone()
+
+" testq %rax, %rax\n" // child if retval =3D=3D 0
+" jnz 1f\n"
+
+ // CHILD - call thread function
+" pop %rax\n" // pop fn
+" pop %rdi\n" // pop fn arg1: arg
+" call *%rax\n" // call fn
+
+ // exit with result
+" movq %rax, %rdi\n" // arg1: return value from fn
+" movq $"__NR_EXIT", %rax\n"
+
+" syscall\n"
+
+ // Exit returned?!
+" ud2\n"
+
+"1:\n" // PARENT or ERROR
+" ret\n"
+);
+
+#undef __NR_CLONE
+#undef __NR_EXIT
+#undef STRINGIFY
+#undef STRINGIFZ
+
+
// forward declaration
static void setup_child ( ThreadArchState*, ThreadArchState* );
=20
@@ -375,20 +337,21 @@
but using the scheduler entrypoint for EIP, and a separate stack
for ESP.
*/
-static Int do_clone(ThreadId ptid,=20
- UInt flags, Addr rsp,=20
- Int *parent_tidptr,=20
- Int *child_tidptr,=20
- Addr tlsaddr)
+static SysRes do_clone ( ThreadId ptid,=20
+ ULong flags, Addr rsp,=20
+ Long* parent_tidptr,=20
+ Long* child_tidptr,=20
+ Addr tlsaddr )
{
static const Bool debug =3D False;
=20
- ThreadId ctid =3D VG_(alloc_ThreadState)();
- ThreadState *ptst =3D VG_(get_ThreadState)(ptid);
- ThreadState *ctst =3D VG_(get_ThreadState)(ctid);
- UWord *stack;
- Segment *seg;
- Int ret;
+ ThreadId ctid =3D VG_(alloc_ThreadState)();
+ ThreadState* ptst =3D VG_(get_ThreadState)(ptid);
+ ThreadState* ctst =3D VG_(get_ThreadState)(ctid);
+ UWord* stack;
+ Segment* seg;
+ SysRes res;
+ Long rax;
vki_sigset_t blockall, savedmask;
=20
VG_(sigfillset)(&blockall);
@@ -412,7 +375,10 @@
*/
setup_child( &ctst->arch, &ptst->arch );
=20
- VGP_SET_SYSCALL_RESULT(ctst->arch, 0);
+ /* Make sys_clone appear to have returned Success(0) in the
+ child. */
+ ctst->arch.vex.guest_RAX =3D 0;
+
if (rsp !=3D 0)
ctst->arch.vex.guest_RSP =3D rsp;
=20
@@ -453,29 +419,37 @@
VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask);
=20
/* Create the new thread */
- ret =3D VG_(clone)(start_thread_NORETURN, stack, flags, &VG_(threads)=
[ctid],
- child_tidptr, parent_tidptr, NULL);
+ rax =3D do_syscall_clone_amd64_linux(
+ start_thread_NORETURN, stack, flags, &VG_(threads)[ctid],
+ child_tidptr, parent_tidptr, NULL
+ );
+ res =3D VG_(mk_SysRes_amd64_linux)( rax );
=20
VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL);
=20
- if (ret < 0) {
+ if (res.isError) {
/* clone failed */
VGP_(cleanup_thread)(&ctst->arch);
ctst->status =3D VgTs_Empty;
}
=20
- return ret;
+ return res;
}
=20
+
/* Do a clone which is really a fork() */
-static Int do_fork_clone(ThreadId tid, UInt flags, Addr rsp, Int *parent=
_tidptr, Int *child_tidptr)
+static SysRes do_fork_clone ( ThreadId tid,=20
+ ULong flags, Addr rsp,=20
+ Long* parent_tidptr,=20
+ Long* child_tidptr )
{
vki_sigset_t fork_saved_mask;
vki_sigset_t mask;
- Int ret;
+ SysRes res;
=20
- if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM | VKI_CLO=
NE_FILES | VKI_CLONE_VFORK))
- return -VKI_EINVAL;
+ if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM=20
+ | VKI_CLONE_FILES | VKI_CLONE_VFORK))
+ return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* Block all signals during fork, so that we can fix things up in
the child without being interrupted. */
@@ -486,19 +460,23 @@
=20
/* Since this is the fork() form of clone, we don't need all that
VG_(clone) stuff */
- ret =3D VG_(do_syscall5)(__NR_clone, flags, (UWord)NULL, (UWord)paren=
t_tidptr,=20
- (UWord)NULL, (UWord)child_t=
idptr);
+ res =3D VG_(do_syscall5)( __NR_clone, flags,=20
+ (UWord)NULL, (UWord)parent_tidptr,=20
+ (UWord)NULL, (UWord)child_tidptr );
=20
- if (ret =3D=3D 0) {
+ if (!res.isError && res.val =3D=3D 0) {
/* child */
VG_(do_atfork_child)(tid);
=20
/* restore signal mask */
VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL);
- } else if (ret > 0) {
+ }=20
+ else=20
+ if (!res.isError && res.val > 0) {
/* parent */
if (VG_(clo_trace_syscalls))
- VG_(printf)(" clone(fork): process %d created child %d\n", VG_(getp=
id)(), ret);
+ VG_(printf)(" clone(fork): process %d created child %d\n",=20
+ VG_(getpid)(), res.val);
=20
VG_(do_atfork_parent)(tid);
=20
@@ -506,7 +484,7 @@
VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL);
}
=20
- return ret;
+ return res;
}
=20
/* ---------------------------------------------------------------------
@@ -525,19 +503,55 @@
child->vex_shadow =3D parent->vex_shadow;
} =20
=20
+
/* ---------------------------------------------------------------------
PRE/POST wrappers for AMD64/Linux-specific syscalls
------------------------------------------------------------------ */
=20
-// Nb: See the comment above the generic PRE/POST wrappers in
-// coregrind/vg_syscalls.c for notes about how they work.
+#define PRE(name) DEFN_PRE_TEMPLATE(amd64_linux, name)
+#define POST(name) DEFN_POST_TEMPLATE(amd64_linux, name)
=20
-#define PRE(name, f) PRE_TEMPLATE(static, amd64_linux, name, f)
-#define POST(name) POST_TEMPLATE(static, amd64_linux, name)
+/* Add prototypes for the wrappers declared here, so that gcc doesn't
+ harass us for not having prototypes. Really this is a kludge --
+ the right thing to do is to make these wrappers 'static' since they
+ aren't visible outside this file, but that requires even more macro
+ magic. */
+DECL_TEMPLATE(amd64_linux, sys_clone);
+DECL_TEMPLATE(amd64_linux, sys_rt_sigreturn);
+DECL_TEMPLATE(amd64_linux, sys_socket);
+DECL_TEMPLATE(amd64_linux, sys_setsockopt);
+DECL_TEMPLATE(amd64_linux, sys_getsockopt);
+DECL_TEMPLATE(amd64_linux, sys_connect);
+DECL_TEMPLATE(amd64_linux, sys_accept);
+DECL_TEMPLATE(amd64_linux, sys_sendto);
+DECL_TEMPLATE(amd64_linux, sys_recvfrom);
+DECL_TEMPLATE(amd64_linux, sys_sendmsg);
+DECL_TEMPLATE(amd64_linux, sys_recvmsg);
+DECL_TEMPLATE(amd64_linux, sys_shutdown);
+DECL_TEMPLATE(amd64_linux, sys_bind);
+DECL_TEMPLATE(amd64_linux, sys_listen);
+DECL_TEMPLATE(amd64_linux, sys_getsockname);
+DECL_TEMPLATE(amd64_linux, sys_getpeername);
+DECL_TEMPLATE(amd64_linux, sys_socketpair);
+DECL_TEMPLATE(amd64_linux, sys_semget);
+DECL_TEMPLATE(amd64_linux, sys_semop);
+DECL_TEMPLATE(amd64_linux, sys_semtimedop);
+DECL_TEMPLATE(amd64_linux, sys_semctl);
+DECL_TEMPLATE(amd64_linux, sys_msgget);
+DECL_TEMPLATE(amd64_linux, sys_msgrcv);
+DECL_TEMPLATE(amd64_linux, sys_msgsnd);
+DECL_TEMPLATE(amd64_linux, sys_msgctl);
+DECL_TEMPLATE(amd64_linux, sys_shmget);
+DECL_TEMPLATE(amd64_linux, wrap_sys_shmat);
+DECL_TEMPLATE(amd64_linux, sys_shmdt);
+DECL_TEMPLATE(amd64_linux, sys_shmdt);
+DECL_TEMPLATE(amd64_linux, sys_shmctl);
+DECL_TEMPLATE(amd64_linux, sys_arch_prctl);
=20
-PRE(sys_clone, Special)
+
+PRE(sys_clone)
{
- UInt cloneflags;
+ ULong cloneflags;
=20
PRINT("sys_clone ( %x, %p, %p, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5);
PRE_REG_READ5(int, "clone",
@@ -550,14 +564,14 @@
if (ARG1 & VKI_CLONE_PARENT_SETTID) {
PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int));
if (!VG_(is_addressable)(ARG3, sizeof(Int), VKI_PROT_WRITE)) {
- SET_RESULT( -VKI_EFAULT );
+ SET_STATUS_Failure( VKI_EFAULT );
return;
}
}
if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) {
PRE_MEM_WRITE("clone(child_tidptr)", ARG4, sizeof(Int));
if (!VG_(is_addressable)(ARG4, sizeof(Int), VKI_PROT_WRITE)) {
- SET_RESULT( -VKI_EFAULT );
+ SET_STATUS_Failure( VKI_EFAULT );
return;
}
}
@@ -565,20 +579,22 @@
cloneflags =3D ARG1;
=20
if (!VG_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) {
- SET_RESULT( -VKI_EINVAL );
+ SET_STATUS_Failure( VKI_EINVAL );
return;
}
=20
/* Only look at the flags we really care about */
- switch(cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES | =
VKI_CLONE_VFORK)) {
+ switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS=20
+ | VKI_CLONE_FILES | VKI_CLONE_VFORK)) {
case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES:
/* thread creation */
- SET_RESULT(do_clone(tid,
- ARG1, /* flags */
- (Addr)ARG2, /* child ESP */
- (Int *)ARG3, /* parent_tidptr */
- (Int *)ARG4, /* child_tidptr */
- (Addr)ARG5)); /* set_tls */
+ SET_STATUS_from_SysRes(
+ do_clone(tid,
+ ARG1, /* flags */
+ (Addr)ARG2, /* child ESP */
+ (Long *)ARG3, /* parent_tidptr */
+ (Long *)ARG4, /* child_tidptr */
+ (Addr)ARG5)); /* set_tls */
break;
=20
case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */
@@ -586,22 +602,26 @@
cloneflags &=3D ~(VKI_CLONE_VFORK | VKI_CLONE_VM);
=20
case 0: /* plain fork */
- SET_RESULT(do_fork_clone(tid,
- cloneflags, /* flags */
- (Addr)ARG2, /* child ESP */
- (Int *)ARG3, /* parent_tidptr */
- (Int *)ARG4)); /* child_tidptr */
+ SET_STATUS_from_SysRes(
+ do_fork_clone(tid,
+ cloneflags, /* flags */
+ (Addr)ARG2, /* child ESP */
+ (Long *)ARG3, /* parent_tidptr */
+ (Long *)ARG4)); /* child_tidptr */
break;
=20
default:
/* should we just ENOSYS? */
- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: %x", ARG1);
+ VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%x", ARG1);
+ VG_(message)(Vg_UserMsg, "");
+ VG_(message)(Vg_UserMsg, "The only supported clone() uses are:");
+ VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads o=
r NPTL)");
+ VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfo=
rk");
VG_(unimplemented)
- ("Valgrind does not support general clone(). The only supporte=
d uses "
- "are via a threads library, fork, or vfork.");
+ ("Valgrind does not support general clone().");
}
=20
- if (!VG_(is_kerror)(RES)) {
+ if (SUCCESS) {
if (ARG1 & VKI_CLONE_PARENT_SETTID)
POST_MEM_WRITE(ARG3, sizeof(Int));
if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID))
@@ -609,35 +629,52 @@
=20
/* Thread creation was successful; let the child have the chance
to run */
- XXX FIXME VG_(vg_yield)();
+ *flags |=3D SfYieldAfter;
}
}
=20
-PRE(sys_rt_sigreturn, Special)
+PRE(sys_rt_sigreturn)
{
+ ThreadState* tst;
PRINT("rt_sigreturn ( )");
=20
+ vg_assert(VG_(is_valid_tid)(tid));
+ vg_assert(tid >=3D 1 && tid < VG_N_THREADS);
+ vg_assert(VG_(is_running_thread)(tid));
+
/* Adjust esp to point to start of frame; skip back up over handler
ret addr */
+ tst =3D VG_(get_ThreadState)(tid);
tst->arch.vex.guest_RSP -=3D sizeof(Addr);
=20
/* This is only so that the RIP is (might be) useful to report if
something goes wrong in the sigreturn */
- restart_syscall(&tst->arch);
+ VG_(fixup_guest_state_to_restart_syscall)(&tst->arch);
=20
VG_(sigframe_destroy)(tid, True);
=20
- /* Keep looking for signals until there are none */
- XXX FIXME VG_(poll_signals)(tid);
+ /* For unclear reasons, it appears we need the syscall to return
+ without changing %RAX. Since %RAX is the return value, and can
+ denote either success or failure, we must set up so that the
+ driver logic copies it back unchanged. Also, note %RAX is of
+ the guest registers written by VG_(sigframe_destroy). */
+ SET_STATUS_from_SysRes(
+ VG_(mk_SysRes_amd64_linux)( tst->arch.vex.guest_RAX )=20
+ );
=20
- /* placate return-must-be-set assertion */
- SET_RESULT(RES);
+ /* Check to see if some any signals arose as a result of this. */
+ *flags |=3D SfPollAfter;
}
=20
-PRE(sys_arch_prctl, 0)
+PRE(sys_arch_prctl)
{
+ ThreadState* tst;
PRINT( "arch_prctl ( %d, %llx )", ARG1, ARG2 );
=20
+ vg_assert(VG_(is_valid_tid)(tid));
+ vg_assert(tid >=3D 1 && tid < VG_N_THREADS);
+ vg_assert(VG_(is_running_thread)(tid));
+
// Nb: can't use "ARG2".."ARG5" here because that's our own macro...
PRE_REG_READ2(long, "arch_prctl",
int, option, unsigned long, arg2);
@@ -646,23 +683,29 @@
=20
/* "do" the syscall ourselves; the kernel never sees it */
vg_assert(ARG1 =3D=3D ARCH_SET_FS);
+ tst =3D VG_(get_ThreadState)(tid);
tst->arch.vex.guest_FS_ZERO =3D ARG2;
- SET_RESULT( 0 );
+
+ /* Note; the Status writeback to guest state that happens after
+ this wrapper returns does not change guest_FS_ZERO; hence that
+ direct assignment to the guest state is safe here. */
+ SET_STATUS_Success( 0 );
}
=20
-PRE(sys_socket, 0)
+PRE(sys_socket)
{
PRINT("sys_socket ( %d, %d, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "socket", int, domain, int, type, int, protocol);
}
-
POST(sys_socket)
{
- UWord r =3D VG_(generic_POST_sys_socket)(tid, RES);
- SET_RESULT(r);
+ SysRes r;
+ vg_assert(SUCCESS);
+ r =3D VG_(generic_POST_sys_socket)(tid, VG_(mk_SysRes_Success)(RES));
+ SET_STATUS_from_SysRes(r);
}
=20
-PRE(sys_setsockopt, 0)
+PRE(sys_setsockopt)
{
PRINT("sys_setsockopt ( %d, %d, %d, %p, %d )",ARG1,ARG2,ARG3,ARG4,ARG=
5);
PRE_REG_READ5(long, "setsockopt",
@@ -671,7 +714,7 @@
VG_(generic_PRE_sys_setsockopt)(tid, ARG1,ARG2,ARG3,ARG4,ARG5);
}
=20
-PRE(sys_getsockopt, 0)
+PRE(sys_getsockopt)
{
PRINT("sys_getsockopt ( %d, %d, %d, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG=
5);
PRE_REG_READ5(long, "getsockopt",
@@ -679,36 +722,42 @@
void *, optval, int, *optlen);
VG_(generic_PRE_sys_getsockopt)(tid, ARG1,ARG2,ARG3,ARG4,ARG5);
}
-
POST(sys_getsockopt)
{
- VG_(generic_POST_sys_getsockopt)(tid, RES,ARG1,ARG2,ARG3,ARG4,ARG5);
+ vg_assert(SUCCESS);
+ VG_(generic_POST_sys_getsockopt)(tid, VG_(mk_SysRes_Success)(RES),
+ ARG1,ARG2,ARG3,ARG4,ARG5);
}
=20
-PRE(sys_connect, MayBlock)
+PRE(sys_connect)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_connect ( %d, %p, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "connect",
int, sockfd, struct sockaddr *, serv_addr, int, addrlen=
);
VG_(generic_PRE_sys_connect)(tid, ARG1,ARG2,ARG3);
}
=20
-PRE(sys_accept, MayBlock)
+PRE(sys_accept)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_accept ( %d, %p, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "accept",
int, s, struct sockaddr *, addr, int, *addrlen);
VG_(generic_PRE_sys_accept)(tid, ARG1,ARG2,ARG3);
}
-
POST(sys_accept)
{
- UWord r =3D VG_(generic_POST_sys_accept)(tid, RES,ARG1,ARG2,ARG3);
- SET_RESULT(r);
+ SysRes r;
+ vg_assert(SUCCESS);
+ r =3D VG_(generic_POST_sys_accept)(tid, VG_(mk_SysRes_Success)(RES),
+ ARG1,ARG2,ARG3);
+ SET_STATUS_from_SysRes(r);
}
=20
-PRE(sys_sendto, MayBlock)
+PRE(sys_sendto)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_sendto ( %d, %s, %d, %u, %p, %d )",ARG1,ARG2,ARG3,ARG4,ARG=
5,ARG6);
PRE_REG_READ6(long, "sendto",
int, s, const void *, msg, int, len,=20
@@ -717,8 +766,9 @@
VG_(generic_PRE_sys_sendto)(tid, ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
}
=20
-PRE(sys_recvfrom, MayBlock)
+PRE(sys_recvfrom)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_recvfrom ( %d, %p, %d, %u, %p, %p )",ARG1,ARG2,ARG3,ARG4,A=
RG5,ARG6);
PRE_REG_READ6(long, "recvfrom",
int, s, void *, buf, int, len, unsigned int, flags,
@@ -727,35 +777,40 @@
}
POST(sys_recvfrom)
{
- VG_(generic_POST_sys_recvfrom)(tid, RES,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6=
);
+ vg_assert(SUCCESS);
+ VG_(generic_POST_sys_recvfrom)(tid, VG_(mk_SysRes_Success)(RES),
+ ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
}
=20
-PRE(sys_sendmsg, MayBlock)
+PRE(sys_sendmsg)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_sendmsg ( %d, %p, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "sendmsg",
int, s, const struct msghdr *, msg, int, flags);
VG_(generic_PRE_sys_sendmsg)(tid, ARG1,ARG2);
}
=20
-PRE(sys_recvmsg, MayBlock)
+PRE(sys_recvmsg)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_recvmsg ( %d, %p, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "recvmsg", int, s, struct msghdr *, msg, int, fla=
gs);
VG_(generic_PRE_sys_recvmsg)(tid, ARG1,ARG2);
}
POST(sys_recvmsg)
{
- VG_(generic_POST_sys_recvmsg)(tid, RES,ARG1,ARG2);
+ VG_(generic_POST_sys_recvmsg)(tid, ARG1,ARG2);
}
=20
-PRE(sys_shutdown, MayBlock)
+PRE(sys_shutdown)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_shutdown ( %d, %d )",ARG1,ARG2);
PRE_REG_READ2(int, "shutdown", int, s, int, how);
}
=20
-PRE(sys_bind, 0)
+PRE(sys_bind)
{
PRINT("sys_bind ( %d, %p, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "bind",
@@ -763,13 +818,13 @@
VG_(generic_PRE_sys_bind)(tid, ARG1,ARG2,ARG3);
}
=20
-PRE(sys_listen, 0)
+PRE(sys_listen)
{
PRINT("sys_listen ( %d, %d )",ARG1,ARG2);
PRE_REG_READ2(long, "listen", int, s, int, backlog);
}
=20
-PRE(sys_getsockname, 0)
+PRE(sys_getsockname)
{
PRINT("sys_getsockname ( %d, %p, %p )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "getsockname",
@@ -778,10 +833,12 @@
}
POST(sys_getsockname)
{
- VG_(generic_POST_sys_getsockname)(tid, RES,ARG1,ARG2,ARG3);
+ vg_assert(SUCCESS);
+ VG_(generic_POST_sys_getsockname)(tid, VG_(mk_SysRes_Success)(RES),
+ ARG1,ARG2,ARG3);
}
=20
-PRE(sys_getpeername, 0)
+PRE(sys_getpeername)
{
PRINT("sys_getpeername ( %d, %p, %p )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "getpeername",
@@ -790,10 +847,12 @@
}
POST(sys_getpeername)
{
- VG_(generic_POST_sys_getpeername)(tid, RES,ARG1,ARG2,ARG3);
+ vg_assert(SUCCESS);
+ VG_(generic_POST_sys_getpeername)(tid, VG_(mk_SysRes_Success)(RES),
+ ARG1,ARG2,ARG3);
}
=20
-PRE(sys_socketpair, 0)
+PRE(sys_socketpair)
{
PRINT("sys_socketpair ( %d, %d, %d, %p )",ARG1,ARG2,ARG3,ARG4);
PRE_REG_READ4(long, "socketpair",
@@ -802,25 +861,29 @@
}
POST(sys_socketpair)
{
- VG_(generic_POST_sys_socketpair)(tid, RES,ARG1,ARG2,ARG3,ARG4);
+ vg_assert(SUCCESS);
+ VG_(generic_POST_sys_socketpair)(tid, VG_(mk_SysRes_Success)(RES),
+ ARG1,ARG2,ARG3,ARG4);
}
=20
-PRE(sys_semget, 0)
+PRE(sys_semget)
{
PRINT("sys_semget ( %d, %d, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "semget", key_t, key, int, nsems, int, semflg);
}
=20
-PRE(sys_semop, MayBlock)
+PRE(sys_semop)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_semop ( %d, %p, %u )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "semop",
int, semid, struct sembuf *, sops, unsigned, nsoops);
VG_(generic_PRE_sys_semop)(tid, ARG1,ARG2,ARG3);
}
=20
-PRE(sys_semtimedop, MayBlock)
+PRE(sys_semtimedop)
{
+ *flags |=3D SfMayBlock;
PRINT("sys_semtimedop ( %d, %p, %u, %p )",ARG1,ARG2,ARG3,ARG4);
PRE_REG_READ4(long, "semtimedop",
int, semid, struct sembuf *, sops, unsigned, nsoops,
@@ -828,7 +891,7 @@
VG_(generic_PRE_sys_semtimedop)(tid, ARG1,ARG2,ARG3,ARG4);
}
=20
-PRE(sys_semctl, 0)
+PRE(sys_semctl)
{
switch (ARG3 & ~VKI_IPC_64) {
case VKI_IPC_INFO:
@@ -858,101 +921,93 @@
}
VG_(generic_PRE_sys_semctl)(tid, ARG1,ARG2,ARG3,ARG4);
}
-
POST(sys_semctl)
{
VG_(generic_POST_sys_semctl)(tid, RES,ARG1,ARG2,ARG3,ARG4);
}
=20
-PRE(sys_msgget, 0)
+PRE(sys_msgget)
{
PRINT("sys_msgget ( %d, %d )",ARG1,ARG2);
PRE_REG_READ2(long, "msgget", key_t, key, int, msgflg);
}
=20
-PRE(sys_msgsnd, 0)
+PRE(sys_msgsnd)
{
PRINT("sys_msgsnd ( %d, %p, %d, %d )",ARG1,ARG2,ARG3,ARG4);
PRE_REG_READ4(long, "msgsnd",
int, msqid, struct msgbuf *, msgp, size_t, msgsz, int, =
msgflg);
VG_(generic_PRE_sys_msgsnd)(tid, ARG1,ARG2,ARG3,ARG4);
- /* if ((ARG4 & VKI_IPC_NOWAIT) =3D=3D 0)
- tst->sys_flags |=3D MayBlock;
- */
+ if ((ARG4 & VKI_IPC_NOWAIT) =3D=3D 0)
+ *flags |=3D SfMayBlock;
}
=20
-PRE(sys_msgrcv, 0)
+PRE(sys_msgrcv)
{
PRINT("sys_msgrcv ( %d, %p, %d, %d, %d )",ARG1,ARG2,ARG3,ARG4,ARG5);
PRE_REG_READ5(long, "msgrcv",
int, msqid, struct msgbuf *, msgp, size_t, msgsz,
long, msgytp, int, msgflg);
VG_(generic_PRE_sys_msgrcv)(tid, ARG1,ARG2,ARG3,ARG4,ARG5);
- /* if ((ARG4 & VKI_IPC_NOWAIT) =3D=3D 0)
- tst->sys_flags |=3D MayBlock;
- */
+ if ((ARG4 & VKI_IPC_NOWAIT) =3D=3D 0)
+ *flags |=3D SfMayBlock;
}
-
POST(sys_msgrcv)
{
VG_(generic_POST_sys_msgrcv)(tid, RES,ARG1,ARG2,ARG3,ARG4,ARG5);
}
=20
-PRE(sys_msgctl, 0)
+PRE(sys_msgctl)
{
PRINT("sys_msgctl ( %d, %d, %p )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "msgctl",
int, msqid, int, cmd, struct msqid_ds *, buf);
VG_(generic_PRE_sys_msgctl)(tid, ARG1,ARG2,ARG3);
}
-
POST(sys_msgctl)
{
VG_(generic_POST_sys_msgctl)(tid, RES,ARG1,ARG2,ARG3);
}
=20
-PRE(sys_shmget, 0)
+PRE(sys_shmget)
{
PRINT("sys_shmget ( %d, %d, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "shmget", key_t, key, size_t, size, int, shmflg);
}
=20
-PRE(wrap_sys_shmat, 0)
+PRE(wrap_sys_shmat)
{
PRINT("wrap_sys_shmat ( %d, %p, %d )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "shmat",
int, shmid, const void *, shmaddr, int, shmflg);
ARG2 =3D VG_(generic_PRE_sys_shmat)(tid, ARG1,ARG2,ARG3);
if (ARG2 =3D=3D 0)
- SET_RESULT( -VKI_EINVAL );
+ SET_STATUS_Failure( VKI_EINVAL );
}
-
POST(wrap_sys_shmat)
{
VG_(generic_POST_sys_shmat)(tid, RES,ARG1,ARG2,ARG3);
}
=20
-PRE(sys_shmdt, 0)
+PRE(sys_shmdt)
{
PRINT("sys_shmdt ( %p )",ARG1);
PRE_REG_READ1(long, "shmdt", const void *, shmaddr);
if (!VG_(generic_PRE_sys_shmdt)(tid, ARG1))
- SET_RESULT( -VKI_EINVAL );
+ SET_STATUS_Failure( VKI_EINVAL );
}
-
POST(sys_shmdt)
{
VG_(generic_POST_sys_shmdt)(tid, RES,ARG1);
}
=20
-PRE(sys_shmctl, 0)
+PRE(sys_shmctl)
{
PRINT("sys_shmctl ( %d, %d, %p )",ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "shmctl",
int, shmid, int, cmd, struct shmid_ds *, buf);
VG_(generic_PRE_sys_shmctl)(tid, ARG1,ARG2,ARG3);
}
-
POST(sys_shmctl)
{
VG_(generic_POST_sys_shmctl)(tid, RES,ARG1,ARG2,ARG3);
@@ -966,9 +1021,9 @@
The AMD64/Linux syscall table
------------------------------------------------------------------ */
=20
-// Macros for adding AMD64/Linux-specific wrappers to the syscall table.
-#define PLAX_(const, name) SYS_WRAPPER_ENTRY_X_(amd64_linux, const, n=
ame)=20
-#define PLAXY(const, name) SYS_WRAPPER_ENTRY_XY(amd64_linux, const, n=
ame)=20
+/* Add an amd64-linux specific wrapper to a syscall table. */
+#define PLAX_(const, name) WRAPPER_ENTRY_X_(amd64_linux, const, name)=
=20
+#define PLAXY(const, name) WRAPPER_ENTRY_XY(amd64_linux, const, name)=
=20
=20
// This table maps from __NR_xxx syscall numbers (from
// linux/include/asm-x86_64/unistd.h) to the appropriate PRE/POST sys_fo=
o()
@@ -978,7 +1033,7 @@
// When implementing these wrappers, you need to work out if the wrapper=
is
// generic, Linux-only (but arch-independent), or AMD64/Linux only.
=20
-const struct SyscallTableEntry VGA_(syscall_table)[] =3D {
+const SyscallTableEntry VGP_(syscall_table)[] =3D {
GENXY(__NR_read, sys_read), // 0=20
GENX_(__NR_write, sys_write), // 1=20
GENXY(__NR_open, sys_open), // 2=20
@@ -1089,8 +1144,8 @@
=20
GENX_(__NR_chmod, sys_chmod), // 90=20
GENX_(__NR_fchmod, sys_fchmod), // 91=20
- GENX_(__NR_chown, sys_chown), // 92=20
- GENX_(__NR_fchown, sys_fchown), // 93=20
+//zz GENX_(__NR_chown, sys_chown), // 92=20
+//zz GENX_(__NR_fchown, sys_fchown), // 93=20
// (__NR_lchown, sys_lchown), // 94=20
=20
GENX_(__NR_umask, sys_umask), // 95=20
@@ -1105,8 +1160,8 @@
// (__NR_syslog, sys_syslog), // 103=20
GENX_(__NR_getgid, sys_getgid), // 104=20
=20
- GENX_(__NR_setuid, sys_setuid), // 105=20
- GENX_(__NR_setgid, sys_setgid), // 106=20
+//zz GENX_(__NR_setuid, sys_setuid), // 105=20
+//zz GENX_(__NR_setgid, sys_setgid), // 106=20
GENX_(__NR_geteuid, sys_geteuid), // 107=20
GENX_(__NR_getegid, sys_getegid), // 108=20
GENX_(__NR_setpgid, sys_setpgid), // 109=20
@@ -1118,10 +1173,10 @@
// (__NR_setregid, sys_setregid), // 114=20
=20
GENXY(__NR_getgroups, sys_getgroups), // 115=20
- GENX_(__NR_setgroups, sys_setgroups), // 116=20
- LINX_(__NR_setresuid, sys_setresuid), // 117=20
+//zz GENX_(__NR_setgroups, sys_setgroups), // 116=20
+//zz LINX_(__NR_setresuid, sys_setresuid), // 117=20
LINXY(__NR_getresuid, sys_getresuid), // 118=20
- LINX_(__NR_setresgid, sys_setresgid), // 119=20
+//zz LINX_(__NR_setresgid, sys_setresgid), // 119=20
=20
LINXY(__NR_getresgid, sys_getresgid), // 120=20
GENX_(__NR_getpgid, sys_getpgid), // 121=20
@@ -1131,9 +1186,9 @@
=20
// (__NR_capget, sys_capget), // 125=20
// (__NR_capset, sys_capset), // 126=20
- GENXY(__NR_rt_sigpending, sys_rt_sigpending), // 127=20
+//zz GENXY(__NR_rt_sigpending, sys_rt_sigpending), // 127=20
GENXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait),// 128=20
- GENXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo),// 129=20
+//zz GENXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo),// 129=20
=20
GENX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 130=20
GENXY(__NR_sigaltstack, sys_sigaltstack), // 131=20
@@ -1149,7 +1204,7 @@
=20
// (__NR_getpriority, sys_getpriority), // =
140=20
// (__NR_setpriority, sys_setpriority), // =
141=20
- GENXY(__NR_sched_setparam, sys_sched_setparam), // =
142=20
+//zz GENXY(__NR_sched_setparam, sys_sched_setparam), =
// 142=20
GENXY(__NR_sched_getparam, sys_sched_getparam), // =
143=20
GENX_(__NR_sched_setscheduler, sys_sched_setscheduler), // =
144=20
=20
@@ -1226,25 +1281,25 @@
// (__NR_sched_getaffinity, sys_sched_getaffinity), // 204=20
=20
// (__NR_set_thread_area, sys_ni_syscall), // 205=20
- LINX_(__NR_io_setup, sys_io_setup), // 206=20
- LINX_(__NR_io_destroy, sys_io_destroy), // 207=20
- LINXY(__NR_io_getevents, sys_io_getevents), // 208=20
- LINX_(__NR_io_submit, sys_io_submit), // 209=20
+//zz LINX_(__NR_io_setup, sys_io_setup), // 206=20
+//zz LINX_(__NR_io_destroy, sys_io_destroy), // 207=20
+//zz LINXY(__NR_io_getevents, sys_io_getevents), // 208=20
+//zz LINX_(__NR_io_submit, sys_io_submit), // 209=20
=20
- LINXY(__NR_io_cancel, sys_io_cancel), // 210=20
+//zz LINXY(__NR_io_cancel, sys_io_cancel), // 210=20
// (__NR_get_thread_area, sys_ni_syscall), // 211=20
// (__NR_lookup_dcookie, sys_lookup_dcookie), // 212=20
- LINXY(__NR_epoll_create, sys_epoll_create), // 213=20
+//zz LINXY(__NR_epoll_create, sys_epoll_create), // 213=20
// (__NR_epoll_ctl_old, sys_ni_syscall), // 214=20
=20
// (__NR_epoll_wait_old, sys_ni_syscall), // 215=20
// (__NR_remap_file_pages, sys_remap_file_pages)// 216=20
GENXY(__NR_getdents64, sys_getdents64), // 217=20
- GENX_(__NR_set_tid_address, sys_set_tid_address),// 218=20
+ LINX_(__NR_set_tid_address, sys_set_tid_address),// 218=20
// (__NR_restart_syscall, sys_restart_syscall),// 219=20
=20
PLAX_(__NR_semtimedop, sys_semtimedop), // 220=20
- LINX_(__NR_fadvise64, sys_fadvise64), // 221=20
+//zz LINX_(__NR_fadvise64, sys_fadvise64), // 221=20
// (__NR_timer_create, sys_timer_create), // 222=20
// (__NR_timer_settime, sys_timer_settime), // 223=20
// (__NR_timer_gettime, sys_timer_gettime), // 224=20
@@ -1257,8 +1312,8 @@
=20
// (__NR_clock_nanosleep, sys_clock_nanosleep),// 230=20
LINX_(__NR_exit_group, sys_exit_group), // 231=20
- LINXY(__NR_epoll_wait, sys_epoll_wait), // 232=20
- LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 233=20
+//zz LINXY(__NR_epoll_wait, sys_epoll_wait), // 232=20
+//zz LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 233=20
LINXY(__NR_tgkill, sys_tgkill), // 234=20
=20
// (__NR_utimes, sys_utimes), // 235=20
@@ -1279,13 +1334,9 @@
// (__NR_waitid, sys_waitid), // 247=20
};
=20
-const UInt VGA_(syscall_table_size) =3D=20
- sizeof(VGA_(syscall_table)) / sizeof(VGA_(syscall_table)[0])=
;
+const UInt VGP_(syscall_table_size) =3D=20
+ sizeof(VGP_(syscall_table)) / sizeof(VGP_(syscall_table)[0])=
;
=20
-//void VG_(clear_TLS_for_thread) ( VgLdtEntry* tls )
-//{
-//}
-
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syscalls/syscalls-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-generic.c 2005-06-09 09:18:01 UTC=
(rev 3855)
+++ trunk/coregrind/m_syscalls/syscalls-generic.c 2005-06-09 12:43:42 UTC=
(rev 3856)
@@ -1648,9 +1648,9 @@
#define PRE(name) DEFN_PRE_TEMPLATE(generic, name)
#define POST(name) DEFN_POST_TEMPLATE(generic, name)
=20
-//zz // Combine two 32-bit values into a 64-bit value
-//zz #define LOHI64(lo,hi) ( (lo) | ((ULong)(hi) << 32) )
-//zz=20
+// Combine two 32-bit values into a 64-bit value
+#define LOHI64(lo,hi) ( (lo) | ((ULong)(hi) << 32) )
+
//zz //PRE(sys_exit_group, Special)
//zz //{
//zz // VG_(core_panic)("syscall exit_group() not caught by the schedu=
ler?!");
@@ -2147,23 +2147,26 @@
PRE_REG_READ1(long, "getsid", vki_pid_t, pid);
}
=20
-//zz // XXX: only for 32-bit archs
-//zz PRE(sys_pread64, SfMayBlock)
-//zz {
-//zz PRINT("sys_pread64 ( %d, %p, %llu, %lld )",
-//zz ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
-//zz PRE_REG_READ5(ssize_t, "pread64",
-//zz unsigned int, fd, char *, buf, vki_size_t, count,
-//zz vki_u32, offset_low32, vki_u32, offset_high32);
-//zz PRE_MEM_WRITE( "pread64(buf)", ARG2, ARG3 );
-//zz }
-//zz=20
-//zz POST(sys_pread64)
-//zz {
-//zz if (RES > 0) {
-//zz POST_MEM_WRITE( ARG2, RES );
-//zz }
-//zz }
+// XXX: only for 32-bit archs
+// XXX even more: this in fact gets used by amd64-linux. Someone
+// should look into this properly.
+PRE(sys_pread64)
+{
+ *flags |=3D SfMayBlock;
+ PRINT("sys_pread64 ( %d, %p, %llu, %lld )",
+ ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
+ PRE_REG_READ5(ssize_t, "pread64",
+ unsigned int, fd, char *, buf, vki_size_t, count,
+ vki_u32, offset_low32, vki_u32, offset_high32);
+ PRE_MEM_WRITE( "pread64(buf)", ARG2, ARG3 );
+}
+POST(sys_pread64)
+{
+ vg_assert(SUCCESS);
+ if (RES > 0) {
+ POST_MEM_WRITE( ARG2, RES );
+ }
+}
=20
PRE(sys_mknod)
{
@@ -2579,7 +2582,7 @@
case VKI_F_GETLK:
case VKI_F_SETLK:
case VKI_F_SETLKW:
-# if defined(VGP_amd64_linux)
+# if defined(VGP_x86_linux)
case VKI_F_GETLK64:
case VKI_F_SETLK64:
case VKI_F_SETLKW64:
@@ -2641,7 +2644,7 @@
case VKI_F_GETLK:
case VKI_F_SETLK:
case VKI_F_SETLKW:
-# if defined(VGP_amd64_linux)
+# if defined(VGP_x86_linux)
case VKI_F_GETLK64:
case VKI_F_SETLK64:
case VKI_F_SETLKW64:
@@ -2653,12 +2656,12 @@
break;
}
=20
-# if defined(VGP_amd64_linux)
- //if (ARG2 =3D=3D VKI_F_SETLKW || ARG2 =3D=3D VKI_F_SETLKW64)
- // tst->sys_flags |=3D SfMayBlock;
+# if defined(VGP_x86_linux)
+ if (ARG2 =3D=3D VKI_F_SETLKW || ARG2 =3D=3D VKI_F_SETLKW64)
+ *flags |=3D SfMayBlock;
# else
- //if (ARG2 =3D=3D VKI_F_SETLKW)
- // tst->sys_flags |=3D SfMayBlock;
+ if (ARG2 =3D=3D VKI_F_SETLKW)
+ *flags |=3D SfMayBlock;
# endif
}
=20
Modified: trunk/coregrind/m_syscalls/syscalls-main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-main.c 2005-06-09 09:18:01 UTC (r=
ev 3855)
+++ trunk/coregrind/m_syscalls/syscalls-main.c 2005-06-09 12:43:42 UTC (r=
ev 3856)
@@ -43,6 +43,15 @@
#include "priv_syscalls-main.h"
=20
=20
+/* Useful info which needs to be recorded somewhere:
+ Use of registers in syscalls (on linux) is:
+
+ NUM ARG1 ARG2 ARG3 ARG4 ARG5 ARG6 RESULT
+ x86 eax ebx ecx edx esi edi ebp eax (=3D=3D NUM=
)
+ amd64 rax rdi rsi rdx r10 r8 r9 rax (=3D=3D NUM=
)
+ ppc32 r0 r3 r4 r5 r6 r7 r8 r3+CR0.SO (=3D=3D ARG=
1)
+*/
+
/* This is the top level of the system-call handler module. All
system calls are channelled through here, doing two things:
=20
@@ -262,8 +271,19 @@
canonical->arg5 =3D gst->guest_EDI;
canonical->arg6 =3D gst->guest_EBP;
# else
+# if defined(VGP_amd64_linux)
+ VexGuestAMD64State* gst =3D (VexGuestAMD64State*)gst_vanilla;
+ canonical->sysno =3D gst->guest_RAX;
+ canonical->arg1 =3D gst->guest_RDI;
+ canonical->arg2 =3D gst->guest_RSI;
+ canonical->arg3 =3D gst->guest_RDX;
+ canonical->arg4 =3D gst->guest_R10;
+ canonical->arg5 =3D gst->guest_R8;
+ canonical->arg6 =3D gst->guest_R9;
+# else
# error "getSyscallArgsFromGuestState: unknown arch"
# endif
+# endif
}
=20
static=20
@@ -280,8 +300,19 @@
gst->guest_EDI =3D canonical->arg5;
gst->guest_EBP =3D canonical->arg6;
# else
+# if defined(VGP_amd64_linux)
+ VexGuestAMD64State* gst =3D (VexGuestAMD64State*)gst_vanilla;
+ gst->guest_RAX =3D canonical->sysno;
+ gst->guest_RDI =3D canonical->arg1;
+ gst->guest_RSI =3D canonical->arg2;
+ gst->guest_RDX =3D canonical->arg3;
+ gst->guest_R10 =3D canonical->arg4;
+ gst->guest_R8 =3D canonical->arg5;
+ gst->guest_R9 =3D canonical->arg6;
+# else
# error "putSyscallArgsIntoGuestState: unknown arch"
# endif
+# endif
}
=20
static
@@ -294,8 +325,15 @@
canonical->what =3D i >=3D -4095 && i <=3D -1 ? SsFailure : SsSucce=
ss;
canonical->val =3D (UWord)(canonical->what=3D=3DSsFailure ? -i : i);
# else
+# if defined(VGP_amd64_linux)
+ VexGuestAMD64State* gst =3D (VexGuestAMD64State*)gst_vanilla;
+ Long i =3D (Int)gst->guest_RAX;
+ canonical->what =3D i >=3D -4095 && i <=3D -1 ? SsFailure : SsSucce=
ss;
+ canonical->val =3D (UWord)(canonical->what=3D=3DSsFailure ? -i : i);
+# else
# error "getSyscallStatusFromGuestState: unknown arch"
# endif
+# endif
}
=20
static=20
@@ -315,8 +353,20 @@
gst->guest_EAX =3D canonical-...
[truncated message content] |
|
From: <sv...@va...> - 2005-06-09 09:18:09
|
Author: sewardj Date: 2005-06-09 10:18:01 +0100 (Thu, 09 Jun 2005) New Revision: 3855 Log: wibble Modified: trunk/NOTES.txt Modified: trunk/NOTES.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/NOTES.txt 2005-06-08 23:38:32 UTC (rev 3854) +++ trunk/NOTES.txt 2005-06-09 09:18:01 UTC (rev 3855) @@ -2,6 +2,10 @@ ~~~~~~~~~ ToDo: vex-amd64: check above/below the line for reg-alloc =20 +9 June 05 (after major syscalls overhaul) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +corecheck/m_syscalls/syscalls-x86-linux.h is now empty. Should it be +deleted? =20 23 Apr 05 (memcheck-on-amd64 notes) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
From: Tom H. <th...@cy...> - 2005-06-09 03:07:13
|
Nightly build on audi ( i686, Red Hat 9 ) started at 2005-06-09 03:25:02 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 176 tests, 10 stderr failures, 1 stdout failure ================= memcheck/tests/sigaltstack (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) corecheck/tests/fdleak_cmsg (stderr) corecheck/tests/pth_cancel1 (stdout) corecheck/tests/pth_cancel1 (stderr) corecheck/tests/pth_cancel2 (stderr) none/tests/faultstatus (stderr) none/tests/pth_blockedsig (stderr) none/tests/x86/int (stderr) |
|
From: <js...@ac...> - 2005-06-09 02:50:02
|
Nightly build on phoenix ( SuSE 9.1 ) started at 2005-06-09 03:50:00 BST Checking out source tree ... done Configuring ... done Building ... done Running regression tests ... done Last 20 lines of log.verbose follow Nightly build on phoenix ( SuSE 9.1 ) started at 2005-06-09 03:50:00 BST |
|
From: Tom H. <th...@cy...> - 2005-06-09 02:25:52
|
Nightly build on ginetta ( i686, Red Hat 8.0 ) started at 2005-06-09 03:20:02 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 175 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/vgtest_ume (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) corecheck/tests/fdleak_cmsg (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-06-09 02:20:51
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2005-06-09 03:15:02 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 175 tests, 14 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vgtest_ume (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) corecheck/tests/fdleak_cmsg (stderr) none/tests/faultstatus (stderr) none/tests/x86/int (stderr) none/tests/yield (stdout) |
|
From: Tom H. <th...@cy...> - 2005-06-09 02:11:24
|
Nightly build on dellow ( x86_64, Fedora Core 3 ) started at 2005-06-09 03:10:04 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... failed Last 20 lines of log.verbose follow gcc -I../../coregrind -I../.. -I../../coregrind/amd64 -I../../coregrind/linux -I../../coregrind/amd64-linux -I../../include -I/tmp/valgrind.21527/vex/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -m64 -Wa,-gstabs -Wno-long-long -c syscall-amd64-linux.S if gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../coregrind -I../.. -I../../coregrind/amd64 -I../../coregrind/linux -I../../coregrind/amd64-linux -I../../include -I/tmp/valgrind.21527/vex/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -fpie -m64 -fomit-frame-pointer -DELFSZ=64 -Wmissing-prototypes -Winline -Wall -Wshadow -O -g -Wno-long-long -MT syscalls-generic.o -MD -MP -MF ".deps/syscalls-generic.Tpo" -c -o syscalls-generic.o syscalls-generic.c; \ then mv -f ".deps/syscalls-generic.Tpo" ".deps/syscalls-generic.Po"; else rm -f ".deps/syscalls-generic.Tpo"; exit 1; fi syscalls-generic.c: In function `vgSysWrap_generic_sys_fcntl_before': syscalls-generic.c:2583: error: `VKI_F_GETLK64' undeclared (first use in this function) syscalls-generic.c:2583: error: (Each undeclared identifier is reported only once syscalls-generic.c:2583: error: for each function it appears in.) syscalls-generic.c:2584: error: `VKI_F_SETLK64' undeclared (first use in this function) syscalls-generic.c:2585: error: `VKI_F_SETLKW64' undeclared (first use in this function) syscalls-generic.c: In function `vgSysWrap_generic_sys_fcntl64_before': syscalls-generic.c:2645: error: `VKI_F_GETLK64' undeclared (first use in this function) syscalls-generic.c:2646: error: `VKI_F_SETLK64' undeclared (first use in this function) syscalls-generic.c:2647: error: `VKI_F_SETLKW64' undeclared (first use in this function) make[3]: *** [syscalls-generic.o] Error 1 make[3]: Leaving directory `/tmp/valgrind.21527/valgrind/coregrind/m_syscalls' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/tmp/valgrind.21527/valgrind/coregrind' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/valgrind.21527/valgrind' make: *** [all] Error 2 |
|
From: Tom H. <th...@cy...> - 2005-06-09 02:01:36
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2005-06-09 03:00:03 BST Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... failed Last 20 lines of log.verbose follow gcc -I../../coregrind -I../.. -I../../coregrind/amd64 -I../../coregrind/linux -I../../coregrind/amd64-linux -I../../include -I/tmp/valgrind.26825/vex/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -m64 -Wa,-gstabs -Wno-long-long -c syscall-amd64-linux.S if gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../coregrind -I../.. -I../../coregrind/amd64 -I../../coregrind/linux -I../../coregrind/amd64-linux -I../../include -I/tmp/valgrind.26825/vex/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -fpie -m64 -fomit-frame-pointer -DELFSZ=64 -Wmissing-prototypes -Winline -Wall -Wshadow -O -g -Wno-long-long -MT syscalls-generic.o -MD -MP -MF ".deps/syscalls-generic.Tpo" -c -o syscalls-generic.o syscalls-generic.c; \ then mv -f ".deps/syscalls-generic.Tpo" ".deps/syscalls-generic.Po"; else rm -f ".deps/syscalls-generic.Tpo"; exit 1; fi syscalls-generic.c: In function `vgSysWrap_generic_sys_fcntl_before': syscalls-generic.c:2583: error: `VKI_F_GETLK64' undeclared (first use in this function) syscalls-generic.c:2583: error: (Each undeclared identifier is reported only once syscalls-generic.c:2583: error: for each function it appears in.) syscalls-generic.c:2584: error: `VKI_F_SETLK64' undeclared (first use in this function) syscalls-generic.c:2585: error: `VKI_F_SETLKW64' undeclared (first use in this function) syscalls-generic.c: In function `vgSysWrap_generic_sys_fcntl64_before': syscalls-generic.c:2645: error: `VKI_F_GETLK64' undeclared (first use in this function) syscalls-generic.c:2646: error: `VKI_F_SETLK64' undeclared (first use in this function) syscalls-generic.c:2647: error: `VKI_F_SETLKW64' undeclared (first use in this function) make[3]: *** [syscalls-generic.o] Error 1 make[3]: Leaving directory `/tmp/valgrind.26825/valgrind/coregrind/m_syscalls' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/tmp/valgrind.26825/valgrind/coregrind' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/valgrind.26825/valgrind' make: *** [all] Error 2 |