From 9a08b1c86bd654d6e1698e8ec7a56c0447b9de1e Mon Sep 17 00:00:00 2001 From: pw <pw> Date: Sat, 25 Oct 1997 16:32:18 +0000 Subject: [PATCH] From: Timothy Miller <tsm@cs.brown.edu> Ok, here are the updated patches to make the same cmucl lisp.core work across OS versions under irix, still by making tzname resolved at runtime (on irix only). --- assembly/mips/arith.lisp | 4 +++- assembly/mips/bit-bash.lisp | 5 +++-- code/foreign.lisp | 31 +++++++++++++++++++++++-------- code/unix.lisp | 15 ++++++++++++--- compiler/mips/arith.lisp | 7 +++++-- lisp/irix-nm | 5 +---- 6 files changed, 47 insertions(+), 20 deletions(-) diff --git a/assembly/mips/arith.lisp b/assembly/mips/arith.lisp index 89edf8109..044cd9d04 100644 --- a/assembly/mips/arith.lisp +++ b/assembly/mips/arith.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/assembly/mips/arith.lisp,v 1.14 1994/10/31 04:56:40 ram Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/arith.lisp,v 1.15 1997/10/25 16:31:44 pw Exp $") ;;; ;;; ********************************************************************** ;;; @@ -291,6 +291,7 @@ (inst bne temp DO-STATIC-FN) (inst and temp y 3) (inst bne temp DO-STATIC-FN) + (inst nop) (inst beq x y RETURN-T) (inst move res null-tn) @@ -333,6 +334,7 @@ (inst bne temp DO-STATIC-FN) (inst and temp y 3) (inst bne temp DO-STATIC-FN) + (inst nop) (inst beq x y RETURN-NIL) (load-symbol res t) diff --git a/assembly/mips/bit-bash.lisp b/assembly/mips/bit-bash.lisp index e7074259c..35bfd09ae 100644 --- a/assembly/mips/bit-bash.lisp +++ b/assembly/mips/bit-bash.lisp @@ -5,11 +5,11 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/bit-bash.lisp,v 1.14 1994/10/31 04:56:40 ram Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/bit-bash.lisp,v 1.15 1997/10/25 16:31:46 pw Exp $") ;;; ;;; ********************************************************************** ;;; -;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/bit-bash.lisp,v 1.14 1994/10/31 04:56:40 ram Exp $ +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/bit-bash.lisp,v 1.15 1997/10/25 16:31:46 pw Exp $ ;;; ;;; Stuff to implement bit bashing. ;;; @@ -52,6 +52,7 @@ (inst bne src dst copy-left) (inst sltu ntemp1 src-bit-offset dst-bit-offset) (inst bne ntemp1 copy-right) + (inst nop) (inst beq src-bit-offset dst-bit-offset done) (inst nop) diff --git a/code/foreign.lisp b/code/foreign.lisp index b09d667f4..094473594 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.24 1997/08/23 15:59:59 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/foreign.lisp,v 1.25 1997/10/25 16:31:55 pw Exp $") ;;; ;;; ********************************************************************** ;;; @@ -394,6 +394,12 @@ (defconstant rtld-lazy 1) (defconstant rtld-now 2) (defconstant rtld-global #-irix #o400 #+irix 4) +;; Dynamically loaded stuff isn't there upon restoring from a save--this is +;;primarily for irix, which resolves tzname at runtime, resulting in +;;*global-table* being set in the saved core image, resulting in havoc upon +;;restart. +(pushnew #'(lambda () (setq *global-table* nil)) + ext:*after-save-initializations*) (defvar *global-table* NIL) (defvar *dso-linker* #+solaris "/usr/ccs/bin/ld" @@ -407,7 +413,22 @@ (alien:def-alien-routine dlclose void (lib system-area-pointer)) (alien:def-alien-routine dlerror c-call:c-string) +;; Ensure we've opened our own binary so can resolve global variables in the +;;lisp image that come from libraries. This used to happen only in +;;alternate-get-global-address, and only if no libraries were dlopened already, +;;but that didn't work if something was dlopened before any problem global vars +;;were used. So now we do this in any function that can add to the global-table, +;;as well as in a-g-g-a. +(defun ensure-lisp-table-opened () + (unless *global-table* + ;; Prevent recursive call if dlopen isn't defined + (setf *global-table* (int-sap 0)) + (setf *global-table* (list (dlopen nil rtld-lazy))) + (when (zerop (system:sap-int (car *global-table*))) + (error "Can't open global symbol table: ~S" (dlerror))))) + (defun load-object-file (file) + (ensure-lisp-table-opened) ; rtld global: so it can find all the symbols previously loaded ; rtld now: that way dlopen will fail if not all symbols are defined. (let ((sap (dlopen file (logior rtld-now rtld-global)))) @@ -416,13 +437,7 @@ (pushnew sap *global-table* :test #'sap=)))) (defun alternate-get-global-address (symbol) - (unless *global-table* - ;; Prevent recursive call when dlopen isn't defined. - (setq *global-table* (int-sap 0)) - ;; Load standard object - (setq *global-table* (list (dlopen nil rtld-lazy))) - (if (zerop (system:sap-int (car *global-table*))) - (error "Can't open global symbol table: ~S" (dlerror)))) + (ensure-lisp-table-opened) ;; find the symbol in any of the loaded obbjects, ;; search in reverse order of loading, later loadings ;; take precedence diff --git a/code/unix.lisp b/code/unix.lisp index 956cabe69..f224603d4 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.54 1997/10/08 21:03:34 dtc Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.55 1997/10/25 16:32:00 pw Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1878,7 +1878,15 @@ (def-alien-variable ("daylight" unix-daylight) int) (def-alien-variable ("timezone" unix-timezone) time-t) (def-alien-variable ("altzone" unix-altzone) time-t) - (def-alien-variable ("tzname" unix-tzname) (array c-string 2)) + #-irix (def-alien-variable ("tzname" unix-tzname) (array c-string 2)) + #+irix (defvar unix-tzname-addr nil) + #+irix (pushnew #'(lambda () (setq unix-tzname-addr nil)) + ext:*after-save-initializations*) + #+irix (declaim (notinline fakeout-compiler)) + #+irix (defun fakeout-compiler (name dst) + (unless unix-tzname-addr + (setf unix-tzname-addr (system:foreign-symbol-address name))) + (deref (sap-alien unix-tzname-addr (array c-string 2)) dst)) (def-alien-routine get-timezone c-call:void (when c-call:long :in) (minutes-west c-call:int :out) @@ -1891,7 +1899,8 @@ (defun unix-get-timezone (secs) (multiple-value-bind (ignore minutes dst) (get-timezone secs) (declare (ignore ignore) (ignore minutes)) - (values (deref unix-tzname (if dst 1 0))) + (values #-irix (deref unix-tzname (if dst 1 0)) + #+irix (fakeout-compiler "tzname" (if dst 1 0))) ) ) ) (declaim (inline unix-gettimeofday)) diff --git a/compiler/mips/arith.lisp b/compiler/mips/arith.lisp index b7e395f7e..8c2197416 100644 --- a/compiler/mips/arith.lisp +++ b/compiler/mips/arith.lisp @@ -5,11 +5,11 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/arith.lisp,v 1.52 1994/10/31 04:44:16 ram Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/arith.lisp,v 1.53 1997/10/25 16:32:10 pw Exp $") ;;; ;;; ********************************************************************** ;;; -;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/arith.lisp,v 1.52 1994/10/31 04:44:16 ram Exp $ +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/arith.lisp,v 1.53 1997/10/25 16:32:10 pw Exp $ ;;; ;;; This file contains the VM definition arithmetic VOPs for the MIPS. ;;; @@ -358,6 +358,7 @@ (:generator 11 (let ((zero (generate-error-code vop division-by-zero-error x y))) (inst beq y zero-tn zero)) + (inst nop) (inst div x y) (inst mflo temp) (inst sll q temp 2) @@ -373,6 +374,7 @@ (:generator 12 (let ((zero (generate-error-code vop division-by-zero-error x y))) (inst beq y zero-tn zero)) + (inst nop) (inst divu x y) (inst mflo q) (inst mfhi r))) @@ -387,6 +389,7 @@ (:generator 12 (let ((zero (generate-error-code vop division-by-zero-error x y))) (inst beq y zero-tn zero)) + (inst nop) (inst div x y) (inst mflo q) (inst mfhi r))) diff --git a/lisp/irix-nm b/lisp/irix-nm index a1bcabfcc..d4bb16216 100755 --- a/lisp/irix-nm +++ b/lisp/irix-nm @@ -1,8 +1,5 @@ #!/bin/sh -#errnoaddr=`/bin/nm -Bg /usr/lib/libc.so|fgrep ' D errno'|sed -e 's/ .*//'` -tznameaddr=`/bin/nm -Bg /usr/lib/libc.so|fgrep ' D tzname'|sed -e 's/ .*//'` - -/bin/nm -Bgv $* | sed -e 's/ (weak)//' -e "/ U errno/ s/00000000 /$errnoaddr /" -e "/ U tzname/ s/00000000 /$tznameaddr /"|sort -k1,1 +/bin/nm -Bgv $* | sed -e 's/ (weak)//' |sort -k1,1 exit 0 -- GitLab