Permalink
Browse files

0.7.1.1:

	Merged	support for SPARC/SunOS (aka Solaris)
	... added relevant runtime and	-os.lisp files;
	... cleaned up sparc backend runtime,	actually _using_ the
		abstractions	that were written for the SPARC/Linux
		port;
	... added some	#includes for compilation (nothing breaks on
		Linux, but BSD has not yet been tested;
	... removed some bash-/ksh-isms from build and test scripts;
	... abstraced wait3() constants into grovel_headers and
		unix.lisp.
  • Loading branch information...
1 parent f030ad9 commit 0d669e68a1ffbea42af6216f2ae8c7d7ca12ffb6 @csrhodes csrhodes committed Mar 25, 2002
View
@@ -67,28 +67,28 @@ done
# *.x86f, *.axpf, *.lbytef, *.fasl
# typical extensions for fasl files
find . \( \
- -type l -or \
- -name '*~' -or \
- -name '#*#' -or \
- -name '.#*' -or \
- -name '?*.x86f' -or \
- -name '?*.axpf' -or \
- -name '?*.lbytef' -or \
- -name '?*.fasl' -or \
- -name 'core' -or \
- -name '?*.core' -or \
- -name '*.map' -or \
- -name '*.nm' -or \
- -name '*.host-obj' -or \
- -name '*.lisp-obj' -or \
- -name '*.target-obj' -or \
- -name '*.lib' -or \
- -name '*.tmp' -or \
- -name '*.o' -or \
- -name 'sbcl' -or \
- -name 'sbcl.h' -or \
- -name 'depend' -or \
- -name '*.htm' -or \
- -name '*.html' -or \
- -name 'TAGS' -or \
+ -type l -o \
+ -name '*~' -o \
+ -name '#*#' -o \
+ -name '.#*' -o \
+ -name '?*.x86f' -o \
+ -name '?*.axpf' -o \
+ -name '?*.lbytef' -o \
+ -name '?*.fasl' -o \
+ -name 'core' -o \
+ -name '?*.core' -o \
+ -name '*.map' -o \
+ -name '*.nm' -o \
+ -name '*.host-obj' -o \
+ -name '*.lisp-obj' -o \
+ -name '*.target-obj' -o \
+ -name '*.lib' -o \
+ -name '*.tmp' -o \
+ -name '*.o' -o \
+ -name 'sbcl' -o \
+ -name 'sbcl.h' -o \
+ -name 'depend' -o \
+ -name '*.htm' -o \
+ -name '*.html' -o \
+ -name 'TAGS' -o \
-name 'local-target-features.lisp-expr' \) -print | xargs rm -f
View
@@ -26,13 +26,14 @@ echo //initializing $ltf
echo ';;;; This is a machine-generated file.' > $ltf
echo ';;;; Please do not edit it by hand.' >> $ltf
echo ';;;; See make-config.sh.' >> $ltf
-echo -n '(' >> $ltf
+printf '(' >> $ltf
echo //guessing default target CPU architecture from host architecture
case `uname -m` in
*86) guessed_sbcl_arch=x86 ;;
[Aa]lpha) guessed_sbcl_arch=alpha ;;
sparc*) guessed_sbcl_arch=sparc ;;
+ sun*) guessed_sbcl_arch=sparc ;;
ppc) guessed_sbcl_arch=ppc ;;
*)
# If we're not building on a supported target architecture, we
@@ -49,7 +50,7 @@ if [ "$sbcl_arch" = "" ] ; then
echo "can't guess target SBCL architecture, need SBCL_ARCH environment var"
exit 1
fi
-echo -n ":$sbcl_arch" >> $ltf
+printf ":%s" "$sbcl_arch" >> $ltf
# KLUDGE: currently the x86 only works with the generational garbage
# collector (indicated by the presence of :GENCGC in *FEATURES*) and
# alpha, sparc and ppc with the stop'n'copy collector (indicated by
@@ -59,7 +60,7 @@ echo -n ":$sbcl_arch" >> $ltf
# if we're building for x86. -- CSR, 2002-02-21 Then we do something
# similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
if [ "$sbcl_arch" = "x86" ] ; then
- echo -n ' :gencgc :stack-grows-downward-not-upward' >> $ltf
+ printf ' :gencgc :stack-grows-downward-not-upward' >> $ltf
else
# Nothing need be done in this case, but sh syntax wants a placeholder.
echo > /dev/null
@@ -68,9 +69,9 @@ for d in src/compiler src/assembly; do
echo //setting up symlink $d/target
original_dir=`pwd`
cd $d
- if [ -L target ] ; then
+ if [ -h target ] ; then
rm target
- elif [ -e target ] ; then
+ elif [ -w target ] ; then
echo "I'm afraid to replace non-symlink $d/target with a symlink."
exit 1
fi
@@ -94,22 +95,22 @@ ln -s $sbcl_arch-arch.h target-arch.h
ln -s $sbcl_arch-lispregs.h target-lispregs.h
case `uname` in
Linux)
- echo -n ' :linux' >> $ltf
+ printf ' :linux' >> $ltf
ln -s Config.$sbcl_arch-linux Config
ln -s $sbcl_arch-linux-os.h target-arch-os.h
ln -s linux-os.h target-os.h
;;
*BSD)
- echo -n ' :bsd' >> $ltf
+ printf ' :bsd' >> $ltf
ln -s $sbcl_arch-bsd-os.h target-arch-os.h
ln -s bsd-os.h target-os.h
case `uname` in
FreeBSD)
- echo -n ' :freebsd' >> $ltf
+ printf ' :freebsd' >> $ltf
ln -s Config.$sbcl_arch-freebsd Config
;;
OpenBSD)
- echo -n ' :openbsd' >> $ltf
+ printf ' :openbsd' >> $ltf
ln -s Config.$sbcl_arch-openbsd Config
;;
*)
@@ -118,6 +119,12 @@ case `uname` in
;;
esac
;;
+ SunOS)
+ printf ' :sunos' >> $ltf
+ ln -s Config.$sbcl_arch-sunos Config
+ ln -s $sbcl_arch-sunos-os.h target-arch-os.h
+ ln -s sunos-os.h target-os.h
+ ;;
*)
echo unsupported OS type: `uname`
exit 1
@@ -1592,7 +1592,9 @@ no guarantees of interface stability."
"UNIX-TRUNCATE" "UNIX-TTYNAME"
"UNIX-UID" "UNIX-UNLINK" "UNIX-UTIMES" "UNIX-WRITE" "WINSIZE"
"WRITEGRP" "WRITEOTH" "WRITEOWN" "WS-COL" "WS-ROW" "WS-XPIXEL"
- "WS-YPIXEL" "W_OK" "X_OK" "SIGSYS" "TCSETPGRP" "FD-ZERO"
+ "WS-YPIXEL"
+ "WNOHANG" "WSTOPPED" "WUNTRACED"
+ "W_OK" "X_OK" "SIGSYS" "TCSETPGRP" "FD-ZERO"
"SIGQUIT" "SIGCHLD" "SIGSEGV" "FD-CLR" "SIGUSR2"
"EALREADY" "SIGPIPE" "CHECK" "SIGXCPU" "EOPNOTSUPP"
"SIGFPE" "SIGHUP" "ENOTSOCK" "EINTR"
View
@@ -617,7 +617,9 @@ Function and macro commands:
(when old-hook
(let ((*debugger-hook* nil))
(funcall old-hook condition old-hook))))
- (sb!unix:unix-sigsetmask 0)
+ ;; FIXME: No-one seems to know what this is for. Nothing is noticeably
+ ;; broken on sunos...
+ #!-sunos (sb!unix:unix-sigsetmask 0)
;; Elsewhere in the system, we use the SANE-PACKAGE function for
;; this, but here causing an exception just as we're trying to handle
View
@@ -354,7 +354,8 @@
(defun find-foreign-symbol-in-table (name table)
(let ((prefixes
#!+(or linux freebsd) #("" "ldso_stub__")
- #!+openbsd #("" "_")))
+ #!+openbsd #("" "_")
+ #!+sunos #("" "ldso_stub__")))
(declare (notinline some)) ; to suppress bug 117 bogowarning
(some (lambda (prefix)
(gethash (concatenate 'string prefix name)
View
@@ -97,25 +97,21 @@
(options sb-alien:int)
(rusage sb-alien:int))
-(defconstant wait-wnohang #-svr4 1 #+svr4 #o100)
-(defconstant wait-wuntraced #-svr4 2 #+svr4 4)
-(defconstant wait-wstopped #-svr4 #o177 #+svr4 wait-wuntraced)
-
(defun wait3 (&optional do-not-hang check-for-stopped)
"Return any available status information on child process. "
(multiple-value-bind (pid status)
(c-wait3 (logior (if do-not-hang
- wait-wnohang
+ sb-unix:wnohang
0)
(if check-for-stopped
- wait-wuntraced
+ sb-unix:wuntraced
0))
0)
(cond ((or (minusp pid)
(zerop pid))
nil)
((eql (ldb (byte 8 0) status)
- wait-wstopped)
+ sb-unix:wstopped)
(values pid
:stopped
(ldb (byte 8 8) status)))
View
@@ -0,0 +1,65 @@
+;;;; OS interface functions for CMU CL under Solaris (FIXME: SunOS?)
+
+;;;; 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.
+
+(in-package "SB!SYS")
+
+;;; Check that target machine features are set up consistently with
+;;; this file.
+#!-sunos (error "missing :SUNOS feature")
+
+(defun software-type ()
+ #!+sb-doc
+ "Return a string describing the supporting software."
+ (values "Solaris"))
+
+(defvar *software-version* nil)
+
+(defun software-version ()
+ #!+sb-doc
+ "Return a string describing version of the supporting software, or NIL
+ if not available."
+ (or *software-version*
+ (setf *software-version*
+ (string-trim '(#\newline)
+ (with-output-to-string (stream)
+ (sb!ext:run-program "/bin/uname" `("-r")
+ :output stream))))))
+
+(defun os-cold-init-or-reinit () ; KLUDGE: don't know what to do here
+ (/show "entering solaris-os.lisp OS-COLD-INIT-OR-REINIT")
+ (setf *software-version* nil)
+ (/show "setting *DEFAULT-PATHNAME-DEFAULTS*")
+ (setf *default-pathname-defaults*
+ ;; (temporary value, so that #'PATHNAME won't blow up when
+ ;; we call it below:)
+ (make-trivial-default-pathname)
+ *default-pathname-defaults*
+ ;; (final value, constructed using #'PATHNAME:)
+ (pathname (sb!unix:posix-getcwd/)))
+ (/show "leaving solaris-os.lisp OS-COLD-INIT-OR-REINIT"))
+
+;;; Return system time, user time and number of page faults.
+(defun get-system-info ()
+ (multiple-value-bind
+ (err? utime stime maxrss ixrss idrss isrss minflt majflt)
+ (sb!unix:unix-getrusage sb!unix:rusage_self)
+ (declare (ignore maxrss ixrss idrss isrss minflt))
+ (unless err? ; FIXME: nonmnemonic (reversed) name for ERR?
+ (error "Unix system call getrusage failed: ~A." (strerror utime)))
+ (values utime stime majflt)))
+
+;;; Return the system page size.
+(defun get-page-size ()
+ ;; probably should call getpagesize()
+ ;; FIXME: Or we could just get rid of this, since the uses of it look
+ ;; disposable.
+ ;; FIXME II: this could well be wrong
+ 8192)
@@ -47,6 +47,7 @@
;;; can pull it out of the CMU CL sources, or the old SBCL sources;
;;; but you might also consider doing things the SBCL way and moving
;;; this kind of C-level work down to C wrapper functions.)
+#!-sunos
(sb!alien:define-alien-routine ("sigsetmask" unix-sigsetmask)
sb!alien:unsigned-long
(mask sb!alien:unsigned-long))
View
@@ -477,7 +477,7 @@
(abort
"Reduce debugger level (leaving debugger, returning to toplevel).")
(catch 'toplevel-catcher
- (sb!unix:unix-sigsetmask 0) ; FIXME: What is this for?
+ #!-sunos (sb!unix:unix-sigsetmask 0) ; FIXME: What is this for?
(repl noprint)
(critically-unreachable "after REPL")))))))
View
@@ -281,12 +281,23 @@
;; behavior, automatically allocating memory when a null buffer
;; pointer is used. On a system which doesn't support that
;; extension, it'll have to be rewritten somehow.
- #!-(or linux openbsd freebsd) (,stub,)
+ ;;
+ ;; SunOS provides almost as useful an extension: if given a null
+ ;; buffer pointer, it will automatically allocate size space. The
+ ;; KLUDGE in this solution arises because we have just read off
+ ;; PATH_MAX+1 from the Solaris header files and stuck it in here as
+ ;; 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) (,stub,)
+ #!+(or linux openbsd freebsd sunos)
(or (newcharstar-string (alien-funcall (extern-alien "getcwd"
(function (* char)
(* char)
size-t))
- nil 0))
+ nil
+ #!+(or linux openbsd freebsd) 0
+ #!+sunos 1025))
(simple-perror "getcwd")))
;;; Return the Unix current directory as a SIMPLE-STRING terminated
@@ -836,6 +847,17 @@
(t
(subseq dst 0 dst-len)))))
+;;;; A magic constant for wait3().
+;;;;
+;;;; FIXME: This used to be defined in run-program.lisp as
+;;;; (defconstant wait-wstopped #-svr4 #o177 #+svr4 wait-wuntraced)
+;;;; According to some of the man pages, the #o177 is part of the API
+;;;; for wait3(); that said, under SunOS there is a WSTOPPED thing in
+;;;; the headers that may or may not be the same thing. To be
+;;;; investigated. -- CSR, 2002-03-25
+(defconstant wstopped #o177)
+
+
;;;; stuff not yet found in the header files
;;;;
;;;; Abandon all hope who enters here...
@@ -146,11 +146,29 @@
(defconstant binding-stack-start #x60000000)
(defconstant binding-stack-end #x61000000))
-#!+solaris ; maybe someday.
+#!+sunos ; might as well start by trying the same numbers
(progn
- (defparameter target-read-only-space-start #x10000000)
- (defparameter target-static-space-start #x28000000)
- (defparameter target-dynamic-space-start #x40000000))
+ (defconstant read-only-space-start #x10000000)
+ (defconstant read-only-space-end #x15000000)
+
+ (defconstant static-space-start #x28000000)
+ (defconstant static-space-end #x2c000000)
+
+ (defconstant dynamic-space-start #x30000000)
+ (defconstant dynamic-space-end #x38000000)
+
+ (defconstant dynamic-0-space-start #x30000000)
+ (defconstant dynamic-0-space-end #x38000000)
+
+ (defconstant dynamic-1-space-start #x40000000)
+ (defconstant dynamic-1-space-end #x48000000)
+
+ (defconstant control-stack-start #x50000000)
+ (defconstant control-stack-end #x51000000)
+
+ (defconstant binding-stack-start #x60000000)
+ (defconstant binding-stack-end #x61000000))
+
;;;; other random constants.
@@ -224,13 +242,22 @@
;;;; Assembler parameters:
;;; The number of bits per element in the assemblers code vector.
-;;;
(defparameter *assembly-unit-length* 8)
;;;; Pseudo-atomic trap number
-;;; KLUDGE
+
+;;; KLUDGE: Linux on the SPARC doesn't seem to conform to any kind of
+;;; standards at all. So we use an explicitly undefined trap, because
+;;; that currently does the right thing. Expect this to break
+;;; eventually (but with luck, at that point we'll be able to revert
+;;; to the compliant trap number...
+;;;
+;;; KLUDGE: Maybe this should be called pseudo-atomic-magic-number,
+;;; allowing other architectures (which don't necessarily use traps
+;;; for pseudo-atomic) to propagate a magic number to C land via
+;;; sbcl.h.
#!-linux
-(defconstant pseudo-atomic-trap 16)
+(defconstant pseudo-atomic-trap #x10)
#!+linux
(defconstant pseudo-atomic-trap #x40)
Oops, something went wrong.

0 comments on commit 0d669e6

Please sign in to comment.