Commit | Line | Data |
---|---|---|
d8664ea2 RH |
1 | /* |
2 | * Copyright (c) 1982 Regents of the University of California | |
76705c73 | 3 | * @(#)instrs.h 4.5 %G% |
d8664ea2 RH |
4 | */ |
5 | /* | |
6 | * Argument data types | |
7 | * | |
8 | * If you change these definitions, you must also change the tables | |
9 | * in assizetab.c | |
10 | */ | |
11 | #define TYPB 000 /* byte integer */ | |
12 | #define TYPW 001 /* word integer */ | |
13 | #define TYPL 002 /* long integer */ | |
14 | #define TYPQ 003 /* quad integer */ | |
15 | #define TYPO 004 /* octa integer */ | |
16 | #define TYPF 005 /* F float */ | |
17 | #define TYPD 006 /* D float */ | |
18 | #define TYPG 007 /* G float */ | |
19 | #define TYPH 010 /* H float */ | |
20 | #define TYPUNPACKED 011 /* when unpacked into mantissa & exponent */ | |
21 | #define TYPNONE 012 /* when nothing */ | |
22 | #define TYPLG 4 /* number of bits the above take up */ | |
23 | ||
24 | #define TYPMASK ((1<<TYPLG)-1) /* the mask (assumes 2's comp arith) */ | |
25 | /* | |
26 | * Constructors and extractors for argument access kinds and types | |
27 | */ | |
28 | #define A_CONS(access, type) ((access) | (type)) | |
29 | #define A_ACCEXT(consed) ((consed) & (TYPMASK << TYPLG)) | |
30 | #define A_TYPEXT(consed) ((consed) & TYPMASK) | |
31 | ||
32 | /* | |
33 | * Argument access types used to test validity of operands to operators | |
34 | */ | |
35 | #define ACCR (1<<TYPLG) /* read */ | |
36 | #define ACCW (2<<TYPLG) /* write */ | |
37 | #define ACCB (4<<TYPLG) /* branch displacement */ | |
38 | #define ACCA (8<<TYPLG) /* address only */ | |
ad2d2388 | 39 | #define ACCV (8<<TYPLG) /* address only */ |
d8664ea2 RH |
40 | #define ACCM (ACCR | ACCW) /* modify */ |
41 | #define ACCI (ACCB | ACCR) /* XFC code */ | |
42 | ||
43 | #define ACCESSMASK (ACCA | ACCR | ACCW | ACCB) /* the mask */ | |
44 | ||
45 | /* | |
46 | * Construction of TYPX and ACCX, to make the instrs table | |
47 | * easy to use and read. | |
48 | */ | |
49 | /* | |
ad2d2388 | 50 | * For real memory address |
d8664ea2 RH |
51 | */ |
52 | #define A_AB A_CONS(ACCA, TYPB) | |
53 | #define A_AW A_CONS(ACCA, TYPW) | |
54 | #define A_AL A_CONS(ACCA, TYPL) | |
55 | #define A_AQ A_CONS(ACCA, TYPQ) | |
56 | #define A_AO A_CONS(ACCA, TYPO) | |
57 | #define A_AF A_CONS(ACCA, TYPF) | |
58 | #define A_AD A_CONS(ACCA, TYPD) | |
59 | #define A_AG A_CONS(ACCA, TYPG) | |
60 | #define A_AH A_CONS(ACCA, TYPH) | |
ad2d2388 RH |
61 | /* |
62 | * For real memory addresses, or register addresses [sic] | |
76705c73 RH |
63 | * |
64 | * CHEAT! we just call these read access, since | |
65 | * registers are allowed. All field instruction, except insv, | |
66 | * are are read access fields. | |
ad2d2388 | 67 | */ |
76705c73 RH |
68 | #define A_VB A_CONS(ACCR, TYPB) |
69 | #define A_VW A_CONS(ACCR, TYPW) | |
70 | #define A_VL A_CONS(ACCR, TYPL) | |
71 | #define A_VQ A_CONS(ACCR, TYPQ) | |
72 | #define A_VO A_CONS(ACCR, TYPO) | |
73 | #define A_VF A_CONS(ACCR, TYPF) | |
74 | #define A_VD A_CONS(ACCR, TYPD) | |
75 | #define A_VG A_CONS(ACCR, TYPG) | |
76 | #define A_VH A_CONS(ACCR, TYPH) | |
d8664ea2 RH |
77 | /* |
78 | * For branch displacement | |
79 | */ | |
80 | #define A_BB A_CONS(ACCB, TYPB) | |
81 | #define A_BW A_CONS(ACCB, TYPW) | |
82 | /* | |
83 | * For modification | |
84 | */ | |
85 | #define A_MB A_CONS(ACCM, TYPB) | |
86 | #define A_MW A_CONS(ACCM, TYPW) | |
87 | #define A_ML A_CONS(ACCM, TYPL) | |
88 | #define A_MF A_CONS(ACCM, TYPF) | |
89 | #define A_MD A_CONS(ACCM, TYPD) | |
90 | #define A_MG A_CONS(ACCM, TYPG) | |
91 | #define A_MH A_CONS(ACCM, TYPH) | |
92 | /* | |
93 | * For reading | |
94 | */ | |
95 | #define A_RB A_CONS(ACCR, TYPB) | |
96 | #define A_RW A_CONS(ACCR, TYPW) | |
97 | #define A_RL A_CONS(ACCR, TYPL) | |
98 | #define A_RQ A_CONS(ACCR, TYPQ) | |
99 | #define A_RO A_CONS(ACCR, TYPO) | |
100 | #define A_RF A_CONS(ACCR, TYPF) | |
101 | #define A_RD A_CONS(ACCR, TYPD) | |
102 | #define A_RG A_CONS(ACCR, TYPG) | |
103 | #define A_RH A_CONS(ACCR, TYPH) | |
104 | /* | |
105 | * For writing | |
106 | */ | |
107 | #define A_WB A_CONS(ACCW, TYPB) | |
108 | #define A_WW A_CONS(ACCW, TYPW) | |
109 | #define A_WL A_CONS(ACCW, TYPL) | |
110 | #define A_WQ A_CONS(ACCW, TYPQ) | |
111 | #define A_WO A_CONS(ACCW, TYPO) | |
112 | #define A_WF A_CONS(ACCW, TYPF) | |
113 | #define A_WD A_CONS(ACCW, TYPD) | |
114 | #define A_WG A_CONS(ACCW, TYPG) | |
115 | #define A_WH A_CONS(ACCW, TYPH) | |
116 | ||
117 | #ifndef INSTTAB | |
118 | /* | |
119 | * Define what the entries in the table look like. | |
120 | * This is only used for adb and sdb; not for as. | |
121 | */ | |
122 | #define INSTTAB | |
123 | struct insttab{ | |
124 | char *iname; | |
125 | u_char eopcode; | |
126 | u_char popcode; | |
127 | char nargs; | |
128 | u_char argtype[6]; | |
129 | } insttab[]; | |
130 | ||
131 | #define OP(name,eopcode,popdcode,nargs,a1,a2,a3,a4,a5,a6) {name,eopcode,popdcode,nargs,a1,a2,a3,a4,a5,a6} | |
132 | ||
133 | #endif INSTTAB | |
134 | ||
135 | /* | |
136 | * Definitions for the escape bytes | |
137 | */ | |
138 | #define CORE 0 | |
139 | #define NEW 1 | |
140 | #define ESCD 0xfd | |
141 | #define ESCF 0xff |