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.1 (Berkeley) 06/05/85 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 struct rtlocals { 34 jmp_buf gotoenv; 35 struct iorec *curfile; 36 struct dispsave dsave; 37 } rtlocs; 38 #define GOTOENVOFFSET ( -sizeof rtlocs ) 39 #define CURFILEOFFSET ( GOTOENVOFFSET + sizeof rtlocs.gotoenv ) 40 #define DSAVEOFFSET ( CURFILEOFFSET + sizeof rtlocs.curfile ) 41 42 /* 43 * this is a cookie used to communicate between the 44 * routine entry code and the routine exit code. 45 * mostly it's for labels shared between the two. 46 */ 47 #ifdef vax 48 struct entry_exit_cookie { 49 struct nl *nlp; 50 char extname[BUFSIZ]; 51 int toplabel; 52 int savlabel; 53 }; 54 #define FRAME_SIZE_LABEL "LF" 55 #define SAVE_MASK_LABEL "L" 56 #endif vax 57 58 #ifdef mc68000 59 struct entry_exit_cookie { 60 struct nl *nlp; 61 char extname[BUFSIZ]; 62 int toplabel; 63 }; 64 #define FRAME_SIZE_LABEL "LF" 65 #define PAGE_BREAK_LABEL "LP" 66 #define SAVE_MASK_LABEL "LS" 67 #endif mc68000 68 69 /* 70 * formats for various names 71 * NAMEFORMAT arbitrary length strings. 72 * EXTFORMAT for externals, a preceding underscore. 73 * LABELFORMAT for label names, a preceding dollar-sign. 74 * PREFIXFORMAT used to print made up names with prefixes. 75 * LABELPREFIX with getlab() makes up label names. 76 * LLABELPREFIX with getlab() makes up sdb labels. 77 * FORMALPREFIX prefix for EXTFORMAT for formal entry points. 78 * a typical use might be to print out a name with a preceeding underscore 79 * with putprintf( EXTFORMAT , 0 , name ); 80 */ 81 #define NAMEFORMAT "%s" 82 #define EXTFORMAT "_%s" 83 #define LABELFORMAT "$%s" 84 #define PREFIXFORMAT "%s%d" 85 #define LABELPREFIX "L" 86 #define LLABELPREFIX "LL" 87 #define FORMALPREFIX "__" 88 89 /* 90 * the name of the statement counter 91 */ 92 #define STMTCOUNT "__stcnt" 93 94 /* 95 * the name of the pcp counters 96 */ 97 #define PCPCOUNT "__pcpcount" 98 99 /* 100 * a vector of pointer to enclosing functions for fully qualified names. 101 */ 102 char *enclosing[ DSPLYSZ ]; 103 104 #ifdef vax 105 /* 106 * the runtime framepointer and argumentpointer registers 107 */ 108 # define P2FP 13 109 # define P2FPNAME "fp" 110 # define P2AP 12 111 # define P2APNAME "ap" 112 113 /* 114 * the register save mask for saving no registers 115 */ 116 # define RSAVEMASK ( 0 ) 117 118 /* 119 * runtime check mask for divide check and integer overflow 120 */ 121 # define RUNCHECK ( ( 1 << 15 ) | ( 1 << 14 ) ) 122 123 /* 124 * and of course ... 125 */ 126 # define BITSPERBYTE 8 127 #endif vax 128 129 #ifdef mc68000 130 /* 131 * these magic numbers lifted from pcc/mac2defs 132 * the offsets are for mapping data and address register numbers 133 * to linear register numbers. e.g. d2 ==> r2, and a2 ==> r10. 134 */ 135 # define DATA_REG_OFFSET 0 136 # define ADDR_REG_OFFSET 8 137 # define P2FPNAME "a6" 138 # define P2FP (ADDR_REG_OFFSET + 6) 139 # define P2APNAME "a6" 140 # define P2AP (ADDR_REG_OFFSET + 6) 141 142 /* 143 * and still ... 144 */ 145 # define BITSPERBYTE 8 146 #endif mc68000 147