core/heap.c
/* assumption: vmm_heap_alloc only gets called for HeapUnits themselves, which
 * are protected by us here, so ignore os heap
 */
vmm_heap_alloc only gets called for HeapUnits themselves, which
are protected by us here, so ignore os heap
vmm_heap_alloc only gets called for HeapUnits themselves which are protected by us here so ignore os heap
void
protect_global_heap(bool writable)
{
    ASSERT(TEST(SELFPROT_GLOBAL, dynamo_options.protect_mask));
    acquire_recursive_lock(&global_alloc_lock);
    if (heapmgt->global_heap_writable == writable) {
        release_recursive_lock(&global_alloc_lock);
        return;
    }
    if (!writable) {
        ASSERT(heapmgt->global_heap_writable);
        heapmgt->global_heap_writable = writable;
    }
    protect_local_units_helper(heapmgt->global_units.top_unit, writable);
    if (DYNAMO_OPTION(enable_reset)) {
        protect_local_units_helper(heapmgt->global_nonpersistent_units.top_unit,
                                   writable);
    }
    if (writable) {
        ASSERT(!heapmgt->global_heap_writable);
        heapmgt->global_heap_writable = writable;
    }
    release_recursive_lock(&global_alloc_lock);
}
void protect_global_heap ( bool writable ) { ASSERT ( TEST ( SELFPROT_GLOBAL , dynamo_options . protect_mask ) ) ; acquire_recursive_lock ( & global_alloc_lock ) ; if ( heapmgt -> global_heap_writable == writable ) { release_recursive_lock ( & global_alloc_lock ) ; return ; } if ( ! writable ) { ASSERT ( heapmgt -> global_heap_writable ) ; heapmgt -> global_heap_writable = writable ; } protect_local_units_helper ( heapmgt -> global_units . top_unit , writable ) ; if ( DYNAMO_OPTION ( enable_reset ) ) { protect_local_units_helper ( heapmgt -> global_nonpersistent_units . top_unit , writable ) ; } if ( writable ) { ASSERT ( ! heapmgt -> global_heap_writable ) ; heapmgt -> global_heap_writable = writable ; } release_recursive_lock ( & global_alloc_lock ) ; }
assumption: vmm_heap_alloc only gets called for HeapUnits themselves, which
 are protected by us here, so ignore os heap
assumption : vmm_heap_alloc only gets called for HeapUnits themselves which are protected by us here so ignore os heap
/* win32 does not allow single protection change call on units that
     * were allocated with separate calls so we don't try to combine
     * adjacent units here

     * FIXME: That may no longer be true for our virtual memory manager that 
     * will in fact be allocated as a single unit.  It is only in case
     * we have run out of that initial allocation that we may have to 
     * keep a separate list of allocations.
     */