1 /* $NetBSD: db_disasm.h,v 1.6 2009/02/16 23:55:31 christos Exp $ */
3 * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
6 * This code is derived from software contributed to Ludd by
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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
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.
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 */
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.
52 * [VAX Architecture Handbook, p.52: Instruction Format]
55 typedef const struct {
60 extern vax_instr_t vax_inst
[256];
61 extern vax_instr_t vax_inst2
[0x56];
63 long skip_opcode(long);
66 * reasonably simple macro to gather all the reserved two-byte opcodes
67 * into only a few table entries...
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