summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2004-08-13 13:38:27 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2004-08-13 13:38:27 +0000
commit6310a642de9a696dbef29e940082abdfc20e1b05 (patch)
tree6a3f767e2b25e98337705ecf5b85f56215509132
parent9dff4b1fa24c727bb4be971fcc39f5cf0148a32a (diff)
Detection stack overflow pour AMD64/Linux
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6602 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmrun/signals.c3
-rw-r--r--asmrun/signals_osdep.h12
-rwxr-xr-xconfigure2
3 files changed, 10 insertions, 7 deletions
diff --git a/asmrun/signals.c b/asmrun/signals.c
index dcab290b5..6f3c607ae 100644
--- a/asmrun/signals.c
+++ b/asmrun/signals.c
@@ -13,6 +13,9 @@
/* $Id$ */
+#if defined(TARGET_amd64) && defined (SYS_linux)
+#define _GNU_SOURCE
+#endif
#include <signal.h>
#include <stdio.h>
#include "alloc.h"
diff --git a/asmrun/signals_osdep.h b/asmrun/signals_osdep.h
index 2491aad79..a2b0652e9 100644
--- a/asmrun/signals_osdep.h
+++ b/asmrun/signals_osdep.h
@@ -34,7 +34,7 @@
/****************** AMD64, Linux */
-#elif defined(TARGET_amd64) && defined (SYS_linux_elf)
+#elif defined(TARGET_amd64) && defined (SYS_linux)
#define DECLARE_SIGNAL_HANDLER(name) \
static void name(int sig, siginfo_t * info, ucontext_t * context)
@@ -43,11 +43,11 @@
sigact.sa_sigaction = (void (*)(int,siginfo_t *,void *)) (name); \
sigact.sa_flags = SA_SIGINFO
- typedef unsigned long context_reg;
- #define CONTEXT_PC (context->uc_mcontext.rip)
- #define CONTEXT_EXCEPTION_POINTER (context->uc_mcontext.r14)
- #define CONTEXT_YOUNG_PTR (context->uc_mcontext.r15)
- #define CONTEXT_FAULTING_ADDRESS ((char *) context->uc_mcontext.cr2)
+ typedef greg_t context_reg;
+ #define CONTEXT_PC (context->uc_mcontext.gregs[REG_RIP])
+ #define CONTEXT_EXCEPTION_POINTER (context->uc_mcontext.gregs[REG_R14])
+ #define CONTEXT_YOUNG_PTR (context->uc_mcontext.gregs[REG_R15])
+ #define CONTEXT_FAULTING_ADDRESS ((char *) context->uc_mcontext.gregs[REG_CR2])
/****************** I386, Linux */
diff --git a/configure b/configure
index e96cedebb..c74a6a120 100755
--- a/configure
+++ b/configure
@@ -1035,7 +1035,7 @@ fi
# Determine if system stack overflows can be detected
case "$arch,$system" in
- i386,linux_elf)
+ i386,linux_elf|amd64,linux)
echo "System stack overflow can be detected."
echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
*)