[kaffe] CVS kaffe (guilhem): Improved stack detection on freebsd.

Kaffe CVS cvs-commits at kaffe.org
Sun May 9 08:37:03 PDT 2004


PatchSet 4723 
Date: 2004/05/09 14:57:18
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Improved stack detection on freebsd.

        * ChangeLog: Fixed ChangeLog entry.

        * config/i386/freebsd2/md.c, config/i386/freebsd2/md.h:
        (mdGetStackBase) Use an alternate way to discover the stack base.

        * configure.ac: Added a new header to check: sys/sysctl.h

        * configure, config/config.h.in: Regenerated.

Members: 
	ChangeLog:1.2297->1.2298 
	configure:1.313->1.314 
	configure.ac:1.12->1.13 
	config/config.h.in:1.99->1.100 
	config/i386/freebsd2/md.c:1.1->1.2 
	config/i386/freebsd2/md.h:1.12->1.13 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2297 kaffe/ChangeLog:1.2298
--- kaffe/ChangeLog:1.2297	Sun May  9 14:20:10 2004
+++ kaffe/ChangeLog	Sun May  9 14:57:18 2004
@@ -1,4 +1,15 @@
-2004-05-07  Guilhem Lavaux <guilhem at kaffe.org>
+2004-05-09 Guilhem Lavaux <guilhem at kaffe.org>
+
+	* ChangeLog: Fixed ChangeLog entry.
+
+	* config/i386/freebsd2/md.c, config/i386/freebsd2/md.h:
+	(mdGetStackBase) Use an alternate way to discover the stack base.
+
+	* configure.ac: Added a new header to check: sys/sysctl.h
+
+	* configure, config/config.h.in: Regenerated.
+
+2004-05-09 Guilhem Lavaux <guilhem at kaffe.org>
 
 	* config/i386/linux/md.c, config/i386/linux/md.h:
 	New machine dependent function mdGetStackBase(). KAFFEMD_STACKBASE
Index: kaffe/configure
diff -u kaffe/configure:1.313 kaffe/configure:1.314
--- kaffe/configure:1.313	Wed Apr 28 20:42:50 2004
+++ kaffe/configure	Sun May  9 14:57:20 2004
@@ -39319,6 +39319,156 @@
 done
 
 
+for ac_header in sys/sysctl.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------ ##
+## Report this to kaffe at kaffe.org ##
+## ------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
 for ac_header in syslog.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.12 kaffe/configure.ac:1.13
--- kaffe/configure.ac:1.12	Wed Apr 28 20:42:55 2004
+++ kaffe/configure.ac	Sun May  9 14:57:27 2004
@@ -969,6 +969,7 @@
 AC_CHECK_HEADERS([sys/time.h])
 AC_CHECK_HEADERS([sys/types.h])
 AC_CHECK_HEADERS([sys/utsname.h])
+AC_CHECK_HEADERS([sys/sysctl.h])
 AC_CHECK_HEADERS([syslog.h])
 AC_CHECK_HEADERS([time.h])
 AC_CHECK_HEADERS([unistd.h])
Index: kaffe/config/config.h.in
diff -u kaffe/config/config.h.in:1.99 kaffe/config/config.h.in:1.100
--- kaffe/config/config.h.in:1.99	Thu Apr 22 16:28:08 2004
+++ kaffe/config/config.h.in	Sun May  9 14:57:31 2004
@@ -533,6 +533,9 @@
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#undef HAVE_SYS_SYSCTL_H
+
 /* Define to 1 if you have the <sys/time.h> header file. */
 #undef HAVE_SYS_TIME_H
 
Index: kaffe/config/i386/freebsd2/md.c
diff -u kaffe/config/i386/freebsd2/md.c:1.1 kaffe/config/i386/freebsd2/md.c:1.2
--- kaffe/config/i386/freebsd2/md.c:1.1	Tue Mar 31 19:10:53 1998
+++ kaffe/config/i386/freebsd2/md.c	Sun May  9 14:57:32 2004
@@ -2,9 +2,33 @@
  * i386/freebsd2/md.c
  * FreeBSD i386 specific functions.
  *
- * Copyright (c) 1996, 1997
- *	Transvirtual Technologies, Inc.  All rights reserved.
+ * 
  *
  * See the file "license.terms" for information on usage and redistribution 
  * of this file. 
  */
+
+#include "config.h"
+#include "config-std.h"
+
+#if defined(HAVE_SYS_SYSCTL_H)
+#include <sys/sysctl.h>
+
+void *mdGetStackBase(void)
+{
+    int control_name[2] =
+      { CTL_KERN, KERN_USRSTACK};
+    ptr_t stackbase;
+    size_t len = sizeof(ptr_t);
+    
+    if (sysctl(nm, 2, &base, &len, NULL, 0))
+      {
+	fprintf(stderr, 
+		"Kaffe VM has not been able to retrieve the pointer to the stack base\n"
+		"Aborting...\n");
+	exit(1);
+      }
+   return base;
+}
+
+#endif
Index: kaffe/config/i386/freebsd2/md.h
diff -u kaffe/config/i386/freebsd2/md.h:1.12 kaffe/config/i386/freebsd2/md.h:1.13
--- kaffe/config/i386/freebsd2/md.h:1.12	Wed May  5 15:32:31 2004
+++ kaffe/config/i386/freebsd2/md.h	Sun May  9 14:57:32 2004
@@ -80,4 +80,9 @@
 }
 #endif
 
+#if defined(HAVE_SYS_SYSCTL_H)
+#define KAFFEMD_STACKBASE
+extern void *mdGetStackBase(void);
+#endif
+
 #endif




More information about the kaffe mailing list