Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

0.8.9.6.netbsd.2:

	Merge Perry Metzger "netbsd patches" sbcl-devel 2004-04-06
	... don't merge SB_THREAD/spinlock cleanup; the right answer
		is to define an almost-null get_spinlock() version
		for non-threaded builds.
  • Loading branch information...
commit 01044af1b8d69fc3899dc0417064c1512223223d 1 parent 074ba06
@csrhodes csrhodes authored
View
4 CREDITS
@@ -608,6 +608,10 @@ Dave McDonald:
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.
+
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
View
4 README
@@ -26,6 +26,10 @@ system, please send mail to one of the mailing lists:
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()
View
2  doc/sbcl.1
@@ -373,7 +373,7 @@ chance to see it.
.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.
View
13 src/code/cold-init.lisp
@@ -219,8 +219,11 @@
;; 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)
@@ -288,7 +291,11 @@ instead (which is another name for the same thing)."))
;; 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)
;; Clear pseudo atomic in case this core wasn't compiled with
View
28 src/compiler/x86/parms.lisp
@@ -135,6 +135,19 @@
;;; 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
@@ -148,7 +161,7 @@
(def!constant dynamic-space-start #x09000000)
(def!constant dynamic-space-end #x29000000))
-#!+bsd
+#!+(or freebsd openbsd)
(progn
(def!constant read-only-space-start #x10000000)
@@ -164,6 +177,19 @@
#!+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))
View
7 src/runtime/Config.x86-netbsd
@@ -0,0 +1,7 @@
+# -*- makefile -*-
+include Config.x86-bsd
+
+ASSEM_SRC += ldso-stubs.S
+OS_LINK_FLAGS = -dynamic -export-dynamic
+
+CFLAGS = -g -Wall -O2
View
1  src/runtime/GNUmakefile
@@ -16,7 +16,6 @@ all: sbcl sbcl.nm
# Config file
CFLAGS = -g -Wall -O3
ASFLAGS = $(CFLAGS)
-DEPEND_FLAGS =
CPPFLAGS = -I.
# Some of these things might be Config-dependent in future versions,
View
40 src/runtime/bsd-os.c
@@ -21,6 +21,8 @@
#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"
@@ -37,11 +39,22 @@
#include "validate.h"
-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)
@@ -50,6 +63,8 @@ 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
@@ -63,7 +78,7 @@ os_context_sigmask_addr(os_context_t *context)
/* (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;
@@ -162,15 +177,14 @@ memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context)
{
/* 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))
@@ -213,6 +227,22 @@ os_install_interrupt_handlers(void)
}
#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);
+ rl.rlim_cur = 1073741824;
+ if (setrlimit (RLIMIT_DATA, &rl) < 0) {
+ fprintf (stderr, "RUNTIME WARNING: unable to raise process data size limit to 1GB (%s). The system may fail to start.\n",
+ strerror(errno));
+ }
+}
+#endif /* __NetBSD__ */
/* threads */
View
10 src/runtime/bsd-os.h
@@ -49,9 +49,18 @@ typedef ucontext_t os_context_t;
* 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,
@@ -63,6 +72,7 @@ typedef struct sigcontext os_context_t;
#include <ucontext.h>
typedef ucontext_t os_context_t;
#define SIG_MEMORY_FAULT SIGBUS
+
#else
#error unsupported BSD variant
#endif
View
2  src/runtime/interrupt.c
@@ -728,7 +728,7 @@ boolean handle_control_stack_guard_triggered(os_context_t *context,void *addr){
}
#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. */
View
1  src/runtime/undefineds.h
@@ -257,6 +257,7 @@ F(gethostbyname)
F(gethostbyaddr)
/* other miscellaneous things */
+/* FIXME: NetBSD needs to get fixed here too PEM 2004-03-27 */
#if defined(SVR4) || defined(__FreeBSD__)
F(setpgid)
F(getpgid)
View
2  src/runtime/x86-arch.c
@@ -57,6 +57,8 @@ context_eflags_addr(os_context_t *context)
return &context->uc_mcontext.mc_eflags;
#elif defined __OpenBSD__ || defined __NetBSD__
return &context->sc_eflags;
+#elif defined __NetBSD__
+ return &(context->uc_mcontext.__gregs[_REG_EFL]);
#else
#error unsupported OS
#endif
View
40 src/runtime/x86-bsd-os.c
@@ -12,7 +12,8 @@
* 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)
{
@@ -44,6 +45,43 @@ os_context_sp_addr(os_context_t *context)
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.
View
2  src/runtime/x86-bsd-os.h
@@ -13,6 +13,8 @@ static inline os_context_t *arch_os_get_context(void **void_context) {
#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
View
2  version.lisp-expr
@@ -17,4 +17,4 @@
;;; 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.6.netbsd.1"
+"0.8.9.6.netbsd.2"
Please sign in to comment.
Something went wrong with that request. Please try again.