Index: /trunk/source/lisp-kernel/memory.c
===================================================================
--- /trunk/source/lisp-kernel/memory.c	(revision 8474)
+++ /trunk/source/lisp-kernel/memory.c	(revision 8475)
@@ -616,2 +616,11 @@
 }
 
+void
+release_readonly_area()
+{
+  area *a = readonly_area;
+  munmap(a->low,align_to_power_of_2(a->active-a->low, log2_page_size));
+  a->active = a->low;
+  a->ndnodes = 0;
+  pure_space_active = pure_space_start;
+}
Index: /trunk/source/lisp-kernel/x86-exceptions.c
===================================================================
--- /trunk/source/lisp-kernel/x86-exceptions.c	(revision 8474)
+++ /trunk/source/lisp-kernel/x86-exceptions.c	(revision 8475)
@@ -157,4 +157,5 @@
   area *a = active_dynamic_area;
   Boolean egc_was_enabled = (a->older != NULL);
+  
   natural gc_previously_deferred = gc_deferred;
 
@@ -219,31 +220,39 @@
       full_gc_deferred = 0;
     }
-    if (selector & GC_TRAP_FUNCTION_PURIFY) {
-      purify_from_xp(xp, 0L);
-      gc_from_xp(xp, 0L);
-    }
-    if (selector & GC_TRAP_FUNCTION_SAVE_APPLICATION) {
-      OSErr err;
-      extern OSErr save_application(unsigned);
-      area *vsarea = tcr->vs_area;
+    if (selector > GC_TRAP_FUNCTION_GC) {
+      if (selector & GC_TRAP_FUNCTION_IMPURIFY) {
+        impurify_from_xp(xp, 0L);
+        /*        nrs_GC_EVENT_STATUS_BITS.vcell |= gc_integrity_check_bit; */
+        gc_from_xp(xp, 0L);
+        release_readonly_area();
+      }
+      if (selector & GC_TRAP_FUNCTION_PURIFY) {
+        purify_from_xp(xp, 0L);
+        gc_from_xp(xp, 0L);
+      }
+      if (selector & GC_TRAP_FUNCTION_SAVE_APPLICATION) {
+        OSErr err;
+        extern OSErr save_application(unsigned);
+        area *vsarea = tcr->vs_area;
 	
-      nrs_TOPLFUNC.vcell = *((LispObj *)(vsarea->high)-1);
-      err = save_application(arg);
-      if (err == noErr) {
-	_exit(0);
+        nrs_TOPLFUNC.vcell = *((LispObj *)(vsarea->high)-1);
+        err = save_application(arg);
+        if (err == noErr) {
+          _exit(0);
+        }
+        fatal_oserr(": save_application", err);
       }
-      fatal_oserr(": save_application", err);
-    }
-    switch (selector) {
-    case GC_TRAP_FUNCTION_SET_HONS_AREA_SIZE:
-      xpGPR(xp, Iimm0) = 0;
-      break;
-    case GC_TRAP_FUNCTION_FREEZE:
-      a->active = (BytePtr) align_to_power_of_2(a->active, log2_page_size);
-      tenured_area->static_dnodes = area_dnode(a->active, a->low);
-      xpGPR(xp, Iimm0) = tenured_area->static_dnodes << dnode_shift;
-      break;
-    default:
-      break;
+      switch (selector) {
+      case GC_TRAP_FUNCTION_SET_HONS_AREA_SIZE:
+        xpGPR(xp, Iimm0) = 0;
+        break;
+      case GC_TRAP_FUNCTION_FREEZE:
+        a->active = (BytePtr) align_to_power_of_2(a->active, log2_page_size);
+        tenured_area->static_dnodes = area_dnode(a->active, a->low);
+        xpGPR(xp, Iimm0) = tenured_area->static_dnodes << dnode_shift;
+        break;
+      default:
+        break;
+      }
     }
     if (egc_was_enabled) {
Index: /trunk/source/lisp-kernel/x86-gc.c
===================================================================
--- /trunk/source/lisp-kernel/x86-gc.c	(revision 8474)
+++ /trunk/source/lisp-kernel/x86-gc.c	(revision 8475)
@@ -1782,4 +1782,5 @@
   }
 }
+
 void 
 purify_headerless_range(LispObj *start, LispObj *end, BytePtr low, BytePtr high, area *to)
@@ -2058,7 +2059,19 @@
   
 
-
-void
-impurify_xp(ExceptionInformation *xp, LispObj low, LispObj high, int delta)
+void
+impurify_gcable_ptrs(LispObj low, LispObj high, signed_natural delta)
+{
+  LispObj *prev = &(lisp_global(GCABLE_POINTERS)), next;
+
+  while ((*prev) != (LispObj)NULL) {
+    impurify_noderef(prev, low, high, delta);
+    next = *prev;
+    prev = &(((xmacptr *)ptr_from_lispobj(untag(next)))->link);
+  }
+}
+
+
+void
+impurify_xp(ExceptionInformation *xp, LispObj low, LispObj high, signed_natural delta)
 {
   natural *regs = (natural *) xpGPRvector(xp);
@@ -2085,5 +2098,5 @@
 
 void
-impurify_headerless_range(LispObj *start, LispObj *end, LispObj low, LispObj high, int delta)
+impurify_headerless_range(LispObj *start, LispObj *end, LispObj low, LispObj high, signed_natural delta)
 {
   while (start < end) {
@@ -2095,5 +2108,5 @@
 
 void
-impurify_range(LispObj *start, LispObj *end, LispObj low, LispObj high, int delta)
+impurify_range(LispObj *start, LispObj *end, LispObj low, LispObj high, signed_natural delta)
 {
   LispObj header;
@@ -2167,5 +2180,5 @@
 
 void
-impurify_tcr_tlb(TCR *tcr,  LispObj low, LispObj high, int delta)
+impurify_tcr_tlb(TCR *tcr,  LispObj low, LispObj high, signed_natural delta)
 {
   unsigned n = tcr->tlb_limit;
@@ -2176,5 +2189,5 @@
 
 void
-impurify_tcr_xframes(TCR *tcr, LispObj low, LispObj high, int delta)
+impurify_tcr_xframes(TCR *tcr, LispObj low, LispObj high, signed_natural delta)
 {
   xframe_list *xframes;
@@ -2192,5 +2205,5 @@
 
 void
-impurify_tstack_area(area *a, LispObj low, LispObj high, int delta)
+impurify_tstack_area(area *a, LispObj low, LispObj high, signed_natural delta)
 {
   LispObj
@@ -2212,5 +2225,5 @@
 }
 void
-impurify_vstack_area(area *a, LispObj low, LispObj high, int delta)
+impurify_vstack_area(area *a, LispObj low, LispObj high, signed_natural delta)
 {
   LispObj
@@ -2223,5 +2236,5 @@
 
 void
-impurify_areas(LispObj low, LispObj high, int delta)
+impurify_areas(LispObj low, LispObj high, signed_natural delta)
 {
   area *next_area;
@@ -2239,7 +2252,4 @@
       
     case AREA_CSTACK:
-#ifdef PPC
-      impurify_cstack_area(next_area, low, high, delta);
-#endif
       break;
       
@@ -2265,5 +2275,5 @@
       oldhigh = a->high, newhigh; 
     unsigned n = ro_limit - ro_base;
-    int delta = oldfree-ro_base;
+    signed_natural delta = oldfree-ro_base;
     TCR *other_tcr;
 
@@ -2290,4 +2300,6 @@
         other_tcr = other_tcr->next;
       } while (other_tcr != tcr);
+
+      impurify_gcable_ptrs(ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta);
       lisp_global(IN_GC) = 0;
     }
