Annotation of 43BSDReno/pgrm/pascal/src/objfmt.h.new, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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