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

📄 as.h

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 H
📖 第 1 页 / 共 2 页
字号:
/*static char sccsid[] = "@(#)as.h	4.3 ULTRIX 9/4/90";*//************************************************************************ *									* *			Copyright (c) 1985 by				* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//************************************************************************ *									* *			Modification History				* * * 003  Tanya Klinchina, 20-Nov-1989 *      Added support for vector instructions. * * 002	David L Ballenger, 24-Feb-1986					* *	Add definitions for module and label alignment.			* *									* *	001 - Added new stab-type FORWARDSTAB, for those stabs		* *	      that address forward references.				* *	      (Victoria Holt, May 7, 1985)				* *									* ************************************************************************//* *	Copyright (c) 1982 Regents of the University of California *	@(#)as.h 4.19 8/11/83 */#define	reg	register#include <sys/types.h>#include <a.out.h>#include <stab.h>#define readonly#define	NINST		300#define	NEXP		20	/* max number of expr. terms per instruction */#define	NARG		6	/* max number of args per instruction */#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 * *	name assembly		NCPName	 *	name save		STRPOOLDALLOP	 * *	-name saving is a simple first fit */#ifndef STRPOOLDALLOP#	define STRPOOLDALLOP	8192#endif /* not STRPOOLDALLOP */#define	NCPName	NCPS#ifndef NCPS#	undef	NCPName#	define	NCPName	4096#endif /* not NCPS *//* *	Check sizes, and compiler error if sizes botch */#if STRPOOLDALLOP < NCPName	$$$botch with definition sizes#endif /* test botches *//* * Symbol types */#define	XUNDEF	0x0#define	XABS	0x2#define	XTEXT	0x4#define	XDATA	0x6#define	XBSS	0x8#define	XXTRN	0x1#define	XTYPE	0x1E#define	XFORW	0x20	/* Was forward-referenced when undefined */#define	ERR	(-1)#define	NBPW	32	/* Bits per word */#define	AMASK	017/* * Actual argument syntax types */#define ACTRL   0       /* vector ctrl word */#define	AREG	1	/* %r */#define	ABASE	2	/* (%r) */#define	ADECR	3	/* -(%r) */#define	AINCR	4	/* (%r)+ */#define	ADISP	5	/* expr(%r) */#define	AEXP	6	/* expr */#define	AIMM	7	/* $ expr */#define	ASTAR	8	/* * */#define	AINDX	16	/* [%r] */#define AVECT   32      /* vector instruction argument */#define AVREG   33      /* vector reg %v */#define AVIMM   39      /* vector $ expr *//* *	Definitions for the things found in ``instrs'' */#define	INSTTAB 1#include "instrs.h"/* *	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<<TYPLG)/* *	reference types for loader */#define	PCREL	1#define	LEN1	2#define	LEN2	4#define	LEN4	6#define	LEN8	8#define	LEN16	10extern	int	reflen[];	/* {LEN*+PCREL} ==> 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	0x1#define	FW	0x3#define	DW	0x7#define	OW	0xF#define	round(x,y)	(((x)+(y)) & ~(y))#define	STABTYPS	0340#define	STABFLAG	0200/* *	Follows are the definitions for the symbol table tags, which are *	all unsigned characters.. *	High value tags are generated by the asembler for internal *	use. *	Low valued tags are the parser coded tokens the scanner returns. *	There are several pertinant bounds in this ordering: *		a)	Symbols greater than JXQUESTIONABLE *			are used by the jxxx bumper, indicating that *			the symbol table entry is a jxxx entry *			that has yet to be bumped. *		b)	Symbols greater than IGNOREBOUND are not *			bequeathed to the loader; they are truly *			for assembler internal use only. *		c)	Symbols greater than OKTOBUMP represent *			indices into the program text that should *			be changed in preceeding jumps or aligns *			must get turned into their long form. */#define	TAGMASK		0xFF#	define	JXACTIVE	0xFF	/*jxxx size unknown*/#	define	JXNOTYET	0xFE	/*jxxx size known, but not yet expanded*/#	define	JXALIGN		0xFD	/*align jxxx entry*/#	define	JXINACTIVE	0xFC	/*jxxx size known and expanded*/#define	JXQUESTIONABLE		0xFB#	define	JXTUNNEL	0xFA	/*jxxx that jumps to another*/#	define	OBSOLETE	0xF9	/*erroneously entered symbol*/#define	IGNOREBOUND	0xF8		/*symbols greater than this are ignored*/#	define	FLOATINGSTAB	0xF7#	define	LABELID		0xF6#define	OKTOBUMP	0xF5#	define  FORWARDSTAB	0xF3#	define	FIXEDSTAB	0xF4/* Definitions pertaining to alignment of modules and labels.  These are * expressed as powers of 2. * * MODULE_ALIGNMENT	This is the maximum alignment factor guaranteed by *			ld(1) for a text, data, or bss segment from a module. *			This header file is included by ld.c to get this *			value. * * LABEL_ALIGNMENT	This is the alignment guaranteed by as(1) for labels *			following jbr instructions or jxxx instructions which *			are converted to a bxxx followed by a brw.  See *			asjxxx.c for a description. * * ALIGN_GUARANTEE	The maximumn value for an alignment expression on a *			.align statement that as(1) will accept without *			issuing a warning message.  This is dependent on *			the maximum module alignment guaranteed by ld(1). * * MAX_ALIGN_EXPR	The maximum value that as will except for an  *			alignment expression without issuing an error. * * LEGAL_ALIGN_VAL(n)	Macro to see if 'n' is in the legal range for an *			alignment expression. */#define MODULE_ALIGNMENT	(3)	/* quadword alignment */#define LABEL_ALIGNMENT		(2)	/* longword alignment */#define ALIGN_GUARANTEE		MODULE_ALIGNMENT#define MAX_ALIGN_EXPR		(16)#define LEGAL_ALIGN_VAL(n)	(((n) >= 0) && ((n) <= MAX_ALIGN_EXPR))/* *	astoks.h contains reserved word codings the parser should *	know about */#include "astoks.h"/* *	The structure for one symbol table entry. *	Symbol table entries are used for both user defined symbols, *	and symbol slots generated to create the jxxx jump from *	slots. *	Caution: the instructions are stored in a shorter version *	of the struct symtab, using all fields in sym_nm and *	tag.  The fields used in sym_nm are carefully redeclared *	in struct Instab and struct instab (see below). *	If struct nlist gets changed, then Instab and instab may *	have to be changed. */struct symtab{		struct	nlist	s_nm;		u_char	s_tag;		/* assembler tag */		u_char	s_ptype;	/* if tag == NAME */		u_char	s_jxneedalign;	/* if a jbr/jxxx needs alignment */		short	s_index;	/* which segment */		struct	symtab *s_dest;	/* if JXXX, where going to */#ifdef DJXXX		short	s_jxline;	/* source line of the jump from */#endif};/* *	Redefinitions of the fields in symtab for *	use when the symbol table entry marks a jxxx instruction. */#define	s_jxbump	s_ptype		/* tag == JX..., how far to expand */#define	s_jxfear	s_desc		/* how far needs to be bumped *//* *	Redefinitions of fields in the struct nlist for symbols so that *	one saves typing, and so that they conform  *	with the old naming conventions. */#define	s_name	s_nm.n_un.n_name#define	i_name	s_name#define	FETCHNAME(sp)	(((struct strdesc *)(sp)->s_name)->sd_string)#define	STRLEN(sp)	(((struct strdesc *)(sp)->s_name)->sd_strlen)#define	STROFF(sp)	(((struct strdesc *)(sp)->s_name)->sd_stroff)#define	STRPLACE(sp)	(((struct strdesc *)(sp)->s_name)->sd_place)#define	s_nmx	s_nm.n_un.n_strx	/* string table index */#define	s_type	s_nm.n_type		/* type of the symbol */#define	s_other	s_nm.n_other		/* other information for sdb */#define	s_desc	s_nm.n_desc		/* type descriptor */#define	s_value	s_nm.n_value		/* value of the symbol, or sdb delta */struct	instab{	struct	nlist	s_nm;		/* instruction name, type (opcode) */	u_char	s_tag;				u_char	s_eopcode;	char    s_format;               /* vector instruction format */	u_char	s_ctrlcode;    		/* vector instruction CMP/CVT code */};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. *	We use a macro to define access to these 6 bytes, assuming that *	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 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.

⌨️ 快捷键说明

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