Patch from Aymeric Vincent.
 ;;;; -*- coding: utf-8; fill-column: 78 -*-
 changes relative to sbcl-1.0.32:
+  * new port: support added for x86-64 NetBSD.  (thanks to Aymeric Vincent)
   * improvement: support O_LARGEFILE access to files larger than 2GB on
     x86-64/linux.  (thanks to Daniel Janus; launchpad bug #453080)
   * new feature: SB-INTROSPECT:WHO-SPECIALIZES-DIRECTLY to get a list of
 
 ;; microsecond but also has a range of years.
 ;; CLH: Note that tv-usec used to be a time-t, but that this seems
 ;; problematic on Darwin x86-64 (and wrong). Trying suseconds-t.
-#!-(or win32 openbsd)
+#!-(or win32 openbsd netbsd)
 (define-alien-type nil
   (struct timeval
           (tv-sec time-t)           ; seconds
 ;; The above definition doesn't work on 64-bit OpenBSD platforms.
 ;; Both tv_sec and tv_usec are declared as long instead of time_t, and
 ;; time_t is a typedef for int.
-#!+openbsd
+#!+(or openbsd netbsd)
 (define-alien-type nil
   (struct timeval
           (tv-sec long)             ; seconds
 
 ;; the POSIX.4 structure for a time value. This is like a "struct
 ;; timeval" but has nanoseconds instead of microseconds.
-#!-openbsd
+#!-(or openbsd netbsd)
 (define-alien-type nil
     (struct timespec
             (tv-sec long)   ; seconds
 ;; Just as with struct timeval, 64-bit OpenBSD has problems with the
 ;; above definition.  tv_sec is declared as time_t instead of long,
 ;; and time_t is a typedef for int.
-#!+openbsd
+#!+(or openbsd netbsd)
 (define-alien-type nil
     (struct timespec
             (tv-sec time-t)  ; seconds
 
--- /dev/null
+# -*- makefile -*- for the C-level run-time support for SBCL
+
+# This software is part of the SBCL system. See the README file for
+# more information.
+#
+# This software is derived from the CMU CL system, which was
+# written at Carnegie Mellon University and released into the
+# public domain. The software is in the public domain and is
+# provided with absolutely no warranty. See the COPYING and CREDITS
+# files for more information.
+
+include Config.x86-64-bsd
+
+ASSEM_SRC += ldso-stubs.S
+OS_LIBS += -lutil
+
+# XXX why do all the other Configs set LINKFLAGS instead of LDFLAGS?
+# LINKFLAGS is only used in src/runtime/GNUmakefile, this causes the
+# dladdr test in tools-for-build/ to fail.
+
+LINKFLAGS += -export-dynamic
+LDFLAGS += -export-dynamic
 
     return CONTEXT_ADDR_FROM_STEM(rflags);
 #elif defined __OpenBSD__
     return &context->sc_rflags;
+#elif defined __NetBSD__
+    return CONTEXT_ADDR_FROM_STEM(RFLAGS);
 #else
 #error unsupported OS
 #endif
 
 #include "genesis/thread.h"
        
 /* Minimize conditionalization for different OS naming schemes. */
-#if defined __linux__  || defined __FreeBSD__ || defined __OpenBSD__ || defined __sun
+#if defined __linux__  || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __sun
 #define GNAME(var) var
 #else
 #define GNAME(var) _##var
 
 /* Get the right type of alignment. Linux, FreeBSD and OpenBSD
  * want alignment in bytes. */
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined __NetBSD__ || defined(__sun)
 #define align_4byte    4
 #define align_8byte    8
 #define align_16byte   16
 
     return CONTEXT_ADDR_FROM_STEM(rip);
 }
 
+#elif defined(LISP_FEATURE_NETBSD)
+os_context_register_t *
+os_context_register_addr(os_context_t *context, int offset)
+{
+    switch(offset) {
+    case reg_RAX:
+        return CONTEXT_ADDR_FROM_STEM(RAX);
+    case reg_RCX:
+        return CONTEXT_ADDR_FROM_STEM(RCX);
+    case reg_RDX:
+        return CONTEXT_ADDR_FROM_STEM(RDX);
+    case reg_RBX:
+        return CONTEXT_ADDR_FROM_STEM(RBX);
+    case reg_RSP:
+        return CONTEXT_ADDR_FROM_STEM(RSP);
+    case reg_RBP:
+        return CONTEXT_ADDR_FROM_STEM(RBP);
+    case reg_RSI:
+        return CONTEXT_ADDR_FROM_STEM(RSI);
+    case reg_RDI:
+        return CONTEXT_ADDR_FROM_STEM(RDI);
+    case reg_R8:
+        return CONTEXT_ADDR_FROM_STEM(R8);
+    case reg_R9:
+        return CONTEXT_ADDR_FROM_STEM(R9);
+    case reg_R10:
+        return CONTEXT_ADDR_FROM_STEM(R10);
+    case reg_R11:
+        return CONTEXT_ADDR_FROM_STEM(R11);
+    case reg_R12:
+        return CONTEXT_ADDR_FROM_STEM(R12);
+    case reg_R13:
+        return CONTEXT_ADDR_FROM_STEM(R13);
+    case reg_R14:
+        return CONTEXT_ADDR_FROM_STEM(R14);
+    case reg_R15:
+        return CONTEXT_ADDR_FROM_STEM(R15);
+    default:
+        return 0;
+    }
+}
+
+os_context_register_t *
+os_context_sp_addr(os_context_t *context)
+{
+    return CONTEXT_ADDR_FROM_STEM(RSP);
+}
+
+os_context_register_t *
+os_context_pc_addr(os_context_t *context)
+{
+    return CONTEXT_ADDR_FROM_STEM(RIP);
+}
+
 #endif
 
 void
 
 ;;; 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".)
-"1.0.32.31"
+"1.0.32.32"