From 55c3e8e3eea64cfb915b7a1ab650bee5df9bc0d5 Mon Sep 17 00:00:00 2001
From: toy <toy>
Date: Thu, 16 Oct 2003 16:21:59 +0000
Subject: [PATCH] Need to disable interrupts when doing an allocation trap. 
 The sigill_handler was enabling them, and this messes up allocation if a
 signal should happen during allocation.  (Thanks to Dan Barlow for help
 hints.)

---
 lisp/sparc-arch.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/sparc-arch.c b/lisp/sparc-arch.c
index 9d472f41e..ba7607716 100644
--- a/lisp/sparc-arch.c
+++ b/lisp/sparc-arch.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sparc-arch.c,v 1.17 2003/10/14 13:11:39 toy Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sparc-arch.c,v 1.18 2003/10/16 16:21:59 toy 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.
@@ -284,6 +284,17 @@ void handle_allocation_trap(struct sigcontext *context)
   int context_index;
   boolean were_in_lisp;
   char* memory;
+  sigset_t block;
+
+  /*
+   * Block all blockable signals.  Need to do this because
+   * sigill_handler enables the signals.  When the handler returns,
+   * signals should be enabled again, automatically.
+   */
+
+  sigemptyset(&block);
+  FILLBLOCKSET(&block);
+  sigprocmask(SIG_BLOCK, &block, 0);
       
   pc = (unsigned int*) SC_PC(context);
   or_inst = pc[-1];
@@ -334,7 +345,7 @@ void handle_allocation_trap(struct sigcontext *context)
 #if 0
   fprintf(stderr, "Alloc %d to %s\n", size, lisp_register_names[rs1]);
 #endif
-  
+
   memory = (char *) alloc(size);
   SC_REG(context, rs1) = (unsigned long) memory;
 
-- 
GitLab