
4-40
G2 PowerPC Core Reference Manual
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Cache Locking
mfmsr
ori
mtmsr
sync
r1
r1, r1, 0x0030
r1
4.12.3.2.3 Disabling Exceptions for Instruction Cache Locking
To ensure that exception handler routines do not execute while the cache is being loaded
(which could possibly pollute the cache with undesired contents) all exceptions must be
disabled. This is accomplished by clearing the appropriate bits in the machine state register
(MSR). See Table 4-17 for the bits within the MSR that must be cleared to ensure that
exceptions are disabled.
The following assembly code disables all asynchronous exceptions:
# Clear the following bits from the MSR:
# EE (16) ME (19)
# FE0 (20) FE1 (23)
#
ME (24)
mfmsr
lis
ori
and
mtmsr
sync
r1
r2, 0xFFFF
r2, r2, 0x667F
r1, r1, r2
r1
4.12.3.2.4 Preloading Instructions into the Instruction Cache
To optimize performance, processors that implement the PowerPC architecture
automatically prefetch instructions into the instruction cache. This feature can be used to
preload explicit instructions into the cache even when it is known that their execution will
be canceled. Although the execution of the instructions is canceled, the instructions remain
valid in the instruction cache.
Table 4-17. MSR Bits for Disabling Exceptions
Bit
Name
Description
16
EE
External interrupt enable
19
ME
Machine check enable
20
FE0
1
1
The floating-point exception may not need to be disabled because the example code shown
in this document that performs cache locking does not execute any floating-point operations.
Floating-point exception mode 0
23
FE1
1
Floating-point exception mode 1
24
CE
Critical interrupt enable
F
Freescale Semiconductor, Inc.
n
.