X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/e5b9ebfbc42243327d4449f20a35fead2999c848..12044a7d98b9f9bfc423afa3defd6ea91d220daa:/usr/src/old/as.vax/as.h diff --git a/usr/src/old/as.vax/as.h b/usr/src/old/as.vax/as.h index ef84371180..8558b0d085 100644 --- a/usr/src/old/as.vax/as.h +++ b/usr/src/old/as.vax/as.h @@ -1,10 +1,14 @@ -/* Copyright (c) 1980 Regents of the University of California */ -/* "@(#)as.h 4.4 %G%" */ +/* + * Copyright (c) 1982 Regents of the University of California + * @(#)as.h 4.14 %G% + */ #ifdef VMS # define vax 1 # define VAX 1 #endif VMS +#define reg register + #include #ifdef UNIX @@ -12,7 +16,8 @@ # include # include #else not FLEXNAMES -# include +# define ONLIST +# include "a.out.h" # include #endif FLEXNAMES @@ -35,27 +40,54 @@ #define NHASH 1103 /* hash table is dynamically extended */ #define TNAMESIZE 32 /* maximum length of temporary file names */ #define NLOC 4 /* number of location ctrs */ - +/* + * Sizes for character buffers. + * what size #define name comments + * + * source file reads ASINBUFSIZ integral of BUFSIZ + * string assembly NCPString large for .stabs + * name assembly NCPName depends on FLEXNAMES + * string save STRPOOLDALLOP + * + * + * -source file reads should be integral of BUFSIZ for efficient reads + * -string saving is a simple first fit + */ +#ifndef ASINBUFSIZ +# define ASINBUFSIZ 4096 +#endif not ASINBUFSIZ +#ifndef STRPOOLDALLOP +# define STRPOOLDALLOP 8192 +#endif not STRPOOLDALLOP +#ifndef NCPString +# define NCPString 4080 +#endif not NCPString + +#define NCPName NCPS #ifdef UNIX -# ifndef FLEXNAMES -# ifndef NCPS -# define NCPS 8 /* number of characters per symbol*/ -# endif -# else -# ifdef NCPS -# undef NCPS -# endif -# define NCPS BUFSIZ /* needed to allocate yytext */ -# endif +# ifndef FLEXNAMES +# ifndef NCPS +# undef NCPName +# define NCPName 8 +# endif not NCPS +# else FLEXNAMES +# ifndef NCPS +# undef NCPName +# define NCPName 4096 +# endif not NCPS +# endif FLEXNAMES # endif UNIX # ifdef VMS -# ifdef NCPS -# undef NCPS -# endif NCPS -# define NCPS 15 +# define NCPName 15 # endif VMS +/* + * Check sizes, and compiler error if sizes botch + */ +#if ((STRPOOLDALLOP < NCPString) || (STRPOOLDALLOP < NCPName)) + $$$botch with definition sizes +#endif test botches /* * Symbol types */ @@ -87,51 +119,45 @@ #define AIMM 7 /* $ expr */ #define ASTAR 8 /* * */ #define AINDX 16 /* [%r] */ - /* - * Argument access types used to test validity of operands to operators + * Definitions for the things found in ``instrs'' */ -#define ACCA (8<<3) /* address only */ -#define ACCR (1<<3) /* read */ -#define ACCW (2<<3) /* write */ -#define ACCM (3<<3) /* modify */ -#define ACCB (4<<3) /* branch displacement */ -#define ACCI (5<<3) /* XFC code */ +#define INSTTAB 1 +#include "instrs.h" /* - * Argument data types + * Tells outrel what it is relocating + * RELOC_PCREL is an implicit argument to outrel; it is or'ed in + * with a TYPX + */ +#define RELOC_PCREL (1< number of bytes */ +extern int lgreflen[]; /* {LEN*+PCREL} ==> lg number of bytes */ +extern int len124[]; /* {1,2,4,8,16} ==> {LEN1, LEN2, LEN4, LEN8} */ +extern char mod124[]; /* {1,2,4,8,16} ==> {bits to construct operands */ +extern int type_124[]; /* {1,2,4,8,16} ==> {TYPB,TYPW,TYPL,TYPQ,TYPO} */ +extern int ty_NORELOC[]; /* {TYPB..TYPH} ==> {1 if relocation not OK */ +extern int ty_float[]; /* {TYPB..TYPH} ==> {1 if floating number */ +extern int ty_LEN[]; /* {TYPB..TYPH} ==> {LEN1..LEN16} */ +extern int ty_nbyte[]; /* {TYPB..TYPH} ==> {1,2,4,8,16} */ +extern int ty_nlg[]; /* {TYPB..TYPH} ==> lg{1,2,4,8,16} */ +extern char *ty_string[]; /* {TYPB..TYPH} ==> printable */ #define TMPC 7 -#define HW 01 -#define FW 03 -#define DW 07 - -#ifdef UNIX -# include -#endif UNIX +#define HW 0x1 +#define FW 0x3 +#define DW 0x7 +#define OW 0xF #ifdef VMS # define PAGRND 0x1FFL @@ -236,7 +262,10 @@ struct symtab{ struct instab{ struct nlist s_nm; /* instruction name, type (opcode) */ u_char s_tag; + u_char s_eopcode; + char s_pad[2]; /* round to 20 bytes */ }; +typedef struct instab *Iptr; /* * The fields nm.n_desc and nm.n_value total 6 bytes; this is * just enough for the 6 bytes describing the argument types. @@ -244,25 +273,74 @@ struct instab{ * they are allocated adjacently. * IF THE FORMAT OF STRUCT nlist CHANGES, THESE MAY HAVE TO BE CHANGED. * - * Instab is cleverly declared to look very much the combination of + * Instab is cleverly declared to look very much like the combination of * a struct symtab and a struct nlist. */ +/* + * With the 1981 VAX architecture reference manual, + * DEC defined and named two byte opcodes. + * In addition, DEC defined four new one byte instructions for + * queue manipulation. + * The assembler was patched in 1982 to reflect this change. + * + * The two byte opcodes are preceded with an escape byte + * (usually an ESCD) and an opcode byte. + * For one byte opcodes, the opcode is called the primary opcode. + * For two byte opcodes, the second opcode is called the primary opcode. + * + * We store the primary opcode in I_popcode, + * and the escape opcode in I_eopcode. + * + * For one byte opcodes in the basic arhitecture, + * I_eopcode is CORE + * For one byte opcodes in the new architecture definition, + * I_eopcode is NEW + * For the two byte opcodes, I_eopcode is the escape byte. + * + * The assembler checks if a NEW or two byte opcode is used, + * and issues a warning diagnostic. + */ +/* + * For upward compatability reasons, we can't have the two opcodes + * forming an operator specifier byte(s) be physically adjacent + * in the instruction table. + * We define a structure and a constructor that is used in + * the instruction generator. + */ +struct Opcode{ + u_char Op_eopcode; + u_char Op_popcode; +}; + +#define BADPOINT 0xAAAAAAAA +/* + * See if a structured opcode is bad + */ +#define ITABCHECK(o) ((itab[o.Op_eopcode] != (Iptr*)BADPOINT) && (itab[o.Op_eopcode][o.Op_popcode] != (Iptr)BADPOINT)) +/* + * Index the itab by a structured opcode + */ +#define ITABFETCH(o) itab[o.Op_eopcode][o.Op_popcode] + struct Instab{ #ifdef FLEXNAMES char *I_name; #else not FLEXNAMES - char I_name[NCPS]; + char I_name[NCPName]; #endif - u_char I_opcode; + u_char I_popcode; /* basic op code */ char I_nargs; char I_args[6]; u_char I_s_tag; + u_char I_eopcode; + char I_pad[2]; /* round to 20 bytes */ }; /* * Redefinitions of fields in the struct nlist for instructions so that * one saves typing, and conforms to the old naming conventions */ -#define i_opcode s_nm.n_type /* use the same field as symtab.type */ +#define i_popcode s_nm.n_type /* use the same field as symtab.type */ +#define i_eopcode s_eopcode #define i_nargs s_nm.n_other /* number of arguments */ #define fetcharg(ptr, n) ((struct Instab *)ptr)->I_args[n] @@ -273,53 +351,36 @@ struct arg { /*one argument to an instruction*/ char a_dispsize; /*usually d124, unless have B^, etc*/ struct exp *a_xp; }; - +/* + * Definitions for numbers and expressions. + */ +#include "asnumber.h" struct exp { - long e_xvalue; /* MUST be the first field (look at union Double) */ - long e_yvalue; /* MUST be second field; least sig word of a double */ + Bignum e_number; /* 128 bits of #, plus tag */ char e_xtype; char e_xloc; - struct symtab *e_xname; + struct symtab *e_xname; }; +#define e_xvalue e_number.num_num.numIl_int.Il_long -#define doub_MSW e_xvalue -#define doub_LSW e_yvalue +#define MINLIT 0 +#define MAXLIT 63 -union Double { - struct{ - long doub_MSW; - long doub_LSW; - } dis_dvalue; - double dvalue; -}; +#define MINBYTE -128 +#define MAXBYTE 127 +#define MINUBYTE 0 +#define MAXUBYTE 255 -struct Quad { - long quad_low_long; - long quad_high_long; -}; +#define MINWORD -32768 +#define MAXWORD 32767 +#define MINUWORD 0 +#define MAXUWORD 65535 -/* - * Magic layout macros - */ -#define MINBYTE -128 -#define MAXBYTE 127 -#define MINWORD -32768 -#define MAXWORD 32767 - -#define LITFLTMASK 0x000043F0 /*really magic*/ -/* - * Is the floating point double word in xp a - * short literal floating point number? - */ -#define slitflt(xp) \ - ( (xp->doub_LSW == 0) \ - && ( (xp->doub_MSW & LITFLTMASK) \ - == xp->doub_MSW) ) -/* - * If it is a slitflt, then extract the 6 interesting bits - */ -#define extlitflt(xp) \ - xp->doub_MSW >> 4 +#define ISLIT(x) (((x) >= MINLIT) && ((x) <= MAXLIT)) +#define ISBYTE(x) (((x) >= MINBYTE) && ((x) <= MAXBYTE)) +#define ISUBYTE(x) (((x) >= MINUBYTE) && ((x) <= MAXUBYTE)) +#define ISWORD(x) (((x) >= MINWORD) && ((x) <= MAXWORD)) +#define ISUWORD(x) (((x) >= MINUWORD) && ((x) <= MAXUWORD)) extern struct arg arglist[NARG]; /*building operands in instructions*/ extern struct exp explist[NEXP]; /*building up a list of expressions*/ @@ -372,7 +433,7 @@ struct Quad { * The lexical analyzer builds up symbols in yytext. Lookup * expects its argument in this buffer */ - extern char yytext[NCPS+2]; /* text buffer for lexical */ + extern char yytext[NCPName+2]; /* text buffer for lexical */ /* * Variables to manage the input assembler source file */ @@ -383,12 +444,17 @@ struct Quad { extern int passno; /* 1 or 2 */ - extern int anyerrs; /*errors assembling arguments*/ + extern int anyerrs; /*errors as'ing arguments*/ + extern int anywarnings; /*warnings as'ing arguments*/ extern int silent; /*don't mention the errors*/ extern int savelabels; /*save labels in a.out*/ extern int orgwarn; /* questionable origin ? */ extern int useVM; /*use virtual memory temp file*/ extern int jxxxJUMP; /*use jmp instead of brw for jxxx */ + extern int readonlydata; /*initialized data into text space*/ + extern int nGHnumbers; /* GH numbers used */ + extern int nGHopcodes; /* GH opcodes used */ + extern int nnewopcodes; /* new opcodes used */ #ifdef DEBUG extern int debug; extern int toktrace; @@ -396,7 +462,7 @@ struct Quad { /* * Information about the instructions */ - extern struct instab *itab[NINST]; /*maps opcodes to instructions*/ + extern struct instab **itab[NINST]; /*maps opcodes to instructions*/ extern readonly struct Instab instab[]; extern int curlen; /*current literal storage size*/ @@ -405,10 +471,21 @@ struct Quad { struct symtab **lookup(); /*argument in yytext*/ struct symtab *symalloc(); + char *Calloc(); + char *ClearCalloc(); + #define outb(val) {dotp->e_xvalue++; if (passno==2) bputc((val), (txtfil));} #define outs(cp, lg) dotp->e_xvalue += (lg); if (passno == 2) bwrite((cp), (lg), (txtfil)) +#ifdef UNIX +#define Outb(o) outb(o) +#endif UNIX + +#ifdef VMS +#define Outb(o) {*vms_obj_ptr++=-1;*vms_obj_ptr++=(char)o;dotp->e_xvalue+=1;} +#endif VMS + /* * Most of the time, the argument to flushfield is a power of two constant, * the calculations involving it can be optimized to shifts.