[PATCH] Tilera 2/3: support for extended Tilera APIs
Chris Metcalf
cmetcalf at tilera.com
Wed Dec 23 16:26:43 UTC 2009
This patch includes the support for Tilera extensions to standard
kernel APIs (mmap and sigaction). The mmap extensions require a bit
of extra code, rather than purely table extensions, since some of the
high bits in the mmap flags word are used as an enumeration to
override the kernel's normal choice of a "home cache" for coherence.
The extension for sigaction() is a flag that tells the kernel not
to notify a ptracer for a particular handled signal. This is useful
if you want to use signals in a way that just confuses a ptracer,
i.e. an API that converts SEGV/BUS to error codes does not want to
dump the debugger user unexpectedly into its implementation.
diff -ru --new-file strace-4.5.19/mem.c tilera-source/mem.c
--- strace-4.5.19/mem.c 2009-01-23 11:10:22.000000000 -0500
+++ tilera-source/mem.c 2009-12-23 10:08:40.729414000 -0500
@@ -188,9 +188,49 @@
#ifdef MAP_NOCORE
{ MAP_NOCORE, "MAP_NOCORE" },
#endif
+#ifdef TILE
+ { MAP_CACHE_NO_LOCAL, "MAP_CACHE_NO_LOCAL" },
+ { MAP_CACHE_NO_L2, "MAP_CACHE_NO_L2" },
+ { MAP_CACHE_NO_L1, "MAP_CACHE_NO_L1" },
+#endif
{ 0, NULL },
};
+#ifdef TILE
+static
+int
+addtileflags(flags)
+long flags;
+{
+ long home = flags & _MAP_CACHE_MKHOME(_MAP_CACHE_HOME_MASK);
+ flags &= ~_MAP_CACHE_MKHOME(_MAP_CACHE_HOME_MASK);
+
+ if (flags & _MAP_CACHE_INCOHERENT) {
+ flags &= ~_MAP_CACHE_INCOHERENT;
+ if (home == MAP_CACHE_HOME_NONE) {
+ tprintf("|MAP_CACHE_INCOHERENT");
+ return flags;
+ }
+ tprintf("|_MAP_CACHE_INCOHERENT");
+ }
+
+ switch (home) {
+ case 0: break;
+ case MAP_CACHE_HOME_HERE: tprintf("|MAP_CACHE_HOME_HERE"); break;
+ case MAP_CACHE_HOME_NONE: tprintf("|MAP_CACHE_HOME_NONE"); break;
+ case MAP_CACHE_HOME_SINGLE: tprintf("|MAP_CACHE_HOME_SINGLE"); break;
+ case MAP_CACHE_HOME_TASK: tprintf("|MAP_CACHE_HOME_TASK"); break;
+ case MAP_CACHE_HOME_HASH: tprintf("|MAP_CACHE_HOME_HASH"); break;
+ default:
+ tprintf("|MAP_CACHE_HOME(%d)",
+ (home >> _MAP_CACHE_HOME_SHIFT) );
+ break;
+ }
+
+ return flags;
+}
+#endif
+
#if !HAVE_LONG_LONG_OFF_T
static
int
@@ -213,7 +253,11 @@
/* flags */
#ifdef MAP_TYPE
printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
+#ifdef TILE
+ addflags(mmap_flags, addtileflags(u_arg[3] & ~MAP_TYPE));
+#else
addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
+#endif
#else
printflags(mmap_flags, u_arg[3], "MAP_???");
#endif
diff -ru --new-file strace-4.5.19/signal.c tilera-source/signal.c
--- strace-4.5.19/signal.c 2009-10-12 15:54:21.000000000 -0400
+++ tilera-source/signal.c 2009-12-23 10:55:18.352554000 -0500
@@ -230,6 +230,9 @@
#ifdef _SA_BSDCALL
{ _SA_BSDCALL, "_SA_BSDCALL" },
#endif
+#ifdef SA_NOPTRACE
+ { SA_NOPTRACE, "SA_NOPTRACE" },
+#endif
{ 0, NULL },
};
More information about the Strace-devel
mailing list