Sun Microelectronics
71
6. MMU Internal Architecture
Code Example 6-1
Pseudo-code for
UltraSPARC
D-MMU Pointer Logic
int64 GenerateTSBPointer(
int64 va,
// Missing virtual address
PointerType type,
// 8K_POINTER or 64K_POINTER
int64 TSBBase,
// TSB Register<63:13> << 13
Boolean split,
// TSB Register<12>
int TSBSize)
// TSB Register<2:0>
{
int64 vaPortion;
int64 TSBBaseMask;
int64 splitMask;
// TSBBaseMask marks the bits from TSB Base Reg
TSBBaseMask = 0xffffffffffffe000 <<
(split? (T 1) : TSBSize);
// Shift va towards lsb appropriately and
// zero out the original va page offset
vaPortion = (va >> ((type == 8K_POINTER)? 9: 12)) &
0xfffffffffffffff0;
if (split) {
// There’s only one bit in question for split
splitMask = 1 << (13 + TSBSize);
if (type == 8K_POINTER)
// Make sure we’re in the lower half
vaPortion &= ~splitMask;
else
// Make sure we’re in the upper half
vaPortion |= splitMask;
}
return (TSBBase & TSBBaseMask) | (vaPortion & ~TSBBaseMask);
}
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com