xref: /csrg-svn/sys/tahoe/align/defs.h (revision 45760)
1*45760Sbostic /*-
2*45760Sbostic  * Copyright (c) 1986 The Regents of the University of California.
3*45760Sbostic  * All rights reserved.
4*45760Sbostic  *
5*45760Sbostic  * This code is derived from software contributed to Berkeley by
6*45760Sbostic  * Computer Consoles Inc.
7*45760Sbostic  *
8*45760Sbostic  * %sccs.include.redist.c%
9*45760Sbostic  *
10*45760Sbostic  *	@(#)defs.h	7.1 (Berkeley) 12/06/90
11*45760Sbostic  */
1229582Ssam 
1345699Sbostic #include "../include/psl.h"
1429582Ssam 
1529582Ssam /************************************************/
1629582Ssam /*	Basic 6/32 machine definitions 		*/
1729582Ssam /************************************************/
1829582Ssam 
1929582Ssam #define	FALSE	0
2029582Ssam #define	TRUE	(~FALSE)
2129582Ssam #define READ	0
2229582Ssam #define WRITE	1
2329582Ssam 
2429582Ssam /*
2529582Ssam  * Some floatng point stuff.
2629582Ssam  */
2729582Ssam 
2829582Ssam #define exp(x)		( (x) & 0x7f800000 )
2929582Ssam #define reserved(x) 	( (x) < 0  && (exp(x) == 0) )
3029582Ssam 
3129582Ssam /************************************************/
3229582Ssam /*						*/
3329582Ssam /*	Opcodes description table stuff		*/
3429582Ssam /*						*/
3529582Ssam /************************************************/
3629582Ssam 
3729582Ssam struct	operand_des	{		/* Operand descriptor in great table */
3829582Ssam 		int	add_modes;	/* Allowed addressing modes */
3929582Ssam 		int	length;		/* Length of this data (bytes) */
4029582Ssam };
4129582Ssam 
4229582Ssam #define	Add	1	/* Any address except PC relative & ablsolute */
4329582Ssam #define	Dir	2	/* Direct register */
4429582Ssam #define	Imm	4	/* Immediate datum */
4529582Ssam #define	Lit	8	/* Short literal */
4629582Ssam #define	Brd	0x10	/* Branch displacement */
4729582Ssam #define	Pcrel	0x20	/* PC relative allowed */
4829582Ssam #define	Abs	0x40	/* Absolute address allowed */
4929582Ssam #define	SPmode	0x80	/* The stack pointer was involved , -(sp) or (sp)+ */
5029582Ssam #define	ADDFIELD 0xff	/* Allowed addressing modes */
5129582Ssam 
5229582Ssam #define	W	0x100	/* Access is write */
5329582Ssam #define R	0x200	/* Access is 'read' */
5429582Ssam #define	Indx	0x400	/* Indexable base address */
5529582Ssam #define	NOVF	0x800	/* Inhibit overflow check when writing byte/word */
5629582Ssam #define FLP	0x1000	/* Floating point operand */
5729582Ssam 
5829582Ssam #define	M	(R|W)	/* Access is 'modify' */
5929582Ssam #define PR	(Pcrel|Abs)
6029582Ssam #define ADDR	(PR|Add)
6129582Ssam #define	ADI	(ADDR|Dir|Imm|Lit)
6229582Ssam #define	AD	(ADDR|Dir)
6329582Ssam #define	MAD	(M|ADDR|Dir)
6429582Ssam #define	WAD	(W|ADDR|Dir)
6529582Ssam #define WD	(W|Dir)
6629582Ssam #define NWAD	(NOVF|WAD)
6729582Ssam #define	NMAD	(NOVF|MAD)
6829582Ssam #define	RADI	(R|ADI)	/* Readable datum */
6929582Ssam #define RAD	(R|AD)	/* Modify type access for destinations */
7029582Ssam #define RADF	(RAD|FLP)
7129582Ssam #define WADF	(WAD|FLP)
7229582Ssam 
7329582Ssam 
7429582Ssam 
7529582Ssam 
7629582Ssam struct	opcode_des	{	/* One line in the big table */
7729582Ssam 	int 	(*routine) 	();		/* Handler for this opcode */
7829582Ssam 	struct 	operand_des operand[4];		/* Up to 4 operands */
7929582Ssam };
8029582Ssam 
8129582Ssam /************************************************/
8229582Ssam /*						*/
8329582Ssam /*	Operand descriptor as returned		*/
8429582Ssam /*	by the address mode decoder 		*/
8529582Ssam /*						*/
8629582Ssam /************************************************/
8729582Ssam 
8829582Ssam struct	oprnd {
8929582Ssam 	long	mode;			/* Add, Imm, Dir or Brd */
9029582Ssam 	long	reg_number;		/* returned for Dir mode */
9129582Ssam 	long	address;		/* Relevant for Add or Brd */
9229582Ssam 	long	data;
9329582Ssam 	long	data2;			/* Up to 8 bytes returned */
9429582Ssam 	long	length;			/* Length of data manipulated */
9529582Ssam };
9629582Ssam 
9729582Ssam /************************************************/
9829582Ssam /*						*/
9929582Ssam /*	Some PSL macros (usefull)		*/
10029582Ssam /*						*/
10129582Ssam /************************************************/
10229582Ssam #define	carry		(psl & PSL_C)
10329582Ssam #define	negative	(psl & PSL_N)
10429582Ssam #define overflow	(psl & PSL_V)
10529582Ssam #define zero		(psl & PSL_Z)
10629582Ssam 
10729582Ssam #define carry_1		psl |= PSL_C
10829582Ssam #define negative_1	psl |= PSL_N
10929582Ssam #define overflow_1	psl |= PSL_V
11029582Ssam #define zero_1		psl |= PSL_Z
11129582Ssam 
11229582Ssam #define carry_0		psl &= ~PSL_C
11329582Ssam #define negative_0	psl &= ~PSL_N
11429582Ssam #define overflow_0	psl &= ~PSL_V
11529582Ssam #define zero_0		psl &= ~PSL_Z
11629582Ssam 
11729582Ssam 
11829582Ssam struct	oprnd		*operand ();
11929582Ssam struct	opcode_des 	Table[];
12029582Ssam 
12129582Ssam struct double_length
12229582Ssam {
12329582Ssam 	int	low;
12429582Ssam 	int	high;
12529582Ssam };
12629582Ssam 
12729582Ssam typedef	struct	double_length	quadword;
12829582Ssam 
129