From: Nicholas Nethercote Date: Sun, 12 Jun 2005 04:34:51 +0000 (+0000) Subject: Move the *ROUND* macros to a better place. X-Git-Tag: svn/VALGRIND_3_0_0~421 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c4f10d8456879aa334cbf9abc0653926798b16b;p=thirdparty%2Fvalgrind.git Move the *ROUND* macros to a better place. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3897 --- diff --git a/coregrind/stage1.c b/coregrind/stage1.c index 7a3fb77138..45a1999d12 100644 --- a/coregrind/stage1.c +++ b/coregrind/stage1.c @@ -45,6 +45,7 @@ #include "ume.h" #include "memcheck/memcheck.h" #include "pub_core_debuglog.h" +#include "pub_core_libcbase.h" #include "pub_core_libcproc.h" diff --git a/coregrind/ume.c b/coregrind/ume.c index 9393921626..cd997ffbcf 100644 --- a/coregrind/ume.c +++ b/coregrind/ume.c @@ -45,6 +45,7 @@ #include #include "ume.h" +#include "pub_core_libcbase.h" #if ELFSZ == 64 #define ESZ(x) Elf64_##x diff --git a/include/basic_types.h b/include/basic_types.h index 786c3a284e..7b747c5be9 100644 --- a/include/basic_types.h +++ b/include/basic_types.h @@ -69,11 +69,19 @@ typedef Word OffT; // 32 64 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. diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h index e96a8c5887..fb59b39b93 100644 --- a/include/pub_tool_libcbase.h +++ b/include/pub_tool_libcbase.h @@ -96,6 +96,13 @@ extern Int VG_(memcmp) ( const void* s1, const void* s2, SizeT n ); #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 ------------------------------------------------------------------ */ diff --git a/include/tool.h b/include/tool.h index d837f3c9e5..6fcb90d5fe 100644 --- a/include/tool.h +++ b/include/tool.h @@ -57,12 +57,6 @@ /*=== 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); @@ -73,11 +67,6 @@ 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 );