From ba332b469b38aa105dfe5ea454f9df77720ec1a1 Mon Sep 17 00:00:00 2001 From: wlott <wlott> Date: Fri, 24 May 1991 17:36:47 +0000 Subject: [PATCH] Added sunos support. --- ldb/coreparse.c | 23 +++++++++++++++-------- ldb/gc.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/ldb/coreparse.c b/ldb/coreparse.c index 0e06af31a..faafb50dc 100644 --- a/ldb/coreparse.c +++ b/ldb/coreparse.c @@ -1,12 +1,13 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/coreparse.c,v 1.7 1991/02/16 00:59:39 wlott Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/coreparse.c,v 1.8 1991/05/24 17:33:10 wlott Exp $ */ #include <stdio.h> -#include <mach.h> #include <sys/types.h> #include <sys/file.h> + +#include "ldb.h" +#include "os.h" #include "lisp.h" #include "globals.h" #include "core.h" -#include "ldb.h" extern int version; @@ -16,7 +17,7 @@ long *ptr; { long id, offset, len; lispobj *free_pointer; - vm_address_t addr; + os_vm_address_t addr; struct ndir_entry *entry; entry = (struct ndir_entry *) ptr; @@ -24,15 +25,21 @@ long *ptr; while (count-- > 0) { id = entry->identifier; offset = CORE_PAGESIZE * (1 + entry->data_page); - addr = (vm_address_t) CORE_PAGESIZE * entry->address; + addr = (os_vm_address_t) (CORE_PAGESIZE * entry->address); free_pointer = (lispobj *) addr + entry->nwords; len = CORE_PAGESIZE * entry->page_count; if (len != 0) { + os_vm_address_t real_addr; #ifdef PRINTNOISE - printf("Mapping %d bytes at 0x%x.\n", len, addr); + printf("Mapping %d bytes at 0x%x.\n", len, addr); #endif - os_map(fd, offset, addr, len); + real_addr=os_map(fd, offset, addr, len); + if(real_addr!=addr) + fprintf(stderr, + "process_directory: file mapped in wrong place! (0x%08x != 0x%08x)\n", + real_addr, + addr); } #if 0 @@ -41,7 +48,7 @@ long *ptr; switch (id) { case DYNAMIC_SPACE_ID: - if (addr != (vm_address_t)dynamic_0_space && addr != (vm_address_t)dynamic_1_space) + if (addr != (os_vm_address_t)dynamic_0_space && addr != (os_vm_address_t)dynamic_1_space) printf("Strange ... dynamic space lossage.\n"); current_dynamic_space = (lispobj *)addr; #ifdef ibmrt diff --git a/ldb/gc.c b/ldb/gc.c index 593897866..4b0fc07da 100644 --- a/ldb/gc.c +++ b/ldb/gc.c @@ -1,7 +1,7 @@ /* * Stop and Copy GC based on Cheney's algorithm. * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/gc.c,v 1.27 1991/05/05 02:20:38 wlott Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/gc.c,v 1.28 1991/05/24 17:36:47 wlott Exp $ * * Written by Christopher Hoover. */ @@ -291,7 +291,7 @@ collect_garbage() user_time = tv_diff(&stop_rusage.ru_utime, &start_rusage.ru_utime); system_time = tv_diff(&stop_rusage.ru_stime, &start_rusage.ru_stime); -#ifdef 0 +#if 0 printf("Statistics:\n"); printf("%10.2f sec of real time\n", real_time); printf("%10.2f sec of user time,\n", user_time); @@ -1896,19 +1896,50 @@ gc_init() void set_auto_gc_trigger(dynamic_usage) unsigned long dynamic_usage; { - vm_address_t addr; - vm_size_t length; + os_vm_address_t addr=(os_vm_address_t)current_dynamic_space + dynamic_usage; + os_vm_size_t length= + DYNAMIC_SPACE_SIZE + (os_vm_address_t)current_dynamic_space - addr; + + if(addr<(os_vm_address_t)current_dynamic_space_free_pointer){ + fprintf(stderr, + "set_auto_gc_trigger: tried to set gc trigger too low! (%d < %d)\n", + dynamic_usage, + current_dynamic_space_free_pointer-current_dynamic_space); + return; + }else if(length<0){ + fprintf(stderr, + "set_auto_gc_trigger: tried to set gc trigger too high! (%d)\n", + dynamic_usage); + return; + } - addr = round_page((vm_address_t)current_dynamic_space + dynamic_usage); - length = DYNAMIC_SPACE_SIZE + (vm_address_t)current_dynamic_space - addr; + addr=os_round_up_to_page(addr); + length=os_trunc_size_to_page(length); +#ifndef MACH + os_invalidate(addr,length); +#else os_protect(addr, length, 0); +#endif + current_auto_gc_trigger = (lispobj *)addr; } void clear_auto_gc_trigger() { - os_protect((vm_address_t)current_dynamic_space, DYNAMIC_SPACE_SIZE, - OS_VM_PROT_READ | OS_VM_PROT_WRITE | OS_VM_PROT_EXECUTE); - current_auto_gc_trigger = NULL; + if(current_auto_gc_trigger!=NULL){ +#ifndef MACH /* don't want to force whole space into swapping mode... */ + os_vm_address_t addr=(os_vm_address_t)current_auto_gc_trigger; + os_vm_size_t length= + DYNAMIC_SPACE_SIZE + (os_vm_address_t)current_dynamic_space - addr; + + os_validate(addr,length); +#else + os_protect((os_vm_address_t)current_dynamic_space, + DYNAMIC_SPACE_SIZE, + OS_VM_PROT_ALL); +#endif + + current_auto_gc_trigger = NULL; + } } -- GitLab