diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-11-07 21:32:22 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-11-07 21:32:58 -0800 |
commit | 92171605156e21d189f4ea01ded6a606ec772e42 (patch) | |
tree | 190a6660b171da8972ff8943cadd8abbd9ae2e9b | |
parent | e448e4c70712103eacb00862ced17379ba764640 (diff) | |
download | nasmbuild-92171605156e21d189f4ea01ded6a606ec772e42.tar.gz nasmbuild-92171605156e21d189f4ea01ded6a606ec772e42.tar.xz nasmbuild-92171605156e21d189f4ea01ded6a606ec772e42.zip |
Update cwsdpmi and the DOS README
-rw-r--r-- | cwsdpmi/bin/cwsdpmi.doc | 369 | ||||
-rw-r--r-- | cwsdpmi/bin/cwsdpmi.exe | bin | 20125 -> 21325 bytes | |||
-rw-r--r-- | cwsdpmi/bin/cwsdpr0.exe | bin | 19335 -> 20519 bytes | |||
-rw-r--r-- | cwsdpmi/bin/cwsdstub.exe | bin | 21504 -> 22528 bytes | |||
-rw-r--r-- | cwsdpmi/bin/cwsparam.doc | 205 | ||||
-rw-r--r-- | cwsdpmi/bin/mswitch.asm | 536 | ||||
-rw-r--r-- | cwsdpmi/bin/readme.upd | 11 | ||||
-rw-r--r-- | cwsdpmi/manifest/csdpmi5b.mft | 8 | ||||
-rw-r--r-- | cwsdpmi/manifest/csdpmi5b.ver | 1 | ||||
-rw-r--r-- | readmes/dos | 13 |
10 files changed, 309 insertions, 834 deletions
diff --git a/cwsdpmi/bin/cwsdpmi.doc b/cwsdpmi/bin/cwsdpmi.doc index de49034..13a7b97 100644 --- a/cwsdpmi/bin/cwsdpmi.doc +++ b/cwsdpmi/bin/cwsdpmi.doc @@ -1,173 +1,196 @@ -CWSDPMI is Copyright (C) 1995-2000 Charles W Sandmann (sandmann@clio.rice.edu)
- 1206 Braelinn, Sugar Land, TX 77479
-
-This is release 5. The files in this binary distribution may be redistributed
-under the GPL (with source) or without the source code provided:
-
-* CWSDPMI.EXE or CWSDPR0.EXE are not modified in any way except via CWSPARAM.
-
-* CWSDSTUB.EXE internal contents are not modified in any way except via
- CWSPARAM or STUBEDIT. It may have a COFF image plus data appended to it.
-
-* Notice to users that they have the right to receive the source code and/or
- binary updates for CWSDPMI. Distributors should indicate a site for the
- source in their documentation.
-
--------------------------------------------------------------------------------
-
-CWSDPMI was written to provide DPMI services for V2 of DJGPP. It currently
-does not support 16-bit DPMI applications, or DPMI applications requiring a
-built in extender. It does support virtual memory and hardware interrupt
-reflection from real mode to protected mode. DJGPP V1.1x and RSX applications
-will also run using this server, which can be used to provide enhanced control
-over hardware interrupts. Some DPMI 1.0 extensions (0x506, 0x507, 0x508) have
-been implemented.
-
-CWSDPR0.EXE is an alternate version which runs at ring 0 with virtual memory
-disabled. It may be used if access to ring-0 features are desired. It
-currently does not switch stacks on HW interrupts, so some DJGPP features
-such as SIGINT and SIGFPE are not supported and will generate a double fault
-or stack fault error (to be fixed someday).
-
-CWSDSTUB.EXE is a stub loader image for DJGPP which includes CWSDPMI. This
-allows single executable image distributions. You can use the EXE2COFF
-program and COPY /B CWSDSTUB.EXE+yourimage yourimage.exe to create a
-standalone executable image.
-
-Some of the internal tuning and configuration parameters may be modified
-in the image using CWSPARAM.EXE (see CWSPARAM.DOC).
-
-If you want to use CWSDPMI with DJGPP, you expand the distribution into the
-DJGPP directory tree. CWSDPMI.EXE will be put in the BIN directory with your
-DJGPP images and it will automatically be loaded when they run.
-
-Directions for use (server can be used in either of two different ways):
-
-1) "cwsdpmi" alone with no parameters will terminate and stay resident
- FOR A SINGLE DPMI PROCESS. This means it unloads itself when your
- DPMI application exits. This mode is useful in software which needs
- DPMI services, since CWSDPMI can be exec'ed and then will unload on exit.
-
-2) "cwsdpmi -p" will terminate and stay resident until you remove it.
- It can be loaded into UMBs with LH. "cwsdpmi -u" will unload the TSR.
-
-3) The file used for virtual memory swapping, if desired, is controlled
- by the "-sc:\cwsdpmi.swp" syntax on the command line. You must specify
- either a file with full disk/directory syntax, or "-s-" which disables
- virtual memory.
-
-4) The default swap file name is c:\cwsdpmi.swp, but this can be changed
- with the CWSPARAM image, as can some other parameters.
-
-5) You can disable the DPMI 1.0 extensions by starting the image with the
- "cwsdpmi -x" syntax. This feature allows you to run programs developed
- under other DPMI providers which do not behave properly with these
- extensions enabled (typically use of NULL pointers).
-
-I would like to give special thanks to DJ Delorie who wrote the original
-GO32 code on which CWSDPMI is based. Morten Welinder also provided and
-improved much of the code in this program.
-
--------------------------------------------------------------------------------
-
-This section contains a list of the error messages you might see out of
-CWSDPMI and some details on what they mean.
-
-Exceptions are only handled by CWSDPMI if the application does not establish
-an exception handler, exceptions nest 5 deep, or the error is particularly bad:
-
-"Page fault" -
- 1) an illegal page fault happens in a RMCB or HW interrupt, (lock all pages!)
- 2) all available pages have been locked,
- 3) the application is using non-committed pages for null pointer protection.
-"Double Fault" - multiple exceptions occurred
-"Invalid TSS" - typically due to RMCB or HW interrupt being called after the
- selectors/memory have been deallocated (remember to reset the mouse)
-"General Protection Fault" - bad parameter sent to a DPMI call
-
-"80386 required."
-
-Since 80286 and lesser processors don't have the hardware necessary to
-run CWSDPMI. No workaround, upgrade.
-
-"DOS 3 required."
-
-A few interrupts are used which need DOS 3.0 or higher. I don't expect to
-ever see this message, since 80386 machines were introduced after DOS 3.0
-and that check is made first.
-
-"CWSDPMI V0.90+ (r5) Copyright (C) 2000 CW Sandmann ABSOLUTELY NO WARRANTY"
-
-An informational message displayed if the program is not run in one-pass mode.
-
-"Protected mode not accessible."
-
-This message should only be displayed if running CWSDPMI in a protected
-environment with no access to protected mode. In this case, DPMI should
-already be available and CWSDPMI would not be needed. This might happen if
-a 16-bit DPMI client is loaded and a DJGPP image attempts to load CWSDPMI
-to provide 32-bit DPMI services under Windows.
-
-"Warning: cannot open swap file c:\cwsdpmi.swp"
-
-Maybe you are out of file handles, or the swap file name is incorrectly
-specified in the image (change the name with cwsparam).
-
-"No swap space!"
-
-This message means you tried to use more paging file than CWSDPMI was
-configured to handle. Since this is protected against in the memory
-allocation code, you should never see this message.
-
-"Swap disk full!"
-
-This means the paging file could not be expanded when trying to page
-memory out to disk. This would normally not be seen, unless you are
-writing output to the same disk which holds the paging file. Decrease
-the amount of memory your DPMI application is using or free up disk space.
-
-"Interrupt 0x??"
-
-Your application tried to call an interrupt from protected mode which
-normally shouldn't be called (something like a data pointer). If the
-request was allowed to continue it would likely hang your machine. If you
-see this message and think the interrupt should be allowed to continue, let
-me know.
-
-"Error: Using XMS switched CPU into V86 mode."
-
-This message might be seen if you have your memory manager in AUTO mode. The
-only workaround in this case is to stop using AUTO mode.
-
-"Error: could not allocate page table memory"
-
-The page table memory (a minimum of 16Kb) is allocated from conventional
-memory (either in the 640Kb region or UMBs). If CWSDPMI cannot allocate the
-minimum necessary memory, you would see this message. Free up some
-conventional memory. You may also see this message if a page directory needs
-to be faulted in, and there are no available pages. This means too many pages
-have been locked for the allocated page tables available. While CWSDPMI
-tries to dynamically allocate these if needed, this effort failed. You need
-to increase the number of page tables with CWSPARAM, or increase the amount
-of free conventional memory if it is low. If the application which calls
-CWSDPMI internally manages all the DOS memory, the page tables may need to
-be pre-allocated at DPMI startup time (if this is needed, try using the
-run option flag 2 in cwsparam).
-
-"16-bit DPMI unsupported."
-
-CWSDPMI is a 32-bit only DPMI server. Ideally, on the request to enter DPMI's
-PM with a 16-bit request, we would just fail the call setting the carry bit
-like the DPMI specification describes. Some buggy 16-bit compiler tools don't
-check the return status and will hang the machine in this case. So, I issue
-an error message and exit the image instead.
-
-"Descriptors exhausted."
-
-An attempt to nest a DPMI client failed in the setup phase due to insufficient
-free selectors in the LDT.
-
-"CWSDPMI not removed"
-
-When the -u parameter is specified, if DPMI is not detected this message is
-printed. Informational.
+CWSDPMI is Copyright (C) 1995-2010 Charles W Sandmann (cwsdpmi@earthlink.net) + 1206 Braelinn, Sugar Land, TX 77479 + +This is release 7. The files in this binary distribution may be redistributed +under the GPL (with source) or without the source code provided: + +* CWSDPMI.EXE or CWSDPR0.EXE are not modified in any way except via CWSPARAM. + +* CWSDSTUB.EXE internal contents are not modified in any way except via + CWSPARAM or STUBEDIT. It may have a COFF image plus data appended to it. + +* Notice to users that they have the right to receive the source code and/or + binary updates for CWSDPMI. Distributors should indicate a site for the + source in their documentation. + +------------------------------------------------------------------------------- + +The purpose of this release is to allow high performance access to large +amounts of physical memory (up to 4GB). Memory above 32-bit address space +(common on machines over 3GB physical memory) will be mapped to fill the +address hole to provide a full 4GB memory. 4MB pages will be automatically +used for large memory requests. Release 5 works well for systems using 256MB +or less of memory; release 7 is useful for quick access to over 500MB. + +Known limitations with 4MB pages: + 1) 4Mb regions are treated as locked (non-pageable). Virtual memory may be + less effective. + 2) DPMI 1.0 extensions to manage page attributes will not work on 4MB pages. + 3) DPMI function 0x503 to resize memory is not supported if it requires the + memory zone to be moved in physical memory and it contains a 4Mb page. +Note: CWSPARAM bit 3, (bitmask 8) can be used to suppress using 4Mb pages. + +CWSDPMI was written to provide DPMI services for V2 of DJGPP. It +does not support 16-bit DPMI applications, or DPMI applications requiring a +built in extender. It does support virtual memory and hardware interrupt +reflection from real mode to protected mode. DJGPP V1.1x and RSX applications +will also run using this server, which can be used to provide enhanced control +over hardware interrupts. Some DPMI 1.0 extensions (0x506, 0x507, 0x508) have +been implemented. + +CWSDPR0.EXE is an alternate version which runs at ring 0 with virtual memory +disabled. It may be used if access to ring-0 features are desired. It +currently does not switch stacks on HW interrupts, so some DJGPP features +such as SIGINT and SIGFPE are not supported and will generate a double fault +or stack fault error (to be fixed someday). + +CWSDSTUB.EXE is a stub loader image for DJGPP which includes CWSDPMI. This +allows single executable image distributions. You can use the EXE2COFF +program and COPY /B CWSDSTUB.EXE+yourimage yourimage.exe to create a +standalone executable image. CWSDSTR0.EXE is the ring 0 stub. + +Some of the internal tuning and configuration parameters may be modified +in the image using CWSPARAM.EXE (see CWSPARAM.DOC). + +If you want to use CWSDPMI with DJGPP, you expand the distribution into the +DJGPP directory tree. CWSDPMI.EXE will be put in the BIN directory with your +DJGPP images and it will automatically be loaded when they run. + +Directions for use (server can be used in either of two different ways): + +1) "cwsdpmi" alone with no parameters will terminate and stay resident + FOR A SINGLE DPMI PROCESS. This means it unloads itself when your + DPMI application exits. This mode is useful in software which needs + DPMI services, since CWSDPMI can be exec'ed and then will unload on exit. + +2) "cwsdpmi -p" will terminate and stay resident until you remove it. + It can be loaded into UMBs with LH. "cwsdpmi -u" will unload the TSR. + +3) The file used for virtual memory swapping, if desired, is controlled + by the "-sc:\cwsdpmi.swp" syntax on the command line. You must specify + either a file with full disk/directory syntax, or "-s-" which disables + virtual memory. If -s is used, it must be the last option on the command + line, since all characters after -s will be treated as the swap file name. + +4) The default swap file name is c:\cwsdpmi.swp, but this can be changed + with the CWSPARAM image, as can some other parameters. + +5) You can disable the DPMI 1.0 extensions by starting the image with the + "cwsdpmi -x" syntax. This feature allows you to run programs developed + under other DPMI providers which do not behave properly with these + extensions enabled (typically use of NULL pointers). + +If you are using an EMM provider for UMBs, CWSDPMI will need to use VCPI. +VCPI memory prevents usage of 4MB pages, so for best performance with an EMM +provider I recommend suppressing VCPI memory. For example, with JEMM386 +this can be done with: JEMM386 LOAD MAX=0 + +I would like to give special thanks to DJ Delorie who wrote the original +GO32 code on which CWSDPMI is based. Morten Welinder also provided and +improved much of the code in this program. + +------------------------------------------------------------------------------- + +This section contains a list of the error messages you might see out of +CWSDPMI and some details on what they mean. + +Exceptions are only handled by CWSDPMI if the application does not establish +an exception handler, exceptions nest 5 deep, or the error is particularly bad: + +"Page fault" - + 1) an illegal page fault happens in a RMCB or HW interrupt, (lock all pages!) + 2) all available pages have been locked, + 3) the application is using non-committed pages for null pointer protection. +"Double Fault" - multiple exceptions occurred +"Invalid TSS" - typically due to RMCB or HW interrupt being called after the + selectors/memory have been deallocated (remember to reset the mouse) +"General Protection Fault" - bad parameter sent to a DPMI call + +"80386 required." + +Since 80286 and lesser processors don't have the hardware necessary to +run CWSDPMI. No workaround, upgrade. + +"DOS 3 required." + +A few interrupts are used which need DOS 3.0 or higher. I don't expect to +ever see this message, since 80386 machines were introduced after DOS 3.0 +and that check is made first. + +"CWSDPMI V0.90+ (r7) Copyright (C) 2010 CW Sandmann ABSOLUTELY NO WARRANTY" + +An informational message displayed if the program is not run in one-pass mode. + +"Protected mode not accessible." + +This message should only be displayed if running CWSDPMI in a protected +environment with no access to protected mode. In this case, DPMI should +already be available and CWSDPMI would not be needed. This might happen if +a 16-bit DPMI client is loaded and a DJGPP image attempts to load CWSDPMI +to provide 32-bit DPMI services under Windows. + +"Warning: cannot open swap file c:\cwsdpmi.swp" + +Maybe you are out of file handles, or the swap file name is incorrectly +specified in the image (change the name with cwsparam). + +"No swap space!" + +This message means you tried to use more swap file than CWSDPMI was +configured to handle. Since this is protected against in the memory +allocation code you should never see this message, except when swapping +is disabled and you run out of DOS memory for page tables (greater than +400MB of memory without 4MB pages). + +"Swap disk full!" + +This means the swap file could not be expanded when trying to swap +memory out to disk. This would normally not be seen, unless you are +writing output to the same disk which holds the swap file. Decrease +the amount of memory your DPMI application is using or free up disk space. + +"Interrupt 0x??" + +Your application tried to call an interrupt from protected mode which +normally shouldn't be called (something like a data pointer). If the +request was allowed to continue it would likely hang your machine. If you +see this message and think the interrupt should be allowed to continue, let +me know. + +"Error: Using XMS switched CPU into V86 mode." + +This message might be seen if you have your memory manager in AUTO mode. The +only workaround in this case is to stop using AUTO mode. + +"Error: could not allocate page table memory" + +The page table memory (a minimum of 16Kb) is allocated from conventional +memory (either in the 640Kb region or UMBs). If CWSDPMI cannot allocate the +minimum necessary memory, you would see this message. Free up some +conventional memory. You may also see this message if a page directory needs +to be faulted in, and there are no available pages. This means too many pages +have been locked for the allocated page tables available. While CWSDPMI +tries to dynamically allocate these if needed, this effort failed. You need +to increase the number of page tables with CWSPARAM, or increase the amount +of free conventional memory if it is low. If the application which calls +CWSDPMI internally manages all the DOS memory, the page tables may need to +be pre-allocated at DPMI startup time (if this is needed, try using the +run option flag 2 in cwsparam). + +"16-bit DPMI unsupported." + +CWSDPMI is a 32-bit only DPMI server. Ideally, on the request to enter DPMI's +PM with a 16-bit request, we would just fail the call setting the carry bit +like the DPMI specification describes. Some buggy 16-bit compiler tools don't +check the return status and will hang the machine in this case. So, I issue +an error message and exit the image instead. + +"Descriptors exhausted." + +An attempt to nest a DPMI client failed in the setup phase due to insufficient +free selectors in the LDT. + +"CWSDPMI not removed" + +When the -u parameter is specified, if DPMI is not detected this message is +printed. Informational. diff --git a/cwsdpmi/bin/cwsdpmi.exe b/cwsdpmi/bin/cwsdpmi.exe Binary files differindex 2285a74..6865892 100644 --- a/cwsdpmi/bin/cwsdpmi.exe +++ b/cwsdpmi/bin/cwsdpmi.exe diff --git a/cwsdpmi/bin/cwsdpr0.exe b/cwsdpmi/bin/cwsdpr0.exe Binary files differindex 1bbac32..565d2f0 100644 --- a/cwsdpmi/bin/cwsdpr0.exe +++ b/cwsdpmi/bin/cwsdpr0.exe diff --git a/cwsdpmi/bin/cwsdstub.exe b/cwsdpmi/bin/cwsdstub.exe Binary files differindex 5388d00..15399ca 100644 --- a/cwsdpmi/bin/cwsdstub.exe +++ b/cwsdpmi/bin/cwsdstub.exe diff --git a/cwsdpmi/bin/cwsparam.doc b/cwsdpmi/bin/cwsparam.doc index 8ed0f97..7c425bf 100644 --- a/cwsdpmi/bin/cwsparam.doc +++ b/cwsdpmi/bin/cwsparam.doc @@ -1,102 +1,103 @@ -CWSPARAM provided by Charles W Sandmann (sandmann@clio.rice.edu)
- 1206 Braelinn, Sugar Land, TX 77479
-CWSPARAM OVERVIEW
-
-There are certain parameters built into the CWSDPMI.EXE, CWSDPR0.EXE, and
-CWSDSTUB.EXE images which might need to be modified for distributing some
-programs for better performance. The modified image could be renamed, and
-then the DPMI server name in a DJGPP V2 image may be stubedited to use the
-new name. CWSPARAM can also be run directly on images created by appending
-COFF images to CWSDSTUB.EXE. The parameters which can be modified are
-discussed below:
-
-Full name of paging file ("" to disable) ? [c:\cwsdpmi.swp]
-
- This is where the file which provides virtual memory should be located. It
- may be desirable to change the default to a faster disk or one with more
- free space. To disable paging, enter two double quotes. The file name
- MUST contain the disk, full path, and file name. Anything less may cause
- unpredictable behavior. The maximum length of the name is 48 characters,
- and it must be a DOS 8.3 style name. Press return to keep the current value.
-
-Number of page tables to initially allocate (0=auto) ? [0]
-
- Page tables are stored in the DOS memory area and consume this precious
- resource. The default value of 0 chooses automatic allocation of enough
- page tables to hold all of the physical memory without paging (with the
- minimum enough to hold 20Mb without paging and a maximum to hold 128Mb).
- If your program is a fixed size (and does not spawn any other DPMI images)
- you can specify one page table for each 4Mb of your program's size. If
- your program is small, this can save a small amount of DOS memory, which
- might be needed for other purposes. If your program is large (typically
- larger than the physical memory) specifying a number will consume more DOS
- memory but improve performance since the page tables themselves will not
- page. CWSDPMI will attempt to dynamically allocate additional page tables
- at run time to prevent paging, but if all of the DOS memory is free,
- performance would be degraded. Remember to add an extra page table if
- mapping physical devices. As of r5, you must also allocate additional
- space for the bitmaps for physical and virtual memory (one bit for each
- 4K page). Add one page for each 128Mb of total address space
- (physical+virtual). Be generous, since someone may run the image on a
- 512Mb machine (or larger) and require 4 pages for the physical bitmap
- even if you disable virtual memory.
-
-Minimum application memory desired before 640K paging ? [512Kb]
-
- Typically, CWSDPMI only uses extended memory to return as DPMI memory, and
- saves the DOS memory area for DOS requests. On small memory machines with
- applications not needing much DOS memory (or poorly tuned memory management)
- there may be very little extended memory left available, with up to 600K of
- DOS memory unused. This parameter determines the threshold which CWSDPMI
- should start using DOS memory as DPMI memory. If an application is known to
- not need much DOS memory, this value could be set to the size of the memory
- required for the image, which provides roughly 0.5Mb additional memory before
- paging happens. This parameter is one I would expect might be adjusted when
- distributing an application for maximum performance on a wide variety of
- machines.
-
-Paragraphs of DOS memory to reserve when 640K paging ? [3840]
-
- If the image needs to page in the DOS memory area (triggered by the parameter
- value above), this parameter tells how much DOS memory to save for DOS
- allocation requests. The value is in paragraphs (16 byte increments), so the
- default is 60Kbytes. You will actually end up with a bit more probably, since
- the page tables are allocated on 4Kbyte rounded boundaries. Some amount of
- DOS memory needs to be saved for potentially expanding the file table, the
- sbrk() algorithm, DMA buffers, etc. This amount can be tuned on an image
- by image basis, and may be as little as 0.
-
-Paragraphs of memory for extra CWSDPMI internal heap ? [256]
-
- CWSDPMI is built with an internal 4K heap. Each nested task consumes around
- 300 bytes, each memory zone takes 12 bytes, and each HW interrupt (nested)
- takes around 850 bytes. If extra DOS memory is available, the additional
- paragraphs specified here are added to the heap at execution time by DOS.
- The 8K default should be good for up to 40Mb in small requests. If you
- compile very large C++ programs or allocate lots of memory in small pieces,
- you might need to bump this parameter. If you are very tight on memory,
- you could decrease it to zero and pick up another 4K of DOS memory. Each
- paragraph allows a little more than one more memory zone (or in the worse
- case around 85Kb of DPMI memory).
-
-Maximum size of swap file ? [128Mb]
-
- CWSDPMI dynamically allocates memory at run time for up to 2044Mb of swap file
- space. The bitmap for the swap usage requires 32 bytes of memory per 1Mb of
- swap usage. The default will provide up to 128Mb of swap space with a run
- time memory requirement of 4Kb DOS memory. The dynamic allocation is limited
- by the free space on the drive, so if you don't have much space on your hard
- drive, you don't need to worry about this. If you run small programs and want
- to save memory (maybe to stuff the allocation in a UMB) you can decrease this
- value. If you want to run monster programs needing 2Gb of address space you
- can increase this value (but this would increase the DOS memory usage). This
- value is ignored by CWSDPR0.
-
-Value of run option flags ? [0]
-
- There are a few run-time options in CWSDPMI which should not be needed by most
- users which can be activated by this field of bit flags:
- Bit 0 (1): Disable allocation of run time page tables in UMBs (low only)
- Bit 1 (2): Pre-allocate page table memory (in DPMI memory request)
- Bit 2 (4): Disable DPMI 1.0 extensions (Null page protection, mapping)
- Other values should be zero for future compatibility but are currently ignored.
+CWSPARAM provided by Charles W Sandmann (cwsdpmi@earthlink.net) + 1206 Braelinn, Sugar Land, TX 77479 +CWSPARAM OVERVIEW + +There are certain parameters built into the CWSDPMI.EXE, CWSDPR0.EXE, and +CWSDSTUB.EXE images which might need to be modified for distributing some +programs for better performance. The modified image could be renamed, and +then the DPMI server name in a DJGPP V2 image may be stubedited to use the +new name. CWSPARAM can also be run directly on images created by appending +COFF images to CWSDSTUB.EXE. The parameters which can be modified are +discussed below: + +Full name of paging file ("" to disable) ? [c:\cwsdpmi.swp] + + This is where the file which provides virtual memory should be located. It + may be desirable to change the default to a faster disk or one with more + free space. To disable paging, enter two double quotes. The file name + MUST contain the disk, full path, and file name. Anything less may cause + unpredictable behavior. The maximum length of the name is 48 characters, + and it must be a DOS 8.3 style name. Press return to keep the current value. + +Number of page tables to initially allocate (0=auto) ? [0] + + Page tables are stored in the DOS memory area and consume this precious + resource. The default value of 0 chooses automatic allocation of enough + page tables to hold all of the physical memory without paging (with the + minimum enough to hold 20Mb without paging and a maximum to hold 128Mb). + If your program is a fixed size (and does not spawn any other DPMI images) + you can specify one page table for each 4Mb of your program's size. If + your program is small, this can save a small amount of DOS memory, which + might be needed for other purposes. If your program is large (typically + larger than the physical memory) specifying a number will consume more DOS + memory but improve performance since the page tables themselves will not + page. CWSDPMI will attempt to dynamically allocate additional page tables + at run time to prevent paging, but if all of the DOS memory is free, + performance would be degraded. Remember to add an extra page table if + mapping physical devices. As of r5, you must also allocate additional + space for the bitmaps for physical and virtual memory (one bit for each + 4K page). Add one page for each 128Mb of total address space + (physical+virtual). Be generous, since someone may run the image on a + 512Mb machine (or larger) and require 4 pages for the physical bitmap + even if you disable virtual memory. + +Minimum application memory desired before 640K paging ? [512Kb] + + Typically, CWSDPMI only uses extended memory to return as DPMI memory, and + saves the DOS memory area for DOS requests. On small memory machines with + applications not needing much DOS memory (or poorly tuned memory management) + there may be very little extended memory left available, with up to 600K of + DOS memory unused. This parameter determines the threshold which CWSDPMI + should start using DOS memory as DPMI memory. If an application is known to + not need much DOS memory, this value could be set to the size of the memory + required for the image, which provides roughly 0.5Mb additional memory before + paging happens. This parameter is one I would expect might be adjusted when + distributing an application for maximum performance on a wide variety of + machines. + +Paragraphs of DOS memory to reserve when 640K paging ? [3840] + + If the image needs to page in the DOS memory area (triggered by the parameter + value above), this parameter tells how much DOS memory to save for DOS + allocation requests. The value is in paragraphs (16 byte increments), so the + default is 60Kbytes. You will actually end up with a bit more probably, since + the page tables are allocated on 4Kbyte rounded boundaries. Some amount of + DOS memory needs to be saved for potentially expanding the file table, the + sbrk() algorithm, DMA buffers, etc. This amount can be tuned on an image + by image basis, and may be as little as 0. + +Paragraphs of memory for extra CWSDPMI internal heap ? [256] + + CWSDPMI is built with an internal 4K heap. Each nested task consumes around + 300 bytes, each memory zone takes 12 bytes, and each HW interrupt (nested) + takes around 850 bytes. If extra DOS memory is available, the additional + paragraphs specified here are added to the heap at execution time by DOS. + The 8K default should be good for up to 40Mb in small requests. If you + compile very large C++ programs or allocate lots of memory in small pieces, + you might need to bump this parameter. If you are very tight on memory, + you could decrease it to zero and pick up another 4K of DOS memory. Each + paragraph allows a little more than one more memory zone (or in the worse + case around 85Kb of DPMI memory). + +Maximum size of swap file ? [128Mb] + + CWSDPMI dynamically allocates memory at run time for up to 2044Mb of swap file + space. The bitmap for the swap usage requires 32 bytes of memory per 1Mb of + swap usage. The default will provide up to 128Mb of swap space with a run + time memory requirement of 4Kb DOS memory. The dynamic allocation is limited + by the free space on the drive, so if you don't have much space on your hard + drive, you don't need to worry about this. If you run small programs and want + to save memory (maybe to stuff the allocation in a UMB) you can decrease this + value. If you want to run monster programs needing 2Gb of address space you + can increase this value (but this would increase the DOS memory usage). This + value is ignored by CWSDPR0. + +Value of run option flags ? [0] + + There are a few run-time options in CWSDPMI which should not be needed by most + users which can be activated by this field of bit flags: + Bit 0 (1): Disable allocation of run time page tables in UMBs (low only) + Bit 1 (2): Pre-allocate page table memory (in DPMI memory request) + Bit 2 (4): Disable DPMI 1.0 extensions (Null page protection, mapping) + Bit 3 (8): Disable use of 4MB pages (very large memory support) + Other values should be zero for future compatibility but are currently ignored. diff --git a/cwsdpmi/bin/mswitch.asm b/cwsdpmi/bin/mswitch.asm deleted file mode 100644 index 32df5ed..0000000 --- a/cwsdpmi/bin/mswitch.asm +++ /dev/null @@ -1,536 +0,0 @@ -; Copyright (C) 1995-2002 CW Sandmann (sandmann@clio.rice.edu) 1206 Braelinn, Sugar Land, TX 77479
-; Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
-;
-; This file is distributed under the terms listed in the document
-; "copying.cws", available from CW Sandmann at the address above.
-; A copy of "copying.cws" should accompany this file; if not, a copy
-; should be available from where this file was obtained. This file
-; may not be distributed without a verbatim copy of "copying.cws".
-;
-; This file is distributed WITHOUT ANY WARRANTY; without even the implied
-; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-; Modified for VCPI Implement by Y.Shibata Aug 5th 1991
-; Modified for PC98 A20 line control by kaho Aug 5 1998
-
- title switch between real and protected mode
- include segdefs.inc
- include tss.inc
- include gdt.inc
- include vcpi.inc
-
-;------------------------------------------------------------------------
-
- start_data16
-
- extrn _gdt:gdt_s
- extrn _gdt_phys:gdt_s
- extrn _idt_phys:gdt_s
- extrn _tss_ptr:word
- extrn _use_xms:byte
- extrn _hard_master_lo:byte
- extrn _hard_master_hi:byte
- extrn _hard_slave_lo:byte
- extrn _hard_slave_hi:byte
- extrn _mtype:byte
-
- extrn _vcpi_installed:byte ;VCPI Installed set this not Zero
- extrn _vcpi_entry:fword
- extrn _abs_client:dword
- extrn _DPMIsp:word
- extrn _saved_interrupt_vector:dword
-
- end_data16
- start_bss
-
- public _dr
-_dr label dword
-_dr0 dd ?
-_dr1 dd ?
-_dr2 dd ?
-_dr3 dd ?
- dd ?
- dd ?
-_dr6 dd ?
-_dr7 dd ?
-
- public _c_tss, _a_tss, _o_tss, _f_tss
-_c_tss label tss_s ; for "real mode" state
- db type tss_s dup (?)
-_a_tss label tss_s ; for running program
- db type tss_s dup (?)
-_o_tss label tss_s ; for convenience functions
- db type tss_s dup (?)
-_f_tss label tss_s ; for page handling
- db type tss_s dup (?)
-
- public _features
-_features dd ? ; CPUID features
- public _was_exception
-_was_exception db ? ; exceptions set this to 1
-
- end_bss
-
-;------------------------------------------------------------------------
-
- start_code16
-
- extrn _xms_local_enable_a20:near
- extrn _xms_local_disable_a20:near
-
-real_stack dd ?
-real_idt dw 03ffh, 0000h, 0000h
-
- public _go32
-_go32 proc near
- push si
- push di
- push bx
-_go32_1:
-; push 0b000h ;dbg
-; pop fs ;dbg
-; mov word ptr fs:[0f01h],07h ;dbg - normal
- mov ax,DGROUP ; Compute physical offset
- xor dx,dx ; of tss_ptr
- shld dx,ax,4 ; Seg * 16
- shl ax,4
- add ax,_tss_ptr ; plus tss_ptr
- adc dx,0
- mov _gdt[g_atss].base0,ax ; Trick here - make atss
- mov _gdt[g_atss].base1,dl ; selector point to
- mov _gdt[g_atss].base2,dh ; tss_ptr (jmpt g_atss)
-
-
- mov al,0fdh ; clear busy flag
- and byte ptr _gdt[g_atss].stype,al
- and byte ptr _gdt[g_ctss].stype,al ; non-VCPI LDTR below
-
- mov _was_exception,0
-
-; set real_stack for return from _go32
- mov word ptr cs:real_stack,sp
- mov word ptr cs:real_stack+2,ss
- movzx esp,sp ; make sure it's OK
-
- cli
-
- cmp _vcpi_installed,0
- je short real_to_protect ;Not VCPI Mode
- mov esi,_abs_client
- mov ax,VCPI_MODE_CHANGE
- int VCPI_REQ ;Change Protect Mode
-;end_loop0:
-; jmp short end_loop0 ;Never Come here!! Safety Loop
-
-real_to_protect:
- call _set_a20
- or _gdt[g_rdata].lim1,40h ;Set the big bit (non-vcpi only)
- lgdt fword ptr _gdt_phys
- lidt fword ptr _idt_phys
-
- mov eax,cr0
- or al,1
- mov cr0,eax ; we're in protected mode!
- db 0eah ; far jmp
- dw offset go_protect_far_jump
- dw g_rcode
-;
-; Entry Protect Mode
-;
- public _protect_entry
-_protect_entry label near
-
-go_protect_far_jump:
- cli
- mov ax,g_rdata
- mov ds,ax
- mov es,ax
- mov fs,ax
- mov gs,ax
- mov ss,ax
- movzx esp,word ptr cs:real_stack ;Need VCPI Inialize
- xor eax,eax
- mov cr2,eax ;zero so we can tell INT 0E from page fault
-
- mov eax,_dr0
- mov dr0,eax
- mov eax,_dr1
- mov dr1,eax
- mov eax,_dr2
- mov dr2,eax
- mov eax,_dr3
- mov dr3,eax
- mov eax,_dr6
- mov dr6,eax
- mov eax,_dr7
- mov dr7,eax
-
- test byte ptr _features,8 ;Page Size Extensions?
- jz short nopse
- db 0fh,20h,0e0h ;mov eax,cr4
- or al,10h ;Enable 4Mb pages
- db 0fh,22h,0e0h ;mov cr4,eax
-nopse:
-
- cmp _vcpi_installed,0
- jne short no_tss_load ;Now Paging Mode in VCPI
- mov bx,_tss_ptr
- mov eax,[bx].tss_cr3
- or eax,eax ;Test for zero
- je short set_paging_far_jump
- mov cr3,eax
- mov eax,cr0
- or eax,80000000h
- mov cr0,eax ; paging enabled!
- db 0eah ; far jmp
- dw offset set_paging_far_jump
- dw g_rcode
-set_paging_far_jump:
- mov ax,g_ctss
- ltr ax
- jmp short no_tss_load ; Chip errata fix from Symantec
-no_tss_load:
- jmpt g_atss ; load state from VCPU
-
-_go32 endp
-
-; _go_real_mode must follow the task jump, so a task jump to return
-; is valid
-
- public _go_real_mode
-_go_real_mode proc near
-
- mov eax,dr6
- mov _dr6,eax
-
- cmp _vcpi_installed,0
- je short protect_to_real
-
-;Make VCPI call to return to real
- clts ;TS Clear
- mov eax,DGROUP
- push eax ;GS
- push eax ;FS
- push eax ;DS
- push eax ;ES
- push eax ;SS
- movzx eax,word ptr cs:real_stack
- push eax ;ESP
- pushfd ;EFLAGS
- mov ax,_TEXT ;high word still zero
- push eax ;CS
- mov ax,offset back_to_v86 ;high word still zero
- push eax ;EIP
-; movzx esp,sp
-
- mov ax,g_core
- mov ds,ax
- mov ax,VCPI_MODE_CHANGE
- assume es:DGROUP
- call fword ptr es:_vcpi_entry
-;end_loop1:
-; jmp short end_loop1 ;Never Come here!! Safety Loop
-
-protect_to_real:
- and _gdt[g_rdata].lim1,0bfh ;Clear the big bit (non-vcpi only)
- push ss
- pop ss ;Reload
- mov eax,cr0
- and eax,07ffffff6h ; clear PE, TS, PG
- mov cr0,eax
-
- db 0eah ; far jmp
- dw offset back_to_real_far_jump
- dw _TEXT
-;
-; Entry Real Mode
-;
-back_to_real_far_jump:
-
- lidt fword ptr cs:real_idt
- lss sp,cs:real_stack
-back_to_v86:
-
- mov ax,ss
- mov ds,ax
- mov es,ax
- mov fs,ax
- mov gs,ax
-
-; call _reset_a20
-
- cmp _was_exception,0
- je short not_hard
-
- mov bx,_tss_ptr
- mov al,[bx].tss_irqn
-
-; push 0b000h ;dbg
-; pop fs ;dbg
-; mov ah, 70h ;dbg - reverse
-; mov word ptr fs:[0f00h],ax ;dbg
-
- mov bx,16 ;pseudo IRQ
- cmp al,1ch
- je short is_hard_1
- xor bx,bx ;IRQ base
- cmp al,_hard_master_lo
- jb short try_slavepic
- cmp al,_hard_master_hi
- jbe short is_hard
-try_slavepic:
- mov bl,8 ;IRQ base
- cmp al,_hard_slave_lo
- jb short not_hard
- cmp al,_hard_slave_hi
- ja short not_hard
-
-is_hard:
-; mov cl,_hard_slave_lo
-; add cl,5
-; cmp al,cl
-; je short not_hard ; for NPX errors
-
-; mov cl,_hard_master_lo
-; inc cl
-; cmp al,cl
-; je short not_hard ; to check for ^C
-
- mov ah,al
- and ah,7 ; IRQ offset
- add bl,ah ; IRQ #
-is_hard_1:
- shl bx,2
- add bx,offset _saved_interrupt_vector ;ES is already DS
- cmp word ptr [bx+2],0
- jne short redirect
-
- push 0 ; Not redirected, use interrupt table
- pop es
- movzx bx,al
- shl bx,2 ; 4 bytes per interrupt entry
-redirect:
- push _DPMIsp ; Needed for RMCB's to be recursive
- mov _DPMIsp,sp
- sub _DPMIsp,spare_stack
- push 3002h
- call dword ptr es:[bx] ; Really an interrupt
- pop _DPMIsp
- jmp _go32_1
-
-not_hard:
- pop bx
- pop di
- pop si
- ret
-
-_go_real_mode endp
-
-;------------------------------------------------------------------------
- public _reset_a20
-_reset_a20 proc near
- cmp _vcpi_installed,0
- jne short reset_a20_nop
- cmp _use_xms,0
- je short reset_a20_local
- call _xms_local_disable_a20
-reset_a20_nop:
- ret
-
-reset_a20_pc98:
- mov al,3
- out 0f6h,al ; disable the A20 line
- ret
-reset_a20_local:
- cmp _mtype,0 ; PC98 raw mode
- jne short reset_a20_pc98
- in al,092h ; 092h PS/2 & clone system control port "A"
- and al,not 2 ; this resets the A20 bit in register al
- jmp short $+2 ; forget the instruction fetch
- out 092h,al ; set the A20 bit off
- ret
-_reset_a20 endp
-
- public _set_a20
-_set_a20 proc near
- cmp _vcpi_installed,0
- jne short set_a20_nop
- call check_a20 ; If already enabled skip A20 enable
- jz short set_a20_nop
- cmp _use_xms,0
- je short set_a20_local
- call _xms_local_enable_a20
-set_a20_nop:
- ret
-
-set_a20_pc98:
- mov al,2
- out 0f6h,al ; enable the A20 line
- ret
-set_a20_local:
- cmp _mtype,0 ; PC98 raw mode
- jne short set_a20_pc98
- pushf
- cli
-
- in al,092h ; 092h PS/2 & clone system control port "A"
- or al,2 ; this sets the A20 bit in register al
- jmp short $+2 ; forget the instruction fetch
- out 092h,al ; set the A20 bit on
-
- call check_a20
- jz short a20_done
-
-need_to_set_a20:
- call waitkb
- mov al,0d1h
- out 64h,al
- call waitkb
- mov al,0dfh ; Patrick
- out 60h,al
- call waitkb
- mov al,0ffh ; Patrick
- out 64h,al ; Patrick
- call waitkb ; Patrick
-
-wait_for_valid_a20:
- call check_a20
- jnz short wait_for_valid_a20
-a20_done:
- popf
- ret
-
-; interrupts disabled, ax, dx, es destroyed, returns z bit if a20 enabled
-check_a20:
- ; Modified by Prashant TR - don't use fs and gs here before switching
- ; to protmode. FS/GS left from TC++ 3.0 can kill us when we come here.
- push bx
- push ds
- xor ax,ax ; zero it
- mov ds,ax
- dec ax ; ax = 0ffffh
- mov es,ax
- xor bx,bx
-
- mov ax,ds:[bx] ; word from 0:0 (int 0 interrupt)
- mov dx,ax ; save it
- not ax ; make a different value
- xchg ax,es:[bx+10h] ; modify ffff:10h to known different value
- xchg cx,ds:[bx] ; get ds:[0] with a write
- cmp dx,cx ; compare 0:0 with saved; z bit if same = a20
- mov es:[bx+10h],ax ; restore
- mov ds:[bx],dx
-
- pop ds
- pop bx
- ret
-
-waitkb:
- xor cx,cx ; zero it
-waitkb1:
- jmp short $+2
- jcxz short $+2
- in al,64h
- test al,2
- loopnz waitkb1
- ret
-_set_a20 endp
-
-;------------------------------------------------------------------------
-
- public _cpumode ; 0=real mode, 1=V86
-_cpumode:
- smsw ax
- and ax,1
- ret
-
-;------------------------------------------------------------------------
-; Determination of Cpu type. EAX, EBX, ECX, EDX destroyed.
-; 0 for 8086/80186
-; 2 for 80286
-; 3 for 386
-; 4 for 486
-; 5 for 586 (Pentium) or better (thanks, Morten!)
-
-cpuid macro
- db 0fh,0a2h
- endm
-
- public _cputype ; from Intel 80486 reference manual
-_cputype:
- xor cx,cx ; default type is 8086
- pushf
- pop bx
- and bh,0fh
- push bx
- popf
- pushf
- pop ax
- and ax,0f000h
- cmp ax,0f000h
- jz short cpu8086
- or bh,0f0h
- push bx
- popf
- pushf
- pop ax
- and ax,0f000h
- jz short cpu286
-
- mov dx,sp ; Save old SP
- and sp,not 3 ; Align it! (we will set AC flag)
- mov al,18 ; AC flag number
- call cpuflipflag
- mov sp,dx
- jnc short cpu386
- mov al,21 ; ID flag number
- call cpuflipflag
- jnc short cpu486
-
-;The cpu supports the CPUID instruction. Maybe Pentium or late 486?
- xor eax,eax
- cpuid ; ebx:edx:ecx = vendor id; eax = max support
- or eax,eax
- mov al,5
- jz short cpu_pentium
- xor eax,eax
- inc ax ; call with eax = 1
- cpuid ; edx=features; ah&0f = family; al=model/step
- mov al,ah
- mov _features,edx
-cpu_pentium:
- and ax,0fh
- ret
-cpu486:
- inc cx
-cpu386:
- inc cx
-cpu286:
- inc cx
- inc cx
-cpu8086: ; or 186
- mov ax,cx
- ret
-
-cpuflipflag: ; Try to flip flag #Al in Eflags, Return C=1 if possible
- push si ; This plus the pushed ret address still stack aligned
- movzx esi,al
- pushfd
- pop eax
- mov ebx,eax
- btc eax,esi
- push eax
- popfd
- pushfd
- pop eax
- xor eax,ebx
- push ebx
- popfd
- bt eax,esi
- pop si
- ret
-;------------------------------------------------------------------------
-
- end_code16
-
- end
diff --git a/cwsdpmi/bin/readme.upd b/cwsdpmi/bin/readme.upd deleted file mode 100644 index 6d7cdec..0000000 --- a/cwsdpmi/bin/readme.upd +++ /dev/null @@ -1,11 +0,0 @@ -This is an update of the r5 distribution for testing purposes. It is a test
-version! The copyright banner has an updated year but the images are very
-similar to the standard r5 binaries. Three bug fixes:
-
-1) Test of PSE feature checks correct bit (removes warnings with BOCHS).
-2) Load ESP properly to clear upper bits with VCPI servers setting them
- (Martin, please test!)
-3) Serializing jump to avoid Pentium III bug hang (Symantec bug).
-
-MSWITCH.ASM includes all three changes. The copyright year is also changed
-in control.c - but a single byte change isn't worth including here.
diff --git a/cwsdpmi/manifest/csdpmi5b.mft b/cwsdpmi/manifest/csdpmi5b.mft deleted file mode 100644 index b8e2f91..0000000 --- a/cwsdpmi/manifest/csdpmi5b.mft +++ /dev/null @@ -1,8 +0,0 @@ -manifest/csdpmi5b.mft
-manifest/csdpmi5b.ver
-bin/cwsdpmi.doc
-bin/cwsdpmi.exe
-bin/cwsdpr0.exe
-bin/cwsparam.doc
-bin/cwsparam.exe
-bin/cwsdstub.exe
diff --git a/cwsdpmi/manifest/csdpmi5b.ver b/cwsdpmi/manifest/csdpmi5b.ver deleted file mode 100644 index 2aebd47..0000000 --- a/cwsdpmi/manifest/csdpmi5b.ver +++ /dev/null @@ -1 +0,0 @@ -csdpmi5b CWSDPMI binary distribution (release 5)
diff --git a/readmes/dos b/readmes/dos index 13b9764..d62c71c 100644 --- a/readmes/dos +++ b/readmes/dos @@ -7,8 +7,15 @@ CWSDPMI can be downloaded from: http://clio.rice.edu/cwsdpmi/ -NASM itself is distributed under the terms of the GNU Lesser General -Public License (LGPL), version 2.1, or at your option, any later -version. See the file COPYING. NASM can be downloaded from: + NASM, the Netwide Assembler. + +Many many developers all over the net respect NASM for what it is +- a widespread (thus netwide), portable (thus netwide!), very +flexible and mature assembler tool with support for many output +formats (thus netwide!!). + +NASM itself is distributed under the terms of the "simplified" +(2-clause) BSD license. See the file LICENSE. NASM can be downloaded +from: http://www.nasm.us/ |