1 /* $NetBSD: db_disasm.h,v 1.7 2009/02/17 13:48:29 christos Exp $ */ 2 /* 3 * Copyright (c) 1996 Ludd, University of Lule}, Sweden. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Ludd by 7 * Bertram Barth. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed at Ludd, University of 20 * Lule}, Sweden and its contributors. 21 * 4. The name of the author may not be used to endorse or promote products 22 * derived from this software without specific prior written permission 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 37 38 #define SIZE_BYTE 1 /* Byte */ 39 #define SIZE_WORD 2 /* Word */ 40 #define SIZE_LONG 4 /* Longword */ 41 #define SIZE_QWORD 8 /* Quadword */ 42 #define SIZE_OWORD 16 /* Octaword */ 43 44 /* 45 * The VAX instruction set has a variable length instruction format which 46 * may be as short as one byte and as long as needed depending on the type 47 * of instruction. [...] Each instruction consists of an opcode followed 48 * by zero to six operand specifiers whose number and type depend on the 49 * opcode. All operand specidiers are, themselves, of the same format -- 50 * i.e. an address mode plus additional information. 51 * 52 * [VAX Architecture Handbook, p.52: Instruction Format] 53 */ 54 55 typedef const struct { 56 const char *mnemonic; 57 const char *argdesc; 58 } vax_instr_t; 59 60 extern vax_instr_t vax_inst[256]; 61 extern vax_instr_t vax_inst2[0x56]; 62 63 long skip_opcode(long); 64 65 /* 66 * reasonably simple macro to gather all the reserved two-byte opcodes 67 * into only a few table entries... 68 */ 69 #define INDEX_OPCODE(x) \ 70 (((x) & 0xff00) == 0xfe00) ? 0 : \ 71 ((x) < 0xfd30) ? 0 : \ 72 ((x) < 0xfd80) ? (x) - 0xfd30 : \ 73 ((x) == 0xfd98) ? 0x50 : \ 74 ((x) == 0xfd99) ? 0x51 : \ 75 ((x) == 0xfdf6) ? 0x52 : \ 76 ((x) == 0xfdf7) ? 0x53 : \ 77 ((x) == 0xfffd) ? 0x54 : \ 78 ((x) == 0xfffe) ? 0x55 : 0 79