diff --git a/code/bsd-os.lisp b/code/bsd-os.lisp index c23a684cab9e74b0c550108941eeca455280a114..e549101ec0cd18bab190778fc40a6f3a1f682c73 100644 --- a/code/bsd-os.lisp +++ b/code/bsd-os.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/bsd-os.lisp,v 1.3 1998/03/10 18:28:43 dtc Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/bsd-os.lisp,v 1.4 2001/12/06 19:15:40 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -15,15 +15,17 @@ ;;; Scott Fahlman, Dan Aronson, and Steve Handerson did stuff here, too. ;;; ;;; Hacked into (Free)bsd-os.lisp by Paul Werkowski. +;;; Generalized a bit for OpenBSD by Pierre R. Mai. (in-package "SYSTEM") (use-package "EXTENSIONS") (export '(get-system-info get-page-size os-init)) (pushnew :bsd *features*) -(pushnew :freebsd *features*) -(setq *software-type* #+FreeBSD "FreeBSD" #-FreeBSD "BSD") +(setq *software-type* #+OpenBSD "OpenBSD" + #+FreeBSD "FreeBSD" + #-(or FreeBSD OpenBSD) "BSD") (defvar *software-version* nil "Version string for supporting software") diff --git a/code/exports.lisp b/code/exports.lisp index 0d698498ed8d469c8c70be1120e681b0f2c5430d..b8d8b6f4b31708c6c24567c2de3a4037a4c58f65 100644 --- a/code/exports.lisp +++ b/code/exports.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/exports.lisp,v 1.185 2001/10/03 16:00:24 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/exports.lisp,v 1.186 2001/12/06 19:15:40 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -280,7 +280,7 @@ "TTY-CSIZE" "TTY-CS5" "TTY-CS6" "TTY-CS7" "TTY-CS8" "VMIN" "VTIME" "VSUSP" "VSTART" "VSTOP" "VDSUSP" "UNIX-TCSENDBREAK" "UNIX-TCDRAIN" "UNIX-TCFLUSH" "UNIX-TCFLOW" - #+(or svr4 freebsd linux) "O_NDELAY") + #+(or svr4 bsd linux) "O_NDELAY") #+(or svr4 linux) (:export "EADDRINUSE" "EADDRNOTAVAIL" "EADV" "EAFNOSUPPORT" "EALREADY" "EBADE" "EBADFD" "EBADMSG" "EBADR" "EBADRQC" diff --git a/code/float-trap.lisp b/code/float-trap.lisp index 5266727a18f43e928813e4c71bc2daa73f0564df..8839d4bc898dd401c990d328914af52bdcfeb3ed 100644 --- a/code/float-trap.lisp +++ b/code/float-trap.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/float-trap.lisp,v 1.16 2001/04/12 19:42:36 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/float-trap.lisp,v 1.17 2001/12/06 19:15:40 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -156,7 +156,7 @@ ;;; Signal the appropriate condition when we get a floating-point error. ;;; -#+FreeBSD +#+BSD (define-condition floating-point-exception (arithmetic-error) ((flags :initarg :traps :reader floating-point-exception-traps)) @@ -189,7 +189,7 @@ (error 'floating-point-underflow)) ((not (zerop (logand float-inexact-trap-bit traps))) (error 'ext:floating-point-inexact)) - #+FreeBSD + #+BSD ((zerop (ldb float-exceptions-byte modes)) ;; I can't tell what caused the exception!! (error 'floating-point-exception diff --git a/code/foreign.lisp b/code/foreign.lisp index 6c8aceba5e26b49f467b52a14a05ca2d76b55f62..da348e77cc9f5b15a821d56555134cd0750fa0d1 100644 --- a/code/foreign.lisp +++ b/code/foreign.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/foreign.lisp,v 1.34 2001/10/30 22:14:36 pmai Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/foreign.lisp,v 1.35 2001/12/06 19:15:41 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -25,9 +25,9 @@ #+hppa (defconstant foreign-segment-start #x10C00000) #+hppa (defconstant foreign-segment-size #x00400000) -#+(and freebsd x86) +#+(and bsd x86) (defconstant foreign-segment-start #x0E000000) -#+(and freebsd x86) +#+(and bsd x86) (defconstant foreign-segment-size #x02000000) (defvar *previous-linked-object-file* nil) @@ -57,7 +57,7 @@ (t (incf code)))))))) -#+(or (and FreeBSD (not elf)) (and sparc (not svr4))) +#+(or OpenBSD (and FreeBSD (not elf)) (and sparc (not svr4))) (alien:def-alien-type exec (alien:struct nil (magic c-call:unsigned-long) @@ -216,10 +216,10 @@ to skip undefined symbols which don't have an address." (unless (eql (aref line 0) #\space) ; Skip undefined symbols.... (let* ((symbol (subseq line 11)) (address (parse-integer line :end 8 :radix 16)) - #+FreeBSD (kind (aref line 9)) ; filter out .o file names + (kind (aref line 9)) ; filter out .o file names (old-address (gethash symbol lisp::*foreign-symbols*))) (unless (or (null old-address) (= address old-address) - #+FreeBSD (char= kind #\F)) + (char= kind #\F)) (warn "~S moved from #x~8,'0X to #x~8,'0X.~%" symbol old-address address)) (setf (gethash symbol symbol-table) address)))))) @@ -230,7 +230,8 @@ to skip undefined symbols which don't have an address." ;;; pw-- This seems to work for FreeBSD. The MAGIC field is not tested ;;; for correct file format so it may croak if ld fails to produce the ;;; expected results. It is probably good enough for now. -#+(or (and FreeBSD (not ELF)) (and sparc (not svr4))) +;;; prm- We assume this works for OpenBSD as well, needs testing... +#+(or OpenBSD (and FreeBSD (not ELF)) (and sparc (not svr4))) (defun load-object-file (name) (format t ";;; Loading object file...~%") (multiple-value-bind (fd errno) (unix:unix-open name unix:o_rdonly 0) @@ -446,10 +447,10 @@ to skip undefined symbols which don't have an address." (return)) (let* ((symbol (subseq line 11)) (address (parse-integer line :end 8 :radix 16)) - #+FreeBSD (kind (aref line 9)) ; filter out .o file names + #+BSD (kind (aref line 9)) ; filter out .o file names (old-address (gethash symbol lisp::*foreign-symbols*))) (unless (or (null old-address) (= address old-address) - #+FreeBSD (char= kind #\F)) + #+BSD (char= kind #\F)) (warn "~S moved from #x~8,'0X to #x~8,'0X.~%" symbol old-address address)) (setf (gethash symbol symbol-table) address))))) diff --git a/code/internet.lisp b/code/internet.lisp index 1c65d7fb84be39bfc23477a4b2dff4a0190fbc8e..dee96e1581e53ee51a6c7d794867e335085dd922 100644 --- a/code/internet.lisp +++ b/code/internet.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/internet.lisp,v 1.30 2001/04/10 13:42:45 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/internet.lisp,v 1.31 2001/12/06 19:15:41 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -119,7 +119,7 @@ (declare (type host-entry host)) (car (host-entry-addr-list host))) -#-FreeBSD +#-BSD (def-alien-type unix-sockaddr (struct nil (family #-(or linux alpha) short #+(or linux alpha) unsigned-short) @@ -132,7 +132,7 @@ struct sockaddr_un { }; |# -#+FreeBSD +#+BSD (def-alien-type unix-sockaddr (struct nil (sun-len unsigned-char) @@ -154,7 +154,7 @@ struct in_addr { }; |# -#+FreeBSD +#+BSD (def-alien-type inet-sockaddr (struct nil (sin-len unsigned-char) @@ -163,7 +163,7 @@ struct in_addr { (addr unsigned-long) (zero (array char 8)))) -#-FreeBSD +#-BSD (def-alien-type inet-sockaddr (struct nil (family #-alpha short #+alpha unsigned-short) @@ -287,10 +287,10 @@ struct in_addr { socket))) ;;; Socket levels. -(defconstant sol-socket #+linux 1 #+(or solaris freebsd) #xffff) +(defconstant sol-socket #+linux 1 #+(or solaris bsd) #xffff) ;;; Socket options. -(defconstant so-reuseaddr #+linux 2 #+(or solaris freebsd) 4) +(defconstant so-reuseaddr #+linux 2 #+(or solaris bsd) 4) (defun get-socket-option (socket level optname) "Get an integer value socket option." diff --git a/code/profile.lisp b/code/profile.lisp index c62a4a72376d87e4f188dd86c0acd21db9139bc0..d3c3978ad241b7c966a2afbb8febcceec9cf47e7 100644 --- a/code/profile.lisp +++ b/code/profile.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/profile.lisp,v 1.19 2001/03/04 20:12:40 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/profile.lisp,v 1.20 2001/12/06 19:15:41 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -281,17 +281,17 @@ ,@required-args optional-args) `(funcall old-definition ,@required-args)) (setq time-inc - #-FreeBSD + #-BSD (- (quickly-get-time) start-time) - #+FreeBSD + #+BSD (max (- (quickly-get-time) start-time) 0)) (setq cons-inc (- (total-consing) start-consed)) (setq profile-inc *enclosed-profilings*) (incf time (the time-type - #-FreeBSD + #-BSD (- time-inc *enclosed-time*) - #+FreeBSD + #+BSD (max (- time-inc *enclosed-time*) 0))) (incf consed (the consing-type diff --git a/code/unix.lisp b/code/unix.lisp index e25563eb811e21f0dcb3527fcdf2048dbe41eebe..5cc641cf29afb802f81a0be0284f84c40b5e12d5 100644 --- a/code/unix.lisp +++ b/code/unix.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.73 2001/09/27 11:28:59 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.74 2001/12/06 19:15:41 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -45,8 +45,8 @@ unix-fcntl f-dupfd f-getfd f-setfd f-getfl f-setfl f-getown f-setown fndelay fappend fasync fcreat ftrunc fexcl unix-link unix-lseek l_set l_incr l_xtnd unix-mkdir unix-open o_rdonly o_wronly o_rdwr - #+(or hpux svr4 freebsd linux) o_ndelay - #+(or hpux svr4 freebsd linux) o_noctty #+(or hpux svr4) o_nonblock + #+(or hpux svr4 bsd linux) o_ndelay + #+(or hpux svr4 bsd linux) o_noctty #+(or hpux svr4) o_nonblock o_append o_creat o_trunc o_excl unix-pipe unix-read unix-readlink unix-rename unix-rmdir unix-fast-select fd-setsize fd-set fd-clr fd-isset fd-zero unix-select unix-sync unix-fsync unix-truncate @@ -56,108 +56,108 @@ tcsetpgrp tcgetpgrp tty-process-group terminal-speeds tty-raw tty-crmod tty-echo tty-lcase #-hpux tty-cbreak #-(or hpux linux) tty-tandem - #+(or hpux svr4 linux freebsd) termios - #+(or hpux svr4 linux freebsd) c-lflag - #+(or hpux svr4 linux freebsd) c-iflag - #+(or hpux svr4 linux freebsd) c-oflag - #+(or hpux svr4 linux freebsd) tty-icrnl + #+(or hpux svr4 linux bsd) termios + #+(or hpux svr4 linux bsd) c-lflag + #+(or hpux svr4 linux bsd) c-iflag + #+(or hpux svr4 linux bsd) c-oflag + #+(or hpux svr4 linux bsd) tty-icrnl #+(or hpux svr4 linux) tty-ocrnl - #+(or hpux svr4 freebsd) vdsusp #+(or hpux svr4 linux freebsd) veof - #+(or hpux svr4 linux freebsd) vintr - #+(or hpux svr4 linux freebsd) vquit - #+(or hpux svr4 linux freebsd) vstart - #+(or hpux svr4 linux freebsd) vstop - #+(or hpux svr4 linux freebsd) vsusp - #+(or hpux svr4 linux freebsd) c-cflag - #+(or hpux svr4 linux freebsd) c-cc + #+(or hpux svr4 bsd) vdsusp #+(or hpux svr4 linux bsd) veof + #+(or hpux svr4 linux bsd) vintr + #+(or hpux svr4 linux bsd) vquit + #+(or hpux svr4 linux bsd) vstart + #+(or hpux svr4 linux bsd) vstop + #+(or hpux svr4 linux bsd) vsusp + #+(or hpux svr4 linux bsd) c-cflag + #+(or hpux svr4 linux bsd) c-cc #+(or bsd osf1) c-ispeed #+(or bsd osf1) c-ospeed - #+(or hpux svr4 linux freebsd) tty-icanon - #+(or hpux svr4 linux freebsd) vmin - #+(or hpux svr4 linux freebsd) vtime - #+(or hpux svr4 linux freebsd) tty-ixon - #+(or hpux svr4 freebsd linux) tcsanow - #+(or hpux svr4 freebsd linux) tcsadrain - #+(or hpux svr4 freebsd linux) tciflush - #+(or hpux svr4 freebsd linux) tcoflush - #+(or hpux svr4 freebsd linux) tcioflush - #+(or hpux svr4 freebsd linux) tcsaflush - #+(or hpux svr4 linux freebsd) unix-tcgetattr - #+(or hpux svr4 linux freebsd) unix-tcsetattr - #+(or hpux svr4 freebsd) unix-cfgetospeed - #+(or hpux svr4 freebsd) unix-cfsetospeed - #+(or hpux svr4 freebsd) unix-cfgetispeed - #+(or hpux svr4 freebsd) unix-cfsetispeed - #+(or hpux svr4 linux freebsd) tty-ignbrk - #+(or hpux svr4 linux freebsd) tty-brkint - #+(or hpux svr4 linux freebsd) tty-ignpar - #+(or hpux svr4 linux freebsd) tty-parmrk - #+(or hpux svr4 linux freebsd) tty-inpck - #+(or hpux svr4 linux freebsd) tty-istrip - #+(or hpux svr4 linux freebsd) tty-inlcr - #+(or hpux svr4 linux freebsd) tty-igncr + #+(or hpux svr4 linux bsd) tty-icanon + #+(or hpux svr4 linux bsd) vmin + #+(or hpux svr4 linux bsd) vtime + #+(or hpux svr4 linux bsd) tty-ixon + #+(or hpux svr4 linux bsd) tcsanow + #+(or hpux svr4 linux bsd) tcsadrain + #+(or hpux svr4 linux bsd) tciflush + #+(or hpux svr4 linux bsd) tcoflush + #+(or hpux svr4 linux bsd) tcioflush + #+(or hpux svr4 linux bsd) tcsaflush + #+(or hpux svr4 linux bsd) unix-tcgetattr + #+(or hpux svr4 linux bsd) unix-tcsetattr + #+(or hpux svr4 bsd) unix-cfgetospeed + #+(or hpux svr4 bsd) unix-cfsetospeed + #+(or hpux svr4 bsd) unix-cfgetispeed + #+(or hpux svr4 bsd) unix-cfsetispeed + #+(or hpux svr4 linux bsd) tty-ignbrk + #+(or hpux svr4 linux bsd) tty-brkint + #+(or hpux svr4 linux bsd) tty-ignpar + #+(or hpux svr4 linux bsd) tty-parmrk + #+(or hpux svr4 linux bsd) tty-inpck + #+(or hpux svr4 linux bsd) tty-istrip + #+(or hpux svr4 linux bsd) tty-inlcr + #+(or hpux svr4 linux bsd) tty-igncr #+(or hpux svr4 linux) tty-iuclc - #+(or hpux svr4 linux freebsd) tty-ixany - #+(or hpux svr4 linux freebsd) tty-ixoff + #+(or hpux svr4 linux bsd) tty-ixany + #+(or hpux svr4 linux bsd) tty-ixoff #+hpux tty-ienqak - #+(or hpux irix solaris linux freebsd) tty-imaxbel - #+(or hpux svr4 linux freebsd) tty-opost + #+(or hpux irix solaris linux bsd) tty-imaxbel + #+(or hpux svr4 linux bsd) tty-opost #+(or hpux svr4 linux) tty-olcuc - #+(or hpux svr4 linux freebsd) tty-onlcr + #+(or hpux svr4 linux bsd) tty-onlcr #+(or hpux svr4 linux) tty-onocr #+(or hpux svr4 linux) tty-onlret #+(or hpux svr4 linux) tty-ofill #+(or hpux svr4 linux) tty-ofdel - #+(or hpux svr4 linux freebsd) tty-isig + #+(or hpux svr4 linux bsd) tty-isig #+(or hpux svr4 linux) tty-xcase - #+(or hpux svr4 linux freebsd) tty-echoe - #+(or hpux svr4 linux freebsd) tty-echok - #+(or hpux svr4 linux freebsd) tty-echonl - #+(or hpux svr4 linux freebsd) tty-noflsh - #+(or hpux svr4 linux freebsd) tty-iexten - #+(or hpux svr4 linux freebsd) tty-tostop - #+(or hpux irix solaris linux freebsd) tty-echoctl - #+(or hpux irix solaris linux freebsd) tty-echoprt - #+(or hpux irix solaris linux freebsd) tty-echoke + #+(or hpux svr4 linux bsd) tty-echoe + #+(or hpux svr4 linux bsd) tty-echok + #+(or hpux svr4 linux bsd) tty-echonl + #+(or hpux svr4 linux bsd) tty-noflsh + #+(or hpux svr4 linux bsd) tty-iexten + #+(or hpux svr4 linux bsd) tty-tostop + #+(or hpux irix solaris linux bsd) tty-echoctl + #+(or hpux irix solaris linux bsd) tty-echoprt + #+(or hpux irix solaris linux bsd) tty-echoke #+(or hpux irix solaris) tty-defecho - #+(or hpux irix solaris freebsd) tty-flusho - #+(or hpux irix solaris linux freebsd) tty-pendin - #+(or hpux svr4 linux freebsd) tty-cstopb - #+(or hpux svr4 linux freebsd) tty-cread - #+(or hpux svr4 linux freebsd) tty-parenb - #+(or hpux svr4 linux freebsd) tty-parodd - #+(or hpux svr4 linux freebsd) tty-hupcl - #+(or hpux svr4 linux freebsd) tty-clocal + #+(or hpux irix solaris bsd) tty-flusho + #+(or hpux irix solaris linux bsd) tty-pendin + #+(or hpux svr4 linux bsd) tty-cstopb + #+(or hpux svr4 linux bsd) tty-cread + #+(or hpux svr4 linux bsd) tty-parenb + #+(or hpux svr4 linux bsd) tty-parodd + #+(or hpux svr4 linux bsd) tty-hupcl + #+(or hpux svr4 linux bsd) tty-clocal #+(or irix solaris) rcv1en #+(or irix solaris) xmt1en #+(or hpux irix solaris) tty-loblk - #+(or hpux svr4 linux freebsd) vintr - #+(or hpux svr4 linux freebsd) verase - #+(or hpux svr4 linux freebsd) vkill - #+(or hpux svr4 linux freebsd) veol - #+(or hpux irix solaris linux freebsd) veol2 + #+(or hpux svr4 linux bsd) vintr + #+(or hpux svr4 linux bsd) verase + #+(or hpux svr4 linux bsd) vkill + #+(or hpux svr4 linux bsd) veol + #+(or hpux irix solaris linux bsd) veol2 #+(or hpux irix solaris) tty-cbaud - #+(or hpux svr4 freebsd) tty-csize #+(or hpux svr4 freebsd) tty-cs5 - #+(or hpux svr4 freebsd) tty-cs6 #+(or hpux svr4 freebsd) tty-cs7 - #+(or hpux svr4 freebsd) tty-cs8 - #+(or hpux svr4 freebsd) unix-tcsendbreak - #+(or hpux svr4 freebsd) unix-tcdrain - #+(or hpux svr4 freebsd) unix-tcflush - #+(or hpux svr4 freebsd) unix-tcflow + #+(or hpux svr4 bsd) tty-csize #+(or hpux svr4 bsd) tty-cs5 + #+(or hpux svr4 bsd) tty-cs6 #+(or hpux svr4 bsd) tty-cs7 + #+(or hpux svr4 bsd) tty-cs8 + #+(or hpux svr4 bsd) unix-tcsendbreak + #+(or hpux svr4 bsd) unix-tcdrain + #+(or hpux svr4 bsd) unix-tcflush + #+(or hpux svr4 bsd) unix-tcflow TIOCGETP TIOCSETP TIOCFLUSH TIOCSETC TIOCGETC TIOCSLTC TIOCGLTC TIOCNOTTY TIOCSPGRP TIOCGPGRP TIOCGWINSZ TIOCSWINSZ TIOCSIGSEND KBDCGET KBDCSET KBDCRESET KBDCRST KBDCSSTD KBDSGET KBDGCLICK - KBDSCLICK FIONREAD #+(or hpux freebsd) siocspgrp + KBDSCLICK FIONREAD #+(or hpux bsd) siocspgrp unix-exit unix-stat unix-lstat unix-fstat unix-getrusage unix-fast-getrusage rusage_self rusage_children unix-gettimeofday #-hpux unix-utimes #-(or svr4 hpux) unix-setreuid #-(or svr4 hpux) unix-setregid unix-getpid unix-getppid - #+(or svr4 freebsd)unix-setpgid + #+(or svr4 bsd)unix-setpgid unix-getgid unix-getegid unix-getpgrp unix-setpgrp unix-getuid unix-getpagesize unix-gethostname unix-gethostid unix-fork unix-current-directory unix-isatty unix-ttyname unix-execve @@ -186,19 +186,19 @@ (def-alien-type dev-t #-(or alpha svr4 bsd linux) short #+linux unsigned-short #+alpha int #+(and (not linux) (or bsd svr4)) unsigned-long) -#-FreeBSD +#-BSD (def-alien-type off-t #-alpha long #+alpha unsigned-long) -#+FreeBSD +#+BSD (def-alien-type off-t quad-t) -#-FreeBSD +#-BSD (def-alien-type uid-t #-(or alpha svr4) unsigned-short #+alpha unsigned-int #+svr4 long) -#+FreeBSD +#+BSD (def-alien-type uid-t unsigned-long) -#-FreeBSD +#-BSD (def-alien-type gid-t #-(or alpha svr4) unsigned-short #+alpha unsigned-int #+svr4 long) -#+FreeBSD +#+BSD (def-alien-type gid-t unsigned-long) (def-alien-type mode-t #-(or alpha svr4) unsigned-short #+alpha unsigned-int #+svr4 unsigned-long) @@ -271,7 +271,7 @@ (tv-sec time-t) (tv-nsec long))) -#+(or linux FreeBSD) +#+(or linux BSD) (def-alien-type nil (struct timespec-t (ts-sec long) @@ -391,7 +391,7 @@ ;;; From sys/stat.h ;; oh boy, in linux-> 2 stat(s)!! -#-(or svr4 freebsd linux) ; eg hpux and alpha +#-(or svr4 bsd linux) ; eg hpux and alpha (def-alien-type nil (struct stat (st-dev dev-t) @@ -412,7 +412,7 @@ (st-blocks #-alpha long #+alpha int) (st-spare4 (array long 2)))) -#+FreeBSD +#+BSD (def-alien-type nil (struct stat (st-dev dev-t) @@ -1139,10 +1139,10 @@ (declare (type unix-fd fd) (type (unsigned-byte 32) offset) (type (integer 0 2) whence)) - #-(and x86 freebsd) (int-syscall ("lseek" int off-t int) fd offset whence) + #-(and x86 bsd) (int-syscall ("lseek" int off-t int) fd offset whence) ;; Need a 64-bit return value type for this. TBD. For now, ;; don't use this with any 2G+ partitions. - #+(and freebsd x86) (int-syscall ("lseek" int unsigned-long unsigned-long int) + #+(and bsd x86) (int-syscall ("lseek" int unsigned-long unsigned-long int) fd offset 0 whence )) ;;; Unix-mkdir accepts a name and a mode and attempts to create the @@ -1162,7 +1162,7 @@ (defconstant o_rdonly 0 "Read-only flag.") (defconstant o_wronly 1 "Write-only flag.") (defconstant o_rdwr 2 "Read-write flag.") -#+(or hpux linux svr4 freebsd) +#+(or hpux linux svr4 bsd) (defconstant o_ndelay #-linux 4 #+linux #o4000 "Non-blocking I/O") (defconstant o_append #-linux #o10 #+linux #o2000 "Append flag.") #+(or hpux svr4 linux) @@ -1450,14 +1450,14 @@ (defconstant tty-raw #-linux #o40 #+linux 1) (defconstant tty-crmod #-linux #o20 #+linux 4) -#-(or hpux svr4 freebsd linux) (defconstant tty-echo #o10) ;; 8 +#-(or hpux svr4 bsd linux) (defconstant tty-echo #o10) ;; 8 (defconstant tty-lcase #-linux #o4 #+linux 2) #-hpux (defconstant tty-cbreak #-linux #o2 #+linux 64) #-(or linux hpux) (defconstant tty-tandem #o1) -#+(or hpux svr4 freebsd linux) +#+(or hpux svr4 bsd linux) (progn (defmacro def-enum (inc cur &rest names) (flet ((defform (name) @@ -1467,41 +1467,41 @@ ;; Input modes. Linux: /usr/include/asm/termbits.h (def-enum ash 1 tty-ignbrk tty-brkint tty-ignpar tty-parmrk tty-inpck - tty-istrip tty-inlcr tty-igncr tty-icrnl #-freebsd tty-iuclc - tty-ixon #-freebsd tty-ixany tty-ixoff #+freebsd tty-ixany - #+hpux tty-ienqak #+freebsd nil tty-imaxbel) + tty-istrip tty-inlcr tty-igncr tty-icrnl #-bsd tty-iuclc + tty-ixon #-bsd tty-ixany tty-ixoff #+bsd tty-ixany + #+hpux tty-ienqak #+bsd nil tty-imaxbel) ;; output modes - #-freebsd (def-enum ash 1 tty-opost tty-olcuc tty-onlcr tty-ocrnl tty-onocr + #-bsd (def-enum ash 1 tty-opost tty-olcuc tty-onlcr tty-ocrnl tty-onocr tty-onlret tty-ofill tty-ofdel) - #+freebsd (def-enum ash 1 tty-opost tty-onlcr) + #+bsd (def-enum ash 1 tty-opost tty-onlcr) ;; local modes - #-freebsd (def-enum ash 1 tty-isig tty-icanon tty-xcase tty-echo tty-echoe + #-bsd (def-enum ash 1 tty-isig tty-icanon tty-xcase tty-echo tty-echoe tty-echok tty-echonl tty-noflsh #+irix tty-iexten #+(or sunos linux) tty-tostop tty-echoctl tty-echoprt tty-echoke #+(or sunos svr4) tty-defecho tty-flusho #+linux nil tty-pendin #+irix tty-tostop #+(or sunos linux) tty-iexten) - #+freebsd (def-enum ash 1 tty-echoke tty-echoe tty-echok tty-echo tty-echonl + #+bsd (def-enum ash 1 tty-echoke tty-echoe tty-echok tty-echo tty-echonl tty-echoprt tty-echoctl tty-isig tty-icanon nil tty-iexten) - #+freebsd (defconstant tty-tostop #x00400000) - #+freebsd (defconstant tty-flusho #x00800000) - #+freebsd (defconstant tty-pendin #x20000000) - #+freebsd (defconstant tty-noflsh #x80000000) + #+bsd (defconstant tty-tostop #x00400000) + #+bsd (defconstant tty-flusho #x00800000) + #+bsd (defconstant tty-pendin #x20000000) + #+bsd (defconstant tty-noflsh #x80000000) #+hpux (defconstant tty-tostop #o10000000000) #+hpux (defconstant tty-iexten #o20000000000) ;; control modes - (def-enum ash #-freebsd #o100 #+freebsd #x400 #+hpux nil tty-cstopb + (def-enum ash #-bsd #o100 #+bsd #x400 #+hpux nil tty-cstopb tty-cread tty-parenb tty-parodd tty-hupcl tty-clocal #+svr4 rcv1en #+svr4 xmt1en #+(or hpux svr4) tty-loblk) ;; special control characters #+(or hpux svr4 linux) (def-enum + 0 vintr vquit verase vkill veof #-linux veol #-linux veol2) - #+freebsd (def-enum + 0 veof veol veol2 verase nil vkill nil nil vintr vquit) + #+bsd (def-enum + 0 veof veol veol2 verase nil vkill nil nil vintr vquit) #+linux (defconstant veol 11) #+linux (defconstant veol2 16) @@ -1509,7 +1509,7 @@ (defconstant tcoflush 1) (defconstant tcioflush 2)) -#+freebsd +#+bsd (progn (defconstant vmin 16) (defconstant vtime 17) @@ -1527,7 +1527,7 @@ (defconstant vstop 15) (defconstant vdsusp 21)) -#+(or hpux freebsd linux) +#+(or hpux bsd linux) (progn (defconstant tcsanow 0) (defconstant tcsadrain 1) @@ -1552,7 +1552,7 @@ (defconstant tty-cs7 #o40) (defconstant tty-cs8 #o60)) -#+freebsd +#+bsd (progn ;; control modes (defconstant tty-csize #x300) @@ -1647,7 +1647,7 @@ (type (unsigned-byte 32) cmd)) (void-syscall ("ioctl" int unsigned-int (* char)) fd cmd arg)) -#+(or svr4 hpux freebsd linux) +#+(or svr4 hpux bsd linux) (progn (defun unix-tcgetattr (fd termios) "Get terminal attributes." @@ -1661,7 +1661,7 @@ ;; XXX rest of functions in this progn probably are present in linux, but ;; not verified. - #-freebsd + #-bsd (defun unix-cfgetospeed (termios) "Get terminal output speed." (multiple-value-bind (speed errno) @@ -1670,24 +1670,24 @@ (values (svref terminal-speeds speed) 0) (values speed errno)))) - #+freebsd + #+bsd (defun unix-cfgetospeed (termios) "Get terminal output speed." (int-syscall ("cfgetospeed" (* (struct termios))) termios)) - #-freebsd + #-bsd (defun unix-cfsetospeed (termios speed) "Set terminal output speed." (let ((baud (or (position speed terminal-speeds) (error "Bogus baud rate ~S" speed)))) (void-syscall ("cfsetospeed" (* (struct termios)) int) termios baud))) - #+freebsd + #+bsd (defun unix-cfsetospeed (termios speed) "Set terminal output speed." (void-syscall ("cfsetospeed" (* (struct termios)) int) termios speed)) - #-freebsd + #-bsd (defun unix-cfgetispeed (termios) "Get terminal input speed." (multiple-value-bind (speed errno) @@ -1696,19 +1696,19 @@ (values (svref terminal-speeds speed) 0) (values speed errno)))) - #+freebsd + #+bsd (defun unix-cfgetispeed (termios) "Get terminal input speed." (int-syscall ("cfgetispeed" (* (struct termios))) termios)) - #-freebsd + #-bsd (defun unix-cfsetispeed (termios speed) "Set terminal input speed." (let ((baud (or (position speed terminal-speeds) (error "Bogus baud rate ~S" speed)))) (void-syscall ("cfsetispeed" (* (struct termios)) int) termios baud))) - #+freebsd + #+bsd (defun unix-cfsetispeed (termios speed) "Set terminal input speed." (void-syscall ("cfsetispeed" (* (struct termios)) int) termios speed)) @@ -1793,13 +1793,13 @@ ;;; Socket options. -#+(or hpux freebsd) +#+(or hpux bsd) (define-ioctl-command SIOCSPGRP #\s 8 int :in) #+linux (define-ioctl-command SIOCSPGRP #\s #x8904 int :in) -#+(or hpux freebsd linux) +#+(or hpux bsd linux) (defun siocspgrp (fd pgrp) "Set the socket process-group for the unix file-descriptor FD to PGRP." (alien:with-alien ((alien-pgrp c-call:int pgrp)) @@ -1828,15 +1828,15 @@ (slot ,buf 'st-gid) (slot ,buf 'st-rdev) (slot ,buf 'st-size) - #-(or svr4 FreeBSD) (slot ,buf 'st-atime) + #-(or svr4 BSD) (slot ,buf 'st-atime) #+svr4 (slot (slot ,buf 'st-atime) 'tv-sec) - #+FreeBSD (slot (slot ,buf 'st-atime) 'ts-sec) - #-(or svr4 FreeBSD)(slot ,buf 'st-mtime) + #+BSD (slot (slot ,buf 'st-atime) 'ts-sec) + #-(or svr4 BSD)(slot ,buf 'st-mtime) #+svr4 (slot (slot ,buf 'st-mtime) 'tv-sec) - #+FreeBSD(slot (slot ,buf 'st-mtime) 'ts-sec) - #-(or svr4 FreeBSD) (slot ,buf 'st-ctime) + #+BSD(slot (slot ,buf 'st-mtime) 'ts-sec) + #-(or svr4 BSD) (slot ,buf 'st-ctime) #+svr4 (slot (slot ,buf 'st-ctime) 'tv-sec) - #+FreeBSD(slot (slot ,buf 'st-ctime) 'ts-sec) + #+BSD(slot (slot ,buf 'st-ctime) 'ts-sec) (slot ,buf 'st-blksize) (slot ,buf 'st-blocks))) diff --git a/code/x86-vm.lisp b/code/x86-vm.lisp index a1cdf0711b91a0decdf8dc3361d4ba7e2ed9c3e3..6c0a9c1f47cc9170b159f0ee360c870adc46ce98 100644 --- a/code/x86-vm.lisp +++ b/code/x86-vm.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/x86-vm.lisp,v 1.16 2000/04/12 17:41:15 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/x86-vm.lisp,v 1.17 2001/12/06 19:15:41 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -103,6 +103,32 @@ (sc-sp unsigned-int) (sc-ss unsigned-int))) +;;; OpenBSD also has a sigcontext that looks more like Linux. +#+openbsd +(def-alien-type sigcontext + (struct nil + (sc-gs unsigned-int) + (sc-fs unsigned-int) + (sc-es unsigned-int) + (sc-ds unsigned-int) + (sc-edi unsigned-int) + (sc-esi unsigned-int) + (sc-fp unsigned-int) ;; ebp + (sc-ebx unsigned-int) + (sc-edx unsigned-int) + (sc-ecx unsigned-int) + (sc-eax unsigned-int) + (sc-pc unsigned-int) + (sc-cs unsigned-int) + (sc-efl unsigned-int) ; sc_ps + (sc-sp unsigned-int) + (sc-ss unsigned-int) + (sc-onstack unsigned-int) + (sc-mask unsigned-int) + (sc-trapno unsigned-int) + (sc-err unsigned-int) + )) + ;; For Linux... #+linux (def-alien-type sigcontext @@ -358,9 +384,9 @@ index)))) (coerce (sys:sap-ref-long reg-sap 0) format)))) -;;; Not supported on FreeBSD because the floating point state is not -;;; saved. -#+FreeBSD +;;; Not supported on Free/OpenBSD because the floating point state is not +;;; saved. For now we assume this is true for all modern BSDs +#+BSD (defun sigcontext-float-register (scp index format) (declare (ignore scp index)) (coerce 0l0 format)) @@ -377,8 +403,8 @@ (setf (sys:sap-ref-long reg-sap 0) (coerce new-value 'long-float)) (coerce new-value format)))) -;;; Not supported on FreeBSD. -#+FreeBSD +;;; Not supported on Free/OpenBSD. +#+BSD (defun %set-sigcontext-float-register (scp index format new-value) (declare (ignore scp index)) (coerce new-value format)) @@ -392,11 +418,11 @@ ;;; same format as returned by FLOATING-POINT-MODES. ;;; -#+FreeBSD +#+BSD (defun sigcontext-floating-point-modes (scp) (declare (type (alien (* sigcontext)) scp) (ignore scp)) - ;; This is broken until some future release of FreeBSD!!! + ;; This is broken until some future release of FreeBSD/OpenBSD!!! (floating-point-modes)) #+linux @@ -428,7 +454,7 @@ value (multiple-value-bind (value found) (gethash - (concatenate 'string #+linux "PVE_stub_" #+freebsd "_" name) + (concatenate 'string #+linux "PVE_stub_" #+bsd "_" name) lisp::*foreign-symbols* 0) (if found value diff --git a/compiler/generic/new-genesis.lisp b/compiler/generic/new-genesis.lisp index 64fe37f433b6b87d7f86428fa9ac1bfb9832734e..1de8b6f4cb2e442c2dac97e30e3309d4272642f3 100644 --- a/compiler/generic/new-genesis.lisp +++ b/compiler/generic/new-genesis.lisp @@ -4,7 +4,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/new-genesis.lisp,v 1.41 2001/02/11 14:22:02 dtc Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/new-genesis.lisp,v 1.42 2001/12/06 19:15:42 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1809,13 +1809,13 @@ (let ((linux-p (and (eq (c:backend-fasl-file-implementation c:*backend*) #.c:x86-fasl-file-implementation) (c:backend-featurep :linux))) - (freebsd-p (and (eq (c:backend-fasl-file-implementation c:*backend*) - #.c:x86-fasl-file-implementation) - (c:backend-featurep :freebsd)))) + (bsd-p (and (eq (c:backend-fasl-file-implementation c:*backend*) + #.c:x86-fasl-file-implementation) + (c:backend-featurep :bsd)))) (cond - ((and freebsd-p (gethash (concatenate 'string "_" name) - *cold-foreign-symbol-table* nil))) + ((and bsd-p (gethash (concatenate 'string "_" name) + *cold-foreign-symbol-table* nil))) ((and linux-p (gethash (concatenate 'string "PVE_stub_" name) *cold-foreign-symbol-table* nil))) ;; Non-linux case @@ -1840,6 +1840,7 @@ ;; syscalls and Unix library things. Linux doesn't or maybe does ;; depending on things I don't know about yet? FreeBSD version 3 ;; is ELF based and looks more like the other systems. +;; For the moment we assume all non-elf BSDs are the same as non-elf FreeBSD. ;; Maybe these x86 hacks can be fixed when the non-elf's are obsoleted. (defun lookup-maybe-prefix-foreign-symbol (name) @@ -1859,9 +1860,9 @@ "" "_")) (#.c:x86-fasl-file-implementation - (if (and (c:backend-featurep :freebsd) + (if (and (c:backend-featurep :bsd) (not (c:backend-featurep :elf))) - "_" ; older FreeBSD + "_" ; older FreeBSD, OpenBSD "")) ; Linux and FreeBSD V3+ ) name))) diff --git a/hemlock/rompsite.lisp b/hemlock/rompsite.lisp index 088d5b18068cc3cf0cba27a6403f1ef611ee2553..eda5130f99355ddd4f10b0b61bb98b651dc7d614 100644 --- a/hemlock/rompsite.lisp +++ b/hemlock/rompsite.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/rompsite.lisp,v 1.13 2001/03/13 15:49:57 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/rompsite.lisp,v 1.14 2001/12/06 19:15:43 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -936,7 +936,7 @@ #-glibc2 (defvar old-ltchars) -#+(or hpux irix freebsd glibc2) +#+(or hpux irix bsd glibc2) (progn (defvar old-c-iflag) (defvar old-c-oflag) @@ -947,7 +947,7 @@ (defun setup-input () (let ((fd *editor-file-descriptor*)) (when (unix:unix-isatty 0) - #+(or hpux irix freebsd glibc2) + #+(or hpux irix bsd glibc2) (alien:with-alien ((tios (alien:struct unix:termios))) (multiple-value-bind (val err) @@ -977,8 +977,8 @@ (lognot (logior unix:tty-icrnl unix:tty-ixon)))) (setf (alien:slot tios 'unix:c-oflag) (logand (alien:slot tios 'unix:c-oflag) - (lognot #-freebsd unix:tty-ocrnl - #+freebsd unix:tty-onlcr))) + (lognot #-bsd unix:tty-ocrnl + #+bsd unix:tty-onlcr))) (setf (alien:deref (alien:slot tios 'unix:c-cc) unix:vdsusp) #xff) (setf (alien:deref (alien:slot tios 'unix:c-cc) unix:veof) #xff) (setf (alien:deref (alien:slot tios 'unix:c-cc) unix:vintr) @@ -995,7 +995,7 @@ (when (null val) (error "Could not tcsetattr, unix error ~S." (unix:get-unix-error-msg err))))) - #-(or hpux irix freebsd glibc2) + #-(or hpux irix bsd glibc2) (alien:with-alien ((sg (alien:struct unix:sgttyb))) (multiple-value-bind (val err) @@ -1006,7 +1006,7 @@ (let ((flags (alien:slot sg 'unix:sg-flags))) (setq old-flags flags) (setf (alien:slot sg 'unix:sg-flags) - (logand #-(or hpux irix freebsd glibc2) (logior flags unix:tty-cbreak) + (logand #-(or hpux irix bsd glibc2) (logior flags unix:tty-cbreak) (lognot unix:tty-echo) (lognot unix:tty-crmod))) (multiple-value-bind @@ -1015,7 +1015,7 @@ (if (null val) (error "Could not set tty information, unix error ~S." (unix:get-unix-error-msg err)))))) - #-(or hpux irix freebsd glibc2) + #-(or hpux irix bsd glibc2) (alien:with-alien ((tc (alien:struct unix:tchars))) (multiple-value-bind (val err) @@ -1076,7 +1076,7 @@ (defun reset-input () (when (unix:unix-isatty 0) (let ((fd *editor-file-descriptor*)) - #+(or hpux irix freebsd glibc2) + #+(or hpux irix bsd glibc2) (when (boundp 'old-c-lflag) (alien:with-alien ((tios (alien:struct unix:termios))) (multiple-value-bind @@ -1113,7 +1113,7 @@ (when (null val) (error "Could not tcsetattr, unix error ~S." (unix:get-unix-error-msg err)))))) - #-(or hpux irix freebsd glibc2) + #-(or hpux irix bsd glibc2) (when (boundp 'old-flags) (alien:with-alien ((sg (alien:struct unix:sgttyb))) (multiple-value-bind @@ -1129,7 +1129,7 @@ (unless val (error "Could not set tty information, unix error ~S." (unix:get-unix-error-msg err))))))) - #-(or hpux irix freebsd glibc2) + #-(or hpux irix bsd glibc2) (when (and (boundp 'old-tchars) (simple-vector-p old-tchars) (eq (length old-tchars) 6)) diff --git a/hemlock/tty-disp-rt.lisp b/hemlock/tty-disp-rt.lisp index cb9a4bef11b5172f935db9e26eb9158b95ad891e..75a30e4b9e823c24c88d8895123fae6781b17a5e 100644 --- a/hemlock/tty-disp-rt.lisp +++ b/hemlock/tty-disp-rt.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/tty-disp-rt.lisp,v 1.6 2001/03/13 15:50:00 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/tty-disp-rt.lisp,v 1.7 2001/12/06 19:15:43 pmai Rel $") ;;; ;;; ********************************************************************** ;;; @@ -61,16 +61,16 @@ ;;; (defun get-terminal-attributes (&optional (fd 1)) (alien:with-alien ((winsize (alien:struct unix:winsize)) - #-(or glibc2 freebsd) + #-(or glibc2 bsd) (sgtty (alien:struct unix:sgttyb)) - #+freebsd ; termios + #+bsd ; termios (tios (alien:struct unix:termios))) (let ((size-win (unix:unix-ioctl fd unix:TIOCGWINSZ (alien:alien-sap winsize))) - #-(or glibc2 freebsd) + #-(or glibc2 bsd) (speed-win (unix:unix-ioctl fd unix:TIOCGETP (alien:alien-sap sgtty))) - #+freebsd + #+bsd (speed-win (unix:unix-tcgetattr fd (alien:alien-sap tios)))) (flet ((frob (val) (if (and size-win (not (zerop val))) @@ -79,12 +79,12 @@ (values (frob (alien:slot winsize 'unix:ws-row)) (frob (alien:slot winsize 'unix:ws-col)) - #-(or glibc2 freebsd) + #-(or glibc2 bsd) (and speed-win (setq *terminal-baud-rate* (svref unix:terminal-speeds (alien:slot sgtty 'unix:sg-ospeed)))) - #+freebsd + #+bsd (and speed-win (setq *terminal-baud-rate* (unix:unix-cfgetospeed tios))) #+glibc2 diff --git a/lisp/Config.OpenBSD b/lisp/Config.OpenBSD new file mode 100644 index 0000000000000000000000000000000000000000..df2287c692e5f36ee2e0e7683d739dfb2d918e05 --- /dev/null +++ b/lisp/Config.OpenBSD @@ -0,0 +1,19 @@ +PATH1 = ../../src/lisp +PATH2 = ../../p86/lisp +vpath %.h $(PATH2):$(PATH1) +vpath %.c $(PATH2):$(PATH1) +vpath %.S $(PATH2):$(PATH1) +CPPFLAGS = -I. -I$(PATH2) -I$(PATH1) -I- -I/usr/X11R6/include +CC = gcc +LD = ld +CPP = cpp +CFLAGS = -Wstrict-prototypes -Wall -O2 -g -DWANT_CGC -Di386 +ASFLAGS = -g -DWANT_CGC -Di386 +NM = nm -gp +UNDEFSYMPATTERN = -Xlinker -u -Xlinker & +ASSEM_SRC = x86-assem.S +ARCH_SRC = x86-arch.c +OS_SRC = OpenBSD-os.c os-common.c undefineds.c +OS_LINK_FLAGS = -static +OS_LIBS = +GC_SRC = cgc.c diff --git a/lisp/Config.OpenBSD_gencgc b/lisp/Config.OpenBSD_gencgc new file mode 100644 index 0000000000000000000000000000000000000000..d4aceaad3aae6b0e7f6bca4ee7c0cc70c73aacf3 --- /dev/null +++ b/lisp/Config.OpenBSD_gencgc @@ -0,0 +1,19 @@ +PATH1 = ../../src/lisp +PATH2 = ../../p86/lisp +vpath %.h $(PATH2):$(PATH1) +vpath %.c $(PATH2):$(PATH1) +vpath %.S $(PATH2):$(PATH1) +CPPFLAGS = -I. -I$(PATH2) -I$(PATH1) -I- -I/usr/X11R6/include +CC = gcc +LD = ld +CPP = cpp +CFLAGS = -Wstrict-prototypes -Wall -O2 -g -DGENCGC -Di386 +ASFLAGS = -g -DGENCGC -Di386 +NM = nm -gp +UNDEFSYMPATTERN = -Xlinker -u -Xlinker & +ASSEM_SRC = x86-assem.S +ARCH_SRC = x86-arch.c +OS_SRC = OpenBSD-os.c os-common.c undefineds.c +OS_LINK_FLAGS = -static +OS_LIBS = +GC_SRC = gencgc.c diff --git a/lisp/OpenBSD-os.c b/lisp/OpenBSD-os.c new file mode 100644 index 0000000000000000000000000000000000000000..6381ec65984c14f4960a8294d9a167df5916b9ba --- /dev/null +++ b/lisp/OpenBSD-os.c @@ -0,0 +1,207 @@ +/* + * OpenBSD-os.c. + * From FreeBSD-os.c 1.6 2000/10/24 13:32:30 dtc Exp + * + * OS-dependent routines. This file (along with os.h) exports an + * OS-independent interface to the operating system VM facilities. + * Suprisingly, this interface looks a lot like the Mach interface + * (but simpler in some places). For some operating systems, a subset + * of these functions will have to be emulated. + * + * This is the OSF1 version. By Sean Hallgren. + * Much hacked by Paul Werkowski + * GENCGC support by Douglas Crosher, 1996, 1997. + * Frobbed for OpenBSD by Pierre R. Mai, 2001. + * + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/OpenBSD-os.c,v 1.1 2001/12/06 19:15:44 pmai Exp $ + * + */ + +#include <stdio.h> +#include <sys/param.h> +#include <sys/file.h> +#include <errno.h> +#include "./signal.h" +#include "os.h" +#include "arch.h" +#include "globals.h" +#include "interrupt.h" +#include "lispregs.h" +#include "internals.h" + +#include <sys/types.h> +#include <signal.h> +/* #include <sys/sysinfo.h> */ +#include <sys/proc.h> +#include "validate.h" +vm_size_t os_vm_page_size; + +#define DPRINTF(t,a) {if (t) fprintf a;} + +#if defined GENCGC +#include "gencgc.h" +#endif + + +void os_init(void) +{ + os_vm_page_size = OS_VM_DEFAULT_PAGESIZE; +} + +int sc_reg(struct sigcontext *c, int offset) +{ + switch(offset) + { + case 0: return c->sc_eax; + case 2: return c->sc_ecx; + case 4: return c->sc_edx; + case 6: return c->sc_ebx; + case 8: return c->sc_esp; + case 10: return c->sc_ebp; + case 12: return c->sc_esi; + case 14: return c->sc_edi; + } + return 0; +} + +void os_save_context(void) +{ + /* + * Called from interrupt handlers so C stuff knows things set in Lisp. + */ +} + +void os_set_context(void) +{ +} + +os_vm_address_t os_validate(os_vm_address_t addr, os_vm_size_t len) +{ + int flags = MAP_PRIVATE | MAP_ANONYMOUS; + + if (addr) + flags |= MAP_FIXED; + else + flags |= MAP_VARIABLE; + + DPRINTF(0, (stderr, "os_validate %x %d => ", addr, len)); + + addr = mmap(addr, len, OS_VM_PROT_ALL, flags, -1, 0); + + if (addr == (os_vm_address_t) -1) + { + perror("mmap"); + return NULL; + } + + DPRINTF(0, (stderr, "%x\n", addr)); + + return addr; +} + +void os_invalidate(os_vm_address_t addr, os_vm_size_t len) +{ + DPRINTF(0, (stderr, "os_invalidate %x %d\n", addr, len)); + + if (munmap(addr, len) == -1) + perror("munmap"); +} + +os_vm_address_t os_map(int fd, int offset, os_vm_address_t addr, + os_vm_size_t len) +{ + addr = mmap(addr, len, + OS_VM_PROT_ALL, + MAP_PRIVATE | MAP_FILE | MAP_FIXED, + fd, (off_t) offset); + + if (addr == (os_vm_address_t) -1) + perror("mmap"); + + return addr; +} + +void os_flush_icache(os_vm_address_t address, os_vm_size_t length) +{ +} + +void os_protect(os_vm_address_t address, os_vm_size_t length, + os_vm_prot_t prot) +{ + if (mprotect(address, length, prot) == -1) + perror("mprotect"); +} + + + +static boolean in_range_p(os_vm_address_t a, lispobj sbeg, size_t slen) +{ + char* beg = (char*) sbeg; + char* end = (char*) sbeg + slen; + char* adr = (char*) a; + return (adr >= beg && adr < end); +} + +boolean valid_addr(os_vm_address_t addr) +{ + int ret; + os_vm_address_t newaddr; + newaddr = os_trunc_to_page(addr); + + if ( in_range_p(addr, READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE) + || in_range_p(addr, STATIC_SPACE_START , STATIC_SPACE_SIZE ) + || in_range_p(addr, DYNAMIC_0_SPACE_START, dynamic_space_size ) + || in_range_p(addr, DYNAMIC_1_SPACE_START, dynamic_space_size ) + || in_range_p(addr, CONTROL_STACK_START , CONTROL_STACK_SIZE ) + || in_range_p(addr, BINDING_STACK_START , BINDING_STACK_SIZE )) + return TRUE; + return FALSE; +} + + +static void sigsegv_handler(HANDLER_ARGS) +{ +#if defined GENCGC + caddr_t fault_addr = code->si_addr; + int page_index = find_page_index((void*)fault_addr); + +#if SIGSEGV_VERBOSE + fprintf(stderr,"Signal %d, fault_addr=%x, page_index=%d:\n", + signal, fault_addr, page_index); +#endif + + /* Check if the fault is within the dynamic space. */ + if (page_index != -1) { + /* Un-protect the page */ + + /* The page should have been marked write protected */ + if (!PAGE_WRITE_PROTECTED(page_index)) + fprintf(stderr, "*** Sigsegv in page not marked as write protected\n"); + + os_protect(page_address(page_index), 4096, OS_VM_PROT_ALL); + page_table[page_index].flags &= ~PAGE_WRITE_PROTECTED_MASK; + page_table[page_index].flags |= PAGE_WRITE_PROTECT_CLEARED_MASK; + + return; + } +#endif + + SAVE_CONTEXT(); + + DPRINTF(0, (stderr, "sigsegv:\n")); + interrupt_handle_now(signal, code, context); +} + +static void sigbus_handler(HANDLER_ARGS) +{ + SAVE_CONTEXT(); + + DPRINTF(0, (stderr, "sigbus:\n")); + interrupt_handle_now(signal, code, context); +} + +void os_install_interrupt_handlers(void) +{ + interrupt_install_low_level_handler(SIGSEGV, sigsegv_handler); + interrupt_install_low_level_handler(SIGBUS, sigbus_handler); +} diff --git a/lisp/OpenBSD-os.h b/lisp/OpenBSD-os.h new file mode 100644 index 0000000000000000000000000000000000000000..85488aeeb1d631f6abf1f8d78a15e79269743c35 --- /dev/null +++ b/lisp/OpenBSD-os.h @@ -0,0 +1,33 @@ +/* + + $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/OpenBSD-os.h,v 1.1 2001/12/06 19:15:44 pmai Exp $ + + This code was written as part of the CMU Common Lisp project at + Carnegie Mellon University, and has been placed in the public domain. + +*/ + +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/signal.h> + +#define MAP_ANONYMOUS MAP_ANON +#define MAP_VARIABLE 0 + +typedef caddr_t os_vm_address_t; +typedef vm_size_t os_vm_size_t; +typedef off_t os_vm_offset_t; +typedef int os_vm_prot_t; + +#define OS_VM_PROT_READ PROT_READ +#define OS_VM_PROT_WRITE PROT_WRITE +#define OS_VM_PROT_EXECUTE PROT_EXEC + +#define OS_VM_DEFAULT_PAGESIZE 4096 + +#define POSIX_SIGS +#define HANDLER_ARGS int signal, siginfo_t *code, struct sigcontext *context +#define CODE(code) ((code) ? code->si_code : 0) + +#define uc_sigmask sc_mask +int sc_reg(struct sigcontext*,int); diff --git a/lisp/gencgc.c b/lisp/gencgc.c index 09bcc72cffa85fc521db93e99579722584f33b81..3e03314c843766bab3c22a4aeef15585d294ee63 100644 --- a/lisp/gencgc.c +++ b/lisp/gencgc.c @@ -7,7 +7,7 @@ * * Douglas Crosher, 1996, 1997, 1998, 1999. * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.24 2000/10/27 19:25:55 dtc Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.25 2001/12/06 19:15:44 pmai Exp $ * */ @@ -85,9 +85,9 @@ boolean check_code_fixups = FALSE; /* * To enable unmapping of a page and re-mmaping it to have it zero filled. - * Note: this can waste a lot of swap on FreeBSD so don't unmap. + * Note: this can waste a lot of swap on FreeBSD and OpenBSD(?) so don't unmap. */ -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) boolean gencgc_unmap_zero = FALSE; #else boolean gencgc_unmap_zero = TRUE; diff --git a/lisp/interrupt.c b/lisp/interrupt.c index f3b959bd2ebed5d268e34b5e49578584b2a37703..bb3104d558ae7f0d3c67789f622a3a39f711cb5d 100644 --- a/lisp/interrupt.c +++ b/lisp/interrupt.c @@ -1,4 +1,4 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.25 2000/10/24 13:32:32 dtc Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.26 2001/12/06 19:15:45 pmai Exp $ */ /* Interrupt handing magic. */ @@ -34,7 +34,7 @@ void (*interrupt_low_level_handlers[NSIG]) (HANDLER_ARGS) = {0}; static int pending_signal = 0; -#ifdef SOLARIS +#if defined(SOLARIS) || defined(__OpenBSD__) static siginfo_t *pending_code; #define PASSCODE(code) ((code)) #define DEREFCODE(code) ((code)) @@ -233,7 +233,7 @@ interrupt_handle_pending(struct sigcontext *context) if (pending_signal) { int signal; -#ifdef SOLARIS +#if defined(SOLARIS) || defined(__OpenBSD__) siginfo_t *code; #else int code; diff --git a/lisp/lisp.h b/lisp/lisp.h index c926e4db47fe90d561c46e181a9c5b1f2f3dd3d2..5145ec9cc560f5bfcc3ce54246389a864023b831 100644 --- a/lisp/lisp.h +++ b/lisp/lisp.h @@ -1,4 +1,4 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.h,v 1.6 1999/02/22 11:45:59 dtc Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.h,v 1.7 2001/12/06 19:15:45 pmai Exp $ */ #ifndef _LISP_H_ #define _LISP_H_ @@ -21,7 +21,7 @@ #if !defined alpha typedef unsigned long lispobj; -#if defined(__FreeBSD__) || defined(__linux__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) typedef unsigned int u32; typedef signed int s32; #endif diff --git a/lisp/os.h b/lisp/os.h index 849aa034201a6ddc3806520df0e3bb04a7ac5c18..800ab331af95a492b8ccfde0b262e30a86abced2 100644 --- a/lisp/os.h +++ b/lisp/os.h @@ -1,5 +1,5 @@ /* - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.7 2000/04/12 17:31:20 pw Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.8 2001/12/06 19:15:45 pmai Exp $ * * Common interface for os-dependent functions. * @@ -29,6 +29,9 @@ #ifdef __FreeBSD__ #include "FreeBSD-os.h" #else +#ifdef __OpenBSD__ +#include "OpenBSD-os.h" +#else #ifdef __linux__ #include "Linux-os.h" #endif @@ -38,6 +41,7 @@ #endif #endif #endif +#endif #ifndef HANDLER_ARGS #define HANDLER_ARGS int signal, int code, struct sigcontext *context diff --git a/lisp/undefineds.h b/lisp/undefineds.h index 9dc2a5517692bd6e2b063ac5ed2123d6a6733cf2..ff5b9199bb2c12cbb123f985d9186b380a2a34e8 100644 --- a/lisp/undefineds.h +++ b/lisp/undefineds.h @@ -1,5 +1,5 @@ /* Routines that must be linked into the core for lisp to work. */ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/undefineds.h,v 1.23 1999/02/20 15:54:45 pw Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/undefineds.h,v 1.24 2001/12/06 19:15:45 pmai Exp $ */ /* Pick up all the syscalls. */ F(accept) @@ -10,7 +10,7 @@ F(adjtime) #endif F(bind) F(brk) -#if defined(hpux) || defined(SVR4) || defined(__FreeBSD__) +#if defined(hpux) || defined(SVR4) || defined(__FreeBSD__) || defined(__OpenBSD__) F(cfgetospeed) F(cfsetospeed) F(cfgetispeed) @@ -116,7 +116,7 @@ F(setpgrp) #if !defined(SVR4) || defined(SOLARIS25) F(setpriority) #endif -#if !defined(mach) && !defined(SOLARIS) && !defined(__FreeBSD__) && !defined(SUNOS) && !defined(osf1) && !defined(irix) && !defined(hpux) && !(defined(linux) && defined(alpha)) +#if !defined(mach) && !defined(SOLARIS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(SUNOS) && !defined(osf1) && !defined(irix) && !defined(hpux) && !(defined(linux) && defined(alpha)) F(setquota) #endif #if !defined(hpux) && !defined(SVR4) || defined(SOLARIS25) @@ -134,7 +134,7 @@ F(sigpause) #if !defined(ibmrt) && !defined(hpux) && !defined(SVR4) && !defined(i386) F(sigreturn) #endif -#if !defined(SVR4) && !defined(__FreeBSD__) +#if !defined(SVR4) && !defined(__FreeBSD__) && !defined(__OpenBSD__) F(sigsetmask) F(sigstack) F(sigvec) @@ -153,7 +153,7 @@ F(closedir) F(opendir) F(readdir) #endif -#if defined(hpux) || defined(SVR4) || defined(__FreeBSD__) || defined(__linux__) +#if defined(hpux) || defined(SVR4) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) F(tcgetattr) F(tcsetattr) F(tcsendbreak) @@ -167,7 +167,7 @@ F(times) F(truncate) F(umask) #if !defined(SUNOS) && !defined(parisc) && !defined(SOLARIS) \ - && !defined(__FreeBSD__) + && !defined(__FreeBSD__) && !defined(__OpenBSD__) F(umount) #endif F(unlink) @@ -177,7 +177,7 @@ F(utimes) #ifndef irix F(vfork) #endif -#if !defined(osf1) && !defined(__FreeBSD__) +#if !defined(osf1) && !defined(__FreeBSD__) && !defined(__OpenBSD__) F(vhangup) #endif F(wait) diff --git a/lisp/x86-arch.c b/lisp/x86-arch.c index a8945413f2724284c6fc0be6db18c5a12fe7e44d..00fc026244c81f626113f7aa202d5eeab2eef611 100644 --- a/lisp/x86-arch.c +++ b/lisp/x86-arch.c @@ -1,6 +1,6 @@ /* x86-arch.c -*- Mode: C; comment-column: 40 -*- * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.14 2000/10/27 19:25:56 dtc Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.15 2001/12/06 19:15:46 pmai Exp $ * */ @@ -238,14 +238,14 @@ void sigtrap_handler(HANDLER_ARGS) case trap_Halt: { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) int fpu_state[27]; fpu_save(fpu_state); #endif fake_foreign_function_call(context); lose("%%primitive halt called; the party is over.\n"); undo_fake_foreign_function_call(context); -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) fpu_restore(fpu_state); #endif arch_skip_instruction(context); diff --git a/lisp/x86-validate.h b/lisp/x86-validate.h index cf7e106e73ed292d3f00e80329dbdfcd2404270e..c71ec8be5c4a7216952e0335aabd674fffc567eb 100644 --- a/lisp/x86-validate.h +++ b/lisp/x86-validate.h @@ -3,7 +3,7 @@ * This code was written as part of the CMU Common Lisp project at * Carnegie Mellon University, and has been placed in the public domain. * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-validate.h,v 1.12 2000/10/24 13:32:32 dtc Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-validate.h,v 1.13 2001/12/06 19:15:46 pmai Exp $ * */ @@ -21,6 +21,17 @@ * 0x48000000->0xC8000000 2GB Dynamic Space. * 0xE0000000-> 256M C stack - Alien stack. * + * OpenBSD: + * 0x00000000->0x0E000000 224M C program and memory allocation. + * 0x0E000000->0x10000000 32M Foreign segment. + * 0x10000000->0x20000000 256M Read-Only Space. + * 0x20000000->0x28000000 128M Binding stack growing up. + * 0x28000000->0x38000000 256M Static Space. + * 0x38000000->0x40000000 128M Control stack growing down. + * 0x40000000->0x48000000 128M Reserved for shared libraries. + * 0x48000000->0xB8000000 1.75GB Dynamic Space. + * 0xE0000000-> 256M C stack - Alien stack. + * * Linux: * 0x00000000->0x08000000 128M Unused. * 0x08000000->0x10000000 128M C program and memory allocation. @@ -56,6 +67,29 @@ #endif +#ifdef __OpenBSD__ +#define READ_ONLY_SPACE_START (0x10000000) +#define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */ + +#define STATIC_SPACE_START (0x28000000) +#define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */ + +#define BINDING_STACK_START (0x20000000) +#define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */ + +#define CONTROL_STACK_START (0x38000000) +#define CONTROL_STACK_SIZE (0x07fff000) /* 128MB - 1 page */ + +#define DYNAMIC_0_SPACE_START (0x48000000) +#ifdef GENCGC +#define DYNAMIC_SPACE_SIZE (0x68000000) /* 1.625GB */ +#else +#define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */ +#endif +#define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */ +#endif + + #ifdef __linux__ #define READ_ONLY_SPACE_START (0x10000000) #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */ diff --git a/motif/server/Config.OpenBSD b/motif/server/Config.OpenBSD new file mode 100644 index 0000000000000000000000000000000000000000..b72d6f383b19ac7ec3f0ed0bdb1fc09830758bf9 --- /dev/null +++ b/motif/server/Config.OpenBSD @@ -0,0 +1,7 @@ +CFLAGS = -O2 -I/usr/local/include -I/usr/X11R6/include -I. -I$(VPATH) +LDFLAGS = -L/usr/X11R6/lib -L/usr/local/lib +LIBS = -lXm -lXt -lXext -lX11 -lSM -lICE -lXp +# This def assumes you are building in the same or parallel +# tree to the CVS souce layout. Sites may need to customize +# this path. +VPATH = ../../../src/motif/server/ diff --git a/tools/worldbuild.lisp b/tools/worldbuild.lisp index 66b81d057fd8625dd858541c4a2a644b96547971..e73bcd6a52cbd082d1862c359ddd4058376f40e7 100644 --- a/tools/worldbuild.lisp +++ b/tools/worldbuild.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/worldbuild.lisp,v 1.42 2001/02/11 14:22:07 dtc Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/worldbuild.lisp,v 1.43 2001/12/06 19:15:48 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -133,7 +133,7 @@ '("target:code/osf1-os")) ,@(when (c:backend-featurep :irix) '("target:code/irix-os")) - ,@(when (c:backend-featurep :FreeBSD) + ,@(when (c:backend-featurep :BSD) '("target:code/bsd-os")) ,@(when (c:backend-featurep :Linux) '("target:code/linux-os"))