From: Christophe Rhodes Date: Thu, 19 Nov 2009 15:38:50 +0000 (+0000) Subject: 1.0.32.32: add support for x86-64/NetBSD X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=9184392783512f76eb971b7e316c875e2a1eb94c;p=sbcl.git 1.0.32.32: add support for x86-64/NetBSD Patch from Aymeric Vincent. --- diff --git a/NEWS b/NEWS index e3d2053..c51f304 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ;;;; -*- 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 diff --git a/src/code/unix.lisp b/src/code/unix.lisp index 5776803..f8ef69d 100644 --- a/src/code/unix.lisp +++ b/src/code/unix.lisp @@ -202,7 +202,7 @@ corresponds to NAME, or NIL if there is none." ;; 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 @@ -211,7 +211,7 @@ corresponds to NAME, or NIL if there is none." ;; 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 @@ -777,7 +777,7 @@ corresponds to NAME, or NIL if there is none." ;; 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 @@ -786,7 +786,7 @@ corresponds to NAME, or NIL if there is none." ;; 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 diff --git a/src/runtime/Config.x86-64-netbsd b/src/runtime/Config.x86-64-netbsd new file mode 100644 index 0000000..e893ee0 --- /dev/null +++ b/src/runtime/Config.x86-64-netbsd @@ -0,0 +1,22 @@ +# -*- 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 diff --git a/src/runtime/x86-64-arch.c b/src/runtime/x86-64-arch.c index a88435c..f3f414b 100644 --- a/src/runtime/x86-64-arch.c +++ b/src/runtime/x86-64-arch.c @@ -67,6 +67,8 @@ context_eflags_addr(os_context_t *context) 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 diff --git a/src/runtime/x86-64-assem.S b/src/runtime/x86-64-assem.S index 79140e0..ac42010 100644 --- a/src/runtime/x86-64-assem.S +++ b/src/runtime/x86-64-assem.S @@ -25,7 +25,7 @@ #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 @@ -33,7 +33,7 @@ /* 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 diff --git a/src/runtime/x86-64-bsd-os.c b/src/runtime/x86-64-bsd-os.c index 3b45bc5..93dec52 100644 --- a/src/runtime/x86-64-bsd-os.c +++ b/src/runtime/x86-64-bsd-os.c @@ -79,6 +79,60 @@ os_context_pc_addr(os_context_t *context) 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 diff --git a/version.lisp-expr b/version.lisp-expr index 0745dea..967a726 100644 --- a/version.lisp-expr +++ b/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".) -"1.0.32.31" +"1.0.32.32"