1 /* 2 * Copyright (c) 1982 Regents of the University of California 3 * @(#)instrs.h 4.3 02/14/82 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 */ 39 #define ACCM (ACCR | ACCW) /* modify */ 40 #define ACCI (ACCB | ACCR) /* XFC code */ 41 42 #define ACCESSMASK (ACCA | ACCR | ACCW | ACCB) /* the mask */ 43 44 /* 45 * Construction of TYPX and ACCX, to make the instrs table 46 * easy to use and read. 47 */ 48 /* 49 * For address 50 */ 51 #define A_AB A_CONS(ACCA, TYPB) 52 #define A_AW A_CONS(ACCA, TYPW) 53 #define A_AL A_CONS(ACCA, TYPL) 54 #define A_AQ A_CONS(ACCA, TYPQ) 55 #define A_AO A_CONS(ACCA, TYPO) 56 #define A_AF A_CONS(ACCA, TYPF) 57 #define A_AD A_CONS(ACCA, TYPD) 58 #define A_AG A_CONS(ACCA, TYPG) 59 #define A_AH A_CONS(ACCA, TYPH) 60 /* 61 * For branch displacement 62 */ 63 #define A_BB A_CONS(ACCB, TYPB) 64 #define A_BW A_CONS(ACCB, TYPW) 65 /* 66 * For modification 67 */ 68 #define A_MB A_CONS(ACCM, TYPB) 69 #define A_MW A_CONS(ACCM, TYPW) 70 #define A_ML A_CONS(ACCM, TYPL) 71 #define A_MF A_CONS(ACCM, TYPF) 72 #define A_MD A_CONS(ACCM, TYPD) 73 #define A_MG A_CONS(ACCM, TYPG) 74 #define A_MH A_CONS(ACCM, TYPH) 75 /* 76 * For reading 77 */ 78 #define A_RB A_CONS(ACCR, TYPB) 79 #define A_RW A_CONS(ACCR, TYPW) 80 #define A_RL A_CONS(ACCR, TYPL) 81 #define A_RQ A_CONS(ACCR, TYPQ) 82 #define A_RO A_CONS(ACCR, TYPO) 83 #define A_RF A_CONS(ACCR, TYPF) 84 #define A_RD A_CONS(ACCR, TYPD) 85 #define A_RG A_CONS(ACCR, TYPG) 86 #define A_RH A_CONS(ACCR, TYPH) 87 /* 88 * For writing 89 */ 90 #define A_WB A_CONS(ACCW, TYPB) 91 #define A_WW A_CONS(ACCW, TYPW) 92 #define A_WL A_CONS(ACCW, TYPL) 93 #define A_WQ A_CONS(ACCW, TYPQ) 94 #define A_WO A_CONS(ACCW, TYPO) 95 #define A_WF A_CONS(ACCW, TYPF) 96 #define A_WD A_CONS(ACCW, TYPD) 97 #define A_WG A_CONS(ACCW, TYPG) 98 #define A_WH A_CONS(ACCW, TYPH) 99 100 #ifndef INSTTAB 101 /* 102 * Define what the entries in the table look like. 103 * This is only used for adb and sdb; not for as. 104 */ 105 #define INSTTAB 106 struct insttab{ 107 char *iname; 108 u_char eopcode; 109 u_char popcode; 110 char nargs; 111 u_char argtype[6]; 112 } insttab[]; 113 114 #define OP(name,eopcode,popdcode,nargs,a1,a2,a3,a4,a5,a6) {name,eopcode,popdcode,nargs,a1,a2,a3,a4,a5,a6} 115 116 #endif INSTTAB 117 118 /* 119 * Definitions for the escape bytes 120 */ 121 #define CORE 0 122 #define NEW 1 123 #define ESCD 0xfd 124 #define ESCF 0xff 125