|
|
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: * @(#)machdep.h 5.3 (Berkeley) 1/9/89 ! 7: */ ! 8: ! 9: #ifdef ADDR32 ! 10: #define pushaddr(x) push4((long)(x)) ! 11: #define popaddr() (char *)pop4() ! 12: #endif ADDR32 ! 13: #ifdef ADDR16 ! 14: #define pushaddr(x) push2((short)(x)) ! 15: #define popaddr() (char *)pop2() ! 16: #endif ADDR16 ! 17: ! 18: #define popfile() (FILE *)(popaddr()) ! 19: ! 20: #if defined(pdp11) ! 21: #define popint pop2 ! 22: #define pushint push2 ! 23: #else ! 24: #define popint pop4 ! 25: #define pushint push4 ! 26: #endif ! 27: ! 28: /* ! 29: * Machine specific macros for reading quantities from the ! 30: * interpreter instruction stream. Operands in the instruction ! 31: * stream are aligned to short, but not long boundries. Blockmarks ! 32: * are always long aligned. Stack alignment indicates whether the ! 33: * stack is short or long aligned. Stack alignment is assumed to ! 34: * be no more than long aligned for ADDR32 machines, short aligned ! 35: * for ADDR16 machines. ! 36: */ ! 37: #if defined(vax) || defined(mc68000) || defined(pdp11) ! 38: #define PCLONGVAL(target) target = *pc.lp++ ! 39: #define GETLONGVAL(target, srcptr) target = *(long *)(srcptr) ! 40: #define STACKALIGN(target, value) target = ((value) + 1) &~ 1 ! 41: #endif vax || mc68000 || pdp11 ! 42: ! 43: #ifdef tahoe ! 44: #define PCLONGVAL(target) target = *pc.sp++ << 16, target += *pc.usp++ ! 45: #define GETLONGVAL(target, srcptr) \ ! 46: tsp = (short *)(srcptr), \ ! 47: target = *tsp++ << 16, target += *(unsigned short *)tsp ! 48: #define STACKALIGN(target, value) target = ((value) + 3) &~ 3 ! 49: #endif tahoe ! 50: ! 51: /* ! 52: * The following macros implement all accesses to the interpreter stack. ! 53: * ! 54: * They used to be hard-coded assembler stuff massaged into the compiler ! 55: * output by sed scripts, but things are cleaner now. ! 56: * ! 57: * The STACKSIZE is an arbitrary value. I picked 100K since it was unlikely ! 58: * that anybody's program would run out of stack. Automatic allocation ! 59: * would be nice, maybe procedure call should check for enough space + slop ! 60: * and expand it if necessary. Expanding the stack will require ! 61: * pointer relocation if it moves, though. Probably better would be a ! 62: * command line option to set the stack size. ! 63: */ ! 64: #define STACKSIZE 100000 ! 65: #define setup() { \ ! 66: extern char *malloc(); \ ! 67: stack.cp = STACKSIZE + malloc((unsigned)STACKSIZE); \ ! 68: } ! 69: #ifndef tahoe ! 70: #define push2(x) (*--stack.sp) = (x) ! 71: #else ! 72: #define push2(x) (*--stack.lp) = (x) << 16 ! 73: #endif ! 74: #define push4(x) (*--stack.lp) = (x) ! 75: #define push8(x) (*--stack.dbp) = (x) ! 76: #define pushsze8(x) (*--stack.s8p) = (x) ! 77: #define pushsp(x) (stack.cp -= (x)) ! 78: #ifndef tahoe ! 79: #define pop2() (*stack.sp++) ! 80: #else ! 81: #define pop2() (*stack.lp++) >> 16 ! 82: #endif ! 83: #define pop4() (*stack.lp++) ! 84: #define pop8() (*stack.dbp++) ! 85: #define popsze8() (*stack.s8p++) ! 86: #define popsp(x) (void)(stack.cp += (x)) ! 87: #define enableovrflo() /*nop*/ ! 88: #define disableovrflo() /*nop*/
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.