/* <etirdef.h>
 *
 *	OBJFMT -- "EVAX" text, information and relocation record (ETIR)
 */
#ifndef _ETIRDEF_H
#define _ETIRDEF_H

#define ETIR$C_MINSTACOD	0	/* minimum store code */
#define ETIR$C_STA_GBL		0	/* stack global symbol value */
#define ETIR$C_STA_LW		1	/* stack longword */
#define ETIR$C_STA_QW		2	/* stack quadword */
#define ETIR$C_STA_PQ		3	/* stack psect base plus quadword offset */
#define ETIR$C_STA_LI		4	/* stack literal */
#define ETIR$C_STA_MOD		5	/* stack module */
#define ETIR$C_STA_CKARG	6	/* check arguments */
#define ETIR$C_MAXSTACOD	6	/* maximum stack code */
#define ETIR$C_MINSTOCOD	50	/* minimum store code */
#define ETIR$C_STO_B		50	/* store byte */
#define ETIR$C_STO_W		51	/* store word */
#define ETIR$C_STO_LW		52	/* store longword */
#define ETIR$C_STO_QW		53	/* store quadword */
#define ETIR$C_STO_IMMR		54	/* store immediate Repeated */
#define ETIR$C_STO_GBL		55	/* store global */
#define ETIR$C_STO_CA		56	/* store code address */
#define ETIR$C_STO_RB		57	/* store relative branch */
#define ETIR$C_STO_AB		58	/* store absolute branch */
#define ETIR$C_STO_OFF		59	/* store offset within psect */
#define ETIR$C_STO_IMM		61	/* store immediate */
#define ETIR$C_STO_GBL_LW	62	/* store global Longword */
	/* STO_LP_PSB not valid in level 2 use STC_LP_PSB */
#define ETIR$C_STO_BR_GBL	64	/* store 21 bit displayment to global address */
#define ETIR$C_STO_BR_PS	65	/* store 21 bit displayment to psect + offset */
#define ETIR$C_MAXSTOCOD	65	/* maximum store code */
#define ETIR$C_MINOPRCOD	100	/* minimum operate code */
#define ETIR$C_OPR_NOP		100	/* no-op */
#define ETIR$C_OPR_ADD		101	/* add */
#define ETIR$C_OPR_SUB		102	/* subtract */
#define ETIR$C_OPR_MUL		103	/* multiply */
#define ETIR$C_OPR_DIV		104	/* divide */
#define ETIR$C_OPR_AND		105	/* logical AND */
#define ETIR$C_OPR_IOR		106	/* logical inclusive OR */
#define ETIR$C_OPR_EOR		107	/* logical exclusive OR */
#define ETIR$C_OPR_NEG		108	/* negate */
#define ETIR$C_OPR_COM		109	/* complement */
#define ETIR$C_OPR_INSV		110	/* insert bit field */
#define ETIR$C_OPR_ASH		111	/* arithmetic shift */
#define ETIR$C_OPR_USH		112	/* unsigned shift */
#define ETIR$C_OPR_ROT		113	/* rotate */
#define ETIR$C_OPR_SEL		114	/* select one of three longwords on top of stack */
#define ETIR$C_OPR_REDEF	115	/* redefine this symbol after pass 2 */
#define ETIR$C_OPR_DFLIT	116	/* define a literal */
#define ETIR$C_MAXOPRCOD	116	/* maximum operate code */
#define ETIR$C_MINCTLCOD	150	/* minimum control code */
#define ETIR$C_CTL_SETRB	150	/* set relocation base */
#define ETIR$C_CTL_AUGRB	151	/* augment relocation base */
#define ETIR$C_CTL_DFLOC	152	/* define debug location */
#define ETIR$C_CTL_STLOC	153	/* set debug location */
#define ETIR$C_CTL_STKDL	154	/* stack debug location */
#define ETIR$C_MAXCTLCOD	154	/* maximum control code */
#define ETIR$C_MINSTCCOD	200	/* minimum store-conditional code */
#define ETIR$C_STC_LP		200	/* store-conditional linkage pair */
#define ETIR$C_STC_LP_PSB	201	/* store-conditional linkage pair with Procedure Signature */
#define ETIR$C_STC_GBL		202	/* store-conditional address at global address */
#define ETIR$C_STC_GCA		203	/* store-conditional code address at global address */
#define ETIR$C_STC_PS		204	/* store-conditional address at psect + offset */
#define ETIR$C_STC_NOP_GBL	205	/* store-conditional NOP at address of global */
#define ETIR$C_STC_NOP_PS	206	/* store-conditional NOP at pect + offset */
#define ETIR$C_STC_BSR_GBL	207	/* store-conditional BSR at global address */
#define ETIR$C_STC_BSR_PS	208	/* store-conditional BSR at pect + offset */
#define ETIR$C_STC_LDA_GBL	209	/* store-conditional LDA at global address */
#define ETIR$C_STC_LDA_PS	210	/* store-conditional LDA at psect + offset */
#define ETIR$C_STC_BOH_GBL	211	/* store-conditional BSR or hint at global address */
#define ETIR$C_STC_BOH_PS	212	/* store-conditional BSR or hint at pect + offset */
#define ETIR$C_STC_NBH_GBL	213	/* store-conditional NOP,BSR or hINT at global address */
#define ETIR$C_STC_NBH_PS	214	/* store-conditional NOP,BSR or hINT at psect + offset */
#define ETIR$C_MAXSTCCOD	214	/* maximum store-conditional code */

struct etirdef {
    unsigned short etir$w_rectyp;	/* record type (OBJ$C_ETIR) */
    unsigned short etir$w_size;		/* record size */
};

#if 0
/*
   Define relocation commands
						ETIR descriptions


   MNEUMONIC	DESCRIPTION			    FORMAT					STACK EFFECT
   ---------	-----------			    ------					------------
						0    2	  4    6    8	 12   16   20	24
						|    |	  |    |    |	 |    |    |	|
						v    v	  v    v    v	 v    v    v	v

   STA_GBL	pushes symbol value on stack	|type|size|counted string...			+1

   STA_LW	pushes longword value on stack	|type|size|longword |				+1

   STA_QW	pushes quadword value on stack	|type|size|	quadword      |			+1

   STA_PQ	pushes image offset associated	|type|size|  psect  |	  quadword	|	+1
		with psect index + quadword
		offset on stack
   STA_LI	pushes literal value on stack	|type|size|counted string...			+1

   STA_MOD	pushes image offset associated	|type|size|counted string...			+1
		with module on stack

   STA_CKARG	compares poped stack element to |type|size|counted string...			 0
		symbol value and pushes result
		on stack

   STO_B	pops stack and stores low byte	|type|size|					-1
		at location pointer

   STO_W	pops stack and stores low word	|type|size|					-1
		at location pointer

   STO_LW	pops stack and stores low	|type|size|					-1
		longword at location pointer

   STO_QW	pops stack and stores qwadword	|type|size|					-1
		at location pointer

   STO_GBL	stores value associated with	|type|size|counted string...			0
		global symbol at location
		pointer

   STO_CA	stores contents of value	|type|size|counted string...			0
		associated with global symbol
		+8 at location pointer

   STO_RB	adds offset from location	|type|size|psect|   quadword	|		0
		 pointer to image offset value
		associated with psect index +
		quadword offset to low word
		at location pointer

   STO_AB	stores value associated with	|type|size|counted string...			0
		global symbol in low 21 bits
		at location pointer

   STO_OFF	pops offset into image from	|type|size|					-1
		stack and stores the value in
		the linker's location counter

   STO_IMMR	pops repeat count and stores	|type|size|  size   |immediate...		-1
		this number of immediates at
		location counter

   STO_LP	stores code address at		|type|size|counted string...			0
		location pointer and global
		symbol value at location
		pointer + 8

   STO_IMM	stores this number of		|type|size|  size   |immediate...		0
		immediates at location counter

   STO_GBL_LW	stores low  order 32 bits of	|type|size|counted string...			0
		value associated with global
		symbol at location pointer

   STO_LP_PSB	stores code address at		|type|size|counted string...|size|signature block...| 0
		location pointer and global
		symbol value at location
		pointer + 8 and signature
		information in fixup section
		(following the LP_PSB fixups).

   STO_BR_GBL	Store low order 23 bits as	|type|size|ps1	    |off1     |ps2 |off2     |
		signed offset from virtual	|counted string					 0
		address signified by ps2 +
		off2 to virtual address of
		global symbol shifted two bits
		to the right into the 21 bit
		displacement field of instruction
		at location ps1 + off1.

   STO_BR_PS	Store low order 23 bits as	|type|size|ps1	    |off1     |ps2 |off2     |
		signed offset from virtual	|ps3	  |off3		 |			 0
		address signified by ps2 +
		off2 to virtual address
		signified by ps3 + off3 shifted
		two bits to the right into
		the 21 bit displacement field
		of instruction at location
		ps1 + off1.

   OPR_NOP	nothing				|type|size|					0

   OPR_ADD	pop two elements from stack	|type|size|					-1
		adds and push results

   OPR_SUB	pop two elements from stack	|type|size|					-1
		subtracts and push results

   OPR_MUL	pop two elements from stack	|type|size|					-1
		multiplys and push results

   OPR_DIV	pop two elements from stack	|type|size|					-1
		divides and push results

   OPR_AND	pop two elements from stack	|type|size|					-1
		ANDs and push results

   OPR_IOR	pop two elements from stack	|type|size|					-1
		inclusive ors and push results

   OPR_EOR	pop two elements from stack	|type|size|					-1
		exclusive ors and push results

   OPR_NEG	pop one element from stack	|type|size|					0
		negates and push results

   OPR_COM	pop one element from stack	|type|size|					0
		compliments and push results

   OPR_INSV	pop two elements from stack	|type|size|					-1
		inserts bit field from first
		into second and push results

   OPR_USH	pop two elements from stack	|type|size|					-1
		unsigned shift and push results

   OPR_ASH	pop two elements from stack	|type|size|					-1
		arithmetic shift and push
		results

   OPR_ROT	pop two elements from stack	|type|size|					-1
		rotate and push results

   OPR_SEL	pop three elements from stack	|type|size|					-2
		if first is true
		then push third
		else push second

   OPR_REDEF	pop value from stack and	|type|size|counted string...			-1
		assign this value to global
		symbol

   OPR_DFLIT	pop value from stack and	|type|size|counted string...			-1
		assign this value to literal


   CTL_SETRB	pop value from stack and move	|type|size|					-1
		to location pointer

   CTL_AUGRB	add quadword to location	|type|size|	 quadword	|		0
		pointer

   CTL_DFLOC	pop index from stack and save	|type|size|   quadword index	|		-1
		current location pointer in
		debug table using index

   CTL_STLOC	pop index from stack, get	|type|size|   quadword index	|		-1
		saved location pointer in
		debug table using index and
		move it to current location
		pointer

   CTL_STKDL	pop index from stack, get	|type|size|   quadword index	|		0
		saved location pointer in
		debug table using index and
		push it


   MNEUMONIC	DESCRIPTION			    FORMAT					STACK EFFECT
   ---------	-----------			    ------					------------
						0    2	  4    6    8	 12   16   20	24
						|    |	  |    |    |	 |    |    |	|
						v    v	  v    v    v	 v    v    v	v

   STC_LP	If the linkage pair specified	|type|size|lp index |counted string...		    0
		by the index is referenced,
		i.e. all instructions ref'ing
		it weren't successfully replaced
		by other STC_** commands, then
		store code address at location
		pointer and global symbol value
		at location pointer + 8.

   STC_LP_PSB	If the linkage pair specified	|type|size|lp index |counted string...|-	    0
		by the index is referenced,		  |size|signature block...|
		i.e. all instructions ref'ing
		it weren't successfully replaced
		by other STC_** commands, then
		store code address at location
		pointer and global symbol value
		at location pointer + 8. Store
		signature information in fixup
		section following the LP_PSB
		fixups.

   STC_GBL	store value associated with	|type|size|lp index |counted string...		    0
		global symbol (if norm bit is
		set this is the procedure desc.
		address) in the linkage pair
		pointed to by the index only
		if that part of the lp is referenced.
		When the norm bit is set the index will
		point to the second quadword of
		the linkage pair.

   STC_GCA	store the value from the field	|type|size|lp index |counted string...		    0
		ESDF$L_LP_1 of the global
		symbol in the linkage pair
		pointed to by the index only
		if that part of the lp is referenced.
		The global symbol must be a procedure,
		and the norm bit must be set.
		The lp index must point to the
		first quadword of the linkage pair.


   STC_PS	store the address associated	|type|size|lp index |psct|qw offset|		    0
		with the psect + offset in the
		lp pointed to by the index.
		The index may point to either
		quadword.

   STC_NOP_GBL	Store a NOP (specified by the	|type|size|lp index |psc1|qw off1  | -
		compiler) at the location		  |repl inst|psc2|qw off2  |counted string  0
		pointed to by PS1, offset1
		if the displacement from
		ps2, offset2 to the value in
		the EGSY$L_LP_1 field of the
		global symbol + its psect base
		can be squished into 21 bits.


   STC_NOP_PS	Store a NOP (specified by the	|type|size|lp index |psc1|qw off1  | -
		compiler) at the location		  |repl inst|psc2|qw off2  | -
		pointed to by PS1, offset1			    |psc3|qw off3  |		    0
		if the displacement from
		ps2, offset2 to ps3,offset3
		can be squished into 21 bits.

   STC_BSR_GBL	Store a BSR (specified in	|type|size|lp index |psc1|qw off1  | -
		repl inst) at the location		  |repl inst|psc2|qw off2  |counted string  0
		pointed to by PS1, offset1
		if the displacement from
		ps2, offset2 to the value in
		the EGSY$L_LP_1 field of the
		global symbol + its psect base
		can be squished into 21 bits.
		Insert the 21 bit displacement
		into the instruction.

   STC_BSR_PS	Store a BSR (specified in	|type|size|lp index |psc1|qw off1  | -
		repl inst) at the location		  |repl inst|psc2|qw off2  | -
		pointed to by PS1, offset1			    |psc3|qw off3  |		    0
		if the displacement from
		ps2, offset2 to ps3,offset3
		can be squished into 21 bits.
		Insert the 21 bit displacement
		into the instruction.

   STC_LDA_GBL	Store a LDA (specified in	|type|size|lp index |psc1|qw off1  | -
		repl inst) at the location		  |repl inst|psc2|qw off2  |counted string  0
		pointed to by PS1, offset1
		if the displacement from
		ps2, offset2 to the value in
		the EGSY$L_VALUE field of the
		global symbol + its psect base
		can be squished into 16 bits.
		The global symbol cannot be from
		a shareable image.
		Insert the 16 bit displacement
		into the instruction.
		The index is only nonzero if the
		instruction being replaced refs
		a linkage pair.

   STC_LDA_PS	Store a LDA (specified in	|type|size|lp index |psc1|qw off1  | -
		repl inst) at the location		  |repl inst|psc2|qw off2  | -
		pointed to by PS1, offset1			    |psc3|qw off3  |		    0
		if the displacement from
		ps2, offset2 to ps3,offset3
		can be squished into 16 bits.
		PS3 cannot be a shareable image psect.
		Insert the 16 bit displacement
		into the instruction.
		The index is only nonzero if the
		instruction being replaced refs
		a linkage pair.

   STC_BOH_GBL	Store a BSR (specified in	|type|size|lp index |ps1 |qw off1  | -
		repl inst) at the location		  |repl inst|ps2 |qw off2  |counted string  0
		pointed to by ps1, off1
		if the displacement from
		ps2, off2 to the value in
		the EGSY$L_LP_1 field of the
		global symbol + its psect base
		can be squished into 21 bits.
		Insert the 21 bit displacement
		into the instruction.  If the
		displacement is too large, then
		store the low order 16 bits of
		the virtual address of the global
		symbol shifted two bits to the
		right into the location
		ps1 + off1.

   STC_BOH_PS	Store a BSR (specified in	|type|size|lp index |ps1 |qw off1  | -
		repl inst) at the location		  |repl inst|ps2 |qw off2  | -
		pointed to by PS1, off1				    |ps3 |qw off3  |		    0
		if the displacement from
		ps2, off2 to ps3,off3
		can be squished into 21 bits.
		Insert the 21 bit displacement
		into the instruction.  If the
		displacement is too large, then
		store the low order 16 bits of
		the virtual address of the global
		symbol shifted two bits to the
		right into the location
		ps1, off1.

   STC_NBH_GBL	Equivalent to STC_NOP_GBL,	|type|size|lp index |ps1 |qw off1  | -
		index, ps1, off1, ins1,  ps2,		  |repl ins1|ps2 |qw off2  | -
		off2 + 4, counted string,		  |repl ins2|counted string...		    0
		followed by STC_BOH_GBL, index,
		ps2, off2, ins2, ps2, off2 + 4,
		counted string.
		Implicit assumption is that
		the original instructions (LDQ, JSR)
		are contiguous.

   STC_NBH_PS	Equivalent to STC_NOP_PS,	|type|size|lp index |ps1 |qw off1  | -
		index, ps1, off1, ins1,  ps2,		  |repl ins1|ps2 |qw off2  | -
		off2 + 4, ps3, off3,			  |repl ins2|ps3 |qw off3  |		    0
		followed by STC_BOH_PS, index,
		ps2, off2, ins2, ps2, off2 + 4,
		ps3, off3.
		Implicit assumption is that
		the original instructions (LDQ, JSR)
		are contiguous.
 */
#endif	/*0*/

#endif	/*_ETIRDEF_H*/
