-;;; FIXME: Couldn't/shouldn't these be DEFCONSTANT instead of DEFPARAMETER?
-#!-linux (defparameter *target-read-only-space-start* #x10000000)
-#!-linux (defparameter *target-static-space-start*
- ;; FIXME: was #x28000000 until RAW's RUN-PROGRAM
- ;; patches, why the change?
- #x30000000)
-#!-linux (defparameter *target-dynamic-space-start* #x48000000)
-#!+linux (defparameter *target-read-only-space-start* #x01000000)
-#!+linux (defparameter *target-static-space-start* #x05000000)
-#!+linux (defparameter *target-dynamic-space-start* #x09000000)
+;;; Note: Mostly these values are black magic, inherited from CMU CL
+;;; without any documentation. However, there were a few explanatory
+;;; comments in the CMU CL sources:
+;;; * On Linux,
+;;; ** The space 0x08000000-0x10000000 is "C program and memory allocation".
+;;; ** The space 0x40000000-0x48000000 is reserved for shared libs.
+;;; ** The space >0xE0000000 is "C stack - Alien stack".
+;;; * On FreeBSD,
+;;; ** The space 0x0E000000-0x10000000 is "Foreign segment".
+;;; ** The space 0x20000000-0x30000000 is reserved for shared libs.
+;;; And there have been some changes since the fork from CMU CL:
+;;; * The OpenBSD port is new since the fork. We started with
+;;; the FreeBSD address map, which actually worked until the
+;;; Alpha port patches, for reasons which in retrospect are rather
+;;; mysterious. After the Alpha port patches were added, the
+;;; OpenBSD port suffered memory corruption problems. While
+;;; debugging those, it was discovered that src/runtime/trymap
+;;; failed for the control stack region #x40000000-#x47fff000.
+;;; After the control stack was moved upward out of this region
+;;; (stealing some bytes from dynamic space) the problems went
+;;; away.
+;;; * The FreeBSD STATIC-SPACE-START value was bumped up from
+;;; #x28000000 to #x30000000 when FreeBSD ld.so dynamic linking
+;;; support was added for FreeBSD ca. 20000910. This was to keep from
+;;; stomping on an address range that the dynamic libraries want to
+;;; use. (They want to use this address range even if we try to
+;;; reserve it with a call to validate() as the first operation in
+;;; main().)
+
+#!+linux
+(progn
+
+ (def!constant read-only-space-start #x01000000)
+ (def!constant read-only-space-end #x037ff000)
+
+ (def!constant static-space-start #x05000000)
+ (def!constant static-space-end #x07fff000)
+
+ (def!constant dynamic-space-start #x09000000)
+ (def!constant dynamic-space-end #x29000000)
+
+ (def!constant control-stack-start #x50000000)
+ (def!constant control-stack-end #x57fff000)
+
+ (def!constant binding-stack-start #x60000000)
+ (def!constant binding-stack-end #x67fff000)
+ (def!constant alternate-signal-stack-start #x58000000))
+
+#!+bsd
+(progn
+
+ (def!constant read-only-space-start #x10000000)
+ (def!constant read-only-space-end #x1ffff000)
+
+ (def!constant static-space-start
+ #!+freebsd #x30000000
+ #!+openbsd #x28000000)
+ (def!constant static-space-end #x37fff000)
+
+ (def!constant binding-stack-start #x38000000)
+ (def!constant binding-stack-end #x3ffff000)
+
+ (def!constant control-stack-start
+ #!+freebsd #x40000000
+ #!+openbsd #x48000000)
+ (def!constant control-stack-end
+ #!+freebsd #x43fff000
+ #!+openbsd #x4bfff000)
+ (def!constant dynamic-space-start
+ #!+freebsd #x48000000
+ #!+openbsd #x50000000)
+ (def!constant dynamic-space-end #x88000000)
+ (def!constant alternate-signal-stack-start
+ #!+freebsd #x44000000
+ #!+openbsd #x4c000000))
+
+
+;;; don't need alternate-signal-stack-end : it's -start+SIGSTKSZ
+