Annotation of 42BSD/ucb/pascal/src/objfmt.h, revision 1.1.1.1

1.1       root        1: /* Copyright (c) 1979 Regents of the University of California */
                      2: 
                      3: /* static char sccsid[] = "@(#)objfmt.h 1.13 4/8/83"; */
                      4: 
                      5: /*
                      6:  * The size of the display.
                      7:  */
                      8: #define DSPLYSZ 20
                      9: 
                     10: /*
                     11:  *     The structure of the runtime display
                     12:  */
                     13: #ifdef OBJ
                     14: struct dispsave {
                     15:        char *locvars;          /* pointer to local variables */
                     16:        struct blockmark *stp;  /* pointer to local stack frame */
                     17: };
                     18:        /*
                     19:         * The following union allows fast access to
                     20:         * precomputed display entries
                     21:         */
                     22: union display {
                     23:        struct dispsave frame[DSPLYSZ];
                     24:        char *raw[2*DSPLYSZ];
                     25: } display;
                     26: #endif OBJ
                     27: #ifdef PC
                     28: #ifdef vax
                     29:        /*
                     30:         *      the display is made up of saved AP's and FP's.
                     31:         *      FP's are used to find locals,
                     32:         *      and AP's are used to find parameters.
                     33:         *      FP and AP are untyped pointers,
                     34:         *      but are used throughout as (char *).
                     35:         *      the display is used by adding AP_OFFSET or FP_OFFSET to the 
                     36:         *      address of the approriate display entry.
                     37:         */
                     38:     struct dispsave {
                     39:        char    *savedAP;
                     40:        char    *savedFP;
                     41:     } display[ DSPLYSZ ];
                     42: 
                     43: #   define     AP_OFFSET       ( 0 )
                     44: #   define     FP_OFFSET       ( sizeof (char *) )
                     45: #endif vax
                     46: #ifdef mc68000
                     47:        /*
                     48:         *      the display is just the saved a6.
                     49:         *      arguments are at positive offsets,
                     50:         *      locals are at negative offsets.
                     51:         *      there are no offsets within the saved display structure.
                     52:         */
                     53:     struct dispsave {
                     54:        char    *saveda6;
                     55:     } display[ DSPLYSZ ];
                     56: 
                     57: #   define     AP_OFFSET       (0)
                     58: #   define     FP_OFFSET       (0)
                     59: #endif mc68000
                     60: #endif PC
                     61: 
                     62:     /*
                     63:      * the structure below describes the block mark used by the architecture.
                     64:      * this is the space used by the machine between the arguments and the
                     65:      * whatever is used to point to the arguments.
                     66:      */
                     67: #ifdef OBJ
                     68: struct blockmark {
                     69:        char *tos;              /* pointer to top of stack frame */
                     70:        struct iorec *file;     /* pointer to active file name */
                     71:        struct hdr {
                     72:                long framesze;  /* number of bytes of local vars */
                     73:                long nargs;     /* number of bytes of arguments */
                     74:                long tests;     /* TRUE => perform runtime tests */
                     75:                short offset;   /* offset of procedure in source file */
                     76:                char name[1];   /* name of active procedure */
                     77:        } *entry;
                     78:        struct dispsave odisp;  /* previous display value for this level */
                     79:        struct dispsave *dp;    /* pointer to active display entry */
                     80:        char *pc;               /* previous location counter */
                     81:        long lino;              /* previous line number */
                     82: };
                     83: #endif OBJ
                     84: #ifdef PC
                     85: #ifdef vax
                     86:        /*
                     87:         *      since we have the ap pointing to the number of args:
                     88:         */
                     89:     struct blockmark {
                     90:         long   nargs;
                     91:     };
                     92: #endif vax
                     93: #ifdef mc68000
                     94:        /*
                     95:         *      there's the saved pc (from the jsr)
                     96:         *      and the saved a6 (from the link a6).
                     97:         */
                     98:     struct blockmark {
                     99:        char    *savedpc;
                    100:        char    *saveda6;
                    101:     };
                    102: #endif mc68000
                    103: #endif PC
                    104: 
                    105:     /*
                    106:      * formal routine structure:
                    107:      */
                    108: struct formalrtn {
                    109:        long            (*fentryaddr)();        /* formal entry point */
                    110:        long            fbn;                    /* block number of function */
                    111:        struct dispsave fdisp[ DSPLYSZ ];       /* saved at first passing */
                    112: } frtn;
                    113: 
                    114: #define        FENTRYOFFSET    0
                    115: #define FBNOFFSET      ( FENTRYOFFSET + sizeof frtn.fentryaddr )
                    116: #define        FDISPOFFSET     ( FBNOFFSET + sizeof frtn.fbn )
                    117: 
                    118: #ifdef OBJ
                    119:        /*
                    120:         *      the creation time, the size and the magic number of the obj file
                    121:         */
                    122:     struct pxhdr {
                    123:            long        maketime;
                    124:            long        objsize;
                    125:            long        symtabsize;
                    126:            short       magicnum;
                    127:     };
                    128: 
                    129: /*
                    130:  *     START defines the beginning of the text space.
                    131:  *     This should be the defined external label "start",
                    132:  *     however there is no way to access externals from C
                    133:  *     whose names do not begin with an "_".
                    134:  */
                    135: #ifdef vax
                    136: #   define HEADER_BYTES        2048                    /* the size of px_header */
                    137: #   define START 0x0                           /* beginning of text */
                    138: #endif vax
                    139: #ifdef mc68000
                    140: #   define HEADER_BYTES        3072                    /* the size of px_header */
                    141: #   define START 0x8000                                /* beginning of text */
                    142: #endif mc68000
                    143: #   define INDX 1                              /* amt to shift display index */
                    144: #endif OBJ
                    145: 
                    146:            /*
                    147:             *  these are because of varying sizes of pointers
                    148:             */
                    149: #ifdef ADDR16
                    150: #      define PTR_AS O_AS2
                    151: #      define PTR_RV O_RV2
                    152: #      define PTR_IND O_IND2
                    153: #      define PTR_CON O_CON2
                    154: #      define PTR_DUP O_SDUP2
                    155: #      define CON_INT O_CON2
                    156: #      define INT_TYP (nl + T2INT)
                    157: #      define PTR_DCL char *
                    158: #      define TOOMUCH 50000
                    159: #      define SHORTADDR 65536
                    160: #      define MAXSET 65536             /* maximum set size */
                    161: #endif ADDR16
                    162: #ifdef ADDR32
                    163: #      define PTR_AS O_AS4
                    164: #      define PTR_RV O_RV4
                    165: #      define PTR_IND O_IND4
                    166: #      define PTR_CON O_CON4
                    167: #      define PTR_DUP O_SDUP4
                    168: #      define CON_INT O_CON24
                    169: #      define INT_TYP (nl + T4INT)
                    170: #      define PTR_DCL unsigned long            /* for pointer variables */
                    171: #      define SHORTADDR 32768                  /* maximum short address */
                    172: #      define TOOMUCH 65536                    /* maximum variable size */
                    173: #      define MAXSET 65536                     /* maximum set size */
                    174: #endif ADDR32
                    175:        /*
                    176:         * Offsets due to the structure of the runtime stack.
                    177:         * DPOFF1       is the amount of fixed storage in each block allocated
                    178:         *              as local variables for the runtime system.
                    179:         *              since locals are allocated negative offsets,
                    180:         *              -DPOFF1 is the last used implicit local offset.
                    181:         * DPOFF2       is the size of the block mark.
                    182:         *              since arguments are allocated positive offsets,
                    183:         *              DPOFF2 is the end of the implicit arguments.
                    184:         *              for obj, the first argument has the highest offset
                    185:         *              from the stackpointer.  and the block mark is an
                    186:         *              implicit last parameter.
                    187:         *              for pc, the first argument has the lowest offset
                    188:         *              from the argumentpointer.  and the block mark is an
                    189:         *              implicit first parameter.
                    190:         */
                    191: #      ifdef OBJ
                    192: #          ifdef ADDR32
                    193: #              define MAGICNUM 0403    /* obj magic number */
                    194: #              define DPOFF1           0
                    195: #              define DPOFF2           (sizeof (struct blockmark))
                    196: #              define INPUT_OFF        -8      /* offset of `input' */
                    197: #              define OUTPUT_OFF       -4      /* offset of `output' */
                    198: #          endif ADDR32
                    199: #          ifdef ADDR16
                    200: #              define MAGICNUM 0404
                    201: #              define DPOFF1           0
                    202: #              define DPOFF2           (sizeof (struct blockmark))
                    203: #              define INPUT_OFF        -2
                    204: #              define OUTPUT_OFF       -4
                    205: #          endif ADDR16
                    206: #      endif OBJ
                    207: #      ifdef   PC
                    208: #          define DPOFF1       ( sizeof (struct rtlocals) )
                    209: #          define DPOFF2       ( sizeof (struct blockmark) )
                    210: #          define INPUT_OFF    0
                    211: #          define OUTPUT_OFF   0
                    212: #      endif PC

unix.superglobalmegacorp.com

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