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