set_address_range_perms ( a, len, VGM_BIT_VALID, VGM_BIT_VALID );
}
+/* For each byte in [a,a+len), if the byte is addressable, make it be
+ defined, but if it isn't addressible, leave it alone. In other
+ words a version of mc_make_readable that doesn't mess with
+ addressibility. Low-performance implementation. */
+static void mc_make_defined ( Addr a, SizeT len )
+{
+ SizeT i;
+ UWord abit, vbyte;
+ DEBUG("mc_make_defined(%p, %llu)\n", a, (ULong)len);
+ for (i = 0; i < len; i++) {
+ get_abit_and_vbyte( &abit, &vbyte, a+i );
+ if (EXPECTED_TAKEN(abit == VGM_BIT_VALID))
+ set_vbyte(a+i, VGM_BYTE_VALID);
+ }
+}
+
/* --- Block-copy permissions (needed for implementing realloc() and
sys_mremap). --- */
*ret = -1;
break;
+ case VG_USERREQ__MAKE_DEFINED: /* make defined */
+ mc_make_defined ( arg[1], arg[2] );
+ *ret = -1;
+ break;
+
case VG_USERREQ__CREATE_BLOCK: /* describe a block */
if (arg[1] != 0 && arg[2] != 0) {
i = alloc_client_block();
#include "valgrind.h"
+/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !!
+ This enum comprises an ABI exported by Valgrind to programs
+ which use client requests. DO NOT CHANGE THE ORDER OF THESE
+ ENTRIES, NOT DELETE ANY -- add new ones at the end. */
typedef
enum {
VG_USERREQ__MAKE_NOACCESS = VG_USERREQ_TOOL_BASE('M','C'),
VG_USERREQ__CREATE_BLOCK,
+ VG_USERREQ__MAKE_DEFINED,
+
/* This is just for memcheck's internal use - don't use it */
_VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR
= VG_USERREQ_TOOL_BASE('M','C') + 256
_qzz_res; \
}))
+/* Similar to mark memory at VALGRIND_MAKE_READABLE except that
+ addressibility is not altered: bytes which are addressible are
+ marked as defined, but those which are not addressible are
+ left unchanged. */
+#define VALGRIND_MAKE_DEFINED(_qzz_addr,_qzz_len) \
+ (__extension__({unsigned int _qzz_res; \
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VG_USERREQ__MAKE_DEFINED, \
+ _qzz_addr, _qzz_len, 0, 0, 0); \
+ _qzz_res; \
+ }))
+
/* Create a block-description handle. The description is an ascii
string which is included in any messages pertaining to addresses
within the specified memory range. Has no other effect on the