7-12 PPC405 Core User’s Manual
7.5.1 TLB Search Instructions (tlbsx/tlbsx.)
tlbsx locates entries in the TLB, to find the TLB entry associated with an interrupt, or to locate
candidate entries to cast out. tlbsx searches the UTLB array for a matching entry. The EA is the value
to be matched; EA = (RA|0)+(RB).
If the TLB entry is found, its index is placed in RT
26:31
. RT can then serve as the source register for a
tlbre or tlbwe instruction to read or write the entry, respectively. If no match is found, the contents of
RT are undefined.
tlbsx. sets the Condition Register (CR) bit CR0
EQ
. The value of CR0
EQ
depends on whether an entry
is found: CR0
EQ
= 1 if an entry is found; CR0
EQ
= 0 if no entry is found.
7.5.2 TLB Read/Write Instructions (tlbre/tlbwe)
TLB entries can be accessed for reading and writing by tlbre and tlbwe, respectively. Separate
extended mnemonics are available for the TLBHI (tag) and TLBLO (data) portions of a TLB entry.
7.5.3 TLB Invalidate Instruction (tlbia)
tlbia sets TLB_entry[V] = 0 to invalidate all TLB entries. All other TLB entry fields remain unchanged.
Using tlbwe to set TLB_entry[V] = 0 invalidates a specific TLB entry.
7.5.4 TLB Sync Instruction (tlbsync)
tlbsync guarantees that all TLB operations have completed for all processors in a multi-processor
system. PPC405 provides no multiprocessor support, so this instruction performs no function. The
instruction is included to facilitate code portability.
7.6 Recording Page References and Changes
When system software manages virtual memory, the software views physical memory as a collection
of pages. Each page is associated with at least one TLB entry. To manage memory effectively, system
software often must know whether a particular page has been referenced or modified. Note that this
involves more than knowing whether a particular TLB entry was used to reference or alter memory,
because multiple TLB entries can translate to the same page.
When system software manages a demand-paged environment, and the software needs to replace
the contents of a page with other data, previously referenced pages (accessed for any purpose) are
more likely to be maintained than pages that were never referenced. If the contents of a page must be
replaced, and data contained in that page was modified, system software generally must write the
contents of the modified page to the backing store before replacing its contents. System software
must maintain records to control the environment.
Similarly, when system software manages TLB entries, the software often must know whether a
particular TLB entry was referenced. When the system software must select a TLB entry to cast out,
previously referenced entries are more likely to be maintained than entries which were never
referenced. System software must also maintain records for this purpose.