He made a lot of progress toward getting SBCL to be bootstrappable
under CLISP.
+Perry E. Metzger:
+ He ported SBCL to NetBSD with newer signals, building on the
+ work of Valtteri Vuorikoski. He also provided various cleanups to
+ the C runtime.
+
Gerd Moellman:
He has made many cleanups and improvements, small and large, in
CMU CL (mostly in PCL), which we have gratefully ported to SBCL. Of
the readtable currently in effect.
changes in sbcl-0.8.10 relative to sbcl-0.8.9:
+ * Support for the forthcoming 2.0 version of the NetBSD kernel
+ running on x86 hardware has been added. (thanks to Perry
+ E. Metzger most immediately, and others for their past work)
* [placeholder for DX summary]
** user code with &REST lists declared dynamic-extent, under high
speed or space and low safety and debug optimization policy.
* The manual has been converted to Texinfo format and the debugger
- chapter from the cmucl manual has been added
+ chapter from the cmucl manual has been added.
* A facility has been added to extract documentation strings from
sbcl and store them as Texinfo-formatted snippets for inclusion in
the manual (via Texinfo's @include directive)
* bug fix: multidimensional simple arrays loaded from FASLs had fill
pointers. (reported by Sean Ross)
* bug fix: PROFILE output is printed nicely even for large numerical
- values. (thanks to Zach Beane)
+ values. (thanks to Zach Beane)
planned incompatible changes in 0.8.x:
* (not done yet, but planned:) When the profiling interface settles
SYSTEM-SPECIFIC HINTS
+for NetBSD:
+ NetBSD 2.0 and above are required because of the lack of needed
+ signal APIs in NetBSD 1.6 and earlier.
+
for OpenBSD:
OpenBSD 3.0 has stricter ulimit values, and/or enforces them more
strictly, than its predecessors. Therefore SBCL's initial mmap()
;; particular version of BSD we're intended to run under.)
;; :freebsd = We're intended to run under FreeBSD.
;; :openbsd = We're intended to run under OpenBSD.
+ ;; :netbsd = We're intended to run under NetBSD.
;; :sunos = We're intended to run under Solaris user environment
;; with the SunOS kernel.
;; :osf1 = We're intended to run under Tru64 (aka Digital Unix
.SH SYSTEM REQUIREMENTS
-SBCL currently runs on X86 (Linux, FreeBSD, and OpenBSD), Alpha
+SBCL currently runs on X86 (Linux, FreeBSD, OpenBSD, and NetBSD), Alpha
(Linux, Tru64), PPC (Linux, Darwin/MacOS X), SPARC (Linux and Solaris
2.x), and MIPS (Linux). For information on other ongoing and possible
ports, see the sbcl-devel mailing list, and/or the web site.
sbcl_os="openbsd"
ln -s Config.$sbcl_arch-openbsd Config
;;
+ NetBSD)
+ printf ' :netbsd' >> $ltf
+ ln -s Config.$sbcl_arch-netbsd Config
+ ;;
*)
echo unsupported BSD variant: `uname`
exit 1
(the string ; (to force error in case of unsupported BSD variant)
#!+FreeBSD "FreeBSD"
#!+OpenBSD "OpenBSD"
+ #!+NetBSD "NetBSD"
#!+Darwin "Darwin"))
(defvar *software-version* nil)
;; FIXME: This list of modes should be defined in one place and
;; explicitly shared between here and REINIT.
- ;; Why was this marked #!+alpha? CMUCL does it here on all architectures
- (set-floating-point-modes :traps '(:overflow :invalid :divide-by-zero))
+ ;; FIXME: For some unknown reason, NetBSD/x86 won't run with the
+ ;; :invalid trap enabled. That should be fixed, but not today...
+ ;; PEM -- April 5, 2004
+ (set-floating-point-modes
+ :traps '(:overflow #!-netbsd :invalid :divide-by-zero))
(show-and-call !class-finalize)
;; LEAST-NEGATIVE-SINGLE-FLOAT, so the :UNDERFLOW exceptions are
;; disabled by default. Joe User can explicitly enable them if
;; desired.
- (set-floating-point-modes :traps '(:overflow :invalid :divide-by-zero))
+ ;;
+ ;; see also comment at the previous SET-FLOATING-POINT-MODES
+ ;; call site.
+ (set-floating-point-modes
+ :traps '(:overflow #!-netbsd :invalid :divide-by-zero))
(sb!thread::maybe-install-futex-functions)))
(gc-on)
(gc))
;;; On any OS where we don't support foreign object file loading, any
;;; query of a foreign symbol value is answered with "no definition
;;; known", i.e. NIL.
-#-(or linux sunos FreeBSD OpenBSD darwin)
+#-(or linux sunos FreeBSD OpenBSD NetBSD darwin)
(defun get-dynamic-foreign-symbol-address (symbol)
(declare (type simple-string symbol) (ignore symbol))
nil)
;;; work on any ELF system with dlopen(3) and dlsym(3)
;;; It also works on OpenBSD, which isn't ELF, but is otherwise modern
;;; enough to have a fairly well working dlopen/dlsym implementation.
-#-(or linux sunos FreeBSD OpenBSD darwin)
+#-(or linux sunos FreeBSD OpenBSD NetBSD darwin)
(macrolet ((define-unsupported-fun (fun-name)
`(defun ,fun-name (&rest rest)
"unsupported on this system"
(error 'unsupported-operator :name ',fun-name))))
(define-unsupported-fun load-1-foreign)
(define-unsupported-fun load-foreign))
-#+(or linux sunos FreeBSD OpenBSD darwin)
+#+(or linux sunos FreeBSD OpenBSD NetBSD darwin)
(progn
;;; flags for dlopen()
;;; code for foreign symbol lookup should be here.
(defun find-foreign-symbol-in-table (name table)
(let ((prefixes
- #!+(or osf1 sunos linux freebsd darwin) #("" "ldso_stub__")
+ #!+(or osf1 sunos linux freebsd netbsd darwin) #("" "ldso_stub__")
#!+openbsd #("")))
(declare (notinline some)) ; to suppress bug 117 bogowarning
(some (lambda (prefix)
;; a constant. Going the grovel_headers route doesn't seem to be
;; helpful, either, as Solaris doesn't export PATH_MAX from
;; unistd.h.
- #!-(or linux openbsd freebsd sunos osf1 darwin) (,stub,)
- #!+(or linux openbsd freebsd sunos osf1 darwin)
+ #!-(or linux openbsd freebsd netbsd sunos osf1 darwin) (,stub,)
+ #!+(or linux openbsd freebsd netbsd sunos osf1 darwin)
(or (newcharstar-string (alien-funcall (extern-alien "getcwd"
(function (* char)
(* char)
size-t))
nil
- #!+(or linux openbsd freebsd darwin) 0
+ #!+(or linux openbsd freebsd netbsd darwin) 0
#!+(or sunos osf1) 1025))
(simple-perror "getcwd")))
;;; 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().)
+;;; * For NetBSD 2.0, the following ranges are used by normal
+;;; executables and mmap:
+;;; ** Executables are (by default) loaded at 0x08048000.
+;;; ** The break for the sbcl runtime seems to end around 0x08400000
+;;; We set read only space around 0x20000000, static
+;;; space around 0x30000000, all ending below 0x37fff000
+;;; ** ld.so and other mmap'ed stuff like shared libs start around
+;;; 0x48000000
+;;; We set dynamic space between 0x60000000 and 0x98000000
+;;; ** Bottom of the stack is typically not below 0xb0000000
+;;; FYI, this can be looked at with the "pmap" program, and if you
+;;; set the top-down mmap allocation option in the kernel (not yet
+;;; the default), all bets are totally off!
#!+linux
(progn
(def!constant dynamic-space-start #x09000000)
(def!constant dynamic-space-end #x29000000))
-#!+bsd
+#!+(or freebsd openbsd)
(progn
(def!constant read-only-space-start #x10000000)
#!+openbsd #x50000000)
(def!constant dynamic-space-end #x88000000))
+#!+netbsd
+(progn
+
+ (def!constant read-only-space-start #x20000000)
+ (def!constant read-only-space-end #x2ffff000)
+
+ (def!constant static-space-start #x30000000)
+ (def!constant static-space-end #x37fff000)
+
+ (def!constant dynamic-space-start #x60000000)
+ (def!constant dynamic-space-end #x98000000))
+
+
;;; Given that NIL is the first thing allocated in static space, we
;;; know its value at compile time:
(def!constant nil-value (+ static-space-start #xb))
# Config file
CFLAGS = -g -Wall -O3
ASFLAGS = $(CFLAGS)
-DEPEND_FLAGS =
CPPFLAGS = -I.
# Some of these things might be Config-dependent in future versions,
#include <stdio.h>
#include <sys/param.h>
#include <sys/file.h>
+#include <unistd.h>
+#include <assert.h>
#include "sbcl.h"
#include "./signal.h"
#include "os.h"
#include "validate.h"
\f
-vm_size_t os_vm_page_size;
+os_vm_size_t os_vm_page_size;
+#ifdef __NetBSD__
+#include <sys/resource.h>
+#include <string.h>
+
+static void netbsd_init();
+#endif /* __NetBSD__ */
+
void os_init(void)
{
os_vm_page_size = getpagesize();
+
+#ifdef __NetBSD__
+ netbsd_init();
+#endif /* __NetBSD__ */
}
int *os_context_pc_addr(os_context_t *context)
return CONTEXT_ADDR_FROM_STEM(eip);
#elif defined __OpenBSD__
return CONTEXT_ADDR_FROM_STEM(pc);
+#elif defined __NetBSD__
+ return CONTEXT_ADDR_FROM_STEM(EIP);
#elif defined LISP_FEATURE_DARWIN
return &context->uc_mcontext->ss.srr0;
#else
/* (Unlike most of the other context fields that we access, the
* signal mask field is a field of the basic, outermost context
* struct itself both in FreeBSD 4.0 and in OpenBSD 2.6.) */
-#if defined __FreeBSD__ || defined LISP_FEATURE_DARWIN
+#if defined __FreeBSD__ || __NetBSD__ || defined LISP_FEATURE_DARWIN
return &context->uc_sigmask;
#elif defined __OpenBSD__
return &context->sc_mask;
{
/* The way that we extract low level information like the fault
* address is not specified by POSIX. */
-#if defined __FreeBSD__
- void *fault_addr = siginfo->si_addr;
-#elif defined __OpenBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
void *fault_addr = siginfo->si_addr;
#elif defined LISP_FEATURE_DARWIN
void *fault_addr = siginfo->si_addr;
#else
#error unsupported BSD variant
#endif
+
os_context_t *context = arch_os_get_context(&void_context);
if (!gencgc_handle_wp_violation(fault_addr))
if(!handle_control_stack_guard_triggered(context,fault_addr))
}
#endif /* defined GENCGC */
+
+#ifdef __NetBSD__
+static void netbsd_init()
+{
+ struct rlimit rl;
+
+ /* NetBSD counts mmap()ed space against the process's data size limit,
+ * so yank it up. This might be a nasty thing to do? */
+ getrlimit (RLIMIT_DATA, &rl);
+ /* Amazingly for such a new port, the provenance and meaning of
+ this number are unknown. It might just mean REALLY_BIG_LIMIT,
+ or possibly it should be calculated from dynamic space size.
+ -- CSR, 2004-04-08 */
+ rl.rlim_cur = 1073741824;
+ if (setrlimit (RLIMIT_DATA, &rl) < 0) {
+ fprintf (stderr,
+ "RUNTIME WARNING: unable to raise process data size limit:\n\
+ %s.\n\
+The system may fail to start.\n",
+ strerror(errno));
+ }
+}
+#endif /* __NetBSD__ */
\f
/* threads */
#include <sys/signal.h>
typedef caddr_t os_vm_address_t;
+#ifdef __NetBSD__
+typedef vsize_t os_vm_size_t;
+#else
typedef vm_size_t os_vm_size_t;
+#endif
typedef off_t os_vm_offset_t;
typedef int os_vm_prot_t;
typedef int os_context_register_t;
* Linux sigaltstack(2) */
typedef struct sigaltstack stack_t;
#elif defined __FreeBSD__
-/* FreeBSD 4.6 already has stack_t defined. */
+/* FreeBSD 4.6 and NetBSD 1.6 already have stack_t defined. */
#endif
#if defined __FreeBSD__
* so we need to implement single stepping in a more roundabout way. */
#define CANNOT_GET_TO_SINGLE_STEP_FLAG
#define SIG_MEMORY_FAULT SIGBUS
+
#elif defined __OpenBSD__
+
typedef struct sigcontext os_context_t;
#define SIG_MEMORY_FAULT SIGSEGV
+
+#elif defined __NetBSD__
+
+#include <ucontext.h>
+typedef ucontext_t os_context_t;
+#define SIG_MEMORY_FAULT SIGSEGV
+
#elif defined LISP_FEATURE_DARWIN
/* man pages claim that the third argument is a sigcontext struct,
but ucontext_t is defined, matches sigcontext where sensible,
#include <ucontext.h>
typedef ucontext_t os_context_t;
#define SIG_MEMORY_FAULT SIGBUS
+
#else
#error unsupported BSD variant
#endif
boolean enable_page_protection = 1;
/* Should we unmap a page and re-mmap it to have it zero filled? */
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
/* comment from cmucl-2.4.8: This can waste a lot of swap on FreeBSD
* so don't unmap there.
*
}
#ifndef LISP_FEATURE_GENCGC
-/* This function gets called from the SIGSEGV (for e.g. Linux or
+/* This function gets called from the SIGSEGV (for e.g. Linux, NetBSD, &
* OpenBSD) or SIGBUS (for e.g. FreeBSD) handler. Here we check
* whether the signal was due to treading on the mprotect()ed zone -
* and if so, arrange for a GC to happen. */
#if defined(hpux) \
|| defined(SVR4) \
|| defined(__FreeBSD__) \
- || defined(__OpenBSD__)
+ || defined(__OpenBSD__) \
+ || defined(__NetBSD__)
F(cfgetospeed)
F(cfsetospeed)
F(cfgetispeed)
#if !defined(SVR4)
F(sigsetmask)
#endif
-#if !defined(SVR4) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#if !defined(SVR4) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
F(sigstack)
F(sigvec)
#endif
|| defined(SVR4) \
|| defined(__FreeBSD__) \
|| defined(__OpenBSD__) \
+ || defined(__NetBSD__) \
|| defined(__linux__)
F(tcgetattr)
F(tcsetattr)
&& !defined(parisc) \
&& !defined(SOLARIS) \
&& !defined(__OpenBSD__) \
- && !defined(__FreeBSD__)
+ && !defined(__FreeBSD__) \
+ && !defined(__NetBSD__)
F(umount)
#endif
F(unlink)
#ifndef irix
F(vfork)
#endif
-#if !defined(osf1) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#if !defined(osf1) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
F(vhangup)
#endif
F(wait)
F(gethostbyaddr)
/* other miscellaneous things */
+/* FIXME: NetBSD plays some renaming games, and so cannot simply
+ reference symbols here. "NetBSD needs to get fixed here too PEM
+ 2004-03-27" */
#if defined(SVR4) || defined(__FreeBSD__)
F(setpgid)
F(getpgid)
return &context->uc_mcontext.gregs[16];
#elif defined __FreeBSD__
return &context->uc_mcontext.mc_eflags;
-#elif defined __OpenBSD__
+#elif defined __OpenBSD__ || defined __NetBSD__
return &context->sc_eflags;
+#elif defined __NetBSD__
+ return &(context->uc_mcontext.__gregs[_REG_EFL]);
#else
#error unsupported OS
#endif
#include "genesis/thread.h"
/* Minimize conditionalization for different OS naming schemes. */
-#if defined __linux__ || defined __FreeBSD__ /* (but *not* OpenBSD) */
+#if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ /* (but *not* OpenBSD) */
#define GNAME(var) var
#else
#define GNAME(var) _##var
#endif
-/* Get the right type of alignment. Linux and FreeBSD (but not OpenBSD)
+/* Get the right type of alignment. Linux, FreeBSD and NetBSD (but not OpenBSD)
* want alignment in bytes. */
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
#define align_4byte 4
#define align_8byte 8
#define align_16byte 16
* flavour, with the cross-architecture complications that this
* entails; unfortunately, currently the situation is worse, not
* better, than in the above paragraph. */
-
+
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
int *
os_context_register_addr(os_context_t *context, int offset)
{
return CONTEXT_ADDR_FROM_STEM(esp);
}
+#endif /* __FreeBSD__ || __OpenBSD__ */
+
+#ifdef __NetBSD__
+int *
+os_context_register_addr(os_context_t *context, int offset)
+{
+ switch(offset) {
+ case 0:
+ return CONTEXT_ADDR_FROM_STEM(EAX);
+ case 2:
+ return CONTEXT_ADDR_FROM_STEM(ECX);
+ case 4:
+ return CONTEXT_ADDR_FROM_STEM(EDX);
+ case 6:
+ return CONTEXT_ADDR_FROM_STEM(EBX);
+ case 8:
+ return CONTEXT_ADDR_FROM_STEM(ESP);
+ case 10:
+ return CONTEXT_ADDR_FROM_STEM(EBP);
+ case 12:
+ return CONTEXT_ADDR_FROM_STEM(ESI);
+ case 14:
+ return CONTEXT_ADDR_FROM_STEM(EDI);
+ default:
+ return 0;
+ }
+}
+
+int *
+os_context_sp_addr(os_context_t *context)
+{
+ return &(_UC_MACHINE_SP(context));
+}
+
+#endif /* __NetBSD__ */
+
+
/* FIXME: If this can be a no-op on BSD/x86, then it
* deserves a more precise name.
#define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem
#elif defined __OpenBSD__
#define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem
+#elif defined __NetBSD__
+#define CONTEXT_ADDR_FROM_STEM(stem) &((context)->uc_mcontext.__gregs[_REG_ ## stem])
#else
#error unsupported BSD variant
#endif
DEFTYPE("uid-t", uid_t);
printf("\n");
- printf(";;; fcntl.h (or unistd.h on OpenBSD)\n");
+ printf(";;; fcntl.h (or unistd.h on OpenBSD and NetBSD)\n");
defconstant("r_ok", R_OK);
defconstant("w_ok", W_OK);
defconstant("x_ok", X_OK);
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.9.28"
+"0.8.9.29"