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