80386
the processor during a task switch, to avoid spurious exceptions in the new task. Note that the break- points must be
All 80386 Gi bits are unaffected during a task switch. The Gi bits support breakpoints that are active in all tasks executing in the system.
2.12.3.3 DEBUG STATUS REGISTER (DR6)
A Debug Status Register, DR6 shown in Figure
1)DRO Breakpoint fault/trap.
2)DR1 Breakpoint fault/trap.
3)DR2 Breakpoint fault/trap.
4)DR3 Breakpoint fault/trap.
5)
6)Task switch trap.
7)Fault due to attempted debug register access when GD= 1.
The Debug Status Register contains
The flags in DR6 are set by the hardware but never cleared by hardware. Exception 1 handler software should clear DR6 before returning to the user pro- gram to avoid future confusion in identifying the source of exception 1.
The fields within the Debug Status Register, DR6, are as follows:
Bi (debug fault/trap due to breakpoint
Four breakpoint indicator flags,
If Gi or Li is set, and if the ith breakpoint is detected, the processor will invoke the exception 1 handler. The exception is handled as a fault if an instruction execution breakpoint occurred, or as a trap if a data breakpoint occurred.
IMPORTANT NOTE: A flag Bi is set whenever the hardware detects a match condition on enabled breakpoint i. Whenever a match is detected on at least one enabled breakpoint i, the hardware imme- diately sets all Bi bits corresponding to breakpoint conditions matching at that instant, whether enabled or not. Therefore, the exception 1 handler may see
31
that multiple Bi bits are set, but only set Bi bits corre- sponding to enabled breakpoints (Li or Gi set) are true indications of why the exception 1 handler was invoked.
BD (debug fault due to attempted register access when GD bit set)
This bit is set if the exception 1 handler was invoked due to an instruction attempting to read or write to the debug registers when GD bit was set. If such an event occurs, then the GD bit is automatically cleared when the exception 1 handler is invoked, allowing handler access to the debug registers.
BS (debug trap due to
This bit is set if the exception 1 handler was invoked due to the TF bit in the flag register being set (for
BT (debug trap due to task switch)
This bit is set if the exception 1 handler was invoked due to a task switch occurring to a task having a 386 TSS with the T bit set. (See Figure
2.12.3.4USE OF RESUME FLAG (RF) IN FLAG REGISTER
The Resume Flag (RF) in the flag word can sup- press an instruction execution breakpoint when the exception 1 handler returns to a user program at a user address which is also an instruction execution breakpoint. See section 2.3.3.
3. REAL MODE ARCHITECTURE
3.1 REAL MODE INTRODUCTION
When the processor is reset or powered up it is ini- tialized in Real Mode. Real Mode has the same base architecture as the 8086, but allows access to the
All of the 80386 instructions are available in Real Mode (except those instructions listed in 4.6.4). The default operand size in Real Mode is