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