This patch adds a runtime check on PVR to see if we're running on a 64-bit capable CPU. If so, we use mtmsrd, which can set the high 32bits of MSR.
That PVR check isn't quite correct.
mfmsr r1 ; /* unset MSR_SF */ \ clrlwi r1,r1,0 ; \
- mtmsr r1 ; \
- mtmsrd r1 ; \
clrlwi 1,1,0 is rlwinm 1,1,0,0,31 which clears all the top 32 bits, not only MSR[SF]. Importantly it clears MSR[HV], which you do not want. Use rldicl instead?
Instead of the PVR thing, you could check if MSR[SF] is set, and only then clear it. Is this same code used on 32-bit systems?
lis x,0x8000 ; add. x,x,x ; beq ohai_we_are_32bit
Segher