[Define to 1 if fpregset_t defines struct _fpchip_state])
fi
+
+# Solaris-specific check determining if schedctl page shared between kernel
+# and userspace program is executable (illumos, older Solaris) or not (newer
+# Solaris).
+#
+# C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
+# Automake-level symbol: none
+#
+AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <assert.h>
+#include <fcntl.h>
+#include <procfs.h>
+#include <schedctl.h>
+#include <stdio.h>
+#include <unistd.h>
+]], [[
+ schedctl_t *scp = schedctl_init();
+ if (scp == NULL)
+ return 1;
+
+ int fd = open("/proc/self/map", O_RDONLY);
+ assert(fd >= 0);
+
+ prmap_t map;
+ ssize_t rd;
+ while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
+ if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
+ fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
+ (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
+ return (map.pr_mflags & MA_EXEC);
+ }
+ }
+
+ return 1;
+]])], [
+solaris_schedctl_page_exec=no
+AC_MSG_RESULT([no])
+], [
+solaris_schedctl_page_exec=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
+ [Define to 1 if you have the schedctl page executable.])
+])
+
else
AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
/* Returned address points to a block in a mapped page. */
if (!VG_(am_find_anon_segment)(a)) {
Addr page = VG_PGROUNDDN(a);
- UInt prot = VKI_PROT_READ | VKI_PROT_WRITE | VKI_PROT_EXEC;
+ UInt prot = VKI_PROT_READ | VKI_PROT_WRITE;
+# if defined(SOLARIS_SCHEDCTL_PAGE_EXEC)
+ prot |= VKI_PROT_EXEC;
+# endif /* SOLARIS_SCHEDCTL_PAGE_EXEC */
UInt flags = VKI_MAP_ANONYMOUS;
/* The kernel always allocates one page for the sc_shared struct. */
SizeT size = VKI_PAGE_SIZE;