1 /*        $NetBSD: db_disasm.h,v 1.8 2017/05/22 16:39:41 ragge 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  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 
31 
32 #define SIZE_BYTE    1                  /* Byte */
33 #define SIZE_WORD    2                  /* Word */
34 #define SIZE_LONG    4                  /* Longword */
35 #define SIZE_QWORD   8                  /* Quadword */
36 #define SIZE_OWORD  16                  /* Octaword */
37 
38 /*
39  * The VAX instruction set has a variable length instruction format which
40  * may be as short as one byte and as long as needed depending on the type
41  * of instruction. [...] Each instruction consists of an opcode followed
42  * by zero to six operand specifiers whose number and type depend on the
43  * opcode. All operand specidiers are, themselves, of the same format --
44  * i.e. an address mode plus additional information.
45  *
46  * [VAX Architecture Handbook, p.52:  Instruction Format]
47  */
48 
49 typedef const struct {
50           const char *mnemonic;
51           const char *argdesc;
52 } vax_instr_t;
53 
54 extern vax_instr_t vax_inst[256];
55 extern vax_instr_t vax_inst2[0x56];
56 
57 long skip_opcode(long);
58 
59 /*
60  * reasonably simple macro to gather all the reserved two-byte opcodes
61  * into only a few table entries...
62  */
63 #define   INDEX_OPCODE(x)     \
64           (((x) & 0xff00) == 0xfe00) ? 0 : \
65           ((x) < 0xfd30) ? 0 : \
66           ((x) < 0xfd80) ? (x) - 0xfd30 : \
67           ((x) == 0xfd98) ? 0x50 : \
68           ((x) == 0xfd99) ? 0x51 : \
69           ((x) == 0xfdf6) ? 0x52 : \
70           ((x) == 0xfdf7) ? 0x53 : \
71           ((x) == 0xfffd) ? 0x54 : \
72           ((x) == 0xfffe) ? 0x55 : 0
73