background image

17-4 Vol. 3B

DEBUG, BRANCH PROFILE, TSC, AND RESOURCE MONITORING FEATURES

Certain debug exceptions may clear bits 0-3. The remaining contents of the DR6 register are never cleared by the 
processor. To avoid confusion in identifying debug exceptions, debug handlers should clear the register (except 
bit 16, which they should set) before returning to the interrupted task.

17.2.4 

Debug Control Register (DR7)

The debug control register (DR7) enables or disables breakpoints and sets breakpoint conditions (see Figure 17-1). 
The flags and fields in this register control the following things:

L0 through L3 (local breakpoint enable) flags (bits 0, 2, 4, and 6) — Enables (when set) the breakpoint 
condition for the associated breakpoint for the current task. When a breakpoint condition is detected and its 
associated Ln flag is set, a debug exception is generated. The processor automatically clears these flags on 
every task switch to avoid unwanted breakpoint conditions in the new task.

G0 through G3 (global breakpoint enable) flags (bits 1, 3, 5, and 7) — Enables (when set) the 
breakpoint condition for the associated breakpoint for all tasks. When a breakpoint condition is detected and its 
associated Gn flag is set, a debug exception is generated. The processor does not clear these flags on a task 
switch, allowing a breakpoint to be enabled for all tasks.

LE and GE (local and global exact breakpoint enable) flags (bits 8, 9) — This feature is not supported in 
the P6 family processors, later IA-32 processors, and Intel 64 processors. When set, these flags cause the 
processor to detect the exact instruction that caused a data breakpoint condition. For backward and forward 
compatibility with other Intel processors, we recommend that the LE and GE flags be set to 1 if exact 
breakpoints are required.

RTM (restricted transactional memory) flag (bit 11) — Enables (when set) advanced debugging of RTM 
transactional regions (see Section 17.3.3). This advanced debugging is enabled only if IA32_DEBUGCTL.RTM is 
also set.

GD (general detect enable) flag (bit 13) — Enables (when set) debug-register protection, which causes a 
debug exception to be generated prior to any MOV instruction that accesses a debug register. When such a 
condition is detected, the BD flag in debug status register DR6 is set prior to generating the exception. This 
condition is provided to support in-circuit emulators. 
When the emulator needs to access the debug registers, emulator software can set the GD flag to prevent 
interference from the program currently executing on the processor.
The processor clears the GD flag upon entering to the debug exception handler, to allow the handler access to 
the debug registers.

R/W0 through R/W3 (read/write) fields (bits 16, 17, 20, 21, 24, 25, 28, and 29) — Specifies the 
breakpoint condition for the corresponding breakpoint. The DE (debug extensions) flag in control register CR4 
determines how the bits in the R/Wn fields are interpreted. When the DE flag is set, the processor interprets 
bits as follows:

00 — Break on instruction execution only. 
01 — Break on data writes only.
10 — Break on I/O reads or writes.
11 — Break on data reads or writes but not instruction fetches.

When the DE flag is clear, the processor interprets the R/Wn bits the same as for the Intel386™ and Intel486™ 
processors, which is as follows:

00 — Break on instruction execution only.
01 — Break on data writes only.
10 — Undefined.
11 — Break on data reads or writes but not instruction fetches.

LEN0 through LEN3 (Length) fields (bits 18, 19, 22, 23, 26, 27, 30, and 31) — Specify the size of the 
memory location at the address specified in the corresponding breakpoint address register (DR0 through DR3). 
These fields are interpreted as follows:

00 — 1-byte length.
01 — 2-byte length.
10 — Undefined (or 8 byte length, see note below).
11 — 4-byte length.