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