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