
2-38
PRELIMINARY
Model Specific Registers
Advanci ng the S tandar ds
2.5
Model Specific
Registers
The CPU contains several Model Specific
Registers (MSRs) that provide time stamp,
performance monitoring and counter event
functions. Access to a specific MSR through an
index value in the ECX register as shown in
Table 2-22 below.
The MSR registers can be read using the
RDMSR instruction, opcode 0F32h. During an
MSR register read, the contents of the particular
MSR register, specified by the ECX register, is
loaded into the EDX:EAX registers.
The MSR registers can be written using the
WRMSR instruction, opcode 0F30h. During a
MSR register write the contents of EDX:EAX are
loaded into the MSR register specified in the
ECX register.
The RDMSR and WRMSR instructions are
privileged instructions and are also used to
setup scratch pad lock (Page 2-61).
Table 2-22. Machine Specific
Register
REGISTER
DESCRIPTION
ECX
VALUE
Test Data
3h
Test Address
4h
Command/Status
5h
Time Stamp Counter (TSC)
10h
Counter Event Selection and Control Register
11h
Performance Counter #0
12h
Performance Counter #1
13h
2.6
Time Stamp Counter
The Time Stamp Counter (TSC) Register
MSR(10) is a 64-bit counter that counts the in-
ternal CPU clock cycles since the last reset. The
TSC uses a continous CPU core clock and will
continue to count clock cycles even when the
M II is suspend mode or shutdown.
The TSC can be accessed using the RDMSR and
WRMSR instructions. In addition, the TSC can
be read using the RDTSC instruction, opcode
0F31h. The RDTSC instruction loads the con-
tents of the TSC into EDX:EAX. The use of the
RDTSC instruction is restricted by the Time
Stamp Disable, (TSD) flag in CR4. When the
TSD flag is 0, the RDTSC instruction can be ex-
ecuted at any privilege level. When the TSD
flag is 1, the RDTSC instruction can only be ex-
ecuted at privilege level 0.
2.7
Performance
Monitoring
Performance monitoring allows counting of
over a hundred different event occurrences and
durations. Two 48-bit counters are used: Per-
formance Monitor Counter 0 and Performance
Monitor Counter 1. These two performance
monitor counters are controlled by the Counter
Event Control Register MSR(11). The perfor-
mance monitor counters use a continuous CPU
core clock and will continue to count clock cy-
cles even when the M II CPU is in suspend
mode or shutdown.