NASM 0.98p3.5
[platform/upstream/nasm.git] / insns.h
1 /* insns.h   header file for insns.c
2  *
3  * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4  * Julian Hall. All rights reserved. The software is
5  * redistributable under the licence given in the file "Licence"
6  * distributed in the NASM archive.
7  */
8
9 #ifndef NASM_INSNS_H
10 #define NASM_INSNS_H
11
12 struct itemplate {
13     int opcode;                        /* the token, passed from "parser.c" */
14     int operands;                      /* number of operands */
15     long opd[3];                       /* bit flags for operand types */
16     char *code;                        /* the code it assembles to */
17     unsigned long flags;               /* some flags */
18 };
19
20 /*
21  * Instruction template flags. These specify which processor
22  * targets the instruction is eligible for, whether it is
23  * privileged or undocumented, and also specify extra error
24  * checking on the matching of the instruction.
25  *
26  * IF_SM stands for Size Match: any operand whose size is not
27  * explicitly specified by the template is `really' intended to be
28  * the same size as the first size-specified operand.
29  * Non-specification is tolerated in the input instruction, but
30  * _wrong_ specification is not.
31  *
32  * IF_SM2 invokes Size Match on only the first _two_ operands, for
33  * three-operand instructions such as SHLD: it implies that the
34  * first two operands must match in size, but that the third is
35  * required to be _unspecified_.
36  *
37  * IF_SB invokes Size Byte: operands with unspecified size in the
38  * template are really bytes, and so no non-byte specification in
39  * the input instruction will be tolerated. IF_SW similarly invokes
40  * Size Word, and IF_SD invokes Size Doubleword.
41  *
42  * (The default state if neither IF_SM nor IF_SM2 is specified is
43  * that any operand with unspecified size in the template is
44  * required to have unspecified size in the instruction too...)
45  */
46
47 #define IF_SM     0x00000001UL         /* size match */
48 #define IF_SM2    0x00000002UL         /* size match first two operands */
49 #define IF_SB     0x00000004UL         /* unsized operands can't be non-byte */
50 #define IF_SW     0x00000008UL         /* unsized operands can't be non-word */
51 #define IF_SD     0x00000010UL         /* unsized operands can't be nondword */
52 #define IF_PRIV   0x00000100UL         /* it's a privileged instruction */
53 #define IF_SMM    0x00000200UL         /* it's only valid in SMM */
54 #define IF_PROT   0x00000400UL         /* it's protected mode only */
55 #define IF_UNDOC  0x00001000UL         /* it's an undocumented instruction */
56 #define IF_FPU    0x00002000UL         /* it's an FPU instruction */
57 #define IF_MMX    0x00004000UL         /* it's an MMX instruction */
58 #define IF_3DNOW  0x00008000UL         /* it's a 3DNow! instruction */
59 #define IF_SSE    0x00010000UL         /* it's a SSE (KNI, MMX2) instruction */
60 #define IF_PMASK  0xFF000000UL         /* the mask for processor types */
61 #define IF_PFMASK 0xF001FF00UL         /* the mask for disassembly "prefer" */
62 #define IF_8086   0x00000000UL         /* 8086 instruction */
63 #define IF_186    0x01000000UL         /* 186+ instruction */
64 #define IF_286    0x02000000UL         /* 286+ instruction */
65 #define IF_386    0x03000000UL         /* 386+ instruction */
66 #define IF_486    0x04000000UL         /* 486+ instruction */
67 #define IF_PENT   0x05000000UL         /* Pentium instruction */
68 #define IF_P6     0x06000000UL         /* P6 instruction */
69 #define IF_KATMAI 0x07000000UL         /* Katmai instructions */
70 #define IF_CYRIX  0x10000000UL         /* Cyrix-specific instruction */
71 #define IF_AMD    0x20000000UL         /* AMD-specific instruction */
72
73 #endif