Annotation of cci/usr/src/bin/cdb/sym.h, revision 1.1.1.1

1.1       root        1: /* @(#)sym.h   2.3 */
                      2: #define isymNil        -1L
                      3: #define isym0  0L
                      4: 
                      5: #define bitHigh        (0x80000000)
                      6: 
                      7: /* magic number definitions */
                      8: #define magicImpure    0407            /* impure format */
                      9: #define magicReadOnly  0410            /* read-only text */
                     10: #define magicDemand    0413            /* demand load format */
                     11: #define        magicLpd        0401            /* lpd (UNIX/RT) */
                     12: #define        magicSplit      0411            /* separated I&D */
                     13: #define        magicOverlay    0405            /* overlay */
                     14: 
                     15: #ifdef SYSIII
                     16: #ifndef REGULUS
                     17: 
                     18: /* stuff directly related to the symbol table */
                     19: struct exec {  /* a.out header */
                     20:        short   a_magic;        /* magic number */
                     21:        uint    a_text;         /* size of text segment */
                     22:        uint    a_data;         /* size of initialized data */
                     23:        uint    a_bss;          /* size of uninitialized data */
                     24:        uint    a_syms;         /* size of symbol table */
                     25:        uint    a_entry;        /* entry point */
                     26:        uint    a_stamp;        /* system environment stamp */
                     27:        uint    a_flag;         /* relocation info stripped */
                     28: };
                     29: 
                     30: /* ***** in invocation of BADMAG macro, argument should not be a function.***/
                     31: #define        FBadMagic(X) (X.a_magic!=magicReadOnly && X.a_magic!=magicImpure \
                     32:                   && X.a_magic!=magicLpd && X.a_magic!=magicSplit \
                     33:                   && X.a_magic!=magicOverlay)
                     34: 
                     35: #define CbTextOffset(x) (cbEXECR)
                     36: #define CbSymOffset(x) ((x).a_text + (x).a_data + CbTextOffset(x))
                     37: 
                     38: /* values for type flag */
                     39: #define        N_UNDF  0       /* undefined */
                     40: #define        N_ABS   01      /* absolute */
                     41: #define        N_TEXT  02      /* text symbol */
                     42: #define        N_DATA  03      /* data symbol */
                     43: #define        N_BSS   04      /* bss symbol */
                     44: #define        N_TYPE  037     /* gets JUST the type bits (removes N_EXT) */
                     45: #define        N_REG   024     /* register name */
                     46: #define        N_FN    037     /* file name symbol */
                     47: #define        N_EXT   040     /* external bit, or'ed in */
                     48: 
                     49: typedef struct SYMS {  /* same record as `nlist, but with my names */
                     50:        char    sbSym[8];       /* symbol name */
                     51:        short   type;           /* type flag */
                     52:        uint    value;          /* something appropriate to the type */
                     53:        } SYMR, *pSYMR;
                     54: #define cbSYMR sizeof(SYMR)
                     55: 
                     56: /* then following is replaced by a procedure for BSD41 - see sym.c */
                     57: #define SbInCore(sb) (sb)
                     58: /* end of normal SYSIII */
                     59: 
                     60: #else
                     61: 
                     62: /* stuff directly related to the symbol table */
                     63: struct exec {  /* a.out header */
                     64:        short   a_magic;        /* magic number */
                     65:        long    a_text;         /* size of text segment */
                     66:        long    a_data;         /* size of initialized data */
                     67:        long    a_bss;          /* size of uninitialized data */
                     68:        long    a_syms;         /* size of symbol table */
                     69:        long    a_stksize;      /* stack size */
                     70:        long    a_entry;        /* entry point */
                     71:        short   a_flag;         /* relocation info stripped */
                     72: };
                     73: 
                     74: #define        A_MAGIC1        0x601a          /* normal */
                     75: #define        A_MAGIC0        0x601c          /* shared text - 2k boundaries */
                     76: #define        A_MAGIC2        0x601d          /* separated I&D */
                     77: #define        A_MAGIC3        0x601e          /* shared text - 4k boundaries */
                     78: /* ***** in invocation of BADMAG macro, argument should not be a function.***/
                     79: #define        FBadMagic(X) (X.a_magic!=A_MAGIC1 && X.a_magic!=A_MAGIC2 \
                     80:                   && X.a_magic!=A_MAGIC3 && X.a_magic!=A_MAGIC0)
                     81: 
                     82: #define CbTextOffset(x) (cbEXECR)
                     83: #define CbSymOffset(x) (CbTextOffset(x) + (x).a_text + (x).a_data)
                     84: 
                     85: /* values for type flag */
                     86: #define        N_UNDF  0       /* undefined */
                     87: #define        N_ABS   040000  /* absolute */
                     88: #define        N_TEXT  01000   /* text symbol */
                     89: #define        N_DATA  02000   /* data symbol */
                     90: #define        N_BSS   0400    /* bss symbol */
                     91: #define        N_TYPE  053600  /* gets JUST the type bits (removes N_EXT) */
                     92: #define        N_REG   010000  /* register name */
                     93: #define        N_FN    0200    /* file name symbol */
                     94: #define        N_EXT   020000  /* external bit, or'ed in */
                     95: 
                     96: typedef struct SYMS {  /* same record as `nlist, but with my names */
                     97:        char    sbSym[8];       /* symbol name */
                     98:        short   type;           /* type flag */
                     99:        ulong   value;          /* something appropriate to the type */
                    100:        } SYMR, *pSYMR;
                    101: #define cbSYMR sizeof(SYMR)
                    102: 
                    103: /* then following is replaced by a procedure for BSD41 - see sym.c */
                    104: #define SbInCore(sb) (sb)
                    105: /* end of REGULUS */
                    106: #endif
                    107: /* end of SYSIII stuff */
                    108: #endif
                    109: 
                    110: #ifdef BSD41
                    111: extern char * SbInCore();
                    112: 
                    113: struct exec {
                    114:         long    a_magic;        /* magic number */
                    115:        ulong   a_text;         /* size of text segment */
                    116:        ulong   a_data;         /* size of initialized data */
                    117:        ulong   a_bss;          /* size of uninitialized data */
                    118:        ulong   a_syms;         /* size of symbol table */
                    119:        ulong   a_entry;        /* entry point */
                    120:        ulong   a_trsize;       /* size of text relocation */
                    121:        ulong   a_drsize;       /* size of data relocation */
                    122: };
                    123: 
                    124: #define FBadMagic(x) \
                    125:     (((x).a_magic)!=magicImpure \
                    126:     && ((x).a_magic)!=magicReadOnly \
                    127:     && ((x).a_magic)!=magicDemand)
                    128: 
                    129: #ifdef SUN
                    130: #define CbTextOffset(x) ((x).a_magic==magicDemand ? 2048 : cbEXECR)
                    131: #else
                    132: #define CbTextOffset(x) ((x).a_magic==magicDemand ? 1024 : cbEXECR)
                    133: #endif
                    134: 
                    135: #define CbSymOffset(x) \
                    136:         (CbTextOffset(x) + (x).a_text+(x).a_data + (x).a_trsize+(x).a_drsize)
                    137: #define CbStrOffset(x) (CbSymOffset(x) + (x).a_syms)
                    138: 
                    139: typedef struct  SYMS { /* berkeley `nlist', almost */
                    140:        long    sbSym;          /* not an `sb', an index into string space */
                    141:        uchar   type;           /* type flag, i.e. N_TEXT etc; see below */
                    142:         char    other;         /* unused */
                    143:         short   desc;          /* see <stab.h> */
                    144:        ulong   value;          /* value of this symbol (or sdb offset) */
                    145:        } SYMR, *pSYMR;
                    146: #define cbSYMR sizeof(SYMR)
                    147: 
                    148: /*
                    149:  * Simple values for n_type.
                    150:  */
                    151: #define N_UNDF  0x0            /* undefined */
                    152: #define N_ABS   0x2            /* absolute */
                    153: #define N_TEXT  0x4            /* text */
                    154: #define N_DATA  0x6            /* data */
                    155: #define N_BSS   0x8            /* bss */
                    156: #define N_FN    0x1f           /* file name symbol */
                    157: 
                    158: #define N_EXT   01             /* external bit, or'ed in */
                    159: #define N_TYPE  0x1e           /* mask for all the type bits */
                    160: 
                    161: #define N_STAB  0xe0           /* if any of these bits set, a SDB entry */
                    162: /* end of BSD41 */
                    163: #endif
                    164: 
                    165: #define symNil ((pSYMR)0)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.