From 5a11b357587f609f4322421880a7d4c69b0bf74d Mon Sep 17 00:00:00 2001
From: wlott <wlott>
Date: Tue, 23 Oct 1990 02:30:47 +0000
Subject: [PATCH] Because the new assembly routine interface uses LIP to hold
 the return address instead of LRA, and we want to use LIP, we need to save
 it.

---
 assembly/mips/array.lisp    | 34 ++++++++++++++++++++++++++++------
 assembly/mips/bit-bash.lisp | 24 +++++++++++++++++++-----
 2 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/assembly/mips/array.lisp b/assembly/mips/array.lisp
index 44128d078..163fa3cb8 100644
--- a/assembly/mips/array.lisp
+++ b/assembly/mips/array.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman (FAHLMAN@CMUC). 
 ;;; **********************************************************************
 ;;;
-;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/array.lisp,v 1.13 1990/09/18 00:34:09 wlott Exp $
+;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/array.lisp,v 1.14 1990/10/23 02:29:54 wlott Exp $
 ;;;
 ;;;    This file contains the support routines for arrays and vectors.
 ;;;
@@ -64,8 +64,12 @@
 
 			  (:temp ndescr non-descriptor-reg nl0-offset)
 			  (:temp lip interior-reg lip-offset)
+			  (:temp retaddr non-descriptor-reg nl1-offset)
 			  (:temp vector descriptor-reg a3-offset))
 
+  ;; Save the return address.
+  (inst subu retaddr lip-tn code-tn)
+
   (allocate-vector vm:simple-vector-type length length vector ndescr)
   (inst beq length zero-tn done)
   (inst addu lip vector (- (* vm:vector-data-offset vm:word-bytes)
@@ -80,7 +84,10 @@
 
   done
   
-  (move result vector))
+  (move result vector)
+
+  ;; Restore the return address.
+  (inst addu lip-tn retaddr code-tn))
 
 
 (define-assembly-routine (alloc-string
@@ -130,7 +137,12 @@
 			  (:temp length any-reg a2-offset)
 			  (:temp accum non-descriptor-reg nl0-offset)
 			  (:temp data non-descriptor-reg nl1-offset)
-			  (:temp byte non-descriptor-reg nl2-offset))
+			  (:temp byte non-descriptor-reg nl2-offset)
+			  (:temp retaddr non-descriptor-reg nl3-offset))
+
+  ;; Save the return address.
+  (inst subu retaddr lip-tn code-tn)
+
   (loadw length string vm:vector-length-slot vm:other-pointer-type)
   (inst addu lip string
 	(- (* vm:vector-data-offset vm:word-bytes) vm:other-pointer-type))
@@ -209,7 +221,10 @@
   done
 
   (inst sll result accum 5)
-  (inst srl result result 3))
+  (inst srl result result 3)
+
+  ;; Restore the return address.
+  (inst addu lip-tn retaddr code-tn))
 
 
 (define-assembly-routine (sxhash-simple-substring
@@ -224,7 +239,11 @@
 			  (:temp lip interior-reg lip-offset)
 			  (:temp accum non-descriptor-reg nl0-offset)
 			  (:temp data non-descriptor-reg nl1-offset)
-			  (:temp byte non-descriptor-reg nl2-offset))
+			  (:temp byte non-descriptor-reg nl2-offset)
+			  (:temp retaddr non-descriptor-reg nl3-offset))
+  ;; Save the return address.
+  (inst subu retaddr lip-tn code-tn)
+
   (inst addu lip string
 	(- (* vm:vector-data-offset vm:word-bytes) vm:other-pointer-type))
   (inst b test)
@@ -302,5 +321,8 @@
   done
 
   (inst sll result accum 5)
-  (inst srl result result 3))
+  (inst srl result result 3)
+
+  ;; Restore the return address.
+  (inst addu lip-tn retaddr code-tn))
 
diff --git a/assembly/mips/bit-bash.lisp b/assembly/mips/bit-bash.lisp
index 7d0d9ccb1..5398934f3 100644
--- a/assembly/mips/bit-bash.lisp
+++ b/assembly/mips/bit-bash.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman (FAHLMAN@CMUC). 
 ;;; **********************************************************************
 ;;;
-;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/bit-bash.lisp,v 1.8 1990/10/16 17:14:12 wlott Exp $
+;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/mips/bit-bash.lisp,v 1.9 1990/10/23 02:30:47 wlott Exp $
 ;;;
 ;;; Stuff to implement bit bashing.
 ;;;
@@ -242,17 +242,24 @@
 			  (:temp dst-bit-offset descriptor-reg l0-offset)
 			  (:temp ntemp1 non-descriptor-reg nl1-offset)
 			  (:temp ntemp2 non-descriptor-reg nl2-offset)
-			  (:temp ntemp3 non-descriptor-reg nl3-offset))
+			  (:temp ntemp3 non-descriptor-reg nl3-offset)
+			  (:temp retaddr non-descriptor-reg nargs-offset))
 
   (progn res) ; don't complain that it's unused.
 
+  ;; Save the return address.
+  (inst subu retaddr lip-tn code-tn)
+
   (inst subu src src-arg vm:other-pointer-type)
   (inst and ntemp1 dst 3)
   (inst xor dst ntemp1)
   (inst sll ntemp1 5)
   (inst addu dst-offset ntemp1)
   (do-copy)
-  done)
+  done
+
+  ;; Restore the return address.
+  (inst addu lip-tn retaddr code-tn))
 
 (define-assembly-routine (copy-from-system-area
 			  ((:policy :fast-safe)
@@ -274,16 +281,23 @@
 			  (:temp dst-bit-offset descriptor-reg l0-offset)
 			  (:temp ntemp1 non-descriptor-reg nl1-offset)
 			  (:temp ntemp2 non-descriptor-reg nl2-offset)
-			  (:temp ntemp3 non-descriptor-reg nl3-offset))
+			  (:temp ntemp3 non-descriptor-reg nl3-offset)
+			  (:temp retaddr non-descriptor-reg nargs-offset))
   (progn res) ; don't complain that it's unused.
 
+  ;; Save the return address.
+  (inst sub retaddr lip-tn code-tn)
+
   (inst and ntemp1 src 3)
   (inst xor src ntemp1)
   (inst sll ntemp1 5)
   (inst addu src-offset ntemp1)
   (inst subu dst dst-arg vm:other-pointer-type)
   (do-copy)
-  done)
+  done
+
+  ;; Restore the return address.
+  (inst add lip-tn retaddr code-tn))
 
 (define-assembly-routine (system-area-copy
 			  ((:policy :fast-safe)
-- 
GitLab