12159047fSniklas /* Opcode table header for m680[01234]0/m6888[12]/m68851. 2*007c2a45Smiod Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 3*007c2a45Smiod 2003 Free Software Foundation, Inc. 42159047fSniklas 52159047fSniklas This file is part of GDB, GAS, and the GNU binutils. 62159047fSniklas 72159047fSniklas GDB, GAS, and the GNU binutils are free software; you can redistribute 82159047fSniklas them and/or modify them under the terms of the GNU General Public 92159047fSniklas License as published by the Free Software Foundation; either version 102159047fSniklas 1, or (at your option) any later version. 112159047fSniklas 122159047fSniklas GDB, GAS, and the GNU binutils are distributed in the hope that they 132159047fSniklas will be useful, but WITHOUT ANY WARRANTY; without even the implied 142159047fSniklas warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 152159047fSniklas the GNU General Public License for more details. 162159047fSniklas 172159047fSniklas You should have received a copy of the GNU General Public License 182159047fSniklas along with this file; see the file COPYING. If not, write to the Free 192159047fSniklas Software Foundation, 59 Temple Place - Suite 330, Boston, MA 202159047fSniklas 02111-1307, USA. */ 212159047fSniklas 222159047fSniklas /* These are used as bit flags for the arch field in the m68k_opcode 232159047fSniklas structure. */ 242159047fSniklas #define _m68k_undef 0 252159047fSniklas #define m68000 0x001 26*007c2a45Smiod #define m68008 m68000 /* Synonym for -m68000. otherwise unused. */ 272159047fSniklas #define m68010 0x002 282159047fSniklas #define m68020 0x004 292159047fSniklas #define m68030 0x008 30*007c2a45Smiod #define m68ec030 m68030 /* Similar enough to -m68030 to ignore differences; 312159047fSniklas gas will deal with the few differences. */ 322159047fSniklas #define m68040 0x010 33*007c2a45Smiod /* There is no 68050. */ 342159047fSniklas #define m68060 0x020 352159047fSniklas #define m68881 0x040 36*007c2a45Smiod #define m68882 m68881 /* Synonym for -m68881. otherwise unused. */ 372159047fSniklas #define m68851 0x080 382159047fSniklas #define cpu32 0x100 /* e.g., 68332 */ 394361b62eSniklas #define mcf5200 0x200 40b305b0f1Sespie #define mcf5206e 0x400 41b305b0f1Sespie #define mcf5307 0x800 42b55d4692Sfgsch #define mcf5407 0x1000 43*007c2a45Smiod #define mcfv4e 0x2000 44*007c2a45Smiod #define mcf528x 0x4000 452159047fSniklas 46*007c2a45Smiod /* Handy aliases. */ 472159047fSniklas #define m68040up (m68040 | m68060) 482159047fSniklas #define m68030up (m68030 | m68040up) 492159047fSniklas #define m68020up (m68020 | m68030up) 502159047fSniklas #define m68010up (m68010 | cpu32 | m68020up) 512159047fSniklas #define m68000up (m68000 | m68010up) 52*007c2a45Smiod #define mcf (mcf5200 | mcf5206e | mcf528x | mcf5307 | mcf5407 | mcfv4e) 53*007c2a45Smiod #define mcf5206eup (mcf5206e | mcf528x | mcf5307 | mcf5407 | mcfv4e) 54*007c2a45Smiod #define mcf5307up (mcf5307 | mcf5407 | mcfv4e) 55*007c2a45Smiod #define mcfv4up (mcf5407 | mcfv4e) 56*007c2a45Smiod #define mcfv4eup (mcfv4e) 572159047fSniklas 58*007c2a45Smiod #define cfloat (mcfv4e) 592159047fSniklas #define mfloat (m68881 | m68882 | m68040 | m68060) 602159047fSniklas #define mmmu (m68851 | m68030 | m68040 | m68060) 612159047fSniklas 622159047fSniklas /* The structure used to hold information for an opcode. */ 632159047fSniklas 642159047fSniklas struct m68k_opcode 652159047fSniklas { 662159047fSniklas /* The opcode name. */ 672159047fSniklas const char *name; 682159047fSniklas /* The opcode itself. */ 692159047fSniklas unsigned long opcode; 702159047fSniklas /* The mask used by the disassembler. */ 712159047fSniklas unsigned long match; 722159047fSniklas /* The arguments. */ 732159047fSniklas const char *args; 742159047fSniklas /* The architectures which support this opcode. */ 752159047fSniklas unsigned int arch; 762159047fSniklas }; 772159047fSniklas 782159047fSniklas /* The structure used to hold information for an opcode alias. */ 792159047fSniklas 802159047fSniklas struct m68k_opcode_alias 812159047fSniklas { 822159047fSniklas /* The alias name. */ 832159047fSniklas const char *alias; 842159047fSniklas /* The instruction for which this is an alias. */ 852159047fSniklas const char *primary; 862159047fSniklas }; 872159047fSniklas 882159047fSniklas /* We store four bytes of opcode for all opcodes because that is the 892159047fSniklas most any of them need. The actual length of an instruction is 902159047fSniklas always at least 2 bytes, and is as much longer as necessary to hold 912159047fSniklas the operands it has. 922159047fSniklas 932159047fSniklas The match field is a mask saying which bits must match particular 942159047fSniklas opcode in order for an instruction to be an instance of that 952159047fSniklas opcode. 962159047fSniklas 972159047fSniklas The args field is a string containing two characters for each 982159047fSniklas operand of the instruction. The first specifies the kind of 992159047fSniklas operand; the second, the place it is stored. */ 1002159047fSniklas 1012159047fSniklas /* Kinds of operands: 102*007c2a45Smiod Characters used: AaBbCcDdEFfGHIJkLlMmnOopQqRrSsTtU VvWwXxYyZz0123|*~%;@!&$?/<>#^+- 1032159047fSniklas 1042159047fSniklas D data register only. Stored as 3 bits. 1052159047fSniklas A address register only. Stored as 3 bits. 1062159047fSniklas a address register indirect only. Stored as 3 bits. 1072159047fSniklas R either kind of register. Stored as 4 bits. 1082159047fSniklas r either kind of register indirect only. Stored as 4 bits. 1092159047fSniklas At the moment, used only for cas2 instruction. 1102159047fSniklas F floating point coprocessor register only. Stored as 3 bits. 1112159047fSniklas O an offset (or width): immediate data 0-31 or data register. 1122159047fSniklas Stored as 6 bits in special format for BF... insns. 1132159047fSniklas + autoincrement only. Stored as 3 bits (number of the address register). 1142159047fSniklas - autodecrement only. Stored as 3 bits (number of the address register). 1152159047fSniklas Q quick immediate data. Stored as 3 bits. 1162159047fSniklas This matches an immediate operand only when value is in range 1 .. 8. 1172159047fSniklas M moveq immediate data. Stored as 8 bits. 1182159047fSniklas This matches an immediate operand only when value is in range -128..127 1192159047fSniklas T trap vector immediate data. Stored as 4 bits. 1202159047fSniklas 1212159047fSniklas k K-factor for fmove.p instruction. Stored as a 7-bit constant or 1222159047fSniklas a three bit register offset, depending on the field type. 1232159047fSniklas 1242159047fSniklas # immediate data. Stored in special places (b, w or l) 1252159047fSniklas which say how many bits to store. 1262159047fSniklas ^ immediate data for floating point instructions. Special places 1272159047fSniklas are offset by 2 bytes from '#'... 1282159047fSniklas B pc-relative address, converted to an offset 1292159047fSniklas that is treated as immediate data. 1302159047fSniklas d displacement and register. Stores the register as 3 bits 1312159047fSniklas and stores the displacement in the entire second word. 1322159047fSniklas 1332159047fSniklas C the CCR. No need to store it; this is just for filtering validity. 1342159047fSniklas S the SR. No need to store, just as with CCR. 1352159047fSniklas U the USP. No need to store, just as with CCR. 136b305b0f1Sespie E the ACC. No need to store, just as with CCR. 137b305b0f1Sespie G the MACSR. No need to store, just as with CCR. 138b305b0f1Sespie H the MASK. No need to store, just as with CCR. 1392159047fSniklas 1402159047fSniklas I Coprocessor ID. Not printed if 1. The Coprocessor ID is always 1412159047fSniklas extracted from the 'd' field of word one, which means that an extended 1422159047fSniklas coprocessor opcode can be skipped using the 'i' place, if needed. 1432159047fSniklas 1442159047fSniklas s System Control register for the floating point coprocessor. 1452159047fSniklas 1462159047fSniklas J Misc register for movec instruction, stored in 'j' format. 1472159047fSniklas Possible values: 1482159047fSniklas 0x000 SFC Source Function Code reg [60, 40, 30, 20, 10] 1492159047fSniklas 0x001 DFC Data Function Code reg [60, 40, 30, 20, 10] 150*007c2a45Smiod 0x002 CACR Cache Control Register [60, 40, 30, 20, mcf] 1512159047fSniklas 0x003 TC MMU Translation Control [60, 40] 1522159047fSniklas 0x004 ITT0 Instruction Transparent 1532159047fSniklas Translation reg 0 [60, 40] 1542159047fSniklas 0x005 ITT1 Instruction Transparent 1552159047fSniklas Translation reg 1 [60, 40] 1562159047fSniklas 0x006 DTT0 Data Transparent 1572159047fSniklas Translation reg 0 [60, 40] 1582159047fSniklas 0x007 DTT1 Data Transparent 1592159047fSniklas Translation reg 1 [60, 40] 1602159047fSniklas 0x008 BUSCR Bus Control Register [60] 1612159047fSniklas 0x800 USP User Stack Pointer [60, 40, 30, 20, 10] 162*007c2a45Smiod 0x801 VBR Vector Base reg [60, 40, 30, 20, 10, mcf] 1632159047fSniklas 0x802 CAAR Cache Address Register [ 30, 20] 1642159047fSniklas 0x803 MSP Master Stack Pointer [ 40, 30, 20] 1652159047fSniklas 0x804 ISP Interrupt Stack Pointer [ 40, 30, 20] 1662159047fSniklas 0x805 MMUSR MMU Status reg [ 40] 1672159047fSniklas 0x806 URP User Root Pointer [60, 40] 1682159047fSniklas 0x807 SRP Supervisor Root Pointer [60, 40] 1692159047fSniklas 0x808 PCR Processor Configuration reg [60] 1704361b62eSniklas 0xC00 ROMBAR ROM Base Address Register [520X] 1714361b62eSniklas 0xC04 RAMBAR0 RAM Base Address Register 0 [520X] 1724361b62eSniklas 0xC05 RAMBAR1 RAM Base Address Register 0 [520X] 1734361b62eSniklas 0xC0F MBAR0 RAM Base Address Register 0 [520X] 174*007c2a45Smiod 0xC04 FLASHBAR FLASH Base Address Register [mcf528x] 175*007c2a45Smiod 0xC05 RAMBAR Static RAM Base Address Register [mcf528x] 1762159047fSniklas 1772159047fSniklas L Register list of the type d0-d7/a0-a7 etc. 1782159047fSniklas (New! Improved! Can also hold fp0-fp7, as well!) 1792159047fSniklas The assembler tries to see if the registers match the insn by 1802159047fSniklas looking at where the insn wants them stored. 1812159047fSniklas 1822159047fSniklas l Register list like L, but with all the bits reversed. 1832159047fSniklas Used for going the other way. . . 1842159047fSniklas 1852159047fSniklas c cache identifier which may be "nc" for no cache, "ic" 1862159047fSniklas for instruction cache, "dc" for data cache, or "bc" 1872159047fSniklas for both caches. Used in cinv and cpush. Always 1882159047fSniklas stored in position "d". 1892159047fSniklas 190b305b0f1Sespie u Any register, with ``upper'' or ``lower'' specification. Used 191b305b0f1Sespie in the mac instructions with size word. 192b305b0f1Sespie 1932159047fSniklas The remainder are all stored as 6 bits using an address mode and a 1942159047fSniklas register number; they differ in which addressing modes they match. 1952159047fSniklas 196b305b0f1Sespie * all (modes 0-6,7.0-4) 1972159047fSniklas ~ alterable memory (modes 2-6,7.0,7.1) 198b305b0f1Sespie (not 0,1,7.2-4) 199b305b0f1Sespie % alterable (modes 0-6,7.0,7.1) 200b305b0f1Sespie (not 7.2-4) 201b305b0f1Sespie ; data (modes 0,2-6,7.0-4) 202b305b0f1Sespie (not 1) 203b305b0f1Sespie @ data, but not immediate (modes 0,2-6,7.0-3) 204b305b0f1Sespie (not 1,7.4) 205b305b0f1Sespie ! control (modes 2,5,6,7.0-3) 2062159047fSniklas (not 0,1,3,4,7.4) 2072159047fSniklas & alterable control (modes 2,5,6,7.0,7.1) 208b305b0f1Sespie (not 0,1,7.2-4) 2092159047fSniklas $ alterable data (modes 0,2-6,7.0,7.1) 210b305b0f1Sespie (not 1,7.2-4) 2112159047fSniklas ? alterable control, or data register (modes 0,2,5,6,7.0,7.1) 212b305b0f1Sespie (not 1,3,4,7.2-4) 213b305b0f1Sespie / control, or data register (modes 0,2,5,6,7.0-3) 2142159047fSniklas (not 1,3,4,7.4) 215b305b0f1Sespie > *save operands (modes 2,4,5,6,7.0,7.1) 216b305b0f1Sespie (not 0,1,3,7.2-4) 217b305b0f1Sespie < *restore operands (modes 2,3,5,6,7.0-3) 218b305b0f1Sespie (not 0,1,4,7.4) 219b305b0f1Sespie 220b305b0f1Sespie coldfire move operands: 221b305b0f1Sespie m (modes 0-4) 222b305b0f1Sespie n (modes 5,7.2) 223b305b0f1Sespie o (modes 6,7.0,7.1,7.3,7.4) 224b305b0f1Sespie p (modes 0-5) 225b305b0f1Sespie 226b305b0f1Sespie coldfire bset/bclr/btst/mulsl/mulul operands: 227b305b0f1Sespie q (modes 0,2-5) 228b305b0f1Sespie v (modes 0,2-5,7.0,7.1) 229*007c2a45Smiod b (modes 0,2-5,7.2) 230*007c2a45Smiod w (modes 2-5,7.2) 231*007c2a45Smiod y (modes 2,5) 232*007c2a45Smiod z (modes 2,5,7.2) 233*007c2a45Smiod x mov3q immediate operand. */ 2342159047fSniklas 2352159047fSniklas /* For the 68851: */ 236*007c2a45Smiod /* I didn't use much imagination in choosing the 2372159047fSniklas following codes, so many of them aren't very 2382159047fSniklas mnemonic. -rab 2392159047fSniklas 2402159047fSniklas 0 32 bit pmmu register 2412159047fSniklas Possible values: 2422159047fSniklas 000 TC Translation Control Register (68030, 68851) 2432159047fSniklas 2442159047fSniklas 1 16 bit pmmu register 2452159047fSniklas 111 AC Access Control (68851) 2462159047fSniklas 2472159047fSniklas 2 8 bit pmmu register 2482159047fSniklas 100 CAL Current Access Level (68851) 2492159047fSniklas 101 VAL Validate Access Level (68851) 2502159047fSniklas 110 SCC Stack Change Control (68851) 2512159047fSniklas 2522159047fSniklas 3 68030-only pmmu registers (32 bit) 2532159047fSniklas 010 TT0 Transparent Translation reg 0 2542159047fSniklas (aka Access Control reg 0 -- AC0 -- on 68ec030) 2552159047fSniklas 011 TT1 Transparent Translation reg 1 2562159047fSniklas (aka Access Control reg 1 -- AC1 -- on 68ec030) 2572159047fSniklas 2582159047fSniklas W wide pmmu registers 2592159047fSniklas Possible values: 2602159047fSniklas 001 DRP Dma Root Pointer (68851) 2612159047fSniklas 010 SRP Supervisor Root Pointer (68030, 68851) 2622159047fSniklas 011 CRP Cpu Root Pointer (68030, 68851) 2632159047fSniklas 2642159047fSniklas f function code register (68030, 68851) 2652159047fSniklas 0 SFC 2662159047fSniklas 1 DFC 2672159047fSniklas 2682159047fSniklas V VAL register only (68851) 2692159047fSniklas 2702159047fSniklas X BADx, BACx (16 bit) 2712159047fSniklas 100 BAD Breakpoint Acknowledge Data (68851) 2722159047fSniklas 101 BAC Breakpoint Acknowledge Control (68851) 2732159047fSniklas 2742159047fSniklas Y PSR (68851) (MMUSR on 68030) (ACUSR on 68ec030) 2752159047fSniklas Z PCSR (68851) 2762159047fSniklas 2772159047fSniklas | memory (modes 2-6, 7.*) 2782159047fSniklas 2792159047fSniklas t address test level (68030 only) 2802159047fSniklas Stored as 3 bits, range 0-7. 2812159047fSniklas Also used for breakpoint instruction now. 2822159047fSniklas 2832159047fSniklas */ 2842159047fSniklas 2852159047fSniklas /* Places to put an operand, for non-general operands: 286b305b0f1Sespie Characters used: BbCcDdghijkLlMmNnostWw123456789 287b305b0f1Sespie 2882159047fSniklas s source, low bits of first word. 2892159047fSniklas d dest, shifted 9 in first word 2902159047fSniklas 1 second word, shifted 12 2912159047fSniklas 2 second word, shifted 6 2922159047fSniklas 3 second word, shifted 0 2932159047fSniklas 4 third word, shifted 12 2942159047fSniklas 5 third word, shifted 6 2952159047fSniklas 6 third word, shifted 0 2962159047fSniklas 7 second word, shifted 7 2972159047fSniklas 8 second word, shifted 10 2982159047fSniklas 9 second word, shifted 5 2992159047fSniklas D store in both place 1 and place 3; for divul and divsl. 3002159047fSniklas B first word, low byte, for branch displacements 3012159047fSniklas W second word (entire), for branch displacements 3022159047fSniklas L second and third words (entire), for branch displacements 3032159047fSniklas (also overloaded for move16) 3042159047fSniklas b second word, low byte 3052159047fSniklas w second word (entire) [variable word/long branch offset for dbra] 3062159047fSniklas W second word (entire) (must be signed 16 bit value) 3072159047fSniklas l second and third word (entire) 3082159047fSniklas g variable branch offset for bra and similar instructions. 3092159047fSniklas The place to store depends on the magnitude of offset. 3102159047fSniklas t store in both place 7 and place 8; for floating point operations 3112159047fSniklas c branch offset for cpBcc operations. 3122159047fSniklas The place to store is word two if bit six of word one is zero, 3132159047fSniklas and words two and three if bit six of word one is one. 3142159047fSniklas i Increment by two, to skip over coprocessor extended operands. Only 3152159047fSniklas works with the 'I' format. 3162159047fSniklas k Dynamic K-factor field. Bits 6-4 of word 2, used as a register number. 3172159047fSniklas Also used for dynamic fmovem instruction. 3182159047fSniklas C floating point coprocessor constant - 7 bits. Also used for static 3192159047fSniklas K-factors... 3202159047fSniklas j Movec register #, stored in 12 low bits of second word. 321b305b0f1Sespie m For M[S]ACx; 4 bits split with MSB shifted 6 bits in first word 322b305b0f1Sespie and remaining 3 bits of register shifted 9 bits in first word. 323b305b0f1Sespie Indicate upper/lower in 1 bit shifted 7 bits in second word. 324b305b0f1Sespie Use with `R' or `u' format. 325b305b0f1Sespie n `m' withouth upper/lower indication. (For M[S]ACx; 4 bits split 326b305b0f1Sespie with MSB shifted 6 bits in first word and remaining 3 bits of 327b305b0f1Sespie register shifted 9 bits in first word. No upper/lower 328b305b0f1Sespie indication is done.) Use with `R' or `u' format. 329b305b0f1Sespie o For M[S]ACw; 4 bits shifted 12 in second word (like `1'). 330b305b0f1Sespie Indicate upper/lower in 1 bit shifted 7 bits in second word. 331b305b0f1Sespie Use with `R' or `u' format. 332b305b0f1Sespie M For M[S]ACw; 4 bits in low bits of first word. Indicate 333b305b0f1Sespie upper/lower in 1 bit shifted 6 bits in second word. Use with 334b305b0f1Sespie `R' or `u' format. 335b305b0f1Sespie N For M[S]ACw; 4 bits in low bits of second word. Indicate 336b305b0f1Sespie upper/lower in 1 bit shifted 6 bits in second word. Use with 337b305b0f1Sespie `R' or `u' format. 338b305b0f1Sespie h shift indicator (scale factor), 1 bit shifted 10 in second word 3392159047fSniklas 3402159047fSniklas Places to put operand, for general operands: 3412159047fSniklas d destination, shifted 6 bits in first word 3422159047fSniklas b source, at low bit of first word, and immediate uses one byte 3432159047fSniklas w source, at low bit of first word, and immediate uses two bytes 3442159047fSniklas l source, at low bit of first word, and immediate uses four bytes 3452159047fSniklas s source, at low bit of first word. 3462159047fSniklas Used sometimes in contexts where immediate is not allowed anyway. 3472159047fSniklas f single precision float, low bit of 1st word, immediate uses 4 bytes 3482159047fSniklas F double precision float, low bit of 1st word, immediate uses 8 bytes 3492159047fSniklas x extended precision float, low bit of 1st word, immediate uses 12 bytes 3502159047fSniklas p packed float, low bit of 1st word, immediate uses 12 bytes 3512159047fSniklas */ 3522159047fSniklas 3532159047fSniklas extern const struct m68k_opcode m68k_opcodes[]; 3542159047fSniklas extern const struct m68k_opcode_alias m68k_opcode_aliases[]; 3552159047fSniklas 3562159047fSniklas extern const int m68k_numopcodes, m68k_numaliases; 3572159047fSniklas 3582159047fSniklas /* end of m68k-opcode.h */ 359