head	1.4;
access;
symbols
	RELEASE_6_2_0:1.3
	RELEASE_6_1_0:1.2
	RELEASE_5_5_0:1.2;
locks; strict;
comment	@# @;


1.4
date	2006.12.02.00.20.41;	author miwi;	state dead;
branches;
next	1.3;

1.3
date	2006.03.15.15.26.47;	author mnag;	state Exp;
branches;
next	1.2;

1.2
date	2006.01.28.15.52.14;	author pav;	state Exp;
branches;
next	1.1;

1.1
date	2005.10.08.18.21.19;	author pav;	state Exp;
branches;
next	;


desc
@@


1.4
log
@- Update to 1.0

Submitted by:   NIIMI Satoshi <sa2c@@sa2c.net> (maintainer)
@
text
@Index: src/code/debug-int.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/debug-int.lisp,v
retrieving revision 1.101
diff -u -r1.101 debug-int.lisp
--- src/code/debug-int.lisp	28 Sep 2005 13:42:24 -0000	1.101
+++ src/code/debug-int.lisp	27 Feb 2006 10:52:45 -0000
@@@@ -559,6 +559,9 @@@@
 
 (defconstant sb!vm::nargs-offset #.sb!vm::ecx-offset)
 
+(sb!alien:define-alien-variable "user_space_start" sb!alien:unsigned-long)
+(sb!alien:define-alien-variable "user_space_end" sb!alien:unsigned-long)
+
 ;;; Check for a valid return address - it could be any valid C/Lisp
 ;;; address.
 ;;;
@@@@ -567,11 +570,7 @@@@
 (defun ra-pointer-valid-p (ra)
   (declare (type system-area-pointer ra))
   (and
-   ;; not the first page (which is unmapped)
-   ;;
-   ;; FIXME: Where is this documented? Is it really true of every CPU
-   ;; architecture? Is it even necessarily true in current SBCL?
-   (>= (sap-int ra) 4096)
+   (>= user-space-end (sap-int ra) user-space-start)
    ;; not a Lisp stack pointer
    (not (control-stack-pointer-valid-p ra))))
 
Index: src/runtime/bsd-os.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/bsd-os.c,v
retrieving revision 1.36
diff -u -r1.36 bsd-os.c
--- src/runtime/bsd-os.c	21 Feb 2006 23:40:36 -0000	1.36
+++ src/runtime/bsd-os.c	27 Feb 2006 10:52:45 -0000
@@@@ -53,6 +53,8 @@@@
 
 #ifdef __FreeBSD__
 #include <sys/sysctl.h>
+#include <link.h>
+#include <dlfcn.h>
 #include <osreldate.h>
 
 static void freebsd_init();
@@@@ -310,6 +312,25 @@@@
         fast_bzero_pointer = fast_bzero_detect;
     }
 #endif /* LISP_FEATURE_X86 */
+    /* extract lowermost address from linkmap */
+    {
+        Link_map *map;
+
+        if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map) == 0
+            && map != NULL && map->l_addr != NULL)
+            user_space_start = (unsigned long)map->l_addr;
+    }
+
+    /* extract uppermost address from "kern.usrstack" mib */
+    {
+        size_t len;
+        unsigned long tmp;
+
+        len = sizeof(tmp);
+        if (sysctlbyname("kern.usrstack", &tmp, &len, NULL, 0) == 0
+            && tmp > user_space_start)
+            user_space_end = tmp;
+    }
 }
 #endif /* __FreeBSD__ */
 
Index: src/runtime/globals.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/globals.c,v
retrieving revision 1.19
diff -u -r1.19 globals.c
--- src/runtime/globals.c	21 Feb 2006 22:59:33 -0000	1.19
+++ src/runtime/globals.c	27 Feb 2006 10:52:45 -0000
@@@@ -16,6 +16,7 @@@@
 #include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <limits.h>
 
 #include "sbcl.h"
 #include "runtime.h"
@@@@ -54,6 +55,14 @@@@
 pthread_key_t specials=0;
 #endif
 
+/* Valid user address space.  */
+
+/* not the first page (which is unmapped)
+ * good default for most architectures.  */
+unsigned long user_space_start = 4096;
+
+unsigned long user_space_end = ULONG_MAX;
+
 void globals_init(void)
 {
     /* Space, stack, and free pointer vars are initialized by
Index: src/runtime/globals.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/globals.h,v
retrieving revision 1.26
diff -u -r1.26 globals.h
--- src/runtime/globals.h	21 Feb 2006 22:59:33 -0000	1.26
+++ src/runtime/globals.h	27 Feb 2006 10:52:46 -0000
@@@@ -108,4 +108,7 @@@@
 
 #endif /* LANGUAGE_ASSEMBLY */
 
+extern unsigned long user_space_start;
+extern unsigned long user_space_end;
+
 #endif /* _INCLUDED_GLOBALS_H_ */
@


1.3
log
@- Update to 0.9.10

PR:		93900
Submitted by:	maintainer
@
text
@@


1.2
log
@- Update to 0.9.9

PR:		ports/92398
Submitted by:	NIIMI Satoshi <sa2c@@sa2c.net> (maintainer)
@
text
@d7 1
a7 1
+++ src/code/debug-int.lisp	26 Jan 2006 01:59:07 -0000
d34 4
a37 4
retrieving revision 1.31
diff -u -r1.31 bsd-os.c
--- src/runtime/bsd-os.c	22 Jan 2006 18:55:07 -0000	1.31
+++ src/runtime/bsd-os.c	26 Jan 2006 01:59:07 -0000
d44 1
d47 2
a48 3
 #endif /* __FreeBSD__ */
@@@@ -311,6 +313,25 @@@@
         fast_bzero_pointer = fast_bzero_base;
d76 4
a79 4
retrieving revision 1.18
diff -u -r1.18 globals.c
--- src/runtime/globals.c	14 Jul 2005 15:41:11 -0000	1.18
+++ src/runtime/globals.c	26 Jan 2006 01:59:07 -0000
d106 5
a110 5
retrieving revision 1.25
diff -u -r1.25 globals.h
--- src/runtime/globals.h	14 Jul 2005 15:41:11 -0000	1.25
+++ src/runtime/globals.h	26 Jan 2006 01:59:07 -0000
@@@@ -99,4 +99,7 @@@@
@


1.1
log
@- Update to 0.9.5

PR:		ports/87123
Submitted by:	Paul Ledbetter <aeacides@@gmail.com> (maintainer)
@
text
@d4 24
a27 11
retrieving revision 1.97
diff -u -r1.97 debug-int.lisp
--- src/code/debug-int.lisp	14 Jul 2005 16:30:31 -0000	1.97
+++ src/code/debug-int.lisp	27 Aug 2005 01:36:06 -0000
@@@@ -572,6 +572,9 @@@@
    ;; FIXME: Where is this documented? Is it really true of every CPU
    ;; architecture? Is it even necessarily true in current SBCL?
    (>= (sap-int ra) 4096)
+   ;; On FreeBSD, kernel area is not valid as return address.
+   ;; FIXME: How to obtain the address instead of magic number?
+   #!+freebsd (< (sap-int ra) #xC0000000)
d31 87
@

