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