Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B, System Programming Guide Part 2

Table Of Contents
Vol. 3 18-15
DEBUGGING AND PERFORMANCE MONITORING
Last branch record (LBR) stack — There are a collection of MSR pairs that
store the source and destination addresses related to recently executed
branches. See Section 18.5.2.
Monitoring and single-stepping of branches, exceptions, and interrupts
See Section 18.7.4 and Section 18.7.5. In addition, the ability to freeze the
LBR stack on a PMI request is available.
Branch trace messages — See Section 18.7.6.
Last exception records — See Section 18.7.7.
Branch trace store and CPL-qualified BTS — See Section 18.7.8.
18.5.1 IA32_DEBUGCTL MSR
The IA32_DEBUGCTL MSR provides bit field controls to enable debug trace inter-
rupts, debug trace stores, trace messages enable, single stepping on branches, last
branch record recording, and to control freezing of LBR stack or performance
counters on a PMI request. IA32_DEBUGCTL MSR is located at register address
01D9H.
See Figure 18-3 for the MSR layout and the bullets below for a description of the
flags:
LBR (last branch/interrupt/exception) flag (bit 0) — When set, the
processor records a running trace of the most recent branches, interrupts, and/or
exceptions taken by the processor (prior to a debug exception being generated)
in the last branch record (LBR) stack. For more information, see the Section
18.5.2, “LBR Stack”.
BTF (single-step on branches) flag (bit 1) — When set, the processor treats
the TF flag in the EFLAGS register as a “single-step on branches” flag rather than
a “single-step on instructions” flag. This mechanism allows single-stepping the
processor on taken branches, interrupts, and exceptions. See Section 18.7.5,
“Single-Stepping on Branches, Exceptions, and Interrupts,” for more information
about the BTF flag.
TR (trace message enable) flag (bit 6) — When set, branch trace messages
are enabled. When the processor detects a taken branch, interrupt, or exception;
it sends the branch record out on the system bus as a branch trace message
(BTM). See Section 18.7.6, “Branch Trace Messages,” for more information about
the TR flag.
BTS (branch trace store) flag (bit 7) When set, the flag enables BTS
facilities to log BTMs to a memory-resident BTS buffer that is part of the DS save
area. See Section 18.18.5, “DS Save Area.
BTINT (branch trace interrupt) flag (bit 8) — When set, the BTS facilities
generate an interrupt when the BTS buffer is full. When clear, BTMs are logged to
the BTS buffer in a circular fashion. See Section 18.7.8, “Branch Trace Store (BTS),
for a description of this mechanism.