
MOTOROLA
Chapter 4. Instruction and Data Cache Operation
For More Information On This Product,
Go to: www.freescale.com
4-35
Cache Locking
The block address translation upper (BATU) and block address translation lower (BATL)
settings in Table 4-13 can be used for both instruction block address translation (IBAT) and
data block address translation (DBAT) registers. After the BAT registers have been set up,
the MMU must be enabled. The following assembly code enables both instruction and data
memory address translation:
# Enable instruction and data memory address translation. This
# corresponds to setting IR and DR in the MSR (bits 26 & 27)
mfmsr
ori
mtmsr
sync
r1
r1, r1, 0x0030
r1
4.12.3.1.3 Disabling Exceptions for Data 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-14 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)
Table 4-13. Example BAT Settings for Cache Locking
Area
Base Address
Memory Size
WIMG Bits
BATU Setting
BATL Setting
First
0xFFF0_0000
1 Mbyte
0b0100
1
0xFFF0_001F
0xFFF0_0002
1
1
Cache-inhibited memory is not a requirement for data cache locking. A setting of 0xFFF0_0002 with a
corresponding WIMG of 0b0000 marks the memory area as cacheable.
Second
0x0000_0000
256 Mbyte
0b0000
0x0000_1FFF
0x0000_0002
Table 4-14. MSR Bits for Disabling Exceptions
Bits
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
.