⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 as.h

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 H
📖 第 1 页 / 共 2 页
字号:
 * *	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{	char	*I_name;	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_format;               /* vector instruction format number */	u_char	I_ctrlcode;    		/* vector instruction CMP/CVT code */};/* *	Redefinitions of fields in the struct nlist for instructions so that *	one saves typing, and conforms to the old naming conventions */#define	i_popcode	s_nm.n_type	/* use the same field as symtab.type */#define	i_eopcode	s_eopcode#define	i_ctrlcode	s_ctrlcode#define	i_nargs		s_nm.n_other	/* number of arguments */#define	fetcharg(ptr, n) ((struct Instab *)ptr)->I_args[n]struct	arg {				/*one argument to an instruction*/	char	a_atype;	char	a_areg1;	char	a_areg2;	char	a_dispsize;		/*usually d124, unless have B^, etc*/	struct	exp *a_xp;};/* *	Definitions for numbers and expressions. */#include "asnumber.h"struct	exp {	Bignum	e_number;	/* 128 bits of #, plus tag */	char	e_xtype;	char	e_xloc;	struct	symtab		*e_xname;};#define	e_xvalue	e_number.num_num.numIl_int.Il_long#define	e_xwvalue	e_number.num_num.numIl_int.Iw_short#define		MINLIT		0#define		MAXLIT		63#define		MINBYTE		-128#define		MAXBYTE		127#define		MINUBYTE	0#define		MAXUBYTE	255#define		MINWORD		-32768#define		MAXWORD		32767#define		MINUWORD	0#define		MAXUWORD	65535#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))/* *	Definitions for strings. * *	Strings are stored in the string pool; see strsave(str, length) *	Strings are known by their length and values. *	A string pointer points to the beginning of the value bytes; * *	If this structure is changed, change insts also. */struct	strdesc{	int	sd_stroff;	/* offset into string file */	short	sd_place;	/* where string is */	u_short	sd_strlen;	/* string length */	char	sd_string[1];	/* the string itself, flexible length */};/* *	Where a string can be.  If these are changed, also change instrs. */#define	STR_FILE	0x1#define	STR_CORE	0x2#define	STR_BOTH	0x3struct strdesc *savestr();/* *	Global variables */	extern	struct	arg	arglist[NARG];	/*building operands in instructions*/	extern	struct	arg	varglist[NARG];	/*building operands in vector instructions*/	extern	struct	exp	explist[NEXP];	/*building up a list of expressions*/	extern	struct	exp	*xp;		/*current free expression*/	/*	 *	Communication between the scanner and the jxxx handlers.	 *	lastnam:	the last name seen on the input	 *	lastjxxx:	pointer to the last symbol table entry for	 *			a jump from	 */	extern	struct	symtab	*lastnam;	extern	struct	symtab	*lastjxxx;		/*	 *	Lgensym is used to make up funny names for local labels.	 *	lgensym[i] is the current funny number to put after	 *	references to if, lgensym[i]-1 is for ib.	 *	genref[i] is set when the label is referenced before	 *	it is defined (i.e. 2f) so that we can be sure these	 *	labels are always defined to avoid weird diagnostics	 *	from the loader later.	 */	extern	int	lgensym[10];	extern	char	genref[10];	extern	struct	exp	*dotp;		/* the current dot location */	extern	int	loctr;	extern	struct	exec	hdr;		/* a.out header */	extern	u_long	tsize;			/* total text size */	extern	u_long	dsize;			/* total data size */	extern	u_long	trsize;			/* total text relocation size */	extern	u_long	drsize;			/* total data relocation size */	extern	u_long	datbase;		/* base of the data segment */	/*	 *	Bitoff and bitfield keep track of the packing into 	 *	bytes mandated by the expression syntax <expr> ':' <expr>	 */	extern	int	bitoff;		extern	long	bitfield;		/*	 *	The lexical analyzer builds up symbols in yytext.  Lookup	 *	expects its argument in this buffer	 */	extern	char	yytext[NCPName+2];	/* text buffer for lexical */	/*	 *	Variables to manage the input assembler source file	 */	extern	int	lineno;			/*the line number*/	extern	char	*dotsname;		/*the name of the as source*/	extern	FILE	*tokfile;		/* temp token communication*/	extern	FILE	*strfile;		/* temp string file*/	extern	char	tokfilename[TNAMESIZE];	/* token file name */	extern	char	strfilename[TNAMESIZE];	/* string file name */	extern	int	strfilepos;		/* position in string file */	extern	int	passno;			/* 1 or 2 */	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;#endif	/*	 *	Information about the instructions	 */	extern	struct	instab	**itab[NINST];	/*maps opcodes to instructions*/	extern  readonly struct Instab instab[];	extern	int	curlen;			/*current literal storage size*/	extern	int	d124;			/*current pointer storage size*/		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))#define	Outb(o)	outb(o)/* *	Most of the time, the argument to flushfield is a power of two constant, *	the calculations involving it can be optimized to shifts. */#define flushfield(n) if (bitoff != 0)  Flushfield( ( (bitoff+n-1) /n ) * n)/* * The biobuf structure and associated routines are used to write * into one file at several places concurrently.  Calling bopen * with a biobuf structure sets it up to write ``biofd'' starting * at the specified offset.  You can then use ``bwrite'' and/or ``bputc'' * to stuff characters in the stream, much like ``fwrite'' and ``fputc''. * Calling bflush drains all the buffers and MUST be done before exit. */struct	biobuf {	short	b_nleft;		/* Number free spaces left in b_buf *//* Initialize to be less than BUFSIZ initially, to boundary align in file */	char	*b_ptr;			/* Next place to stuff characters */	char	*b_buf;			/* Pointer to the buffer */	off_t	b_off;			/* Current file offset */	struct	biobuf *b_link;		/* Link in chain for bflush() */};#define	bputc(c,b) ((b)->b_nleft ? (--(b)->b_nleft, *(b)->b_ptr++ = (c)) \		       : bflushc(b, c))#define BFILE	struct biobuf	extern	BFILE	*biobufs;	/* head of the block I/O buffer chain */	extern	int	biofd;		/* file descriptor for block I/O file */	extern	off_t	boffset;	/* physical position in logical file */	extern	int	biobufsize;	/* optimal block size for I/O */#define min(a,b) ((a) < (b) ? (a):(b))#define movestr(to,from,len)	{register char *too = to, *fromm = from;\				 register int length = len;\				 if (length>0) bcopy(from,to,length);}	/*	 *	For each of the named .text .data segments	 *	(introduced by .text <expr>), we maintain	 *	the current value of the dot, and the BFILE where	 *	the information for each of the segments is placed	 *	during the second pass.	 */	extern	struct	exp	usedot[NLOC + NLOC];	extern		BFILE	*usefile[NLOC + NLOC];	extern		BFILE	*txtfil;/* file for text and data: into usefile */	/*	 *	Relocation information for each segment is accumulated	 *	seperately from the others.  Writing the relocation	 *	information is logically viewed as writing to one	 *	relocation saving file for  each segment; physically	 *	we have a bunch of buffers allocated internally that	 *	contain the relocation information.	 */	struct	relbufdesc	*rusefile[NLOC + NLOC];	struct	relbufdesc	*relfil;struct Ctrl_word{  unsigned vc_bits:4;             /* bits 0-3 */  unsigned vb_bits:4;             /* bits 4-7 */  unsigned va_bits:4;             /* bits 8-11 */  unsigned unused_bit:1;          /* bit  12 */  unsigned mod_bits:3  ;          /* bit  13-15 */};struct Vinst_arg {  int               va_tag;       /* VCTRL, VOPND, VLTRL */  char              va_args[3];   /* if va_tag = VCTRL: va,vb,vc */                                  /* if va_tag = VOPND: src opnd # */};struct Vinst_fmt {  u_short           vi_mod_mask;  /* modifier mask */  u_short           vi_mod_dflt;  /* default modifiers */  char              vi_nargs;     /* number of vector inst operands */  struct Vinst_arg  vi_args[6];   /* up to 6 arguments per vinst */};union Vinst_mod {  struct {    short   mod_length;    char    mod_ch[2];  }mod_value;  int     imod;};/* Definitions pertaining to vector instruction format.  */#define         VCTRL 1#define         VOPND 2#define         VLTRL 3#define         VARG1 1#define         VARG2 (VARG1 + 1)#define         VARG3 (VARG2 + 1)#define         VARG4 (VARG3 + 1)#define         VARG5 (VARG4 + 1)#define         VARG6 (VARG5 + 1)#define         VCODE (VARG6 + 1)#define         VA    0#define         VB    1#define         VC    2#define         mi_bit    (1)#define         exc_bit   (1)#define         mtf_bit   (1<<1)#define         moe_bit   (1<<2)#define         MOE 0x01#define         MTF 0x02#define         MI  0x04#define         EXC 0x08

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -