views:

231

answers:

3

I'm looking at a core dump of a (Xenon) PowerPC executable compiled with MSVC. The function I'm debugging has an op that the MSVC disassembler calls mtmsree r13. mtmsree isn't in the IBM docs for the PPC; what does this op do?

It immediately follows a mfmsr and obviously it's moving something to the machine state register, but I don't know what that ee suffix is supposed to mean. It must be some sort of cutesy Microsoft nickname for an op the PPC docs call something different.

A: 

I picked apart the machine code for the instruction ( 011111 01101 00001 00000 0010110010 0 ) and it turns out that mtmsree is what everyone else just calls mtmsrd.

Who knows what the hell Microsoft was thinking by tacking on an 'ee' at the end for no reason whatsoever.

Crashworks
A: 

Bits 21:30 of the mtmsr instruction are 0010010010, not 0010110010.

My guess is that mtmsree is a Xenon-specific instruction that sets only the EE bit in the MSR. The Book E machines have the wrtee and wrteei instructions to do that. I wish I knew where to find a PEM for Xenon.

My bad -- 0010110010 is mtmsrd, not mtmsr (that is, the 64-bit version). But if you search for mtmsrd in the IBM docs it just takes you to MTMSR.
Crashworks
The relevant PEM, so far as I can tell, is just IBM's "PowerPC Microprocessor Family: Programming Environments Manual for 64 and 32-Bit Microprocessors." But MSFT loves to invent its own quirky little codenames for things.
Crashworks
+1  A: 

The instruction is an extended form of the mtmsrd instruction that has the L bit set (0x00010000). Instead of modifying the entire MSR, it only modifies the EE (External interrupt Enable) and RI (Recoverable Interrupt) btis. It is faster than mtmsrd L=0 as it execution synchronizing instead of context synchronizing. It is a priviledged instruction so will cause an exception to the os, and is .: still slow.

There is public documentation for this in IBM's Book III: PowerPC Operating Environment Architecture v2.02 (page 91), http://www.ibm.com/developerworks/power/library/pa-archguidev2/?S%5FTACT=105AGX16&S%5FCMP=LP

  • Luke H
luke h