|
From: <sv...@va...> - 2010-01-01 18:37:42
|
Author: sewardj
Date: 2010-01-01 18:31:41 +0000 (Fri, 01 Jan 2010)
New Revision: 10985
Log:
Make Callgrind, DRD and Ptrcheck build on arm-linux.
Modified:
trunk/callgrind/Makefile.am
trunk/drd/drd_bitmap.h
trunk/drd/drd_load_store.c
trunk/exp-ptrcheck/h_main.c
trunk/exp-ptrcheck/pc_main.c
Modified: trunk/callgrind/Makefile.am
===================================================================
--- trunk/callgrind/Makefile.am 2010-01-01 18:30:59 UTC (rev 10984)
+++ trunk/callgrind/Makefile.am 2010-01-01 18:31:41 UTC (rev 10985)
@@ -48,8 +48,9 @@
threads.c \
../cachegrind/cg-x86-amd64.c \
../cachegrind/cg-ppc32.c \
- ../cachegrind/cg-ppc64.c
-
+ ../cachegrind/cg-ppc64.c \
+ ../cachegrind/cg-arm.c
+
CALLGRIND_CFLAGS_COMMON = -I$(top_srcdir)/cachegrind
callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
Modified: trunk/drd/drd_bitmap.h
===================================================================
--- trunk/drd/drd_bitmap.h 2010-01-01 18:30:59 UTC (rev 10984)
+++ trunk/drd/drd_bitmap.h 2010-01-01 18:31:41 UTC (rev 10985)
@@ -134,7 +134,7 @@
#define BITS_PER_UWORD (8U * sizeof(UWord))
/** Log2 of BITS_PER_UWORD. */
-#if defined(VGA_x86) || defined(VGA_ppc32)
+#if defined(VGA_x86) || defined(VGA_ppc32) || defined(VGA_arm)
#define BITS_PER_BITS_PER_UWORD 5
#elif defined(VGA_amd64) || defined(VGA_ppc64)
#define BITS_PER_BITS_PER_UWORD 6
Modified: trunk/drd/drd_load_store.c
===================================================================
--- trunk/drd/drd_load_store.c 2010-01-01 18:30:59 UTC (rev 10984)
+++ trunk/drd/drd_load_store.c 2010-01-01 18:31:41 UTC (rev 10985)
@@ -43,9 +43,11 @@
#elif defined(VGA_amd64)
#define STACK_POINTER_OFFSET OFFSET_amd64_RSP
#elif defined(VGA_ppc32)
-#define STACK_POINTER_OFFSET ((OFFSET_ppc32_GPR0 + OFFSET_ppc32_GPR2) / 2)
+#define STACK_POINTER_OFFSET OFFSET_ppc32_GPR1
#elif defined(VGA_ppc64)
-#define STACK_POINTER_OFFSET ((OFFSET_ppc64_GPR0 + OFFSET_ppc64_GPR2) / 2)
+#define STACK_POINTER_OFFSET OFFSET_ppc64_GPR1
+#elif defined(VGA_arm)
+#define STACK_POINTER_OFFSET OFFSET_arm_R13
#else
#error Unknown architecture.
#endif
Modified: trunk/exp-ptrcheck/h_main.c
===================================================================
--- trunk/exp-ptrcheck/h_main.c 2010-01-01 18:30:59 UTC (rev 10984)
+++ trunk/exp-ptrcheck/h_main.c 2010-01-01 18:31:41 UTC (rev 10985)
@@ -559,7 +559,7 @@
}
#endif
-#if defined(VGA_x86) || defined(VGA_ppc32)
+#if defined(VGA_x86) || defined(VGA_ppc32) || defined(VGA_arm)
# define SHMEM_SECMAP_MASK 0xFFFC
# define SHMEM_SECMAP_SHIFT 2
# define SHMEM_IS_WORD_ALIGNED(_a) VG_IS_4_ALIGNED(_a)
@@ -1271,27 +1271,32 @@
#if defined(VGA_x86)
# include "libvex_guest_x86.h"
-# define MC_SIZEOF_GUEST_STATE sizeof(VexGuestX86State)
+# define PC_SIZEOF_GUEST_STATE sizeof(VexGuestX86State)
#endif
#if defined(VGA_amd64)
# include "libvex_guest_amd64.h"
-# define MC_SIZEOF_GUEST_STATE sizeof(VexGuestAMD64State)
+# define PC_SIZEOF_GUEST_STATE sizeof(VexGuestAMD64State)
# define PC_OFF_FS_ZERO offsetof(VexGuestAMD64State,guest_FS_ZERO)
# define PC_SZB_FS_ZERO sizeof( ((VexGuestAMD64State*)0)->guest_FS_ZERO)
#endif
#if defined(VGA_ppc32)
# include "libvex_guest_ppc32.h"
-# define MC_SIZEOF_GUEST_STATE sizeof(VexGuestPPC32State)
+# define PC_SIZEOF_GUEST_STATE sizeof(VexGuestPPC32State)
#endif
#if defined(VGA_ppc64)
# include "libvex_guest_ppc64.h"
-# define MC_SIZEOF_GUEST_STATE sizeof(VexGuestPPC64State)
+# define PC_SIZEOF_GUEST_STATE sizeof(VexGuestPPC64State)
#endif
+#if defined(VGA_arm)
+# include "libvex_guest_arm.h"
+# define PC_SIZEOF_GUEST_STATE sizeof(VexGuestARMState)
+#endif
+
/* See description on definition of type IntRegInfo. */
static void get_IntRegInfo ( /*OUT*/IntRegInfo* iii, Int offset, Int szB )
{
@@ -1806,7 +1811,28 @@
tl_assert(0);
# undef GOF
+ /* -------------------- arm -------------------- */
+# elif defined(VGA_arm)
+
+# define GOF(_fieldname) \
+ (offsetof(VexGuestARMState,guest_##_fieldname))
+
+ Int o = offset;
+ Int sz = szB;
+ Bool is4 = sz == 4;
+ Bool is8 = sz == 8;
+
+ tl_assert(sz > 0);
+ tl_assert(host_is_big_endian());
+
+ /* Set default state to "does not intersect any int register". */
+ VG_(memset)( iii, 0, sizeof(*iii) );
+
+ VG_(printf)("get_IntRegInfo(arm):failing on (%d,%d)\n", o, sz);
+ tl_assert(0);
+
+
# else
# error "FIXME: not implemented for this architecture"
# endif
@@ -1888,6 +1914,14 @@
VG_(printf)("\n");
tl_assert(0);
+ /* -------------------- arm -------------------- */
+# elif defined(VGA_arm)
+ /* There are no rotating register sections on ARM. */
+ VG_(printf)("is_integer_guest_reg_array(arm): unhandled: ");
+ ppIRRegArray(arr);
+ VG_(printf)("\n");
+ tl_assert(0);
+
# else
# error "FIXME: not implemented for this architecture"
# endif
@@ -1939,7 +1973,7 @@
static void init_shadow_registers ( ThreadId tid )
{
Int i, wordSzB = sizeof(UWord);
- for (i = 0; i < MC_SIZEOF_GUEST_STATE-wordSzB; i += wordSzB) {
+ for (i = 0; i < PC_SIZEOF_GUEST_STATE-wordSzB; i += wordSzB) {
put_guest_intreg( tid, 1, i, wordSzB, (UWord)UNKNOWN );
}
}
@@ -2207,9 +2241,13 @@
ADD(0, __NR_dup);
ADD(0, __NR_dup2);
ADD(0, __NR_epoll_create);
+# if defined(__NR_epoll_create1)
ADD(0, __NR_epoll_create1);
+# endif
ADD(0, __NR_epoll_ctl);
+# if defined(__NR_epoll_pwait)
ADD(0, __NR_epoll_pwait);
+# endif
ADD(0, __NR_epoll_wait);
ADD(0, __NR_execve); /* presumably we see this because the call failed? */
ADD(0, __NR_exit); /* hmm, why are we still alive? */
@@ -2684,9 +2722,18 @@
# if defined(VGA_x86) || defined(VGA_ppc32)
tl_assert(sizeof(UWord) == 4);
return (a > 0x01000000UL && a < 0xFF000000UL);
+
# elif defined(VGA_amd64) || defined(VGA_ppc64)
tl_assert(sizeof(UWord) == 8);
return (a >= 16 * 0x10000UL && a < 0xFF00000000000000UL);
+
+# elif defined(VGA_arm)
+ /* Unfortunately arm-linux seems to load the exe at very low, at
+ 0x8000, so we have to assume any value above that is a pointer,
+ which is pretty dismal. */
+ tl_assert(sizeof(UWord) == 4);
+ return (a >= 0x00008000UL && a < 0xFF000000UL);
+
# else
# error "Unsupported architecture"
# endif
@@ -5280,7 +5327,7 @@
(void*)&pce );
/* Stay sane. These two should agree! */
- tl_assert(layout->total_sizeB == MC_SIZEOF_GUEST_STATE);
+ tl_assert(layout->total_sizeB == PC_SIZEOF_GUEST_STATE);
/* Copy verbatim any IR preamble preceding the first IMark */
Modified: trunk/exp-ptrcheck/pc_main.c
===================================================================
--- trunk/exp-ptrcheck/pc_main.c 2010-01-01 18:30:59 UTC (rev 10984)
+++ trunk/exp-ptrcheck/pc_main.c 2010-01-01 18:31:41 UTC (rev 10985)
@@ -127,10 +127,10 @@
sg_post_clo_init();
# if defined(VGA_x86) || defined(VGA_amd64)
/* nothing */
-# elif defined(VGA_ppc32) || defined(VGA_ppc64)
+# elif defined(VGA_ppc32) || defined(VGA_ppc64) || defined(VGA_arm)
if (VG_(clo_verbosity) >= 1 && sg_clo_enable_sg_checks) {
VG_(message)(Vg_UserMsg,
- "WARNING: exp-ptrcheck on ppc32/ppc64 platforms: "
+ "WARNING: exp-ptrcheck on ppc32/ppc64/arm platforms: "
"stack and global array\n");
VG_(message)(Vg_UserMsg,
"WARNING: checking is not currently supported. "
|