home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOFTIC~1.ZIP / DOC-TXT.ZIP / CHAP13 < prev    next >
Text File  |  1992-05-24  |  6KB  |  152 lines

  1.  
  2.   CHAPTER 13
  3.  
  4.  Theory Of Operation
  5.     13.1 Activating Other Debuggers
  6.     13.2 Virtual Machine Basics
  7.  
  8.      227 
  9.  
  10. 13.1 Activating Other Debuggers
  11.  
  12. Soft-ICE works with most other debuggers by taking advantage of the 8086
  13. family break point interrupt (INT 3). Most debuggers use the single byte
  14. INT 3 (CCH) instruction to produce break points. The target instruction is
  15. replaced by an INT 3. When the target address is executed, control is
  16. given to the debugger's INT 3 handler. The debugger then replaces the
  17. (CCH) with the first byte of the original instruction.
  18.  
  19. When Soft-ICE break points occur, one of several events can happen,
  20. depending on the ACTION command. Typically, when using Soft-ICE with
  21. another debugger, ACTION is set to INT3. When break point conditions
  22. match, Soft-ICE passes control to the host debugger by simulating an INT
  23. 3.
  24.  
  25. Some debuggers may not work properly by simulating INT 3's. For these
  26. debuggers, two other ACTION options are provided. They are INT1 and NMI.
  27. IX 1 is the 8086 family single-step interrupt. Most debuggers will handle
  28. an unsolicited INT 1 as a break point. NMI is supported by many debuggers
  29. as a means of breaking out of a hung condition. These debuggers were
  30. designed for hardware break-out switches that produced non-maskable
  31. interrupts. When ACTION is set for NMI, Soft-ICE simulates the non-
  32. maskable interrupt (Interrupt 2). CODEVIEW works best with ACTION set to
  33. NMI.
  34.  
  35.  13.2 Virtual Machine Basics
  36.  
  37. The magic of Soft-ICE is made possible by the virtual machine capability
  38. of the 80386 processor. Soft-ICE runs in the 80386 protected mode and
  39. manages the DOS environment. The 80386 protection circuitry gives Soft-ICE
  40. complete control of the DOS environment while protecting it from a wayward
  41. program.
  42.  
  43.      228 
  44.  
  45. How are Soft-ICE break points generated?
  46.  
  47. Soft-ICE uses three different 80386 features to produce break points:
  48.     * Break points on memory location use the 80386
  49.         break registers
  50.     * Break points on memory ranges use the 80386
  51.         paging mechanism
  52.     * Break points on I/O instructions use the I/O
  53.         privilege level and I/O bit mask
  54.  How is the BREAK command implemented?
  55.  
  56.  
  57. The BREAK command allows use of the keyboard to bring up Soft-ICE, even
  58. when interrupts are disabled and the system is hung. Soft-ICE virtualizes
  59. the interrupt mechanism so that interrupts are never disabled to Soft-ICE,
  60. even when they are disabled to the DOS program running in the virtual
  61. machine.
  62.  
  63. When in break mode, the following instructions are virtualized to make
  64. sure the interrupt flag is never cleared:
  65.  
  66.   PUSHF
  67.   POPF
  68.   STI
  69.   CLI
  70.   INT n
  71.   IRET
  72.  
  73.  Special considerations with virtual 8086 mode
  74.  
  75.  Soft-ICE runs DOS in an 8086 virtual machine. This capability is a major
  76. feature of the 80386 microprocessor. When running real address mode
  77. software (DOS, etc.) in a virtual machine some 8086 features must be
  78. emulated by a program that controls the virtual machine. In our case,
  79.    
  80.  
  81.      229 
  82.  
  83. Soft-ICE controls the virtual machine. The following peculiarities are
  84. handled by Soft-ICE:
  85.  
  86.    * ROM BIOS interrupt 15H functions 87H, 88H,
  87.        and 89H
  88.    * The undocumented loadall instruction
  89.    * Address line 20H control
  90.    * 80286 and 80386 protected instructions
  91.    * 80386 bugs
  92.  
  93.    ROM BIOS interrupt 15H functions 87H, 88H, and
  94.          89H
  95.  
  96.    BIOS function 87H allows a program to access memory
  97.    above one megabyte in the IBM AT or Personal Series
  98.    11 architectures through a block move mechanism.
  99.    Function 88H returns the extended memory size.
  100.    These functions are used by the VDISK device driver.
  101.    Soft-ICE emulates these BIOS calls for VDISK
  102.    compatibility. Function 89H is normally used to put
  103.    you into protected mode, but Soft-ICE can not allow
  104.    this to happen. Instead it returns with the carry flag set.
  105.  
  106.    The undocumented loadall instruction
  107.  
  108.    The 80286 contains an undocumented instruction
  109.    called loadall. This instruction was originally placed on
  110.    the chip for diagnostic purposes and is not generally
  111.    used by software. However, it is used by some versions
  112.    of Microsoft's RAMDRIVE which is sold with
  113.    Microsoft Windows and MSDOS 3.2. Soft-ICE
  114.    emulates loadall to the extent of getting RAMDRIVE
  115.    to work, however it is impossible to do a complete
  116.    emulation of this instruction.
  117.  
  118.      230 
  119.  
  120. Address line 20H control
  121.  
  122. The IBM AT introduced a special feature that allowed some old programs
  123. that were originally written for CP/M to function on the 80286 processor.
  124. This feature allowed memory accesses that wrapped from the one megabyte
  125. region to the zero region on the 8086 to work on the 80286. Some programs
  126. disable this 'wrap compatibility' to access memory just above one megabyte
  127. in real address mode. Soft-ICE emulates this ability. This is supported on
  128. all 80386 AT machines through the keyboard controller, and through I/O
  129. port 92H on the PS/2.
  130.  
  131. 80286 and 80386 protected instructions
  132.  
  133. Some AT specific programs have used 80286 protected instructions. With the
  134. emergence of the 80386, some 80386 programs use 80386 protected
  135. instructions. These programs will not work with Soft-ICE.
  136.  
  137. Soft-ICE supports the standard real-address mode extensions that Intel had
  138. included with the 80186 & 80286 processors (PUSHALL, POPALL, etc.), but
  139. not protected mode instructions such as LGDT, LMSW, etc.
  140.  
  141. 80386 Bugs
  142.  
  143. There are several 80386 bugs up through the C stepping of the chip. Most
  144. of these bugs only apply to protected mode software (such as Soft-ICE).
  145.      
  146.      231
  147.  
  148.  Page 232 is BLANK
  149.  
  150.      232
  151.  
  152.