diff --git a/lisp/sunos-os.c b/lisp/sunos-os.c
index 2ce365cf028c76845edf517e9444e8144a64122c..00f212919539eba7084280f042727d7ffda06b74 100644
--- a/lisp/sunos-os.c
+++ b/lisp/sunos-os.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sunos-os.c,v 1.5 1997/06/18 08:57:23 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sunos-os.c,v 1.6 2000/10/27 19:33:05 dtc Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -36,6 +36,10 @@ extern int errno;
 #endif /* SOLARIS */
 
 #include "os.h"
+/* To get dynamic_0_space and friends */
+#include "globals.h"
+/* To get memory map */
+#include "sparc-validate.h"
 
 /* block size must be larger than the system page size */
 #define SPARSE_BLOCK_SIZE (1<<15)
@@ -987,3 +991,92 @@ sigsetmask(int mask)
 }
 
 #endif /* SOLARIS */
+
+os_vm_address_t
+round_up_sparse_size(os_vm_address_t addr)
+{
+  return (addr + SPARSE_BLOCK_SIZE - 1) & ~SPARSE_SIZE_MASK;
+}
+
+/*
+ * An array of the start of the spaces which should have holes placed
+ * after them.  Must not include the dynamic spaces because the size
+ * of the dynamic space can be controlled from the command line.
+ */
+static os_vm_address_t spaces[] =
+{
+  READ_ONLY_SPACE_START, STATIC_SPACE_START, 
+  BINDING_STACK_START, CONTROL_STACK_START
+};
+
+/*
+  
+ * The corresponding array for the size of each space.  Be sure that
+ * the spaces and holes don't overlap!  The sizes MUST be on
+ * SPARSE_BLOCK_SIZE boundaries.
+ 
+ */
+static unsigned long space_size[] = 
+{
+  READ_ONLY_SPACE_SIZE, STATIC_SPACE_SIZE, 
+  BINDING_STACK_SIZE, CONTROL_STACK_SIZE
+};
+
+/*
+ * The size of the hole to make.  It should be strictly smaller than
+ * SPARSE_BLOCK_SIZE.
+ */
+
+#define HOLE_SIZE 0x2000
+
+void make_holes(void)
+{
+  int k;
+  os_vm_address_t hole;
+  
+  /* Make holes of the appropriate size for desired spaces */
+  
+  for (k = 0; k < sizeof(spaces)/sizeof(spaces[0]); ++k)
+    {
+
+      hole = spaces[k] + space_size[k];
+    
+      if (os_validate(hole, HOLE_SIZE) == NULL) {
+        fprintf(stderr,
+                "ensure_space: Failed to validate hole of %ld bytes at 0x%08X\n",
+                HOLE_SIZE,
+                (unsigned long)hole);
+        exit(1);
+      }
+      /* Make it inaccessible */
+      os_protect(hole, HOLE_SIZE, 0);
+    }
+
+  /* Round up the dynamic_space_size to the nearest SPARSE_BLOCK_SIZE */
+  dynamic_space_size = round_up_sparse_size(dynamic_space_size);
+  
+  /* Now make a hole for the dynamic spaces */
+  hole = dynamic_space_size + (os_vm_address_t) dynamic_0_space;
+  
+  if (os_validate(hole, HOLE_SIZE) == NULL)
+    {
+      fprintf(stderr,
+              "ensure_space: Failed to validate hold of %ld bytes at 0x%08X\n",
+              HOLE_SIZE,
+              (unsigned long)hole);
+      exit(1);
+    }
+  os_protect(hole, HOLE_SIZE, 0);
+
+  hole = dynamic_space_size + (os_vm_address_t) dynamic_1_space;
+  if (os_validate(hole, HOLE_SIZE) == NULL)
+    {
+      fprintf(stderr,
+              "ensure_space: Failed to validate hole of %ld bytes at 0x%08X\n",
+              HOLE_SIZE,
+              (unsigned long)hole);
+      exit(1);
+    }
+  os_protect(hole, HOLE_SIZE, 0);
+}
+