|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1985 The Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that: (1) source distributions retain this entire copyright ! 7: * notice and comment, and (2) distributions including binaries display ! 8: * the following acknowledgement: ``This product includes software ! 9: * developed by the University of California, Berkeley and its contributors'' ! 10: * in the documentation or other materials provided with the distribution ! 11: * and in all advertising materials mentioning features or use of this ! 12: * software. Neither the name of the University nor the names of its ! 13: * contributors may be used to endorse or promote products derived ! 14: * from this software without specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: */ ! 19: ! 20: #ifndef lint ! 21: static char sccsid[] = "@(#)ops.tahoe.c 5.7 (Berkeley) 6/1/90"; ! 22: #endif /* not lint */ ! 23: ! 24: /* ! 25: * Machine operators. ! 26: */ ! 27: ! 28: #include "defs.h" ! 29: #include "ops.h" ! 30: ! 31: #ifndef public ! 32: typedef unsigned char Opcode; ! 33: ! 34: /* ! 35: * Opcode definitions. ! 36: */ ! 37: ! 38: /* ! 39: * Argument access types ! 40: */ ! 41: #define ACCA (8<<3) /* address only */ ! 42: #define ACCR (1<<3) /* read */ ! 43: #define ACCW (2<<3) /* write */ ! 44: #define ACCM (3<<3) /* modify */ ! 45: #define ACCB (4<<3) /* branch displacement */ ! 46: #define ACCI (5<<3) /* XFC code */ ! 47: ! 48: /* ! 49: * Argument data types ! 50: */ ! 51: #define TYPB 0 /* byte */ ! 52: #define TYPW 1 /* word */ ! 53: #define TYPL 2 /* long */ ! 54: #define TYPQ 3 /* quad */ ! 55: #define TYPF 4 /* float */ ! 56: #define TYPD 5 /* double */ ! 57: ! 58: /* ! 59: * Addressing modes. ! 60: */ ! 61: #define LITSHORT 0x0 /* short literals */ ! 62: #define LITUPTO31 0x1 ! 63: #define LITUPTO47 0x2 ! 64: #define LITUPTO63 0x3 ! 65: #define INDEX 0x4 /* i[r] */ ! 66: #define REG 0x5 /* r */ ! 67: #define REGDEF 0x6 /* (r) */ ! 68: #define AUTODEC 0x7 /* -(r) */ ! 69: #define AUTOINC 0x8 /* (r)+ */ ! 70: #define AUTOINCDEF 0x9 /* *(r)+ */ ! 71: #define BYTEDISP 0xA /* BD(r) */ ! 72: #define BYTEDISPDEF 0xB /* *BD(r) */ ! 73: #define WORDDISP 0xC /* WD(r) */ ! 74: #define WORDDISPDEF 0xD /* *WD(r) */ ! 75: #define LONGDISP 0xE /* LD(r) */ ! 76: #define LONGDISPDEF 0xF /* *LD(r) */ ! 77: ! 78: #define is_branch_disp(arg) ((arg & ACCB) != 0) ! 79: #define typelen(arg) (arg & 07) ! 80: #define regnm(mode) (mode & 0xF) ! 81: #define addrmode(mode) (mode >> 4) ! 82: ! 83: /* ! 84: * Certain opcodes values are used either in calculating ! 85: * the next address a process will go to, or for other ! 86: * random reasons -- these are defined here. ! 87: */ ! 88: #define O_AOBLEQ 0x3f ! 89: #define O_AOBLSS 0x2f ! 90: #define O_BBC 0x1e ! 91: #define O_BBS 0x0e ! 92: #define O_BBSSI 0x5f ! 93: #define O_BCC 0xf1 ! 94: #define O_BCS 0xe1 ! 95: #define O_BEQL 0x31 ! 96: #define O_BGEQ 0x81 ! 97: #define O_BGEQU 0xe1 ! 98: #define O_BGTR 0x41 ! 99: #define O_BGTRU 0xa1 ! 100: #define O_BLEQ 0x51 ! 101: #define O_BLEQU 0xb1 ! 102: #define O_BLSS 0x91 ! 103: #define O_BLSSU 0xf1 ! 104: #define O_BNEQ 0x21 ! 105: #define O_BPT 0x30 ! 106: #define O_BRB 0x11 ! 107: #define O_BRW 0x13 ! 108: #define O_BTCS 0xce ! 109: #define O_BVC 0xc1 ! 110: #define O_BVS 0xd1 ! 111: #define O_CALLF 0xfe ! 112: #define O_CALLS 0xbf ! 113: #define O_CASEL 0xfc ! 114: #define O_JMP 0x71 ! 115: #define O_KCALL 0xcf ! 116: #define O_RET 0x40 ! 117: ! 118: /* ! 119: * Operator information structure. ! 120: */ ! 121: typedef struct { ! 122: char *iname; ! 123: char val; ! 124: char numargs; ! 125: char argtype[6]; ! 126: } Optab; ! 127: ! 128: #define SYSSIZE 151 /* # of system calls */ ! 129: #endif ! 130: ! 131: #ifndef ADBINSTRS ! 132: #define ADBINSTRS "../../bin/adb/adb.tahoe/instrs.adb" ! 133: #endif ! 134: ! 135: public Optab optab[] = { ! 136: #define OP(a,b,c,d,e,f,g,h,i) {a,b,c,d,e,f,g,h,i} ! 137: #include ADBINSTRS ! 138: 0}; ! 139: ! 140: /* ! 141: * Register names. ! 142: */ ! 143: ! 144: public String regname[] = { ! 145: "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", ! 146: "r8", "r9", "r10","r11","r12", "fp", "sp", "pc" ! 147: }; ! 148: ! 149: public String systab[SYSSIZE] = { ! 150: "indir", "exit", "fork", "read", ! 151: "write", "open", "close", "owait", ! 152: "creat", "link", "unlink", "execv", ! 153: "chdir", "otime", "mknod", "chmod", ! 154: "chown", "obreak", "ostat", "lseek", ! 155: "getpid", "mount", "umount", "osetuid", ! 156: "getuid", "ostime", "ptrace", "oalarm", ! 157: "ofstat", "opause", "outime", "ostty", ! 158: "ogtty", "access", "onice", "oftime", ! 159: "sync", "kill", "stat", "osetpgrp", ! 160: "lstat", "dup", "pipe", "otimes", ! 161: "profil", 0, "osetgid", "getgid", ! 162: "osig", 0, 0, "acct", ! 163: "ophys", "olock", "ioctl", "reboot", ! 164: "ompxchan", "symlink", "readlink", "execve", ! 165: "umask", "chroot", "fstat", 0, ! 166: "getpagesize", "mremap", "vfork", "ovread", ! 167: "ovwrite", "sbrk", "sstk", "mmap", ! 168: "ovadvise", "munmap", "mprotect", "madvise", ! 169: "vhangup", "ovlimit", "mincore", "getgroups", ! 170: "setgroups", "getpgrp", "setpgrp", "setitimer", ! 171: "wait", "swapon", "getitimer", "gethostname", ! 172: "sethostname", "getdtablesize","dup2", "getdopt", ! 173: "fcntl", "select", "setdopt", "fsync", ! 174: "setpriority", "socket", "connect", "accept", ! 175: "getpriority", "send", "recv", "osocketaddr", ! 176: "bind", "setsockopt", "listen", "ovtimes", ! 177: "sigvec", "sigblock", "sigsetmask", "sigpause", ! 178: "sigstack", "recvmsg", "sendmsg", "vtrace", ! 179: "gettimeofday", "getrusage", "getsockopt", "resuba", ! 180: "readv", "writev", "settimeofday", "fchown", ! 181: "fchmod", "recvfrom", "setreuid", "setregid", ! 182: "rename", "truncate", "ftruncate", "flock", ! 183: 0, "sendto", "shutdown", "socketpair", ! 184: "mkdir", "rmdir", "utimes", 0, ! 185: 0, "getpeername", "gethostid", "sethostid", ! 186: "getrlimit", "setrlimit", "killpg", 0, ! 187: "quota", "qquota", "getsockname", ! 188: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.