From 9689a3239ba2885e9d9cb7f587b2a0ca23b9d76b Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Sat, 23 Mar 1996 19:25:23 +0000 Subject: [PATCH] Changes to the Windows 3.1/95/NT version: auto-configuration and better virtual memory behaviour. There used to be two version of the library NTSCMLIB.DLL, one version for WIN32S, and another version for NT (and '95). The WIN32S version had a partner, NTW16LIB.DLL, to handle the 16-bit side of things. The system was configured for Windows 3.1 or NT by copying the appropriate version of NTSCMLIB.DLL into the same directory as SCHEME.EXE, or putting an appropriate directory in the PATH. The new scheme is that instead of two NTSCMLIB.DLL files and a NTW16LIB.DLL file there will be three files: SCHEME32.DLL The true 32 bit version (NT & '95) SCHEME31.DLL The windows 3.1 (win32s) version SCHEME16.DLL and its 16 bit buddy These are no longer bound at link time. Instead, nttop.c now detects WIN32S vs. NT and explicitly loads the appropriate version. To support this dynamic linking, the utilities referenced via a WIN32_SYSTEM_UTILITIES structure. Now both SCHEME31.DLL and SCHEME32.DLL use VirtualAlloc, so the garbage collector has been changed to de-commit and re-commit the pages in the old half-space. Toy experiments show that roughly 30-50% of the working set is in the old half-space. The allocation code *could* be changed to reserve the virtual address space of the whole heap as this would allow an extensible heap. --- v7/src/microcode/cmpint.c | 6 +- v7/src/microcode/memmag.c | 22 ++++++- v7/src/microcode/memmag.h | 30 ++++----- v7/src/microcode/ntio.c | 5 +- v7/src/microcode/ntscmlib.h | 95 +++++++++++++++-------------- v7/src/microcode/ntsig.c | 25 ++++---- v7/src/microcode/ntsys.h | 5 +- v7/src/microcode/nttop.c | 45 +++++++++++++- v7/src/microcode/ntutl/makefile | 44 ++++++------- v7/src/microcode/ntutl/scheme16.c | 4 +- v7/src/microcode/ntutl/scheme16.def | 4 +- v7/src/microcode/ntutl/scheme16.mak | 16 ++--- v7/src/microcode/ntutl/scheme31.c | 37 ++++++++--- v7/src/microcode/ntutl/scheme31.def | 16 ++--- v7/src/microcode/ntutl/scheme32.c | 82 +++++++++++++++++++------ v7/src/microcode/ntutl/scheme32.def | 14 +---- 16 files changed, 282 insertions(+), 168 deletions(-) diff --git a/v7/src/microcode/cmpint.c b/v7/src/microcode/cmpint.c index 98b4ebabc..525cc1f45 100644 --- a/v7/src/microcode/cmpint.c +++ b/v7/src/microcode/cmpint.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: cmpint.c,v 1.88 1996/01/04 23:59:47 cph Exp $ +$Id: cmpint.c,v 1.89 1996/03/23 19:25:23 adams Exp $ Copyright (c) 1989-96 Massachusetts Institute of Technology @@ -4162,7 +4162,7 @@ DEFUN_VOID (winnt_allocate_registers) winnt_catatonia_block = ((unsigned long *) &mem->catatonia_block[0]); RegistersPtr = mem->Registers; - if (! (win32_lock_memory_area (mem, (sizeof (REGMEM))))) + if (! (win32_system_utilities.lock_memory_area (mem, (sizeof (REGMEM))))) { outf_error ("Unable to lock registers\n"); outf_flush_error (); @@ -4173,7 +4173,7 @@ DEFUN_VOID (winnt_allocate_registers) void DEFUN_VOID (winnt_deallocate_registers) { - win32_unlock_memory_area (®mem, (sizeof (REGMEM))); + win32_system_utilities.unlock_memory_area (®mem, (sizeof (REGMEM))); return; } diff --git a/v7/src/microcode/memmag.c b/v7/src/microcode/memmag.c index 2ceb67620..bb31ad375 100644 --- a/v7/src/microcode/memmag.c +++ b/v7/src/microcode/memmag.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: memmag.c,v 9.58 1995/10/08 15:22:15 cph Exp $ +$Id: memmag.c,v 9.59 1996/03/23 19:25:17 adams Exp $ Copyright (c) 1987-95 Massachusetts Institute of Technology @@ -543,6 +543,26 @@ DEFUN_VOID (GC) } COMPILER_TRANSPORT_END (); + +#ifdef WINNT + /* Since we allocated the heap with VirtualAlloc, we can decommit the old + half-space to tell the VM system that it comtains trash. + Immediately recommitting the region allows the old half-space to be used + for temporary storage (e.g. by fasdump). + We are careful to do this with pages that are strictly within the old + half-space + */ + { long pagesize = 4096; + void *base = + ((void*) + (((DWORD)((char*)Unused_Heap_Bottom + pagesize)) & ~(pagesize-1))) ; + DWORD len = + ((DWORD)(((char*)Unused_Heap_Top) - ((char*)base))) & ~(pagesize-1); + VirtualFree (base, len, MEM_DECOMMIT); + VirtualAlloc (base, len, MEM_COMMIT, PAGE_READWRITE); + } +#endif + CLEAR_INTERRUPT (INT_GC); return; } diff --git a/v7/src/microcode/memmag.h b/v7/src/microcode/memmag.h index bd07775bd..933c2c66c 100644 --- a/v7/src/microcode/memmag.h +++ b/v7/src/microcode/memmag.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: memmag.h,v 1.3 1995/10/24 04:56:12 cph Exp $ +$Id: memmag.h,v 1.4 1996/03/23 19:25:10 adams Exp $ -Copyright (c) 1993-95 Massachusetts Institute of Technology +Copyright (c) 1993-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -48,8 +48,8 @@ extern void winnt_deallocate_registers (void); #ifdef WINNT_RAW_ADDRESSES -#define WIN32_ALLOCATE_HEAP win32_allocate_heap -#define WIN32_RELEASE_HEAP win32_release_heap +#define WIN32_ALLOCATE_HEAP win32_system_utilities.allocate_heap +#define WIN32_RELEASE_HEAP win32_system_utilities.release_heap #else /* not WINNT_RAW_ADDRESSES */ @@ -84,17 +84,18 @@ WIN32_ALLOCATE_HEAP (unsigned long size, unsigned long * handle) total_fudge = (actual_fudge_1 + actual_fudge_2); actual_size = (size + total_fudge); - base = (win32_allocate_heap (actual_size, handle)); + base = (win32_system_utilities.allocate_heap (actual_size, handle)); if (base == ((char *) NULL)) return (base); virtual_base = (base + total_fudge); winnt_address_delta = (((unsigned long) base) + actual_fudge_1); - if (! (win32_alloc_scheme_selectors (winnt_address_delta, - (size + actual_fudge_2), - &Scheme_Code_Segment_Selector, - &Scheme_Data_Segment_Selector, - &Scheme_Stack_Segment_Selector))) + if (! (win32_system_utilities.alloc_scheme_selectors + (winnt_address_delta, + (size + actual_fudge_2), + &Scheme_Code_Segment_Selector, + &Scheme_Data_Segment_Selector, + &Scheme_Stack_Segment_Selector))) /* Let the higher-level code fail. */ winnt_address_delta = 0L; @@ -105,10 +106,11 @@ static void WIN32_RELEASE_HEAP (char * area, unsigned long handle) { if (winnt_address_delta != 0) - win32_release_scheme_selectors (Scheme_Code_Segment_Selector, - Scheme_Data_Segment_Selector, - Scheme_Stack_Segment_Selector); - win32_release_heap ((area - total_fudge), handle); + win32_system_utilities.release_scheme_selectors + (Scheme_Code_Segment_Selector, + Scheme_Data_Segment_Selector, + Scheme_Stack_Segment_Selector); + win32_system_utilities.release_heap ((area - total_fudge), handle); return; } diff --git a/v7/src/microcode/ntio.c b/v7/src/microcode/ntio.c index 383b8279a..b1ba24ecd 100644 --- a/v7/src/microcode/ntio.c +++ b/v7/src/microcode/ntio.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntio.c,v 1.11 1995/10/24 05:05:08 cph Exp $ +$Id: ntio.c,v 1.12 1996/03/23 19:25:04 adams Exp $ -Copyright (c) 1992-95 Massachusetts Institute of Technology +Copyright (c) 1992-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -516,7 +516,6 @@ DEFUN_VOID (OS_have_ptys_p) int OS_have_select_p = 0; extern HANDLE master_tty_window; -extern BOOL __cdecl win32_under_win32s_p (void); extern void EXFUN (NT_initialize_channels, (void)); extern void EXFUN (NT_reset_channels, (void)); extern void EXFUN (NT_restore_channels, (void)); diff --git a/v7/src/microcode/ntscmlib.h b/v7/src/microcode/ntscmlib.h index 1c54e8095..a2f70427c 100644 --- a/v7/src/microcode/ntscmlib.h +++ b/v7/src/microcode/ntscmlib.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntscmlib.h,v 1.5 1995/10/24 05:24:48 cph Exp $ +$Id: ntscmlib.h,v 1.6 1996/03/23 19:24:58 adams Exp $ -Copyright (c) 1993-95 Massachusetts Institute of Technology +Copyright (c) 1993-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -52,48 +52,53 @@ MIT in each case. */ /* Exports to Scheme */ -extern BOOL __cdecl - win32_under_win32s_p (void); - -extern char * __cdecl - win32_allocate_heap (unsigned long, /* size */ - unsigned long *); /* handle */ -extern void __cdecl - win32_release_heap (char *, /* base */ - unsigned long); /* handle */ - -extern BOOL __cdecl - win32_lock_memory_area (void *, /* area */ - unsigned long); /* size */ -extern void __cdecl - win32_unlock_memory_area (void *, /* area */ - unsigned long); /* size */ - -extern UINT __cdecl - win32_install_async_timer (void **, /* timer state */ - unsigned long *, /* regs */ - long, /* memtop off */ - long, /* int_code off */ - long, /* int_mask off */ - unsigned long, /* mask */ - long, /* ctr_off */ - unsigned long, /* message */ - HWND); /* window */ - -extern void __cdecl - win32_flush_async_timer (void *); - -extern BOOL __cdecl - win32_alloc_scheme_selectors (unsigned long, /* base */ - unsigned long, /* limit */ - unsigned short *, /* cs */ - unsigned short *, /* ds */ - unsigned short *); /* ss */ - -extern void __cdecl - win32_release_scheme_selectors (unsigned short, /* cs */ - unsigned short, /* ds */ - unsigned short); /* ss */ +typedef struct { + + BOOL (__cdecl *under_win32s_p) (); + + char * + (__cdecl *allocate_heap) (unsigned long, /* size */ + unsigned long *); /* handle */ + void + (__cdecl *release_heap) (char *, /* base */ + unsigned long); /* handle */ + + BOOL + (__cdecl *lock_memory_area) (void *, /* area */ + unsigned long); /* size */ + void + (__cdecl *unlock_memory_area) (void *, /* area */ + unsigned long); /* size */ + + UINT + (__cdecl *install_async_timer) (void **, /* timer state */ + unsigned long *, /* regs */ + long, /* memtop off */ + long, /* int_code off */ + long, /* int_mask off */ + unsigned long, /* mask */ + long, /* ctr_off */ + unsigned long, /* message */ + HWND); /* window */ + + void + (__cdecl *flush_async_timer) (void *); + + BOOL + (__cdecl *alloc_scheme_selectors) (unsigned long, /* base */ + unsigned long, /* limit */ + unsigned short *, /* cs */ + unsigned short *, /* ds */ + unsigned short *); /* ss */ + + void + (__cdecl *release_scheme_selectors) (unsigned short, /* cs */ + unsigned short, /* ds */ + unsigned short); /* ss */ + +} WIN32_SYSTEM_UTILITIES; + +extern WIN32_SYSTEM_UTILITIES win32_system_utilities; #endif /* not W32SUT_16 */ #if defined(W32SUT_32) || defined(W32SUT_16) @@ -119,7 +124,7 @@ typedef unsigned short SCM_SEL; #define STRINGIFY(arg) #arg -#define NTW16LIB_DLL_NAME "ntw16lib.dll" +#define NTW16LIB_DLL_NAME "scheme16.dll" #define NTW16LIB_DLL_INIT ntw16lib_init #define NTW16LIB_DLL_ENTRY ntw16lib_handler diff --git a/v7/src/microcode/ntsig.c b/v7/src/microcode/ntsig.c index 6d7cd1048..680ca3bb0 100644 --- a/v7/src/microcode/ntsig.c +++ b/v7/src/microcode/ntsig.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntsig.c,v 1.16 1994/05/19 00:05:14 adams Exp $ +$Id: ntsig.c,v 1.17 1996/03/23 19:24:53 adams Exp $ -Copyright (c) 1992-1993 Massachusetts Institute of Technology +Copyright (c) 1992-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -428,15 +428,16 @@ DEFUN_VOID (install_timer) winnt_catatonia_block[CATATONIA_BLOCK_LIMIT] = (CATATONIA_PERIOD / ASYNC_TIMER_PERIOD); winnt_catatonia_block[CATATONIA_BLOCK_FLAG] = 0; - switch (win32_install_async_timer (&timer_state, - &Registers[0], - REGBLOCK_MEMTOP, - REGBLOCK_INT_CODE, - REGBLOCK_INT_MASK, - (INT_Global_GC | INT_Global_1), - catatonia_offset, - WM_CATATONIC, - master_tty_window)) + switch (win32_system_utilities.install_async_timer + (&timer_state, + &Registers[0], + REGBLOCK_MEMTOP, + REGBLOCK_INT_CODE, + REGBLOCK_INT_MASK, + (INT_Global_GC | INT_Global_1), + catatonia_offset, + WM_CATATONIC, + master_tty_window)) { case WIN32_ASYNC_TIMER_OK: return (NULL); @@ -467,7 +468,7 @@ DEFUN_VOID (install_timer) static void DEFUN_VOID (flush_timer) { - win32_flush_async_timer (timer_state); + win32_system_utilities.flush_async_timer (timer_state); return; } diff --git a/v7/src/microcode/ntsys.h b/v7/src/microcode/ntsys.h index 3e534b697..d10611bd2 100644 --- a/v7/src/microcode/ntsys.h +++ b/v7/src/microcode/ntsys.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntsys.h,v 1.4 1993/09/03 18:03:31 gjr Exp $ +$Id: ntsys.h,v 1.5 1996/03/23 19:24:46 adams Exp $ -Copyright (c) 1992-1993 Massachusetts Institute of Technology +Copyright (c) 1992-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -44,6 +44,7 @@ typedef struct version_struct /* Misc */ +extern BOOL win32_under_win32s_p (); extern int nt_console_write (void * vbuffer, size_t nsize); extern void nt_get_version (version_t * version_number); extern BOOL nt_pathname_as_filename (char * name, char * buffer); diff --git a/v7/src/microcode/nttop.c b/v7/src/microcode/nttop.c index c70afa385..981e309d8 100644 --- a/v7/src/microcode/nttop.c +++ b/v7/src/microcode/nttop.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: nttop.c,v 1.16 1995/10/25 02:30:37 cph Exp $ +$Id: nttop.c,v 1.17 1996/03/23 19:24:40 adams Exp $ -Copyright (c) 1993-95 Massachusetts Institute of Technology +Copyright (c) 1993-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -39,6 +39,7 @@ MIT in each case. */ #include "errors.h" #include "option.h" #include "outf.h" +#include "ntscmlib.h" extern void EXFUN (execute_reload_cleanups, (void)); @@ -59,6 +60,46 @@ extern void EXFUN (NT_restore_traps, (void)); extern CONST char * OS_Name; extern CONST char * OS_Variant; + + +BOOL +win32_under_win32s_p () +{ + return ((GetVersion()) >> 31); +} + +WIN32_SYSTEM_UTILITIES win32_system_utilities; + +HINSTANCE win32_system_utilities_dll = 0; + +void +NT_initialize_win32_system_utilities () +{ + char * dll_name = win32_under_win32s_p() ? "SCHEME31.DLL" : "SCHEME32.DLL"; + char * entry_name = "install_win32_system_utilities"; + FARPROC install; + + win32_system_utilities_dll = LoadLibrary (dll_name); + if (win32_system_utilities_dll == NULL) { + outf_fatal ("MIT Scheme is unable to find or load %s\n" + "This essential MIT Scheme file should be in the\n" + "same directory as SCHEME.EXE", + dll_name); + outf_flush_fatal(); + abort (); + } + + install = GetProcAddress (win32_system_utilities_dll, entry_name); + if (install==NULL) { + outf_fatal ("Something is wrong with %s\n" + "It does not have an entry called \"%s\".", + dll_name, entry_name); + outf_flush_fatal (); + abort (); + } + + install (&win32_system_utilities); +} static int interactive; diff --git a/v7/src/microcode/ntutl/makefile b/v7/src/microcode/ntutl/makefile index b5934f22f..a5bbe53aa 100644 --- a/v7/src/microcode/ntutl/makefile +++ b/v7/src/microcode/ntutl/makefile @@ -1,6 +1,6 @@ ### -*- Fundamental -*- ### -### $Id: makefile,v 1.17 1995/10/24 05:32:20 cph Exp $ +### $Id: makefile,v 1.18 1996/03/23 19:24:33 adams Exp $ ### ### Copyright (c) 1992-95 Massachusetts Institute of Technology ### @@ -56,7 +56,7 @@ USER_PRIM_SOURCES = USER_PRIM_OBJECTS = USER_LIBS = BINDIR = \scheme\nt\microcode -AS = mlx /Zm /Cp /c # masm386 /z # +AS = c:\usr\lib\masm\bin\mlx /Zm /Cp /c # masm386 /z # LDFLAGS = cflags = $(cflags) -DMIT_SCHEME -DWINNT -DCL386 $(MACHINE_SWITCHES) -DGUI=1 @@ -66,7 +66,8 @@ sysflags = $(guiflags) syslibs = $(guilibs) cvobj = cvtomf -all: scheme.exe ntscmlib.dll bchschem.exe # bintopsb.exe psbtobin.exe +all: scheme.exe scheme31.dll scheme32.dll bchschem.exe # bintopsb.exe psbtobin.exe +# scheme16.dll has to build with a 16 bit compiler .c.obj: $(cc) $(cflags) $(cdebug) -c $*.c @@ -282,10 +283,12 @@ ntgui.rbj: ntgui.rc ntgui.h ntdialog.dlg ntdialog.h !ENDIF scheme: scheme.exe -scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scm-cl3.lst ntscmlib.dll - $(link) $(linkdebug) $(sysflags) -out:scheme.exe @scm-cl3.lst $(syslibs) ntscmlib.lib crtdll.lib -bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bch-cl3.lst ntscmlib.dll - $(link) $(linkdebug) $(sysflags) -out:bchschem.exe @bch-cl3.lst $(syslibs) ntscmlib.lib crtdll.lib +scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scm-cl3.lst +## $(link) $(linkdebug) $(sysflags) -out:scheme.exe @scm-cl3.lst $(syslibs) crtdll.lib + $(link) $(sysflags) -out:scheme.exe @scm-cl3.lst $(syslibs) crtdll.lib +bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bch-cl3.lst +## $(link) $(linkdebug) $(sysflags) -out:bchschem.exe @bch-cl3.lst $(syslibs) crtdll.lib + $(link) $(sysflags) -out:bchschem.exe @bch-cl3.lst $(syslibs) crtdll.lib findprim.exe : findprim.obj $(link) $(linkdebug) $(conflags) -out:findprim.exe findprim.obj $(conlibs) bintopsb.exe : bintopsb.obj missing.obj @@ -429,14 +432,15 @@ NT_DEPENDENCIES = oscond.h ansidecl.h posixtyp.h intext.h \ ntenv.obj : scheme.tch osenv.h ntscreen.h $(NT_DEPENDENCIES) ntfile.obj : osfile.h osio.h ntio.h $(NT_DEPENDENCIES) ntfs.obj : osfs.h $(NT_DEPENDENCIES) -ntio.obj : osio.h ntio.h ntscreen.h $(NT_DEPENDENCIES) -nttop.obj : ostop.h nttop.h osctty.h errors.h option.h $(NT_DEPENDENCIES) +ntio.obj : osio.h ntio.h ntscmlib.h ntscreen.h $(NT_DEPENDENCIES) +nttop.obj : ostop.h nttop.h osctty.h errors.h option.h ntscmlib.h \ + $(NT_DEPENDENCIES) nttty.obj : ostty.h osenv.h osio.h ntio.h osterm.h ntterm.h $(NT_DEPENDENCIES) ntsig.obj : ossig.h osctty.h ostty.h critsec.h \ $(NT_DEPENDENCIES) ntgui.h ntio.h ntscmlib.h ntscreen.h nttrap.obj: nttrap.h ntscmlib.h $(GC_HEAD_FILES) $(NT_DEPENDENCIES) ntsys.obj: ntsys.h -ntgui.obj : ntgui.c ntdialog.h ntgui.h ntscreen.h $(NT_DEPENDENCIES) scheme.tch +ntgui.obj : ntgui.c ntdialog.h ntgui.h ntscmlib.h ntscreen.h $(NT_DEPENDENCIES) scheme.tch ntasutl.obj : ntasutl.asm ntkbutl.obj : ntkbutl.asm ntscreen.obj : ntscreen.c ntgui.h ntscreen.h @@ -446,26 +450,24 @@ prntio.obj : $(NT_DEPENDENCIES) scheme.tch prims.h ntio.h osio.h syscall.h cmpauxmd.obj : cmpauxmd.asm -ntscmlib.dll: ntwntlib.dll ntw32lib.dll - copy ntwntlib.lib ntscmlib.lib - copy ntwntlib.dll ntscmlib.dll -ntwntlib.obj: ntwntlib.c ntscmlib.h makefile +scheme32.obj: scheme32.c ntscmlib.h makefile -ntwntlib.exp: ntwntlib.obj ntscmlib.def - $(implib) -machine:$(CPU) -def:ntscmlib.def $*.obj -out:$*.lib +scheme32.exp: scheme32.obj scheme32.def + $(implib) -machine:$(CPU) -def:scheme32.def $*.obj -out:$*.lib -ntwntlib.dll: ntwntlib.obj ntwntlib.exp +scheme32.dll: scheme32.obj scheme32.exp $(link) $(linkdebug) -dll -out:$*.dll \ -entry:_CRT_INIT$(DLLENTRY) \ $** $(syslibs) winmm.lib crtdll.lib -ntw32lib.obj : ntw32lib.c ntscmlib.h makefile -ntw32lib.exp: ntw32lib.obj ntscmlib.def - $(implib) -machine:$(CPU) -def:ntscmlib.def $*.obj -out:$*.lib +scheme31.obj: scheme31.c ntscmlib.h makefile + +scheme31.exp: scheme31.obj scheme31.def + $(implib) -machine:$(CPU) -def:scheme32.def $*.obj -out:$*.lib -ntw32lib.dll: ntw32lib.obj ntw32lib.exp +scheme31.dll: scheme31.obj scheme31.exp $(link) $(linkdebug) -dll -out:$*.dll \ -entry:ntw32lib_dllinit$(DLLENTRY) \ $** $(syslibs) w32sut32.lib diff --git a/v7/src/microcode/ntutl/scheme16.c b/v7/src/microcode/ntutl/scheme16.c index 16b229203..f1f7315fa 100644 --- a/v7/src/microcode/ntutl/scheme16.c +++ b/v7/src/microcode/ntutl/scheme16.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: scheme16.c,v 1.7 1993/09/13 18:39:57 gjr Exp $ +$Id: scheme16.c,v 1.8 1996/03/23 19:24:27 adams Exp $ -Copyright (c) 1993 Massachusetts Institute of Technology +Copyright (c) 1993-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and diff --git a/v7/src/microcode/ntutl/scheme16.def b/v7/src/microcode/ntutl/scheme16.def index 06106e8c1..25da88788 100644 --- a/v7/src/microcode/ntutl/scheme16.def +++ b/v7/src/microcode/ntutl/scheme16.def @@ -1,5 +1,5 @@ -LIBRARY ntw16lib -DESCRIPTION "MIT Scheme Win16 Server for Win32s DLL" +LIBRARY scheme16 +DESCRIPTION "MIT Scheme Win16 Server for Win32S DLL" EXETYPE WINDOWS diff --git a/v7/src/microcode/ntutl/scheme16.mak b/v7/src/microcode/ntutl/scheme16.mak index f020d8ba1..8e0264534 100644 --- a/v7/src/microcode/ntutl/scheme16.mak +++ b/v7/src/microcode/ntutl/scheme16.mak @@ -1,8 +1,8 @@ ### -*- Fundamental -*- ### -### $Id: scheme16.mak,v 1.3 1993/08/21 03:56:17 gjr Exp $ +### $Id: scheme16.mak,v 1.4 1996/03/23 19:24:14 adams Exp $ ### -### Copyright (c) 1993 Massachusetts Institute of Technology +### Copyright (c) 1996 Massachusetts Institute of Technology ### ### This material as developed by the Scheme project at the ### Massachusetts Institute of Technology, Department of @@ -39,15 +39,15 @@ #### Makefile for the 16-bit component of the MIT Scheme Win32 support -all: ntw16lib.dll +all: scheme16.dll # These have to be compiled by a 16-bit compiler (e.g. C700) # with the Win16 SDK! -ntw16lib.obj: ntw16lib.c ntscmlib.h - cl /c /ASw /G2 /Gsw /Ow /W2 /Zp1 ntw16lib.c +scheme16.obj: scheme16.c ntscmlib.h + cl /c /ASw /G2 /Gsw /Ow /W2 /Zp1 scheme16.c -ntw16lib.dll: ntw16lib.obj ntw16lib.def - link ntw16lib.obj, ntw16lib.dll,ntw16lib.map /map, \ - w32sut16.lib mdllcew.lib libw.lib/noe/nod,ntw16lib.def +scheme16.dll: scheme16.obj scheme16.def + link scheme16.obj, scheme16.dll,scheme16.map /map, \ + w32sut16.lib mdllcew.lib libw.lib/noe/nod,scheme16.def diff --git a/v7/src/microcode/ntutl/scheme31.c b/v7/src/microcode/ntutl/scheme31.c index bc5092b5b..91f35f8a4 100644 --- a/v7/src/microcode/ntutl/scheme31.c +++ b/v7/src/microcode/ntutl/scheme31.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: scheme31.c,v 1.6 1995/10/24 05:34:23 cph Exp $ +$Id: scheme31.c,v 1.7 1996/03/23 19:24:08 adams Exp $ Copyright (c) 1993-95 Massachusetts Institute of Technology @@ -122,13 +122,13 @@ ntw32lib_dllinit (HANDLE self, DWORD reason, LPVOID reserved) return (crt_result); } -BOOL +static BOOL win32_under_win32s_p (void) { return (TRUE); } -char * +static char * win32_allocate_heap (unsigned long size, unsigned long * handle) { LPVOID base; @@ -141,7 +141,7 @@ win32_allocate_heap (unsigned long size, unsigned long * handle) return ((char *) base); } -void +static void win32_release_heap (char * area, unsigned long handle) { VirtualFree (((LPVOID) area), @@ -153,7 +153,7 @@ win32_release_heap (char * area, unsigned long handle) return; } -BOOL +static BOOL win32_lock_memory_area (LPVOID area, unsigned long size) { struct ntw32lib_vlock_s param; @@ -168,7 +168,7 @@ win32_lock_memory_area (LPVOID area, unsigned long size) (¶m, NTW32LIB_VIRTUAL_LOCK, &translation[0]))); } -void +static void win32_unlock_memory_area (LPVOID area, unsigned long size) { struct ntw32lib_vulock_s param; @@ -183,7 +183,7 @@ win32_unlock_memory_area (LPVOID area, unsigned long size) return; } -UINT +static UINT win32_install_async_timer (void ** state_ptr, unsigned long * base, long memtop_off, @@ -216,7 +216,7 @@ win32_install_async_timer (void ** state_ptr, return (result); } -void +static void win32_flush_async_timer (void * timer_state) { struct ntw32lib_ftimer_s param; @@ -230,7 +230,7 @@ win32_flush_async_timer (void * timer_state) #define I386_PAGE_SIZE 0x1000 -BOOL +static BOOL win32_alloc_scheme_selectors (unsigned long base, unsigned long size, unsigned short * scheme_cs, @@ -258,7 +258,7 @@ win32_alloc_scheme_selectors (unsigned long base, return (result); } -void +static void win32_release_scheme_selectors (unsigned short scheme_cs, unsigned short scheme_ds, unsigned short scheme_ss) @@ -275,3 +275,20 @@ win32_release_scheme_selectors (unsigned short scheme_cs, (* call_16_bit_code) (& param, NTW32LIB_FREE_SELECTORS, &translation[0]); return; } + + + +void +install_win32_system_utilities (WIN32_SYSTEM_UTILITIES *utils) +{ +#define EXPORT(field) utils->field = win32_##field + EXPORT (under_win32s_p); + EXPORT (allocate_heap); + EXPORT (release_heap); + EXPORT (lock_memory_area); + EXPORT (unlock_memory_area); + EXPORT (install_async_timer); + EXPORT (flush_async_timer); + EXPORT (alloc_scheme_selectors); + EXPORT (release_scheme_selectors); +} diff --git a/v7/src/microcode/ntutl/scheme31.def b/v7/src/microcode/ntutl/scheme31.def index 5ce4541cf..016cd535f 100644 --- a/v7/src/microcode/ntutl/scheme31.def +++ b/v7/src/microcode/ntutl/scheme31.def @@ -1,17 +1,9 @@ -LIBRARY ntscmlib -DESCRIPTION "MIT Scheme Win32 DLL" +LIBRARY scheme31 +DESCRIPTION "MIT Scheme Win32S DLL" -VERSION 0.4 +VERSION 0.5 CODE PRELOAD MOVEABLE DISCARDABLE DATA NONE -EXPORTS win32_under_win32s_p @ 1 - win32_allocate_heap @ 2 - win32_release_heap @ 3 - win32_lock_memory_area @ 4 - win32_unlock_memory_area @ 5 - win32_install_async_timer @ 6 - win32_flush_async_timer @ 7 - win32_alloc_scheme_selectors @ 8 - win32_release_scheme_selectors @ 9 +EXPORTS install_win32_system_utilities @ 1 diff --git a/v7/src/microcode/ntutl/scheme32.c b/v7/src/microcode/ntutl/scheme32.c index 059d07d5c..9f2fb88bb 100644 --- a/v7/src/microcode/ntutl/scheme32.c +++ b/v7/src/microcode/ntutl/scheme32.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: scheme32.c,v 1.8 1995/10/24 05:36:00 cph Exp $ +$Id: scheme32.c,v 1.9 1996/03/23 19:23:47 adams Exp $ -Copyright (c) 1993-95 Massachusetts Institute of Technology +Copyright (c) 1993-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -39,38 +39,64 @@ MIT in each case. */ #include "ntscmlib.h" #include -BOOL +static BOOL win32_under_win32s_p (void) { return ((BOOL) 0); } -char * +//char * +//win32_allocate_heap (unsigned long size, unsigned long * handle) +//{ +//#ifdef CL386 +// extern char * malloc (unsigned long); +//#endif +// * handle = 0L; +// return ((char *) (malloc (size))); +//} +// +//void +//win32_release_heap (char * base, unsigned long handle) +//{ +// extern void free (char *); +// +// free (base); +// return; +//} + + +static char * win32_allocate_heap (unsigned long size, unsigned long * handle) { -#ifdef CL386 - extern char * malloc (unsigned long); -#endif - * handle = 0L; - return ((char *) (malloc (size))); + LPVOID base; + + base = (VirtualAlloc (((LPVOID) NULL), + ((DWORD) size), + ((DWORD) (MEM_RESERVE | MEM_COMMIT)), + ((DWORD) PAGE_READWRITE))); + * handle = size; + return ((char *) base); } -void -win32_release_heap (char * base, unsigned long handle) +static void +win32_release_heap (char * area, unsigned long handle) { - extern void free (char *); - - free (base); + VirtualFree (((LPVOID) area), + ((DWORD) handle), + ((DWORD) MEM_DECOMMIT)); + VirtualFree (((LPVOID) area), + ((DWORD) 0), + ((DWORD) MEM_RELEASE)); return; } -BOOL +static BOOL win32_lock_memory_area (void * area, unsigned long size) { return (VirtualLock (area, size)); } -void +static void win32_unlock_memory_area (void * area, unsigned long size) { (void) VirtualUnlock (area, size); @@ -134,7 +160,7 @@ win32_nt_timer_tick (UINT wID, UINT wMsg, DWORD dwUser, DWORD dw1, DWORD dw2) return; } -void +static void win32_flush_async_timer (void * state) { struct win32_timer_closure_s * scm_timer @@ -153,7 +179,7 @@ win32_flush_async_timer (void * state) return; } -UINT +static UINT win32_install_async_timer (void ** state_ptr, unsigned long * base, long memtop_off, @@ -222,7 +248,7 @@ win32_install_async_timer (void ** state_ptr, /* These are NOPs in this version. */ -BOOL +static BOOL win32_alloc_scheme_selectors (unsigned long base, unsigned long size, unsigned short * scheme_cs, @@ -232,10 +258,26 @@ win32_alloc_scheme_selectors (unsigned long base, return (FALSE); } -void +static void win32_release_scheme_selectors (unsigned short scheme_cs, unsigned short scheme_ds, unsigned short scheme_ss) { return; } + + +void +install_win32_system_utilities (WIN32_SYSTEM_UTILITIES *utils) +{ +#define EXPORT(field) utils->field = win32_##field + EXPORT (under_win32s_p); + EXPORT (allocate_heap); + EXPORT (release_heap); + EXPORT (lock_memory_area); + EXPORT (unlock_memory_area); + EXPORT (install_async_timer); + EXPORT (flush_async_timer); + EXPORT (alloc_scheme_selectors); + EXPORT (release_scheme_selectors); +} diff --git a/v7/src/microcode/ntutl/scheme32.def b/v7/src/microcode/ntutl/scheme32.def index 5ce4541cf..0228b3ff4 100644 --- a/v7/src/microcode/ntutl/scheme32.def +++ b/v7/src/microcode/ntutl/scheme32.def @@ -1,17 +1,9 @@ -LIBRARY ntscmlib +LIBRARY scheme32 DESCRIPTION "MIT Scheme Win32 DLL" -VERSION 0.4 +VERSION 0.5 CODE PRELOAD MOVEABLE DISCARDABLE DATA NONE -EXPORTS win32_under_win32s_p @ 1 - win32_allocate_heap @ 2 - win32_release_heap @ 3 - win32_lock_memory_area @ 4 - win32_unlock_memory_area @ 5 - win32_install_async_timer @ 6 - win32_flush_async_timer @ 7 - win32_alloc_scheme_selectors @ 8 - win32_release_scheme_selectors @ 9 +EXPORTS install_win32_system_utilities @ 1 -- 2.25.1