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