Permalink
Browse files

1.0.26.18: Solaris x86-64 support

        * Patch by Alex Viskovatoff
  • Loading branch information...
1 parent ce73c96 commit 53ab0266f9a92943cc93f675cc727d01cfa55474 @jsnell jsnell committed Mar 22, 2009
View
1 NEWS
@@ -1,6 +1,7 @@
;;;; -*- coding: utf-8; fill-column: 78 -*-
changes in sbcl-1.0.27 relative to 1.0.26:
* new port: support added for x86-64 OpenBSD. (thanks to Josh Elsasser)
+ * new port: support added for x86-64 Solaris. (thanks to Alex Viskovatoff)
* bug fix: a type error is signaled for attempts to use the LOOP
keyword ACROSS for a NIL value. (thanks to Daniel Lowe)
* bug fix: fix gc related interrupt handling bug on ppc (regression from
View
1 contrib/sb-grovel/def-to-lisp.lisp
@@ -207,6 +207,7 @@ code:
"-D_FILE_OFFSET_BITS=64")
#+(and x86-64 darwin)
'("-arch" "x86_64")
+ #+(and x86-64 sunos) '("-m64")
(list "-o"
(namestring tmp-a-dot-out)
(namestring tmp-c-source)))
View
10 contrib/sb-posix/posix-tests.lisp
@@ -415,14 +415,14 @@
#+win32
#.sb-posix:eacces)
-#-(or (and x86-64 linux) win32)
+#-(or (and x86-64 (or linux sunos)) win32)
(deftest fcntl.1
(let ((fd (sb-posix:open "/dev/null" sb-posix::o-nonblock)))
(= (sb-posix:fcntl fd sb-posix::f-getfl) sb-posix::o-nonblock))
t)
;; On AMD64/Linux O_LARGEFILE is always set, even though the whole
;; flag makes no sense.
-#+(and x86-64 linux)
+#+(and x86-64 (or linux sunos))
(deftest fcntl.1
(let ((fd (sb-posix:open "/dev/null" sb-posix::o-nonblock)))
(/= 0 (logand (sb-posix:fcntl fd sb-posix::f-getfl)
@@ -767,8 +767,10 @@
(delete-file temp))))
t "mkstemp-1")
-#-(or win32 sunos hpux)
-;;; mkdtemp is unimplemented on at least Solaris 10
+;#-(or win32 sunos hpux)
+;;;; mkdtemp is unimplemented on at least Solaris 10
+#-(or win32 hpux)
+;;; But it is implemented on OpenSolaris 2008.11
(deftest mkdtemp.1
(let ((pathname
(sb-ext:parse-native-namestring
View
7 make-config.sh
@@ -123,6 +123,11 @@ case `uname -m` in
;;
esac
+# Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
+if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
+ guessed_sbcl_arch=x86-64
+fi
+
echo //setting up CPU-architecture-dependent information
sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
echo sbcl_arch=\"$sbcl_arch\"
@@ -250,7 +255,7 @@ case "$sbcl_os" in
printf ' :unix' >> $ltf
printf ' :elf' >> $ltf
printf ' :sunos' >> $ltf
- if [ $sbcl_arch = "x86" ]; then
+ if [ $sbcl_arch = "x86" ] || [ $sbcl_arch = "amd64" ]; then
printf ' :sb-lutex' >> $ltf
fi
link_or_copy Config.$sbcl_arch-sunos Config
View
2 src/code/sunos-os.lisp
@@ -48,4 +48,4 @@
;; disposable.
;; FIXME II: this could well be wrong
#!+sparc 8192
- #!+x86 4096)
+ #!+(or x86 x86-64) 4096)
View
23 src/runtime/Config.x86-64-sunos
@@ -0,0 +1,23 @@
+CC=gcc
+CFLAGS = -m64 -g -O2 -Wall -D__EXTENSIONS__ -D_POSIX_C_SOURCE=199506L -DSVR4 -D_REENTRANT -fno-omit-frame-pointer
+ASFLAGS = -m64 -Wall
+LD = ld
+LINKFLAGS = -m64 -g
+NM = nm -xgp
+GREP = ggrep
+
+#CC=/opt/SunStudioExpress/bin/cc
+#CFLAGS = -xarch=generic64 -g -O2 -Wall -D__EXTENSIONS__ -D_POSIX_C_SOURCE=199506L -DSVR4 -D_REENTRANT -fno-omit-frame-pointer
+#ASFLAGS = -xarch=generic64 -Wall
+
+ASSEM_SRC = x86-64-assem.S ldso-stubs.S
+ARCH_SRC = x86-64-arch.c
+
+OS_SRC = sunos-os.c x86-64-sunos-os.c os-common.c
+OS_LIBS= -ldl -lsocket -lnsl -lrt
+
+GC_SRC= gencgc.c
+
+# Nothing to do for after-grovel-headers.
+.PHONY: after-grovel-headers
+after-grovel-headers:
View
1 src/runtime/sparc-sunos-os.h
@@ -2,6 +2,7 @@
#define _SPARC_SOLARIS_OS_H
typedef ucontext_t os_context_t;
+typedef int os_context_register_t ;
static inline os_context_t *arch_os_get_context(void **void_context)
{
View
2 src/runtime/sunos-os.c
@@ -28,7 +28,7 @@
#if defined LISP_FEATURE_SPARC
#define OS_VM_DEFAULT_PAGESIZE 8192
-#elif defined LISP_FEATURE_X86
+#elif defined LISP_FEATURE_X86 || defined LISP_FEATURE_X86_64
#define OS_VM_DEFAULT_PAGESIZE 4096
#else
#error "Don't know OS_VM_DEFAULT_PAGESIZE"
View
4 src/runtime/sunos-os.h
@@ -33,7 +33,3 @@ typedef int os_vm_prot_t;
#define SIG_MEMORY_FAULT SIGSEGV
#define SIG_STOP_FOR_GC (SIGUSR2)
-
-/* Yaargh?! */
-typedef int os_context_register_t ;
-
View
2 src/runtime/x86-64-arch.c
@@ -54,7 +54,7 @@ arch_get_bad_addr(int sig, siginfo_t *code, os_context_t *context)
os_context_register_t *
context_eflags_addr(os_context_t *context)
{
-#if defined __linux__
+#if defined __linux__ || defined __sun
/* KLUDGE: As of kernel 2.2.14 on Red Hat 6.2, there's code in the
* <sys/ucontext.h> file to define symbolic names for offsets into
* gregs[], but it's conditional on __USE_GNU and not defined, so
View
4 src/runtime/x86-64-assem.S
@@ -25,15 +25,15 @@
#include "genesis/thread.h"
/* Minimize conditionalization for different OS naming schemes. */
-#if defined __linux__ || defined __FreeBSD__ || defined __OpenBSD__
+#if defined __linux__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __sun
#define GNAME(var) var
#else
#define GNAME(var) _##var
#endif
/* Get the right type of alignment. Linux, FreeBSD and OpenBSD
* want alignment in bytes. */
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun)
#define align_4byte 4
#define align_8byte 8
#define align_16byte 16
View
93 src/runtime/x86-64-sunos-os.c
@@ -0,0 +1,93 @@
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/file.h>
+#include "sbcl.h"
+#include "./signal.h"
+#include "os.h"
+#include "arch.h"
+#include "globals.h"
+#include "interrupt.h"
+#include "interr.h"
+#include "lispregs.h"
+#include <sys/socket.h>
+#include <sys/utsname.h>
+
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifdef LISP_FEATURE_SB_THREAD
+#error "Threading is not supported for Solaris running on x86-64."
+#endif
+
+#include "validate.h"
+
+
+int arch_os_thread_init(struct thread *thread) {
+ stack_t sigstack;
+ return 1;
+}
+
+int arch_os_thread_cleanup(struct thread *thread) {
+ return 1;
+}
+
+
+os_context_register_t *
+os_context_register_addr(os_context_t *context, int offset)
+{
+#define RCASE(name) case reg_ ## name: return &context->uc_mcontext.gregs[REG_ ## name];
+ switch(offset) {
+ RCASE(RAX)
+ RCASE(RCX)
+ RCASE(RDX)
+ RCASE(RBX)
+ RCASE(RSP)
+ RCASE(RBP)
+ RCASE(RSI)
+ RCASE(RDI)
+ RCASE(R8)
+ RCASE(R9)
+ RCASE(R10)
+ RCASE(R11)
+ RCASE(R12)
+ RCASE(R13)
+ RCASE(R14)
+ RCASE(R15)
+ default:
+ if(offset<NGREG)
+ return &context->uc_mcontext.gregs[offset/2+4];
+ else return 0;
+ }
+ return &context->uc_mcontext.gregs[offset];
+}
+
+os_context_register_t *
+os_context_pc_addr(os_context_t *context)
+{
+ return &context->uc_mcontext.gregs[REG_RIP];
+}
+
+os_context_register_t *
+os_context_sp_addr(os_context_t *context)
+{
+ return &context->uc_mcontext.gregs[REG_RSP];
+}
+
+sigset_t *
+os_context_sigmask_addr(os_context_t *context)
+{
+ return &(context->uc_sigmask);
+}
+
+void os_flush_icache(os_vm_address_t address, os_vm_size_t length)
+{
+}
+
+unsigned long
+os_context_fp_control(os_context_t *context)
+{
+ return context->uc_mcontext.fpregs.fp_reg_set.fpchip_state.cw;
+}
View
12 src/runtime/x86-64-sunos-os.h
@@ -0,0 +1,12 @@
+#ifndef _X86_64_SOLARIS_OS_H
+#define _X86_64_SOLARIS_OS_H
+
+typedef struct ucontext os_context_t;
+typedef long os_context_register_t;
+
+static inline os_context_t *arch_os_get_context(void **void_context)
+{
+ return (os_context_t *) *void_context;
+}
+
+#endif /* _X86_64_SOLARIS_OS_H */
View
1 src/runtime/x86-sunos-os.h
@@ -2,6 +2,7 @@
#define _X86_SOLARIS_OS_H
typedef ucontext_t os_context_t;
+typedef int os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context)
{
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".)
-"1.0.26.17"
+"1.0.26.18"

0 comments on commit 53ab026

Please sign in to comment.