Annotation of 43BSDTahoe/ucb/dbx/ops.tahoe.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.