#
/*
 *
 *	UNIX debugger - common definitions
 *
 */



/*	Layout of a.out file (fsym):
 *
 *	header of 8 words	magic number 405, 407, 410, 411
 *				text size	)
 *				data size	) in bytes but even
 *				bss size	)
 *				symbol table size
 *				entry point
 *				{unused}
 *				flag set if no relocation
 *
 *
 *	header:		0
 *	text:		16
 *	data:		16+textsize
 *	relocation:	16+textsize+datasize
 *	symbol table:	16+2*(textsize+datasize) or 16+textsize+datasize
 *
 */


#include "../head/param.h"
#include "../head/user.h"
#include "a68defs"


#define DEVMEM	"/dev/mem"
#define DEVSWAP	"/dev/swap"

#define VARB	11
#define VARD	13
#define VARE	14
#define VARM	22
#define VARS	28
#define VART	29
#define MAXCOM	64
#define MAXARG	32
#define LINSIZ	256

#define TXTHDR	16
#define CORHDR	1024
#define COREMAGIC 0140000

#define RD	0
#define WT	1
#define NSP	0
#define	ISP	1
#define	DSP	2
#define STAR	4
#define STARCOM 0200
#define DSYM	7
#define ISYM	2
#define ASYM	1
#define NSYM	0
#define ESYM	(-1)
#define BKPTSET	1
#define BKPTEXEC 2
#define	SYMSIZ	100
#define MAXSIG	20

#define USERPS	2*(512-1)
#define USERPC	2*(512-2)
#define UPROCP	(&(0->u_procp))
#define BPT	03
#define TBIT	020
#define FD	0200
#define	SETTRC	0
#define	RDUSER	2
#define	RIUSER	1
#define	WDUSER	5
#define WIUSER	4
#define	RUREGS	3
#define	WUREGS	6
#define	CONTIN	7
#define	EXIT	8

#define	ps	-1
#define	pc	-2
#define	sp	-6
#define	r5	-9
#define	r4	-10
#define	r3	-11
#define	r2	-12
#define	r1	-5
#define	r0	-3

#define MAXOFF	255
#define MAXPOS	80
#define MAXLIN	128
#define EOF	0
#define EOR	'\n'
#define SP	' '
#define TB	'\t'
#define QUOTE	0200
#define STRIP	0177
#define LOBYTE	0377
#define EVEN	-2

#define BADMOD	1
#define BADFMT	1
#define BADCOM	2
#define BADSYM	3
#define NOCRTN	4
#define	NOMATCH	5
#define NOBKPT	6
#define BADKET	7
#define NOADR	8
#define NOPCS	9
#define BADVAR	10
#define BADTXT	11
#define BADDAT	12
#define ODDADR	13
#define EXBKPT	14
#define A68FRAME 15
#define A68LINK	16
#define ADRWRAP	17
#define BADEQ	18
#define BADWAIT	19
#define ENDPCS	20
#define NOFORK	21
#define BADSYN	22
#define NOEOR	23
#define LENBKPT	24
#define BADFIL	25
#define BADNAM	26
#define LONGFIL	27
#define NOTOPEN 28


/* long to ints and back (puns) */
struct {
	int hiword;
	int loword;
};
struct {
	long longwd;
};
struct {
	float realwd;
};
int	int2ws[2];
int	lengws[2];
long	longws[1];
float	realws[1];

#define leng(a)		(lengws[1]= a, lengws[0].longwd)

#define shorten(a)	(longws[0]= a, longws[0].loword)

#define itol(a,b)	(int2ws[0]= a, int2ws[1]= b, int2ws[0].longwd)

#define ltor(a)		(realws[0]= a, realws[0].longwd)


/* file address maps */
#define MAP struct map
MAP {
	long b1;
	long e1;
	long f1;
	long b2;
	long e2;
	long f2;
	int ufd;
};
MAP txtmap;
MAP datmap;

#define SYMTAB struct symtab
SYMTAB {
	char symc[8];
	int symf;
	int symv;
} symbol;
BOOL	localok;
INT	lastframe;
INT	callpc;


#define SYMSLAVE struct symslave
SYMSLAVE {
	INT valslave;
	INT typslave;
};
SYMSLAVE	*symvec;

INT	mkfault;
INT	executing;
CHAR	line[LINSIZ];
INT	infile;
INT	outfile;
CHAR	*lp;
INT	maxoff;
INT	maxpos;
INT	sigint;
INT	sigqit;
INT	octal;
