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