sym-sgi.h 14.7 KB
/*
 * Copyright (C) 1996-1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */


#ifndef _SYM_SGI_H_
#define _SYM_SGI_H_

#include "simtypes.h"

#define	langAssembler	3	/* one Assembley inst might map to many mach */


#define scNil		0
#define scText		1	/* text symbol */
#define scData		2	/* initialized data symbol */
#define scBss		3	/* un-initialized data symbol */
#define scRegister	4	/* value of symbol is register number */
#define scAbs		5	/* value of symbol is absolute */
#define scUndefined	6	/* who knows? */
#define scCdbLocal	7	/* variable's value is IN se->va.?? */
#define scBits		8	/* this is a bit field */
#define scCdbSystem	9	/* variable's value is IN CDB's address space */
#define scDbx		9	/* overlap dbx internal use */
#define scRegImage	10	/* register value saved on stack */
#define scInfo		11	/* symbol contains debugger information */
#define scUserStruct	12	/* address in struct user for current process */
#define scSData		13	/* load time only small data */
#define scSBss		14	/* load time only small common */
#define scRData		15	/* load time only read only data */
#define scVar		16	/* Var parameter (fortran,pascal) */
#define scCommon	17	/* common variable */
#define scSCommon	18	/* small common */

#define stNil		0	/* Nuthin' special */
#define stGlobal	1	/* external symbol */
#define stStatic	2	/* static */
#define stParam		3	/* procedure argument */
#define stLocal		4	/* local variable */
#define stLabel		5	/* label */
#define stProc		6	/*     "      "	 Procedure */
#define stBlock		7	/* beginnning of block */
#define stEnd		8	/* end (of anything) */
#define stMember	9	/* member (of anything	- struct/union/enum */
#define stTypedef	10	/* type definition */
#define stFile		11	/* file name */
#define stRegReloc	12	/* register relocation */
#define stForward	13	/* forwarding address */
#define stStaticProc	14	/* load time only static procs */
#define stConstant	15	/* const */
#define stStaParam	16	/* Fortran static parameters */
#define stBase          17      /* DEC */
#define stTag           18      /*  DEC */
#define stAdjMember     19      /*  DEC INTERLUDE */
#define stPublic        20      /* public access divider */
#define stProtected     21      /* protected access divider */                
#define stPrivate       22      /* private access divider */
#define stTemp          23	/* template */
#define stTempProc      24	/* template function */
#define stDefArg	25	/* default argument */

#define stStruct        26      /* begin Struct kind of stBlock */
#define stUnion         27      /* begin Union kind of stBlock */
#define stEnum          28      /* begin Enum  kind of stBlock */

#define	stIndirect	34	/* Indirect type specification */

#define tqNil	0	/* bt is what you see */
#define tqPtr	1	/* pointer */
#define tqProc	2	/* procedure */
#define tqArray 3	/* duh */
#define tqFar	4	/* longer addressing - 8086/8 land */
#define tqVol	5	/* volatile */
#define tqConst 6	/* const */

#define btNil		0	/* undefined */
#define btAdr32		1	/* 32-bit address */
#define btAdr		btAdr32	/* address - integer same size as pointer */
#define btChar		2	/* character */
#define btUChar		3	/* unsigned character */
#define btShort		4	/* short */
#define btUShort	5	/* unsigned short */
#define btInt32		6	/* 32-bit int */
#define btInt		btInt32	/* int */
#define btUInt32	7	/* 32-bit unsigned int */
#define btUInt		btUInt32	/* unsigned int */
#define btLong32	8	/* 32-bit long */
#define btLong		btLong32	/* long */
#define btULong32	9	/* 32-bit unsigned long */
#define btULong		btULong32	/* unsigned long */
#define btFloat		10	/* float (real) */
#define btDouble	11	/* Double (real) */
#define btStruct	12	/* Structure (Record) */
#define btUnion		13	/* Union (variant) */
#define btEnum		14	/* Enumerated */
#define btTypedef	15	/* defined via a typedef, isymRef points */
#define btLong64	30	/* 64-bit long */
#define btULong64	31	/* 64-bit unsigned long */
#define btLongLong64	32	/* 64-bit int64 */
#define btLongLong	btLongLong64	/* int64 */
#define btULongLong64	33	/* 64-bit uint64 */
#define btULongLong	btULongLong64	/* uint64 */
#define btAdr64		34	/* 64-bit address */

typedef int32  long_i;
typedef uint32 ulong_i;


typedef struct __sgi_hdrr_s  {
	short	magic;		/* to verify validity of the table */
	short	vstamp;		/* version stamp */
	long_i	ilineMax;	/* number of line number entries */
	long_i	cbLine;		/* number of bytes for line number entries */
	long_i	cbLineOffset;	/* offset to start of line number entries*/
	long_i	idnMax;		/* max index into dense number table */
	long_i	cbDnOffset;	/* offset to start dense number table */
	long_i	ipdMax;		/* number of procedures */
	long_i	cbPdOffset;	/* offset to procedure descriptor table */
	long_i	isymMax;	/* number of local symbols */
	long_i	cbSymOffset;	/* offset to start of local symbols*/
	long_i	ioptMax;	/* max index into optimization symbol entries */
	long_i	cbOptOffset;	/* offset to optimization symbol entries */
	long_i	iauxMax;	/* number of auxillary symbol entries */
	long_i	cbAuxOffset;	/* offset to start of auxillary symbol entries*/
	long_i	issMax;		/* max index into local strings */
	long_i	cbSsOffset;	/* offset to start of local strings */
	long_i	issExtMax;	/* max index into external strings */
	long_i	cbSsExtOffset;	/* offset to start of external strings */
	long_i	ifdMax;		/* number of file descriptor entries */
	long_i	cbFdOffset;	/*s offset to file descriptor table */
	long_i	crfd;		/* number of relative file descriptor entries */
	long_i	cbRfdOffset;	/* offset to relative file descriptor table */
	long_i	iextMax;	/* max index into external symbols */
	long_i	cbExtOffset;	/* offset to start of external symbol entries*/
	/* If you add machine dependent fields, add them here */
	} HDRR, *pHDRR; 
#define cbHDRR sizeof(HDRR)
#define hdrNil ((pHDRR)0)

#ifdef HOST_BIG_ENDIAN
typedef struct fdr {
	ulong_i	adr;	/* memory address of beginning of file */
	long_i	rss;		/* file name (of source, if known) */
	long_i	issBase;	/* file's string space */
	long_i	cbSs;		/* number of bytes in the ss */
	long_i	isymBase;	/* beginning of symbols */
	long_i	csym;		/* count file's of symbols */
	long_i	ilineBase;	/* file's line symbols */
	long_i	cline;		/* count of file's line symbols */
	long_i	ioptBase;	/* file's optimization entries */
	long_i	copt;		/* count of file's optimization entries */
				/* the following MUST be unsigned: still
				** restricts to 64K procedures. sgi */
	unsigned short ipdFirst;/* start of procedures for this file */
	unsigned short	cpd;	/* count of procedures for this file */
	long_i	iauxBase;	/* file's auxiliary entries */
	long_i	caux;		/* count of file's auxiliary entries */
	long_i	rfdBase;	/* index into the file indirect table */
	long_i	crfd;		/* count file indirect entries */
	unsigned lang: 5;	/* language for this file */
	unsigned fMerge : 1;	/* whether this file can be merged */
	unsigned fReadin : 1;	/* true if it was read in (not just created) */
	unsigned fBigendian : 1;/* if set, was compiled on big endian machine */
				/*	aux's will be in compile host's sex */
	unsigned glevel : 2;	/* level this file was compiled with */
	unsigned signedchar : 1; /* whether files was compiled with char being signed */
        unsigned ipdFirstMSBits: 4; /* upper bits to allow  ipdFirst to
			 exceed 64K entries 
                         (These are the most significant bits of what is, 
			 after concatenating the bits, a 20 bit number) */
        unsigned cpdMSBits: 4;  /* upper bits to allow cpd to exceed 64K
			 entries 
                         (These are the most significant bits of what is, 
			 after concatenating the bits, a 20 bit number) */
	unsigned reserved : 13;  /* reserved for future use */
	long_i	cbLineOffset;	/* byte offset from header for this file ln's */
	long_i	cbLine;		/* size of lines for this file */
	} FDR, *pFDR;
#endif
#ifdef HOST_LITTLE_ENDIAN
typedef struct fdr {
	ulong_i	adr;	/* memory address of beginning of file */
	long_i	rss;		/* file name (of source, if known) */
	long_i	issBase;	/* file's string space */
	long_i	cbSs;		/* number of bytes in the ss */
	long_i	isymBase;	/* beginning of symbols */
	long_i	csym;		/* count file's of symbols */
	long_i	ilineBase;	/* file's line symbols */
	long_i	cline;		/* count of file's line symbols */
	long_i	ioptBase;	/* file's optimization entries */
	long_i	copt;		/* count of file's optimization entries */
				/* the following MUST be unsigned: still
				** restricts to 64K procedures. sgi */
	unsigned short ipdFirst;/* start of procedures for this file */
	unsigned short	cpd;	/* count of procedures for this file */
	long_i	iauxBase;	/* file's auxiliary entries */
	long_i	caux;		/* count of file's auxiliary entries */
	long_i	rfdBase;	/* index into the file indirect table */
	long_i	crfd;		/* count file indirect entries */
	unsigned reserved : 13;  /* reserved for future use */
        unsigned cpdMSBits: 4;  /* upper bits to allow cpd to exceed 64K
			 entries 
                         (These are the most significant bits of what is, 
			 after concatenating the bits, a 20 bit number) */
        unsigned ipdFirstMSBits: 4; /* upper bits to allow  ipdFirst to
			 exceed 64K entries 
                         (These are the most significant bits of what is, 
			 after concatenating the bits, a 20 bit number) */
	unsigned signedchar : 1; /* whether files was compiled with char being signed */
	unsigned glevel : 2;	/* level this file was compiled with */
	unsigned fBigendian : 1;/* if set, was compiled on big endian machine */
				/*	aux's will be in compile host's sex */
	unsigned fReadin : 1;	/* true if it was read in (not just created) */
	unsigned fMerge : 1;	/* whether this file can be merged */
	unsigned lang: 5;	/* language for this file */
	long_i	cbLineOffset;	/* byte offset from header for this file ln's */
	long_i	cbLine;		/* size of lines for this file */
	} FDR, *pFDR;
#endif



#define cbFDR sizeof(FDR)
#define fdNil ((pFDR)0)
#define ifdNil -1
#define ifdTemp 0
#define ilnNil -1

typedef struct pdr {
	ulong_i	adr;	/* memory address of start of procedure */
	long_i	isym;		/* start of local symbol entries */
	long_i	iline;		/* start of line number entries*/
	long_i	regmask;	/* save register mask */
	long_i	regoffset;	/* save register offset */
	long_i	iopt;		/* start of optimization symbol entries*/
	long_i	fregmask;	/* save floating point register mask */
	long_i	fregoffset;	/* save floating point register offset */
	long_i	frameoffset;	/* frame size */
	short	framereg;	/* frame pointer register */
	short	pcreg;		/* offset or reg of return pc */
	long_i	lnLow;		/* lowest line in the procedure */
	long_i	lnHigh;		/* highest line in the procedure */
	long_i	cbLineOffset;	/* byte offset for this procedure from the fd base */
	} PDR, *pPDR;
#define cbPDR sizeof(PDR)
#define pdNil ((pPDR) 0)
#define ipdNil	-1

typedef	long_i LINER, *pLINER;
#define lineNil ((pLINER)0)
#define cbLINER sizeof(LINER)
#define ilineNil	-1


#ifdef HOST_BIG_ENDIAN
typedef struct __sgi_symr_s {
	long_i	iss;		/* index into String Space of name */
	long_i	value;		/* value of symbol */
	unsigned st : 6;	/* symbol type */
	unsigned sc  : 5;	/* storage class - text, data, etc */
	unsigned reserved : 1;	/* reserved */
	unsigned index : 20;	/* index into sym/aux table */
	} SYMR, *pSYMR;
#endif
#ifdef HOST_LITTLE_ENDIAN
typedef struct __sgi_symr_s {
	long_i	iss;		/* index into String Space of name */
	long_i	value;		/* value of symbol */
	unsigned index : 20;	/* index into sym/aux table */
	unsigned reserved : 1;	/* reserved */
	unsigned sc  : 5;	/* storage class - text, data, etc */
	unsigned st : 6;	/* symbol type */
	} SYMR, *pSYMR;
#endif

#define symNil ((pSYMR)0)
#define cbSYMR sizeof(SYMR)
#define isymNil -1
#define indexNil 0xfffff
#define issNil -1
#define issNull 0

#ifdef HOST_BIG_ENDIAN
typedef struct __sgi_extr__ {
	unsigned jmptbl:1;	/* symbol is a jump table entry for shlibs */
	unsigned cobol_main:1;	/* symbol is a cobol main procedure */
	unsigned weakext:1;	/* symbol is weak external */
	unsigned deltacplus:1;	/* symbol is delta C++ symbol */
	unsigned multiext:1;	/* symbol may be defined multiple times */
	unsigned reserved:11;	/* reserved for future use */
	short	ifd;		/* where the iss and index fields point into */
	SYMR	asym;		/* symbol for the external */
	} EXTR, *pEXTR;
#endif
#ifdef HOST_LITTLE_ENDIAN
typedef struct __sgi_extr__ {
	unsigned reserved:11;	/* reserved for future use */
	unsigned multiext:1;	/* symbol may be defined multiple times */
	unsigned deltacplus:1;	/* symbol is delta C++ symbol */
	unsigned weakext:1;	/* symbol is weak external */
	unsigned cobol_main:1;	/* symbol is a cobol main procedure */
	unsigned jmptbl:1;	/* symbol is a jump table entry for shlibs */
	short	ifd;		/* where the iss and index fields point into */
	SYMR	asym;		/* symbol for the external */
	} EXTR, *pEXTR;

#endif


#define extNil ((pEXTR)0)
#define cbEXTR sizeof(EXTR)

#ifdef HOST_BIG_ENDIAN
typedef struct {
	unsigned fBitfield : 1; /* set if bit width is specified */
	unsigned continued : 1; /* indicates additional TQ info in next AUX */
	unsigned bt  : 6;	/* basic type */
	unsigned tq4 : 4;
	unsigned tq5 : 4;
	/* ---- 16 bit boundary ---- */
	unsigned tq0 : 4;
	unsigned tq1 : 4;	/* 6 type qualifiers - tqPtr, etc. */
	unsigned tq2 : 4;
	unsigned tq3 : 4;
	} TIR, *pTIR;
#endif
#ifdef HOST_LITTLE_ENDIAN
typedef struct {
	unsigned tq3 : 4;
	unsigned tq2 : 4;
	unsigned tq1 : 4;	/* 6 type qualifiers - tqPtr, etc. */
	unsigned tq0 : 4;
	/* ---- 16 bit boundary ---- */
	unsigned tq5 : 4;
	unsigned tq4 : 4;
	unsigned bt  : 6;	/* basic type */
	unsigned continued : 1; /* indicates additional TQ info in next AUX */
	unsigned fBitfield : 1; /* set if bit width is specified */
	} TIR, *pTIR;
#endif


#define cbTIR sizeof(TIR)
#define tiNil ((pTIR)0)
#define itqMax 6

#ifdef HOST_BIG_ENDIAN
typedef struct {
	unsigned	rfd : 12;    /* index into the file indirect table */
	unsigned	index : 20; /* index int sym/aux/iss tables */
	} RNDXR, *pRNDXR;
#endif
#ifdef HOST_LITTLE_ENDIAN
typedef struct {
	unsigned	index : 20; /* index int sym/aux/iss tables */
	unsigned	rfd : 12;    /* index into the file indirect table */
	} RNDXR, *pRNDXR;
#endif


#define cbRNDXR sizeof(RNDXR)
#define rndxNil ((pRNDXR)0)

typedef union __sgi_auxu_u {
	TIR	ti;		/* type information record */
	RNDXR	rndx;		/* relative index into symbol table */
	long_i	dnLow;		/* low dimension */
	long_i	dnHigh;		/* high dimension */
	long_i	isym;		/* symbol table index (end of proc) */
	long_i	iss;		/* index into string space (not used) */
	long_i	width;		/* width for non-default sized struc fields */
	long_i	count;		/* count of ranges for variant arm */
	} AUXU, *pAUXU;
#define cbAUXU sizeof(AUXU)
#define auxNil ((pAUXU)0)
#define iauxNil -1

typedef long_i RFDT, *pRFDT;
#define cbRFDT sizeof(RFDT)
#define rfdNil	-1

#endif