home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 033 / stltech.zip / STLTECH.TEC
Text File  |  1994-12-14  |  19KB  |  337 lines

  1. ID:QS QEMM's Stealth ROM Technology
  2. Quarterdeck Technical Note #168                     Filename: STLTECH.TEC
  3. by Michael Bolton                                 CompuServe: STTECH.ZIP
  4. Last revised: 12/14/94                              Category: QEMM
  5.  
  6. Subject: An overview of QEMM's Stealth ROM technology -- how it works,
  7.          why it works so well, and what can cause complications for it.
  8.  
  9. PLEASE NOTE:  Unless otherwise indicated, references to the 386 processor
  10.               include all 386 and higher processors.
  11.  
  12.  
  13. Q: What is Stealth Rom?
  14.  
  15. A: Traditionally, 386 memory managers such as QEMM have been able to
  16.    create High RAM by associating physical extended memory with unused
  17.    addresses between 640K and 1MB.  Quarterdeck's Stealth ROM technology
  18.    (which is included with QEMM versions 6.00 and higher) is QEMM's
  19.    method of creating more High RAM than previously thought possible, by
  20.    mapping memory to addresses that are used by system, video, disk, and
  21.    other ROMs.
  22.  
  23. Q: How does Stealth ROM work?
  24.  
  25. A: To understand how Stealth ROM works, it is useful to understand the
  26.    concept of mapping.  Mapping is the process by which memory management
  27.    hardware and software can make memory appear in appropriate places at
  28.    appropriate times; it is the process of associating memory with an
  29.    address other than its actual one.  The expanded memory specification
  30.    (EMS) uses mapping to make portions of expanded memory appear inside
  31.    the EMS page frame when that memory is requested by a program.  When a
  32.    program needs more memory than what is normally available to it under
  33.    DOS, it can request that some expanded memory be allocated from either
  34.    an EMS board, or from the EMS memory created by a 386 expanded memory
  35.    manager.
  36.  
  37.    Expanded memory has no addresses of its own, but can be made to appear
  38.    at a valid address -- "mapped in".  Expanded memory pages that are not
  39.    currently needed may be "mapped out" -- relieved of their addresses
  40.    and put back into the expanded memory pool, with code and data still
  41.    intact.  When the application needs these pages, they are "mapped in"
  42.    to the EMS page frame again.  It is therefore possible for a program
  43.    that uses expanded memory to have access to much more memory than DOS
  44.    itself can see of its own accord.  You may know this technology as
  45.    "bank switching," which is one of the techniques used to extend and
  46.    add power to everything from mainframe computers to high-end UNIX
  47.    systems to DOS machines.
  48.  
  49.    Mapping is also useful for creating High RAM; in the same way as
  50.    detailed above, memory can be associated with unused addresses between
  51.    640K and 1MB.  The 386 hardware and QEMM cooperate to make memory
  52.    appear where there is otherwise none.
  53.  
  54.    Stealth ROM uses mapping for a new purpose.  The 386 chip can be made
  55.    to map memory in or out of DOS' address space at any time. Stealth ROM
  56.    uses 386 mapping to map system, disk, or video ROMs in and out of DOS'
  57.    address space when appropriate, using one of two strategies -- ST:M or
  58.    ST:F.
  59.  
  60.  
  61.  
  62. Q: What is the difference between ST:M and ST:F?
  63.  
  64. A: ROMs on your system are accessed via interrupts, which are
  65.    conceptually similar to BASIC subroutines.  When your system boots up,
  66.    it sets up something called an interrupt vector table.  This is a list
  67.    of addresses where specific ROM subroutines can be found.  When a
  68.    program on your system needs a certain ROM function (for example,
  69.    writing colored text to the screen), it sets up some data in
  70.    appropriate places, and then calls the interrupt with a processor INT
  71.    instruction. The processor then looks at the interrupt vector table to
  72.    find out the address where the ROM function can be found.  The
  73.    processor transfers control to that address, the ROM subroutine gets
  74.    run, and then control is returned to the calling program.
  75.  
  76.    When you use Stealth ROM, as your system boots QEMM takes control of
  77.    interrupts that are in use by the ROMs on your system and points those
  78.    interrupts into itself.  This way, QEMM can monitor exactly when a ROM
  79.    interrupt occurs, and can manage the interrupt appropriately.
  80.  
  81.    When you use ST:M ("Mapping Method"), QEMM maps system, video, and
  82.    disk ROMs and any other "Stealthable" ROMs out of the first megabyte.
  83.    (For information on what is "Stealthable," see "How can Stealth ROM
  84.    fail?" below.)  When the ROM is needed by the system, QEMM maps the
  85.    appropriate ROM code into the expanded memory page frame.  The ROM
  86.    code now has a valid address at which it can execute, and it does so
  87.    normally.  When the ROM routine is finished, QEMM then remaps the ROM
  88.    elsewhere out of the address space.
  89.  
  90.    When you use ST:F ("Frame Method"), QEMM leaves the system, video, and
  91.    disk ROMs where they are normally found.  QEMM then places the EMS
  92.    page frame on top of a ROM.  Expanded memory can then be mapped into
  93.    the EMS page frame.  When the ROM that has been hidden by the page
  94.    frame is needed, QEMM maps the ROM back into the page frame, at its
  95.    original address.  The ROM code then executes normally.  When the ROM
  96.    routine is finished, QEMM can then restore the contents of the EMS
  97.    page frame, and the ROM is mapped out again.
  98.  
  99. Q: Which Stealth ROM strategy is preferable?
  100.  
  101. A: Since ST:M is capable of mapping almost all ROMs out of DOS' address
  102.    space, and thus leaves you with much more High RAM, it is the better
  103.    of the two options.  ST:F should only be needed on a very small number
  104.    of systems; its object is to ensure compatibility with machines that
  105.    have ROMs that jump to each other without using an interrupt to do so,
  106.    or with ROMs that need to execute at their original addresses.
  107.  
  108. Q: Do I have to have a special version of QEMM so that Stealth ROM will
  109.    work on my system?  Does my system need to be one that Stealth ROM
  110.    knows about?
  111.  
  112. A: No to both questions!  Stealth ROM is designed to work on ANY system,
  113.    regardless of brand, model, or ROM BIOS revision.  You do not need a
  114.    special version of QEMM or Stealth ROM that has been customized for
  115.    your machine, because Stealth ROM's strategy merely relocates your
  116.    ROMs instead of replacing them.  Stealth ROM does not modify, compress
  117.    or replace your ROM BIOS, and it does not depend on being aware of the
  118.    brand or revision of your ROMs.  Additionally, Stealth ROM will
  119.  
  120.  
  121.    typically create more High RAM on your system than any other memory
  122.    management technique.  You do not have to disable any of QEMM's
  123.    features -- EMS, XMS, DPMI, or VCPI memory management -- as other
  124.    memory managers force you to do in order to squeeze every last byte of
  125.    High RAM from your system.
  126.  
  127. Q: Does Stealth ROM slow my system down?
  128.  
  129. A: Stealth ROM does add some tiny amount of overhead to ROM BIOS
  130.    interrupts.  Since most application programs spend very little time
  131.    calling ROM code, the slowdowns are usually imperceptible or
  132.    insignificant to the user.  Ironically, since benchmark programs often
  133.    call ROM interrupts repeatedly (some do almost nothing but this), the
  134.    greatest slowdown will be seen in some benchmark results; these
  135.    results rarely have much to do with the speed of useful programs,
  136.    however.  Since your application programs typically have much more
  137.    conventional memory to deal with when Stealth ROM is invoked, you are
  138.    much more likely to observe faster performance.  Furthermore, QEMM
  139.    replaces some ROM video functions with its own faster code when
  140.    Stealth ROM is active, and QEMM's ROM parameter can provide additional
  141.    performance increases.  Using Stealth ROM with the ROM parameter is
  142.    typically significantly faster than not using QEMM at all.
  143.  
  144. Q: How can Stealth ROM fail?
  145.  
  146. A: Stealth ROM is a robust and proven technology.  However, some programs
  147.    and some system ROM implementations can interfere with Stealth ROM's
  148.    strategies.  Note that the problems described here are infrequent
  149.    and/or system-specific, and that most users will experience no
  150.    difficulty at all with Stealth ROM.
  151.  
  152.  * In the above description of how Stealth ROM works, each strategy
  153.    depends on a processor interrupt being asserted.  This is the normal
  154.    way of calling a piece of ROM code; processor registers are loaded
  155.    with data and with information which denotes exactly which ROM service
  156.    is being requested, and then a processor INT instruction is called.
  157.    BASIC programmers will recognize that this is similar to the process
  158.    of initializing a few variables with data, and then calling a
  159.    subroutine with a GOSUB instruction; most good texts favor this method
  160.    of programming.  However, it is possible (though relatively uncommon)
  161.    for a piece of code to JUMP to a specific ROM address, without
  162.    asserting an interrupt.  This is analogous to a BASIC GOTO, rather
  163.    than a GOSUB; GOTOs are frowned upon by expert programmers, since a
  164.    GOTO presumes that the address to which the code is jumping will
  165.    remain constant and unchanging.  This is less of a problem if one
  166.    person writes all the code, since it is easier for one person to keep
  167.    track of the proper destination addresses; when more than one person
  168.    is involved, it's more difficult to determine why and where the code
  169.    should branch.
  170.  
  171.    If an application or utility jumps directly to a ROM address when
  172.    Stealth ROM is invoked, QEMM will not be able to intercept an
  173.    interrupt, and thus may not have a chance to make sure that the
  174.    appropriate portion of the ROM code is mapped into the page frame. If
  175.    QEMM's Optimize program detects this behavior, it can make the
  176.    application work properly with Stealth ROM by applying the
  177.    STEALTHTHUNK parameter, sacrificing a small amount of High RAM
  178.  
  179.  
  180.    (usually 4K) in order to intercept the direct jump, map the
  181.    appropriate ROM into the page frame, and divert the direct jump to the
  182.    proper address.  If the behavior does not occur during the Optimize
  183.    process, it will probably be necessary to EXCLUDE a portion of the ROM
  184.    on the QEMM386.SYS line in the CONFIG.SYS.
  185.  
  186.  * In the case of system setup programs and installation routines for
  187.    video cards (many of which access ROM addresses directly), it is far
  188.    better to disable QEMM temporarily than to use EXCLUDEs or sacrifice
  189.    the large amounts of extra High RAM that ST:M can provide.  Setup
  190.    programs should need to be run infrequently, and typically require a
  191.    reboot before the modified settings take effect.  High RAM is
  192.    generally much more useful.  It is worth weighing the benefits of
  193.    instant access to your setup program against the extra High RAM that
  194.    Stealth ROM can provide; the decision should not be a difficult one.
  195.  
  196.    The easiest way to deal with this is to disable QEMM, run your Setup
  197.    program, and reboot with QEMM active again.  To disable QEMM
  198.    temporarily, hold down the <Alt> key immediately after you hear a beep
  199.    on bootup.  QEMM will post a message telling you to press <Esc> to
  200.    unload QEMM, or any other key to continue with QEMM.  Press <Esc>, and
  201.    run your Setup program.  (If you are using the DOS-UP feature from
  202.    QEMM version 7.0 or later, you will first see a message asking if you
  203.    want to unload DOSDATA.  Press <Esc> to unload DOSDATA, then hold down
  204.    the <Alt> key again until you see the message telling you to press
  205.    <Esc> to unload QEMM.  After unloading QEMM, run your Setup program,
  206.    then reboot the machine normally (without holding down <Alt>); your
  207.    revised Setup will be in effect, and so will QEMM.
  208.  
  209.  * Some ROMs are written in such a way that they jump internally to
  210.    addresses that are "hard-wired" into the ROM code.  For instance, a
  211.    ROM that lives at address C000 may jump within itself using a full
  212.    address like C000:AD91, where a jump to offset AD91 would have had the
  213.    same effect.  Jumps to explicit addresses can confound Stealth ROM, as
  214.    the ROM does not always execute at its original address. The best way
  215.    of getting around this problem is for the EMS page frame to overlay
  216.    the ROM in question; this means that the ROM will execute at its
  217.    original location without any sacrifice of High RAM. If you cannot put
  218.    the page frame over the offending ROM, the ST:F option is another
  219.    method of guaranteeing that all ROMs will execute at their original
  220.    addresses.
  221.  
  222.  * Sometimes one ROM will jump directly into another ROM's code instead
  223.    of accessing the other ROM through interrupts.  In such circumstances,
  224.    ST:F may be helpful, since the ROMs will all execute at their original
  225.    addresses, making both inter-ROM and intra-ROM jumps safe.
  226.  
  227.  * Some programs find the address of a given piece of ROM at startup, and
  228.    then jump directly to that address later on, at a time when the ROM
  229.    may not be mapped into memory.  Programs like these will often require
  230.    that a portion of the ROM be EXCLUDEd on the QEMM386.SYS line in
  231.    CONFIG.SYS.
  232.  
  233.  * Some ROMs do not have any interrupts pointing to them at startup. If
  234.    this is the case, QEMM will not be able to detect where a given
  235.    interrupt should point, and thus may not invoke Stealth ROM for that
  236.    ROM.
  237.  
  238.  
  239.  
  240.  * Some device drivers refuse to load unless they see an interrupt
  241.    pointing to its normal location; these programs can be loaded before
  242.    QEMM if necessary. Alternatively,  Quarterdeck Technical Note #233,
  243.    "QEMM and the XSTI parameter" (XSTI.TEC), explains another way to
  244.    resolve this problem which usually results in more conventional memory
  245.    saved than if the driver is loaded before QEMM.
  246.  
  247.  * Some programs make invalid assumptions about the EMS page frame. In
  248.    some cases, programs assume that the state of the EMS page frame will
  249.    remain unchanged even after they free an EMS handle; this is akin to
  250.    assuming that you can get your property back after leaving it at the
  251.    end of the driveway on garbage pick-up day.  This fails with Stealth
  252.    ROM because, by default, the page frame is immediately un-mapped after
  253.    a handle has been abandoned -- as if, in the above example, the city
  254.    picks up the garbage pretty much immediately -- as soon as you get
  255.    back into your house.  The UFP:N parameter suppresses this feature and
  256.    can make such careless programs work with Stealth ROM, perhaps at the
  257.    expense of some speed.
  258.  
  259.  * Some applications assume that the contents of the page frame will be
  260.    the same at hardware interrupt time as they are when the main body of
  261.    the application is executing -- like assuming that your coat will
  262.    never get moved from the place in which you saw the cloakroom
  263.    attendant put it.  This is an invalid assumption, and can cause
  264.    problems not only with Stealth ROM, but with EMS-using TSRs as well.
  265.    This is in plain violation of the Expanded Memory Specification.
  266.  
  267.  * Other programs outright violate the Expanded Memory Specification by
  268.    placing their interrupt stacks in the page frame.  This is not simply
  269.    a problem for Stealth ROM or for QEMM; this can cause a conflict with
  270.    programs using expanded memory and ANY expanded memory manager.
  271.  
  272.    Fortunately, the programs that exhibit these problems are rare.  If
  273.    you experience difficulty that is found to be Stealth-related, you
  274.    might wish to encourage the developer of the faulting program to make
  275.    the program more compatible with Stealth ROM.  Quarterdeck is very
  276.    happy to assist the developer of any commercial hardware or software
  277.    who wishes added compatibility with our products.
  278.  
  279.    ROM code is normally read 8 or 16 bits at a time, and 32-bit RAM is
  280.    therefore much faster.  (You can see this in action by looking at
  281.    Manifest First Meg / Timings, first without the ROM parameter on the
  282.    QEMM386.SYS line in CONFIG.SYS, and then with ROM added to the end of
  283.    that line.)  Some video ROM speed-up drivers work by copying the
  284.    contents of video ROM to conventional RAM.  These programs (such as
  285.    TVGABIO.SYS, RAMBIOS.SYS, FASTBIOS.SYS, and SPEED_UP.SYS, typically
  286.    shipped on the utilities diskette provided with your video card) will
  287.    often conflict with Stealth ROM.  If loaded after QEMM, such programs
  288.    may refuse to load because they detect that a program loaded before
  289.    them (QEMM) is intercepting the video interrupt, INT 10.  Conversely,
  290.    if loaded before QEMM, these programs may divert interrupts into RAM,
  291.    so that QEMM cannot locate the ROM handler for those interrupts.  In
  292.    these cases, the video speed-up program will function properly, but
  293.    Stealth ROM will be disabled.  XSTI.TEC explains how to resolve this
  294.    problem if you really want to load the video enhancement program.
  295.    However, QEMM's ROM parameter generally provides the same feature
  296.  
  297.  
  298.    these drivers do, with three important advantages:  First, QEMM copies
  299.    the video ROM into 32-bit RAM and then write-protects the RAM so that
  300.    some errant program does not overwrite the ROM code.  Second, QEMM's
  301.    ROM parameter costs neither conventional memory nor High RAM to
  302.    provide this feature -- the video drivers mentioned above will
  303.    typically take 32K of one or the other.  Finally, the ROM parameter is
  304.    fully compatible with Stealth ROM.
  305.  
  306. Q: If I'm having problems with Stealth ROM, what should I do?
  307.  
  308. A: Stealth ROM problems can be resolved by consulting Quarterdeck
  309.    Technical Note #205, "Troubleshooting Stealth ROM" (STEALTH.TEC). If
  310.    you are using QEMM version 7.0 or later, this technote was installed
  311.    in your \QEMM\TECHNOTE directory.  This and other Quarterdeck
  312.    Technical Notes are also available on the Quarterdeck BBS (310)
  313.    314-3210, CompuServe (!GO QUARTERDECK), our Anonymous FTP Site
  314.    (qdeck.com (149.17.8.10)), via our Q/FAX fax retrieval service (from
  315.    the handset of your fax machine, call (310) 314-3214, or in Canada,
  316.    (416)665-5070), and some large local BBS systems.
  317.  
  318.  
  319.                                SUMMARY
  320.                                -------
  321. Stealth ROM is a robust and proven technology.  It is an easy-to-use,
  322. safe, and efficient way of creating more High RAM on your system,
  323. providing more memory for your TSRs, your device drivers, DESQview 386,
  324. MS Windows, and your application programs.  It is likely to speed up your
  325. system rather than slow it down.  It is designed to be effective on any
  326. 386 or higher processor, regardless of the ROM's manufacturer or version.
  327. Many programs that cause conflicts with Stealth ROM can cause problems
  328. with other programs and memory managers.  Stealth conflicts are rare, and
  329. troubleshooting is straightforward.  Stealth ROM is the easiest way to
  330. provide the optimal amount of High RAM on your system.
  331.  
  332.  ************************************************************************
  333.  *This technical note may be copied and distributed freely as long as it*
  334.  *is distributed in its entirety and it is not distributed for profit.  *
  335.  *          Copyright (C) 1994 by Quarterdeck Office Systems            *
  336.  ************************ E N D   O F   F I L E *************************
  337.