--- ./ccl-orig/lisp-kernel/mach-o-image.c 2020-04-19 23:32:56.000000000 +0200 +++ ./ccl/lisp-kernel/mach-o-image.c 2023-01-08 20:31:10.000000000 +0100 @@ -781,7 +781,8 @@ } p = (BytePtr)align_to_power_of_2(dh_end,12); q = static_space_active; - mprotect(q,8192,PROT_READ|PROT_WRITE|PROT_EXEC); + if (!CommitMemory(q,8192)) goto fail; + if (0 != mprotect(q,8192,PROT_READ|PROT_WRITE|PROT_EXEC)) goto fail; memcpy(q,p,8192); memset(p,0,8192); @@ -827,14 +828,15 @@ lisp_global(HEAP_START) = (LispObj)p; lisp_global(HEAP_END) = (LispObj)q; add_area_holding_area_lock(a); - resize_dynamic_heap(dh_end, lisp_heap_gc_threshold); - xMakeDataExecutable(a->low, a->active - a->low); - static_cons_area = new_area(sc_start, sc_end, AREA_STATIC_CONS); + tenured_area = static_cons_area = new_area(sc_start, sc_end, AREA_STATIC_CONS); static_cons_area->active = sc_start; lower_heap_start(sc_start,a); a->static_dnodes = area_dnode(sc_end,sc_start); + resize_dynamic_heap(dh_end, lisp_heap_gc_threshold); + xMakeDataExecutable(a->low, a->active - a->low); + managed_static_area = new_area(ms_start,ms_end,AREA_MANAGED_STATIC); managed_static_area->active = ms_end; add_area_holding_area_lock(managed_static_area); @@ -853,4 +855,8 @@ } return image_nil; } + + fail: + if (lib) dlclose(lib); + return 0; }