Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : QWHITE13.ZIP
Filename : STLTECH.TEC

 
Output of file : STLTECH.TEC contained in archive : QWHITE13.ZIP

ID:QS QEMM-386's Stealth Technology
Quarterdeck Technical Note #168 Filename: STLTECH.TEC
by Michael Bolton CompuServe: STTECH.ZIP
Last revision: 23 March 1993 Category: QEMM

Subject: An overview of QEMM-386's Stealth technology -- how it works, why it
works so well, and what can cause complications for it.


Q: What is Stealth?
Q: How does Stealth work?
Q: What is the difference between ST:M and ST:F?
Q: Which Stealth strategy is preferable?
Q: What machines are supported by QEMM-386's Stealth?
Q: Does Stealth slow down my system?
Q: How can Stealth fail?
Q: If I'm having problems with Stealth, what should I do?


Q: What is Stealth?
-------------------
Traditionally, 386 memory managers such as QEMM-386 have been able to create
High RAM by associating physical extended memory with unused addresses between
640K and 1MB. Quarterdeck's Stealth technology (new to version 6 of QEMM-386)
is QEMM-386's method of creating more High RAM than previously thought
possible, by mapping memory to addresses that are used by system, video, disk,
and other ROMs.


Q. How does Stealth work?
-------------------------
To understand how Stealth works, it is useful to understand the concept of
MAPPING.

MAPPING is the process by which memory management hardware and software can
make memory appear in appropriate places at appropriate times; it's the
process of associating memory with an address. The exPANded memory
specification (EMS) uses mapping to make portions of exPANded memory appear
inside the EMS Page Frame when that memory is requested by a program. When a
program needs more memory than what is normally available to it under DOS, it
can request that some exPANded memory be allocated from either an EMS board,
or from the EMS memory created by a 386 exPANded memory manager. ExPANded
memory has no DOS addresses of its own, but can be made to appear at a valid
DOS address -- "mapped in". ExPANded memory pages that are not currently
needed may be "mapped out" -- relieved of their DOS addresses and put back
into the exPANded memory pool, with code and data still intact. When the
application needs these pages, they are "mapped in" to the EMS page frame
again. It is therefore possible for a program that uses exPANded memory to
have access to much more memory than DOS itself can see of its own accord.
You may know this technology as "bank switching", which is one of the
techniques used to extend and add power to everything from mainframe computers
to high-end UNIX systems... to DOS machines!

Mapping is also useful for creating High RAM; in the same way as detailed
above, expanded memory can be associated with unused addresses between 640K
and 1MB. The EMS hardware and software co-operate to make memory appear where
there is otherwise none.

Stealth uses mapping for a new purpose. The 386 (or 486) chip can
be made to map memory in or out of DOS's address space at any time. Stealth
uses 386 mapping to map system, disk, or video ROMs in and out of DOS's
address space when appropriate, using one of two strategies -- ST:M and ST:F.


Q. What is the difference between ST:M and ST:F?
------------------------------------------------
ROMs on your system are accessed via interrupts -- which are conceptually
similar to BASIC subroutines. When your system boots up, it sets up something
called an interrupt vector table. This is a list of addresses where specific
ROM subroutines can be found. When a program on your system needs a certain
ROM function (for example, writing coloured text to the screen), it sets up
some data in appropriate places, and then calls the interrupt with a processor
INT instruction. The processor then looks at the interrupt vector table to
find out the address where the ROM function can be found. The calling program
jumps to that address, the ROM subroutine gets run, and then control is
returned to the calling program.

When you use Stealth, as your system boots, QEMM-386 takes control of
interrupts that are in use by the ROMs on your system, and points those
interrupts into itself. This way, QEMM-386 can monitor exactly when a ROM
interrupt occurs, and can manage the interrupt appropriately.

When you use ST:M ("Map Mode"), QEMM-386 maps system, video, disk ROMs, and
any other "Stealthable" ROMs out of the first megabyte to addresses elsewhere
in the processor's memory map. (For information on what is "Stealthable", see
"How can Stealth fail?" below.) When the ROM is needed by the system,
QEMM-386 maps the appropriate ROM code into the expanded memory page frame.
The ROM code now has a valid DOS address at which it can execute, and it does
so normally. When the ROM routine is finished, QEMM-386 then remaps the ROM
elsewhere outside of DOS's address space.

When you use ST:F ("Frame Mode"), QEMM-386 leaves the system, video, and disk
ROMs where they are normally found. QEMM-386 then maps the EMS page frame to
such that it lies on top of a ROM. Expanded memory can then be mapped into
the EMS page frame. When the ROM that has been hidden by the page frame is
needed, QEMM-386 momentarily disables expanded memory usage and maps the page
frame out of DOS's address space, exposing the ROM beneath. The ROM code then
executes normally. When the ROM routine is finished, QEMM-386 can then
re-enable the EMS page frame, and lie it back down over the ROM.


Q. Which Stealth strategy is preferable?
----------------------------------------
Since ST:M is capable of mapping almost all ROMs out of DOS's address space,
and thus leaves you with much more High RAM, it is the better of the two
options. ST:F should only be needed on a very small number of systems; its
object is to ensure compatibility with machines that have ROMs that jump to
each other without using an interrupt to do so.


Q. I have to have a special version of QEMM-386 so that Stealth will work on
my system, right? My system has to be one that Stealth knows about, right?
------------------------------------------------------------------------------
No to both questions! Stealth is desiged to work on ANY system, regardless of
brand, model, or ROM BIOS revision. You do not need a special version of
QEMM-386 or Stealth that has been customized for your machine, because
Stealth's strategy merely remaps you ROMs instead of replacing them. Stealth
does not modify, compress or replace your ROM BIOS, and it does not depend on
being aware of the brand or revision of your ROMs. Additionally, Stealth will
typically create more High RAM on your system than any other memory management
technique. You do not have to disable any of QEMM-386's features -- EMS, XMS,
or VCPI memory management -- as other memory managers force you to do in order
to squeeze every last byte of High RAM from your system.


Q. Does Stealth slow my system down?
------------------------------------
Stealth does add some tiny amount of overhead to ROM BIOS interrrupts. Since
most application programs spend very little time calling ROM code, the
slowdowns are usually imperceptible or insignificant to the user. Ironically,
since benchmark programs often call ROM interrupts repeatedly (some do almost
nothing but this), the greatest slowdown will be seen in benchmark results;
these results rarely have much to do with the speed of useful programs,
however. Since your application programs typically have much more
conventional memory to deal with when Stealth is invoked, you are much more
likely to observe faster performance. It should be noted that QEMM-386's ROM
parameter can provide significant performance increases. Using Stealth with
the ROM parameter is typically significantly faster than not using QEMM-386 at
all.


Q. How can Stealth fail?
------------------------
Stealth is a robust and proven technology. However, some programs and some
system ROM implementations can interfere with Stealth's strategies. Note that
the problems described here are infrequent and/or system-specific, and that
most users will experience no difficulty at all with Stealth.

Note that in the above description of how Stealth works, each strategy depends
on a processor interrupt being asserted. This is the normal way of calling a
piece of ROM code; processor registers are loaded with data and with
information which denotes exactly which ROM service is being requested, and
then a processor INT instruction is called. BASIC programmers will recognize
that this is similar to the process of loading a few variables with data, and
then calling a subroutine with a GOSUB instruction; most good texts favour
this method of programming. However, it is possible (though relatively
uncommon) for a piece of ROM code to JUMP to a specific address without
asserting an interrupt. This is analogous to a BASIC GOTO, rather than a
GOSUB; GOTOs are frowned upon by expert programmers, since a GOTO presumes
that the address to which the code is jumping will remain constant and
unchanging. This is less of a problem if one person writes all the code,
since it is easier for one person to keep track of the proper destination
addresses; when more than one person is involved, it's more difficult to
determine why and where the code should branch.

Prudent programmers do not depend on ROM code being at a specific address,
since the code's address could easily vary when the ROM code is revised (and,
like any software, ROM code is constantly under revision). Programs that jump
to an invalid ROM address (and therefore invalid code) will quickly crash in
ANY circumstance. In the case of a direct jump to ROM code when Stealth is
invoked, QEMM-386 will not be able to intercept an interrupt, and thus may not
have a chance to make sure that the appropriate portion of the ROM code is
mapped into the page frame (ST:M). In such circumstances, ST:F may be
helpful, since the Page Frame will be made to disappear, exposing the ROM
beneath, and will not reappear until after the ROM BIOS call is completely
done.

* Many ROM-BIOS-based system setup programs exhibit this same sort of
behaviour, as do installation routines for some video cards. If you wish to
run such programs, it is far better to disable QEMM-386 temporarily than to
sacrifice the large amounts of extra High RAM that ST:M can provide. Setup
programs should need to be run infrequently, and typically require a reboot
before the modified settings take effect. High RAM is generally much more
useful. It is worth weighing the benefits of instant access to your setup
program against the extra High RAM that Stealth can provide; the decision
should not be a difficult one.

The easiest way to deal with this is to disable QEMM-386, run your Setup
program, and reboot with QEMM-386 active again. To disable QEMM-386
temporarily, hold down the key immediately after you hear a beep on
bootup. QEMM-386 will post a message telling you to press to unload
QEMM-386, or any other key to continue with QEMM-386. Press , and run
your Setup program. Reboot the machine normally (without holding down ;
your revised Setup will be in effect, and so will QEMM-386.

* Some programs find the address of a given piece of ROM at startup, and then
jump directly to that address later on, at a time when the ROM may not be
mapped into memory. Programs like these will often require that a portion of
the ROM be EXCLUDEd on the QEMM386.SYS line in CONFIG.SYS.

* Some ROMs do not have any interrupts pointing to them at startup. If this
is the case, QEMM-386 will not be able to detect where a given interrupt
should point, and thus may not invoke Stealth for that ROM. Some device
drivers refuse to load unless they see an interrupt pointing to its normal
location; these programs can be loaded before QEMM-386 if necessary.

* Some programs make invalid assumptions about the EMS page frame. In some
cases, programs assume that the state of the EMS page frame will remain
unchanged even after they abandon an EMS handle; this is akin to assuming that
you can get your property back after leaving it at the end of the driveway on
garbage pick-up day. This fails with Stealth because, by default, the page
frame is immediately unmapped after a handle has been abandoned -- as if, in
the above example, the city picks up the garbage pretty much immediately -- as
soon as you get back into your house. The UFP:N parameter suppresses this
feature, perhaps at the expense of some speed.

* Some applications assume that the contents of the page frame will be
preserved across a hardware interrupt -- like assuming that your coat will
never get moved from the place in which you saw the cloakroom attendant put
it. This is an invalid assumption, and can cause problems not only with
Stealth, but with EMS-using TSRs as well.

* Other programs outright violate the Expanded Memory Specification by placing
their interrupt stacks in the page frame. This is not simply a problem for
Stealth or for QEMM-386; this can cause a conflict with programs using
expanded memory and ANY expanded memory manager.

Fortunately, the programs that exhibit these problems are rare. If you
experience difficulty that is found to be Stealth-related, you might wish to
encourage the developer of the faulting program to make the program more
compatible with Stealth. Quarterdeck is very happy to assist the developer of
any commercial hardware or software who wishes added compatibility with our
products.

ROM code is normally read 8 or 16 bits at a time, and 32-bit RAM is therefore
much faster. (You can see this in action by looking at Manifest First Meg /
Timings, first without the ROM parameter on the QEMM386.SYS line in
CONFIG.SYS, and then with ROM added to the end of that line.) Some video ROM
speed-up drivers (TVGABIO.SYS, RAMBIOS.SYS, FASTBIOS.SYS, SPEED_UP.SYS...
these typically come on the utilities diskettes provided with your video card)
work by copying the contents of video ROM to conventional RAM. These programs
will often fail if Stealth is active; again, they assume that the video ROM is
in its normal place, and has not been moved by Stealth. QEMM-386's ROM
parameter provides the same feature as these drivers do, with three important
advantages: first, QEMM-386 copies the video ROM into 32-bit RAM, and then
write-protects the RAM so that some errant program does not overwrite the ROM
code. Second, QEMM-386's ROM parameter costs neither conventional memory nor
High RAM to provide this feature -- the video drivers mentioned above will
typically take 32K of one or the other. Finally, the ROM parameter is fully
compatible with Stealth.


Q. If I'm having problems with Stealth, what should I do?
---------------------------------------------------------
Stealth problems can be resolved by consulting Quarterdeck Technical Note
#205, "Trouble-shooting Stealth" (STEALTH.TEC). This and other Quarterdeck
Technical Notes are available on the Quarterdeck BBS at (310) 314-3227,
Compuserve (!GO QUARTERDECK), or large local BBS systems, and also via our
Q/FAX fax retrieval service; from the handset of your fax machine, call (310)
314-3214, or in Canada, (416) 665-5070.


SUMMARY
-------
Stealth is a robust and proven technology. It is an easy-to-use, safe, and
efficient way of creating more High RAM on your system, providing more memory
for your TSRs, your device drivers, DESQview 386, MS Windows, and your
application programs. It is likely to speed up your system rather than
slowing it down. It is designed to be effective on any 386 or 486 processor,
regardless of the ROM's manufacturer or version. Programs that cause
conflicts with Stealth are apt to cause problems with other programs and
memory managers. Stealth conflicts are rare, and troubleshooting is
straightforward. Stealth is the easiest way to provide the optimal amount of
High RAM on your system.

************************************************************************
* Trademarks are property of their respective owners. *
*This technical note may be copied and distributed freely as long as it*
*is distributed in its entirety and it is not distributed for profit. *
* Copyright (C) 1993 by Quarterdeck Office Systems *
************************ E N D O F F I L E *************************