PowerPC opcode table?
I am interested in developing a PowerPC emulator for my own learning purposes. I've found a fair amo开发者_运维百科unt of resources about programming in PowerPC assembly, but after quite some time looking, I haven't been able to find an instruction/opcode mapping table anywhere yet. Of course, I need the opcodes to be able to write an emulator. Where can I find one?
I did some more hunting and found documentation on IBM's website. This page links to three books of documentation, of which the first one contains all relevant information about PowerPC instructions.
I was initially confused by seeing that many instructions all had the same OPCODE field value, and thought, "How will we distinguish the instructions then?". However, in section 1.7, "Instruction formats", many of the instruction forms that are used throughout the architecture actually have a two-part opcode; the first part being the six-bit OPCODE field at the high end of the instruction, and the second part being a field called XO, which contains extra identification for the opcode. Its size and location varies depending on the instruction format.
Here's one: http://pds.twi.tudelft.nl/vakken/in101/labcourse/instruction-set/
EDIT: This one's better: The Programming Environments for 32-Bit Microprocessors
The latest spec is the Power ISA book, available here. It has plenty of tables in the appendices.
Note that the ISA fluctuated a bit over time, so it might be best to find the doc for the specific core you're going to emulate.
RCPU RISC Central Processing Unit Reference Manual
Many of the other resources being long-since lost, here's an answer that is valid as of 2020 and has the best chance of remaining so in perpetuity.
Find a copy of PowerPC Microprocessor Family: The Programmer’s Reference Guide; Archive.org hosts this one from 1995 and that same document is also available elsewhere — search for the text MPRPPCPRG-01 to locate other copies.
In that document, skip to either:
- Page 44 for the start of section '4.2 PowerPC Instruction Set Listings', which begins with 'Table 33. Complete Instruction List Sorted by Mnemonic'; or
- Page 51 for 'Table 34. Complete Instruction List Sorted by Opcode'.
As per the date of the document, that's the 1995-vintage version of PowerPC, i.e. that which was in the first few generations of PowerMac, the various licensed Mac clones, the IBM ThinkPad 850, etc.
The tables are compact and provide only the encoding information (following the IBM convention that bit 0 is most significant):
If you're on a Mac, check out /Library/Application Support/Shark/Helpers/PowerPC Help.app, or choose Services -> ISA Reference -> Lookup PowerPC Instruction.
精彩评论