- return ((sdr1 << 16) | 0x0000ffff) + 1;
- return (((sdr1 & 0x1f) << 16) | 0x0000ffff) + 1;
}
Shouldn't this actually be something like 0x10000UL << (sdr1 & 0x1f) ?
No, I don't think so. HTABSIZE (formerly HTABMASK) is a bit mask, not a number. Thus the +1.
PowerISA v2.05 says:
"The HTABSIZE field in SDR1 contains an integer giving the number of bits (in addition to the minimum of 11 bits) from the hash that are used in the Page Table index."
It is like this on even the oldest 64-bit implementations (a 5-bit integer, add 11; max is 28, so 11..39 bits used, 2**18..2**47 bytes htab size).
In the 32-bit "classic" PEM, it's a bitmask indeed (9 bits, all zeroes means 10 bits used, so 10..19 bits used, 2**16..2**25 bytes htab size).
Segher