#include "ume.h"
#include "memcheck/memcheck.h"
#include "pub_core_debuglog.h"
+#include "pub_core_libcbase.h"
#include "pub_core_libcproc.h"
#include <assert.h>
#include "ume.h"
+#include "pub_core_libcbase.h"
#if ELFSZ == 64
#define ESZ(x) Elf64_##x
non-builtin types
------------------------------------------------------------------ */
+// XXX: these probably shouldn't be here...
+
/* ThreadIds are simply indices into the VG_(threads)[] array. */
typedef
UInt
ThreadId;
+/* Special magic value for an invalid ThreadId. It corresponds to
+ LinuxThreads using zero as the initial value for
+ pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */
+#define VG_INVALID_THREADID ((ThreadId)(0))
+
+
/* An abstraction of syscall return values.
When .isError == False, val holds the return value.
When .isError == True, val holds the error code.
#define VG_IS_WORD_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(sizeof(Addr)-1))))
#define VG_IS_PAGE_ALIGNED(aaa_p) (0 == (((Addr)(aaa_p)) & ((Addr)(VKI_PAGE_SIZE-1))))
+// 'a' -- the alignment -- must be a power of 2.
+// The latter two require the vki-*.h header to be imported also.
+#define VG_ROUNDDN(p, a) ((Addr)(p) & ~((Addr)(a)-1))
+#define VG_ROUNDUP(p, a) VG_ROUNDDN((p)+(a)-1, (a))
+#define VG_PGROUNDDN(p) VG_ROUNDDN(p, VKI_PAGE_SIZE)
+#define VG_PGROUNDUP(p) VG_ROUNDUP(p, VKI_PAGE_SIZE)
+
/* ---------------------------------------------------------------------
Misc useful functions
------------------------------------------------------------------ */
/*=== Useful macros ===*/
/*====================================================================*/
-// 'a' -- the alignment -- must be a power of 2
-#define VG_ROUNDDN(p, a) ((Addr)(p) & ~((Addr)(a)-1))
-#define VG_ROUNDUP(p, a) VG_ROUNDDN((p)+(a)-1, (a))
-#define VG_PGROUNDDN(p) VG_ROUNDDN(p, VKI_PAGE_SIZE)
-#define VG_PGROUNDUP(p) VG_ROUNDUP(p, VKI_PAGE_SIZE)
-
/* Path to all our library/aux files */
extern const Char *VG_(libdir);
/* ------------------------------------------------------------------ */
/* Thread-related stuff */
-/* Special magic value for an invalid ThreadId. It corresponds to
- LinuxThreads using zero as the initial value for
- pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */
-#define VG_INVALID_THREADID ((ThreadId)(0))
-
/* Get the TID of the thread which currently has the CPU. */
extern ThreadId VG_(get_running_tid) ( void );