From 816c50a5589bcf756f67119e657ae348e4858357 Mon Sep 17 00:00:00 2001
From: Gabor Melis <mega@hotpop.com>
Date: Mon, 16 Feb 2009 22:12:36 +0000
Subject: [PATCH] 1.0.25.43: alpha interrupt context fixes

- interrupt contexts pointers are 64 bit

- add padding to DEFINE-PRIMITIVE-OBJECT THREAD, because the C
  compiler aligns interrupt_contexts on a double word boundary
---
 NEWS                             |    1 +
 src/code/debug-int.lisp          |    4 +++-
 src/compiler/generic/objdef.lisp |    6 ++++++
 version.lisp-expr                |    2 +-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index bb49133..e3b105d 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ changes in sbcl-1.0.26 relative to 1.0.25:
   * bug fix: INTERRUPT-THREAD on a dying thread could produce memory
     fault.
   * bug fix: finalizers, gc hooks never run in a WITHOUT-INTERRUPTS
+  * bug fix: fix random memory faults related to interrupts on alpha
   * bug fix: fix deadlocks related to starting threads
 
 changes in sbcl-1.0.25 relative to 1.0.24:
diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp
index 80b5aae..57fe61d 100644
--- a/src/code/debug-int.lisp
+++ b/src/code/debug-int.lisp
@@ -881,7 +881,9 @@
   (declare (type (unsigned-byte 32) n)
            (optimize (speed 3) (safety 0)))
   (sb!alien:sap-alien (sb!vm::current-thread-offset-sap
-                       (+ sb!vm::thread-interrupt-contexts-offset n))
+                       (+ sb!vm::thread-interrupt-contexts-offset
+                          #!-alpha n
+                          #!+alpha (* 2 n)))
                       (* os-context-t)))
 
 #!+(or x86 x86-64)
diff --git a/src/compiler/generic/objdef.lisp b/src/compiler/generic/objdef.lisp
index e2d8396..09c331f 100644
--- a/src/compiler/generic/objdef.lisp
+++ b/src/compiler/generic/objdef.lisp
@@ -403,4 +403,10 @@
   (interrupt-data :c-type "struct interrupt_data *"
                   :length #!+alpha 2 #!-alpha 1)
   (stepping)
+  ;; KLUDGE: On alpha, until STEPPING we have been lucky and the 32
+  ;; bit slots came in pairs. However the C compiler will align
+  ;; interrupt_contexts on a double word boundary. This logic should
+  ;; be handled by DEFINE-PRIMITIVE-OBJECT.
+  #!+alpha
+  (padding)
   (interrupt-contexts :c-type "os_context_t *" :rest-p t))
diff --git a/version.lisp-expr b/version.lisp-expr
index d293415..e48494b 100644
--- a/version.lisp-expr
+++ b/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.25.42"
+"1.0.25.43"
-- 
1.7.10.4