home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / q / qemmtec.zip / STLTECH.TEC < prev   
Text File  |  1993-03-02  |  13KB  |  222 lines

  1. ID:QS QEMM-386's Stealth Technology
  2. Quarterdeck Technical Note #168
  3. by Michael Bolton
  4. Last Revision: 2 March 1993
  5.  
  6.  
  7. Q. What is Stealth?
  8. Q. How does Stealth work?
  9. Q. What is the difference between ST:M and ST:F?
  10. Q. Which Stealth strategy is preferable?
  11. Q. Does Stealth slow down my system?
  12. Q. How can Stealth fail?
  13. Q. If I'm having problems with Stealth, what should I do?
  14.  
  15.  
  16. Q. What is Stealth?
  17. -------------------
  18. Traditionally, 386 memory managers such as QEMM-386 have been able to create
  19. High RAM by associating physical extended memory with unused addresses between
  20. 640K and 1MB.  Quarterdeck's Stealth technology (new to version 6 of QEMM-386)
  21. is QEMM-386's method of creating more High RAM than previously thought
  22. possible, by mapping memory to addresses that are used by system, video, disk,
  23. and other ROMs.
  24.  
  25.  
  26. Q. How does Stealth work?
  27. -------------------------
  28. To understand how Stealth works, it is useful to understand the concept of
  29. MAPPING.
  30.  
  31. MAPPING is the process by which memory management hardware and software can
  32. make memory appear in appropriate places at appropriate times; it's the
  33. process of associating memory with an address.  The exPANded memory
  34. specification (EMS) uses mapping to make portions of exPANded memory appear
  35. inside the EMS Page Frame when that memory is requested by a program.  When a
  36. program needs more memory than what is normally available to it under DOS, it
  37. can request that some exPANded memory be allocated from either an EMS board,
  38. or from the EMS memory created by a 386 exPANded memory manager.  ExPANded
  39. memory has no DOS addresses of its own, but can be made to appear at a valid
  40. DOS address -- "mapped in".  ExPANded memory pages that are not currently
  41. needed may be "mapped out" -- relieved of their DOS addresses and put back
  42. into the exPANded memory pool, with code and data still intact.  When the
  43. application needs these pages, they are "mapped in" to the EMS page frame
  44. again.  It is therefore possible for a program that uses exPANded memory to
  45. have access to much more memory than DOS itself can see of its own accord;
  46. users who are familiar with "bank switching" found on mainframe computers or
  47. on older 64K home computers may remember this kind of technology.
  48.  
  49. Mapping is also useful for creating High RAM; in the same way as detailed
  50. above, expanded memory can be associated with unused addresses between 640K
  51. and 1MB.  The EMS hardware and software co-operate to make memory appear where
  52. there is otherwise none.
  53.  
  54. Stealth uses mapping for a new purpose.  The 386 (or 486) chip can
  55. be made to map memory in or out of DOS's address space at any time.  Stealth
  56. uses 386 mapping to map system, disk, or video ROMs in and out of DOS's
  57. address space when appropriate, using one of two strategies -- ST:M and ST:F.
  58.  
  59.  
  60. Q. What is the difference between ST:M and ST:F?
  61. ------------------------------------------------
  62.  
  63. ROMs on your system are accessed via interrupts -- which are conceptually
  64. similar to BASIC subroutines.  When your system boots up, it sets up something
  65. called an interrupt vector table.  This is a list of addresses where specific
  66. ROM subroutines can be found.  When a program on your system needs a certain
  67. ROM function (for example, writing coloured text to the screen), it sets up
  68. some data in appropriate places, and then calls the interrupt with a processor
  69. INT instruction.  The processor then looks at the interrupt vector table to
  70. find out the address where the ROM function can be found.  The calling program
  71. jumps to that address, the ROM subroutine gets run, and then control is
  72. returned to the calling program.
  73.  
  74. When you use Stealth, as your system boots, QEMM-386 takes control of
  75. interrupts that are in use by the ROMs on your system, and points those
  76. interrupts into itself.  This way, QEMM-386 can monitor exactly when a ROM
  77. interrupt occurs, and can manage the interrupt appropriately.
  78.  
  79. When you use ST:M ("Map Mode"), QEMM-386 maps system, video, disk ROMs, and
  80. any other "Stealthable" ROMs out of the first megabyte to addresses elsewhere
  81. in the processor's memory map.  (For information on what is "Stealthable", see
  82. "How can Stealth fail?" below.)  When the ROM is needed by the system,
  83. QEMM-386 maps the appropriate ROM code into the expanded memory page frame.
  84. The ROM code now has a valid DOS address at which it can execute, and it does
  85. so normally.  When the ROM routine is finished, QEMM-386 then remaps the ROM
  86. elsewhere outside of DOS's address space.
  87.  
  88. When you use ST:F ("Frame Mode"), QEMM-386 leaves the system, video, and disk
  89. ROMs where they are normally found.  QEMM-386 then maps the EMS page frame to
  90. such that it lies on top of a ROM.  Expanded memory can then be mapped into
  91. the EMS page frame.  When the ROM that has been hidden by the page frame is
  92. needed, QEMM-386 momentarily disables expanded memory usage and maps the page
  93. frame out of DOS's address space, exposing the ROM beneath.  The ROM code then
  94. executes normally.  When the ROM routine is finished, QEMM-386 can then
  95. re-enable the EMS page frame, and lie it back down over the ROM.
  96.  
  97.  
  98. Q. Which Stealth strategy is preferable?
  99. ----------------------------------------
  100. Since ST:M is capable of mapping almost all ROMs out of DOS's address space,
  101. and thus leaves you with much more High RAM, it is the better of the two
  102. options.  ST:F should only be needed on a very small number of systems; its
  103. object is to ensure compatibility with machines that have ROMs that jump to
  104. each other without using an interrupt to do so.
  105.  
  106.  
  107. Q. Does Stealth slow my system down?
  108. ------------------------------------
  109. Stealth does add some small amount of overhead to ROM BIOS interrrupts.  Since
  110. most application programs spend very little time calling ROM code, the
  111. slowdowns are usually imperceptible or insignificant to the user.  Ironically,
  112. since benchmark programs often call ROM interrupts repeatedly (some do almost
  113. nothing but this), the greatest slowdown will be seen in benchmark results;
  114. these rarely have much to do with the speed of useful programs, however.  It
  115. should be noted that QEMM-386's ROM parameter can provide significant
  116. performance increases.  Using Stealth with the ROM parameter is typically
  117. faster than not using QEMM-386 at all.
  118.  
  119.  
  120. Q. How can Stealth fail?
  121. ------------------------
  122. Stealth is a robust and proven technology.  However, some programs and some
  123. system ROM implementations can interfere with Stealth's strategies.  Note that
  124. the problems described here are infrequent and system-specific, and that most
  125. users will experience no difficulty at all with Stealth.
  126.  
  127. Note that in the above description of how Stealth works, each strategy depends
  128. on a processor interrupt being asserted.  This is the normal way of calling a
  129. piece of ROM code; processor registers are loaded with data and with
  130. information which denotes exactly which ROM service is being requested, and
  131. then a processor INT instruction is called.  BASIC programmers will recognize
  132. that this is similar to the process of loading a few variables with data, and
  133. then calling a subroutine with a GOSUB instruction; most good texts favour
  134. this method of programming.  However, it is possible (though relatively
  135. uncommon) for a piece of ROM code to JUMP to a specific address without
  136. asserting an interrupt. (This is analogous to a BASIC GOTO, rather than a
  137. GOSUB; GOTOs are frowned upon by expert programmers, since a GOTO presumes
  138. that the address to which you are going will remain constant and unchanging.)
  139. In this case, QEMM-386 will not be able to intercept an interrupt, and thus
  140. may not have a chance to make sure that the appropriate portion of the ROM
  141. code is mapped into the page frame (ST:M).  In such circumstances, ST:F is
  142. often helpful, since the Page Frame will not reappear until after the ROM BIOS
  143. call is completely done.
  144.  
  145. * Many ROM-BIOS-based system setup programs exhibit this same sort of
  146. behaviour, as do installation routines for some video cards. If you wish to
  147. run such programs, it is far better to disable QEMM-386 temporarily than to
  148. sacrifice the large amounts of extra High RAM that ST:M can provide.  Setup
  149. programs should need to be run infrequently, and typically require a reboot
  150. before the modified settings take effect.  High RAM is generally much more
  151. useful.  It is worth weighing the benefits of instant access to your setup
  152. program against the extra High RAM that Stealth can provide; the decision
  153. should not be a difficult one.
  154.  
  155. * Some programs find the address of a given piece of ROM at startup, and then
  156. jump directly to that address later on, at a time when the ROM may not be
  157. mapped into memory.  Programs like these will often require that a portion of
  158. the ROM be EXCLUDEd on the QEMM386.SYS line in CONFIG.SYS.
  159.  
  160. * Some ROMs do not have any interrupts pointing to them at startup.  If this
  161. is the case, QEMM-386 will not be able to detect where a given interrupt
  162. should point, and thus may not be able to manage that interrupt properly. Some
  163. programs refuse to load unless they see an interrupt pointing to its normal
  164. location; these programs can be loaded before QEMM-386 if necessary.
  165.  
  166. * Some programs make invalid assumptions about the EMS page frame.  In some
  167. cases, programs assume that the state of the EMS page frame will remain
  168. unchanged even after they abandon an EMS handle; this is akin to assuming that
  169. you can get your property back after leaving it at the end of the driveway on
  170. garbage pick-up day.  This fails with Stealth because, by default, the page
  171. frame is immediately unmapped after a handle has been abandoned -- as if, in
  172. the above example, the city picks up the garbage pretty much immediately -- as
  173. soon as you get back into your house.  The UFP:N parameter suppresses this
  174. feature, perhaps at the expense of some speed.
  175.  
  176. * Some applications assume that the contents of the page frame will be
  177. preserved across a hardware interrupt -- like assuming that your coat will
  178. never get moved from the place in which you saw the cloakroom attendant put
  179. it.  This is an invalid assumption, and can cause problems not only with
  180. Stealth, but with EMS-using TSRs as well.
  181.  
  182. * Other programs outright violate the Expanded Memory Specification by placing
  183. their interrupt stacks in the page frame.
  184.  
  185. Fortunately, the programs that exhibit these problems are rare.  Furthermore,
  186. Quarterdeck is happy to work with commercial software developers who are
  187. having difficulties with Stealth compatibility.
  188.  
  189. ROM code is normally read 8 or 16 bits at a time, and 32-bit RAM is therefore
  190. much faster.  (You can see this in action by looking at Manifest First Meg /
  191. Timings, first without the ROM parameter on the QEMM386.SYS line in
  192. CONFIG.SYS, and then with ROM added to the end of that line.) Some video ROM
  193. speed-up drivers (TVGABIO.SYS, RAMBIOS.SYS, FASTBIOS.SYS, SPEED_UP.SYS...
  194. these typically come on the utilities diskettes provided with your video card)
  195. work by copying the contents of video ROM to conventional RAM.  These programs
  196. will often fail if Stealth is active; again, they assume that the video ROM is
  197. in its normal place, and has not been moved by Stealth.  QEMM-386's ROM
  198. parameter provides the same feature as these drivers do, with three important
  199. advantages:  first, QEMM-386 copies the video ROM into 32-bit RAM, and then
  200. write-protects the RAM so that some errant program does not overwrite the ROM
  201. code.  Second, QEMM-386's ROM parameter costs neither conventional memory nor
  202. High RAM to provide this feature -- the video drivers mentioned above will
  203. typically take 32K of one or the other.  Finally, the ROM parameter is fully
  204. compatible with Stealth.
  205.  
  206.  
  207. Q. If I'm having problems with Stealth, what should I do?
  208. ---------------------------------------------------------
  209. Stealth problems can be resolved by consulting Quarterdeck Technical Note
  210. #205, "Trouble-shooting Stealth" (STEALTH.TEC).  This and other Quarterdeck
  211. Technical Notes are available on the Quarterdeck BBS at (310) 314-3227,
  212. Compuserve (!GO QUARTERDECK), or large local BBS systems, and also via our
  213. Q/FAX fax retrieval service; from the handset of your fax machine, call (310)
  214. 314-3214, or in Canada, (416) 665-5070.
  215.  
  216.   ************************************************************************
  217.   *          Trademarks are property of their respective owners.         *
  218.   *This technical note may be copied and distributed freely as long as it*
  219.   *is distributed in its entirety and it is not distributed for profit.  *
  220.   *          Copyright (C) 1993 by Quarterdeck Office Systems            *
  221.   ************************ E N D   O F   F I L E *************************
  222.