126325Ssam /* 238105Sbostic * Copyright (c) 1985 The Regents of the University of California. 338105Sbostic * All rights reserved. 438105Sbostic * 542683Sbostic * %sccs.include.redist.c% 626325Ssam */ 726325Ssam 826325Ssam #ifndef lint 9*51692Sbostic static char sccsid[] = "@(#)ops.tahoe.c 5.9 (Berkeley) 11/14/91"; 1038105Sbostic #endif /* not lint */ 1126325Ssam 1226325Ssam /* 1326325Ssam * Machine operators. 1426325Ssam */ 1526325Ssam 1626325Ssam #include "defs.h" 1726325Ssam #include "ops.h" 1846187Sbostic #include "pathnames.h" 1926325Ssam 2026325Ssam #ifndef public 2126325Ssam typedef unsigned char Opcode; 2226325Ssam 2326325Ssam /* 2426325Ssam * Opcode definitions. 2526325Ssam */ 2626325Ssam 2726325Ssam /* 2826325Ssam * Argument access types 2926325Ssam */ 3026325Ssam #define ACCA (8<<3) /* address only */ 3126325Ssam #define ACCR (1<<3) /* read */ 3226325Ssam #define ACCW (2<<3) /* write */ 3326325Ssam #define ACCM (3<<3) /* modify */ 3426325Ssam #define ACCB (4<<3) /* branch displacement */ 3526325Ssam #define ACCI (5<<3) /* XFC code */ 3626325Ssam 3726325Ssam /* 3826325Ssam * Argument data types 3926325Ssam */ 4026325Ssam #define TYPB 0 /* byte */ 4126325Ssam #define TYPW 1 /* word */ 4226325Ssam #define TYPL 2 /* long */ 4326325Ssam #define TYPQ 3 /* quad */ 4426325Ssam #define TYPF 4 /* float */ 4526325Ssam #define TYPD 5 /* double */ 4626325Ssam 4726325Ssam /* 4826325Ssam * Addressing modes. 4926325Ssam */ 5026325Ssam #define LITSHORT 0x0 /* short literals */ 5126325Ssam #define LITUPTO31 0x1 5226325Ssam #define LITUPTO47 0x2 5326325Ssam #define LITUPTO63 0x3 5426325Ssam #define INDEX 0x4 /* i[r] */ 5526325Ssam #define REG 0x5 /* r */ 5626325Ssam #define REGDEF 0x6 /* (r) */ 5726325Ssam #define AUTODEC 0x7 /* -(r) */ 5826325Ssam #define AUTOINC 0x8 /* (r)+ */ 5926325Ssam #define AUTOINCDEF 0x9 /* *(r)+ */ 6026325Ssam #define BYTEDISP 0xA /* BD(r) */ 6126325Ssam #define BYTEDISPDEF 0xB /* *BD(r) */ 6226325Ssam #define WORDDISP 0xC /* WD(r) */ 6326325Ssam #define WORDDISPDEF 0xD /* *WD(r) */ 6426325Ssam #define LONGDISP 0xE /* LD(r) */ 6526325Ssam #define LONGDISPDEF 0xF /* *LD(r) */ 6626325Ssam 6726325Ssam #define is_branch_disp(arg) ((arg & ACCB) != 0) 6826325Ssam #define typelen(arg) (arg & 07) 6926325Ssam #define regnm(mode) (mode & 0xF) 7026325Ssam #define addrmode(mode) (mode >> 4) 7126325Ssam 7226325Ssam /* 7326325Ssam * Certain opcodes values are used either in calculating 7426325Ssam * the next address a process will go to, or for other 7526325Ssam * random reasons -- these are defined here. 7626325Ssam */ 7726325Ssam #define O_AOBLEQ 0x3f 7826325Ssam #define O_AOBLSS 0x2f 7926325Ssam #define O_BBC 0x1e 8026325Ssam #define O_BBS 0x0e 8126325Ssam #define O_BBSSI 0x5f 8226325Ssam #define O_BCC 0xf1 8326325Ssam #define O_BCS 0xe1 8426325Ssam #define O_BEQL 0x31 8526325Ssam #define O_BGEQ 0x81 8626325Ssam #define O_BGEQU 0xe1 8726325Ssam #define O_BGTR 0x41 8826325Ssam #define O_BGTRU 0xa1 8926325Ssam #define O_BLEQ 0x51 9026325Ssam #define O_BLEQU 0xb1 9126325Ssam #define O_BLSS 0x91 9226325Ssam #define O_BLSSU 0xf1 9326325Ssam #define O_BNEQ 0x21 9426325Ssam #define O_BPT 0x30 9526325Ssam #define O_BRB 0x11 9626325Ssam #define O_BRW 0x13 9726325Ssam #define O_BTCS 0xce 9826325Ssam #define O_BVC 0xc1 9926325Ssam #define O_BVS 0xd1 10026325Ssam #define O_CALLF 0xfe 10126325Ssam #define O_CALLS 0xbf 10226325Ssam #define O_CASEL 0xfc 10326325Ssam #define O_JMP 0x71 10426325Ssam #define O_KCALL 0xcf 10526325Ssam #define O_RET 0x40 10626325Ssam 10726325Ssam /* 10826325Ssam * Operator information structure. 10926325Ssam */ 11026325Ssam typedef struct { 11126325Ssam char *iname; 11226325Ssam char val; 11326325Ssam char numargs; 11426325Ssam char argtype[6]; 11526325Ssam } Optab; 11626325Ssam 11726325Ssam #define SYSSIZE 151 /* # of system calls */ 11826325Ssam #endif 11926325Ssam 12026325Ssam public Optab optab[] = { 12126325Ssam #define OP(a,b,c,d,e,f,g,h,i) {a,b,c,d,e,f,g,h,i} 122*51692Sbostic #include "instrs.adb" 12326325Ssam 0}; 12426325Ssam 12526325Ssam /* 12626325Ssam * Register names. 12726325Ssam */ 12826325Ssam 12926325Ssam public String regname[] = { 13026325Ssam "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", 13126325Ssam "r8", "r9", "r10","r11","r12", "fp", "sp", "pc" 13226325Ssam }; 13326325Ssam 13426325Ssam public String systab[SYSSIZE] = { 13526325Ssam "indir", "exit", "fork", "read", 13626325Ssam "write", "open", "close", "owait", 13726325Ssam "creat", "link", "unlink", "execv", 13826325Ssam "chdir", "otime", "mknod", "chmod", 13926325Ssam "chown", "obreak", "ostat", "lseek", 14026325Ssam "getpid", "mount", "umount", "osetuid", 14126325Ssam "getuid", "ostime", "ptrace", "oalarm", 14226325Ssam "ofstat", "opause", "outime", "ostty", 14326325Ssam "ogtty", "access", "onice", "oftime", 14426325Ssam "sync", "kill", "stat", "osetpgrp", 14526325Ssam "lstat", "dup", "pipe", "otimes", 14626325Ssam "profil", 0, "osetgid", "getgid", 14726325Ssam "osig", 0, 0, "acct", 14826325Ssam "ophys", "olock", "ioctl", "reboot", 14926325Ssam "ompxchan", "symlink", "readlink", "execve", 15026325Ssam "umask", "chroot", "fstat", 0, 15126325Ssam "getpagesize", "mremap", "vfork", "ovread", 15226325Ssam "ovwrite", "sbrk", "sstk", "mmap", 15326325Ssam "ovadvise", "munmap", "mprotect", "madvise", 15426325Ssam "vhangup", "ovlimit", "mincore", "getgroups", 15526325Ssam "setgroups", "getpgrp", "setpgrp", "setitimer", 15626325Ssam "wait", "swapon", "getitimer", "gethostname", 15726325Ssam "sethostname", "getdtablesize","dup2", "getdopt", 15826325Ssam "fcntl", "select", "setdopt", "fsync", 15926325Ssam "setpriority", "socket", "connect", "accept", 16026325Ssam "getpriority", "send", "recv", "osocketaddr", 16126325Ssam "bind", "setsockopt", "listen", "ovtimes", 16226325Ssam "sigvec", "sigblock", "sigsetmask", "sigpause", 16326325Ssam "sigstack", "recvmsg", "sendmsg", "vtrace", 16426325Ssam "gettimeofday", "getrusage", "getsockopt", "resuba", 16526325Ssam "readv", "writev", "settimeofday", "fchown", 16626325Ssam "fchmod", "recvfrom", "setreuid", "setregid", 16726325Ssam "rename", "truncate", "ftruncate", "flock", 16826325Ssam 0, "sendto", "shutdown", "socketpair", 16926325Ssam "mkdir", "rmdir", "utimes", 0, 17026325Ssam 0, "getpeername", "gethostid", "sethostid", 17126325Ssam "getrlimit", "setrlimit", "killpg", 0, 17226325Ssam "quota", "qquota", "getsockname", 17326325Ssam }; 174