1 /*- 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)pc.h 8.1 (Berkeley) 06/06/93 8 */ 9 10 #include <setjmp.h> 11 12 /* 13 * random constants for pc 14 */ 15 16 /* 17 * the name of the display. 18 */ 19 #define DISPLAYNAME "__disply" 20 21 /* 22 * the structure below describes the locals used by the run time system. 23 * at function entry, at least this much space is allocated, 24 * and the following information is filled in: 25 * the address of a routine to close the current frame for unwinding, 26 * a pointer to the display entry for the current static level and 27 * the previous contents of the display for this static level. 28 * the curfile location is used to point to the currently active file, 29 * and is filled in as io is initiated. 30 * one of these structures is allocated on the (negatively growing) stack. 31 * at function entry, fp is set to point to the last field of the struct, 32 * thus the offsets of the fields are as indicated below. 33 */ 34 #ifdef vax 35 struct rtlocals { 36 jmp_buf gotoenv; 37 struct iorec *curfile; 38 struct dispsave dsave; 39 } rtlocs; 40 #endif vax 41 42 #ifdef tahoe 43 struct rtlocals { 44 jmp_buf gotoenv; 45 struct iorec *curfile; 46 struct dispsave dsave; 47 long savedregs[9]; 48 } rtlocs; 49 #endif tahoe 50 51 #ifdef mc68000 52 struct rtlocals { 53 jmp_buf gotoenv; 54 struct iorec *curfile; 55 struct dispsave dsave; 56 } rtlocs; 57 #endif mc68000 58 59 #define GOTOENVOFFSET ( -sizeof rtlocs ) 60 #define CURFILEOFFSET ( GOTOENVOFFSET + sizeof rtlocs.gotoenv ) 61 #define DSAVEOFFSET ( CURFILEOFFSET + sizeof rtlocs.curfile ) 62 63 /* 64 * this is a cookie used to communicate between the 65 * routine entry code and the routine exit code. 66 * mostly it's for labels shared between the two. 67 */ 68 #ifdef vax 69 struct entry_exit_cookie { 70 struct nl *nlp; 71 char extname[BUFSIZ]; 72 int toplabel; 73 int savlabel; 74 }; 75 #define FRAME_SIZE_LABEL "LF" 76 #define SAVE_MASK_LABEL "L" 77 #endif vax 78 79 #ifdef tahoe 80 struct entry_exit_cookie { 81 struct nl *nlp; 82 char extname[BUFSIZ]; 83 int toplabel; 84 int savlabel; 85 }; 86 #define FRAME_SIZE_LABEL "LF" 87 #define SAVE_MASK_LABEL "L" 88 #endif tahoe 89 90 #ifdef mc68000 91 struct entry_exit_cookie { 92 struct nl *nlp; 93 char extname[BUFSIZ]; 94 int toplabel; 95 }; 96 #define FRAME_SIZE_LABEL "LF" 97 #define PAGE_BREAK_LABEL "LP" 98 #define SAVE_MASK_LABEL "LS" 99 #endif mc68000 100 101 /* 102 * formats for various names 103 * NAMEFORMAT arbitrary length strings. 104 * EXTFORMAT for externals, a preceding underscore. 105 * LABELFORMAT for label names, a preceding dollar-sign. 106 * PREFIXFORMAT used to print made up names with prefixes. 107 * LABELPREFIX with getlab() makes up label names. 108 * LLABELPREFIX with getlab() makes up sdb labels. 109 * FORMALPREFIX prefix for EXTFORMAT for formal entry points. 110 * a typical use might be to print out a name with a preceeding underscore 111 * with putprintf( EXTFORMAT , 0 , name ); 112 */ 113 #define NAMEFORMAT "%s" 114 #define EXTFORMAT "_%s" 115 #define LABELFORMAT "$%s" 116 #define PREFIXFORMAT "%s%d" 117 #define LABELPREFIX "L" 118 #define LLABELPREFIX "LL" 119 #define FORMALPREFIX "__" 120 121 /* 122 * the name of the statement counter 123 */ 124 #define STMTCOUNT "__stcnt" 125 126 /* 127 * the name of the pcp counters 128 */ 129 #define PCPCOUNT "__pcpcount" 130 131 /* 132 * a vector of pointer to enclosing functions for fully qualified names. 133 */ 134 char *enclosing[ DSPLYSZ ]; 135 136 #ifdef vax 137 /* 138 * the runtime framepointer and argumentpointer registers 139 */ 140 # define P2FP 13 141 # define P2FPNAME "fp" 142 # define P2AP 12 143 # define P2APNAME "ap" 144 145 /* 146 * the register save mask for saving no registers 147 */ 148 # define RSAVEMASK ( 0 ) 149 150 /* 151 * runtime check mask for divide check and integer overflow 152 */ 153 # define RUNCHECK ( ( 1 << 15 ) | ( 1 << 14 ) ) 154 155 /* 156 * and of course ... 157 */ 158 # define BITSPERBYTE 8 159 #endif vax 160 161 #ifdef tahoe 162 /* 163 * the runtime framepointer and argumentpointer registers 164 */ 165 # define P2FP 13 166 # define P2FPNAME "fp" 167 # define P2AP 13 168 # define P2APNAME "fp" 169 170 /* 171 * the register save mask for saving no registers 172 */ 173 # define RSAVEMASK ( 0 ) 174 175 /* 176 * divide check and integer overflow don't exist in the save mask 177 */ 178 # define RUNCHECK ( 0 ) 179 180 /* 181 * and of course ... 182 */ 183 # define BITSPERBYTE 8 184 #endif tahoe 185 186 #ifdef mc68000 187 /* 188 * these magic numbers lifted from pcc/mac2defs 189 * the offsets are for mapping data and address register numbers 190 * to linear register numbers. e.g. d2 ==> r2, and a2 ==> r10. 191 */ 192 # define DATA_REG_OFFSET 0 193 # define ADDR_REG_OFFSET 8 194 # define P2FPNAME "a6" 195 # define P2FP (ADDR_REG_OFFSET + 6) 196 # define P2APNAME "a6" 197 # define P2AP (ADDR_REG_OFFSET + 6) 198 199 /* 200 * and still ... 201 */ 202 # define BITSPERBYTE 8 203 #endif mc68000 204