]> git.saurik.com Git - apple/boot.git/blob - i386/nasm/insns.h
boot-111.tar.gz
[apple/boot.git] / i386 / nasm / insns.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /* insns.h header file for insns.c
26 *
27 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
28 * Julian Hall. All rights reserved. The software is
29 * redistributable under the licence given in the file "Licence"
30 * distributed in the NASM archive.
31 */
32
33 #ifndef NASM_INSNS_H
34 #define NASM_INSNS_H
35
36 struct itemplate {
37 int opcode; /* the token, passed from "parser.c" */
38 int operands; /* number of operands */
39 long opd[3]; /* bit flags for operand types */
40 char *code; /* the code it assembles to */
41 int flags; /* some flags */
42 };
43
44 /*
45 * Instruction template flags. These specify which processor
46 * targets the instruction is eligible for, whether it is
47 * privileged or undocumented, and also specify extra error
48 * checking on the matching of the instruction.
49 *
50 * IF_SM stands for Size Match: any operand whose size is not
51 * explicitly specified by the template is `really' intended to be
52 * the same size as the first size-specified operand.
53 * Non-specification is tolerated in the input instruction, but
54 * _wrong_ specification is not.
55 *
56 * IF_SM2 invokes Size Match on only the first _two_ operands, for
57 * three-operand instructions such as SHLD: it implies that the
58 * first two operands must match in size, but that the third is
59 * required to be _unspecified_.
60 *
61 * IF_SB invokes Size Byte: operands with unspecified size in the
62 * template are really bytes, and so no non-byte specification in
63 * the input instruction will be tolerated. IF_SW similarly invokes
64 * Size Word, and IF_SD invokes Size Doubleword.
65 *
66 * (The default state if neither IF_SM nor IF_SM2 is specified is
67 * that any operand with unspecified size in the template is
68 * required to have unspecified size in the instruction too...)
69 */
70
71 #define IF_SM 0x0001 /* size match */
72 #define IF_SM2 0x0002 /* size match first two operands */
73 #define IF_SB 0x0004 /* unsized operands can't be non-byte */
74 #define IF_SW 0x0008 /* unsized operands can't be non-word */
75 #define IF_SD 0x0010 /* unsized operands can't be nondword */
76 #define IF_8086 0x0000 /* 8086 instruction */
77 #define IF_186 0x0100 /* 186+ instruction */
78 #define IF_286 0x0200 /* 286+ instruction */
79 #define IF_386 0x0300 /* 386+ instruction */
80 #define IF_486 0x0400 /* 486+ instruction */
81 #define IF_PENT 0x0500 /* Pentium instruction */
82 #define IF_P6 0x0600 /* P6 instruction */
83 #define IF_CYRIX 0x0800 /* Cyrix-specific instruction */
84 #define IF_PMASK 0x0F00 /* the mask for processor types */
85 #define IF_PRIV 0x1000 /* it's a privileged instruction */
86 #define IF_UNDOC 0x2000 /* it's an undocumented instruction */
87 #define IF_FPU 0x4000 /* it's an FPU instruction */
88 #define IF_MMX 0x8000 /* it's an MMX instruction */
89
90 #endif