Computer Systems Research Group BSD Distribution
Check-in Differences
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From ce8933afac9b0c71 To 8c205ff00e4ce858

1986-01-11
11:00
date and time created 86/01/11 11:00:55 by sam check-in: 71995845ad user: sam tags: trunk
11:00
date and time created 86/01/11 11:00:54 by sam check-in: 8c205ff00e user: sam tags: trunk
11:00
date and time created 86/01/11 11:00:53 by sam check-in: 82e31698f0 user: sam tags: trunk
1986-01-03
23:49
date and time created 86/01/03 23:49:22 by sam check-in: c8463e3d46 user: sam tags: trunk
23:47
massive cleanups; use SYS.h macros to allow profiling; moved to tahoemath directory; revamp comments for cpp check-in: ce8933afac user: sam tags: trunk
16:27
error needs to take additional arguments (jason@opal) check-in: cf01d721a5 user: mckusick tags: trunk

Changes to bin/ps/ps.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)ps.c	5.4 (Berkeley) 09/07/85";
#endif not lint

#include <stdio.h>
#include <ctype.h>
#include <a.out.h>
#include <pwd.h>
#include <sys/param.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)ps.c	5.5 (Berkeley) 01/10/86";
#endif not lint

#include <stdio.h>
#include <ctype.h>
#include <a.out.h>
#include <pwd.h>
#include <sys/param.h>
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

#ifndef	PSFILE
char	*psdb	= "/etc/psdatabase";
#else
char	*psdb	= PSFILE;
#endif

int	chkpid;
int	aflg, cflg, eflg, gflg, kflg, lflg, nflg, sflg,
	uflg, vflg, xflg, Uflg;
int	nchans;				/* total # of wait channels */
char	*tptr;
char	*gettty(), *getcmd(), *getname(), *savestr(), *state();
char	*rindex(), *calloc(), *sbrk(), *strcpy(), *strcat(), *strncat();
char	*strncpy(), *index(), *ttyname(), mytty[MAXPATHLEN+1];







|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

#ifndef	PSFILE
char	*psdb	= "/etc/psdatabase";
#else
char	*psdb	= PSFILE;
#endif

int	chkpid = -1;
int	aflg, cflg, eflg, gflg, kflg, lflg, nflg, sflg,
	uflg, vflg, xflg, Uflg;
int	nchans;				/* total # of wait channels */
char	*tptr;
char	*gettty(), *getcmd(), *getname(), *savestr(), *state();
char	*rindex(), *calloc(), *sbrk(), *strcpy(), *strcat(), *strncat();
char	*strncpy(), *index(), *ttyname(), mytty[MAXPATHLEN+1];
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
			    mproc->p_pgrp == 0 && xflg == 0)
				continue;
			if (tptr == 0 && gflg == 0 && xflg == 0 &&
			    mproc->p_ppid == 1)
				continue;
			if (uid != mproc->p_uid && aflg==0)
				continue;
			if (chkpid != 0 && chkpid != mproc->p_pid)
				continue;
			if (vflg && gflg == 0 && xflg == 0) {
				if (mproc->p_stat == SZOMB ||
				    mproc->p_flag&SWEXIT)
					continue;
				if (mproc->p_slptime > MAXSLP &&
				    (mproc->p_stat == SSLEEP ||







|







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
			    mproc->p_pgrp == 0 && xflg == 0)
				continue;
			if (tptr == 0 && gflg == 0 && xflg == 0 &&
			    mproc->p_ppid == 1)
				continue;
			if (uid != mproc->p_uid && aflg==0)
				continue;
			if (chkpid != -1 && chkpid != mproc->p_pid)
				continue;
			if (vflg && gflg == 0 && xflg == 0) {
				if (mproc->p_stat == SZOMB ||
				    mproc->p_flag&SWEXIT)
					continue;
				if (mproc->p_slptime > MAXSLP &&
				    (mproc->p_stat == SSLEEP ||

Changes to bin/rm/rm.c.

1
2
3
4
5
6
7
8
static char *sccsid = "@(#)rm.c	4.17 (Berkeley) 11/05/85";

/*
 * rm - for ReMoving files, directories & trees.
 */

#include <stdio.h>
#include <sys/param.h>
|







1
2
3
4
5
6
7
8
static char *sccsid = "@(#)rm.c	4.18 (Berkeley) 01/06/86";

/*
 * rm - for ReMoving files, directories & trees.
 */

#include <stdio.h>
#include <sys/param.h>
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

			default:
				fprintf(stderr, "usage: rm [-rif] file ...\n");
				exit(1);
			}
	}

	if (argc < 2) {
		fprintf(stderr, "usage: rm [-rif] file ...\n");
		exit(1);
	}

	while (--argc > 0)
		(void) rm(*++argv, 0);








|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

			default:
				fprintf(stderr, "usage: rm [-rif] file ...\n");
				exit(1);
			}
	}

	if (argc < 2 && !fflg) {
		fprintf(stderr, "usage: rm [-rif] file ...\n");
		exit(1);
	}

	while (--argc > 0)
		(void) rm(*++argv, 0);

Changes to bin/stty/stty.1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



20

21

22
23








24
25
26
27
28
29
30
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)stty.1	6.2 (Berkeley) 08/13/85
.\"
.TH STTY 1 ""
.UC 4
.SH NAME
stty \- set terminal options
.SH SYNOPSIS
.B stty
[ option ... ]
.SH DESCRIPTION
.I Stty
sets certain I/O options on the current output terminal,
placing its output on the diagnostic output.
With no argument, it reports the speed of the terminal and the
settings of the options which are different from their defaults.



With the argument ``all'', all normally used option settings are reported.

With the argument ``everything'', everything

.I stty
knows about is printed.








The option strings are
selected from the following set:
.TP  10
.B even 
allow even parity input
.br
.ns




|














>
>
>
|
>
|
>


>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)stty.1	6.3 (Berkeley) 01/09/86
.\"
.TH STTY 1 ""
.UC 4
.SH NAME
stty \- set terminal options
.SH SYNOPSIS
.B stty
[ option ... ]
.SH DESCRIPTION
.I Stty
sets certain I/O options on the current output terminal,
placing its output on the diagnostic output.
With no argument, it reports the speed of the terminal and the
settings of the options which are different from their defaults.
Use of one of the following options modifies the output as described:
.TP 10
.B all
All normally used option settings are reported.
.TP 10
.B everything
Everything
.I stty
knows about is printed.
.TP 10
.B speed
The terminal speed alone is printed on the standard output.
.TP 10
.B size
The terminal (window) sizes are printed on the standard output,
first rows and then columns.
.sp
The option strings are
selected from the following set:
.TP  10
.B even 
allow even parity input
.br
.ns
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
.br
.ns
.TP 10
.BI brk \ c\fR
set break character to
.I c
(default undefined.)
This character is an extra wakeup causing character.
.br
.ns
.TP 10
.B  cr0 cr1 cr2 cr3
.br
select style of delay for carriage return (see
.IR ioctl (2))







|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
.br
.ns
.TP 10
.BI brk \ c\fR
set break character to
.I c
(default undefined.)
This character is an additional character causing wakeup.
.br
.ns
.TP 10
.B  cr0 cr1 cr2 cr3
.br
select style of delay for carriage return (see
.IR ioctl (2))
266
267
268
269
270
271
272









273
274
275
276
277
278
279
.br
.ns
.TP 10
.B  "50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 exta extb"
.br
Set terminal baud rate to the number given, if possible.
(These are the speeds supported by the DH-11 interface).









.PP
A teletype driver which supports the job control processing of
.IR csh (1)
and more functionality than the basic driver is fully described in
.IR tty (4).
The following options apply only to it.
.TP 10







>
>
>
>
>
>
>
>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
.br
.ns
.TP 10
.B  "50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 exta extb"
.br
Set terminal baud rate to the number given, if possible.
(These are the speeds supported by the DH-11 interface).
.TP 10
.BI rows \ n\fR
The terminal size is recorded as having
.I n
rows.
.BI columns \ n\fR
The terminal size is recorded as having
.I n
columns.
.PP
A teletype driver which supports the job control processing of
.IR csh (1)
and more functionality than the basic driver is fully described in
.IR tty (4).
The following options apply only to it.
.TP 10

Changes to bin/stty/stty.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)stty.c	5.2 (Berkeley) 08/13/85";
#endif not lint

/*
 * set teletype modes
 */

#include <stdio.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)stty.c	5.3 (Berkeley) 01/09/86";
#endif not lint

/*
 * set teletype modes
 */

#include <stdio.h>
282
283
284
285
286
287
288





289
290
291
292
293
294
295
				goto done;
			win.ws_row = atoi(*++argv);
		}
		if (eq("columns")) {
			if (--argc == 0)
				goto done;
			win.ws_col = atoi(*++argv);





		}
		for(i=0; speeds[i].string; i++)
			if(eq(speeds[i].string)) {
				mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed;
				goto cont;
			}
		if (eq("speed")) {







>
>
>
>
>







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
				goto done;
			win.ws_row = atoi(*++argv);
		}
		if (eq("columns")) {
			if (--argc == 0)
				goto done;
			win.ws_col = atoi(*++argv);
		}
		if (eq("size")) {
			ioctl(open("/dev/tty", 0), TIOCGWINSZ, &win);
			printf("%d %d\n", win.ws_row, win.ws_col);
			exit(0);
		}
		for(i=0; speeds[i].string; i++)
			if(eq(speeds[i].string)) {
				mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed;
				goto cont;
			}
		if (eq("speed")) {

Changes to games/backgammon/backgammon/Mesgfix.


1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)Mesgfix	5.1 (Berkeley) 05/29/85";
#endif not lint

4!date

g/Sun /s//Sunday, /
g/Mon /s//Monday, /
g/Tue /s//Tuesday, /
g/Wed /s//Wednesday, /
g/Thu /s//Thursday, /
g/Fri /s//Friday, /
g/Sat /s//Saturday, /
g/Jan /s//January /
g/Feb /s//February /
g/Mar /s//March /
g/Apr /s//April /
g/Jun /s//June /
g/Jul /s//July /
g/Aug /s//August /
g/Sep /s//September /
g/Oct /s//October /
g/Nov /s//November /
g/Dec /s//December /
g/  /s// /
4s/ ..:..:.. .../,/
4s/^/	"Last update on /
4s/$/.",/
w!
q
>





|
|
|
<
|
|
>



















|
|
|


1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1,5c
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */
.
/Msccsid/c
static char Msccsid[] = "@(#)Mesgfix	5.2 (Berkeley) 01/08/86";

.
/Last update/!date
mark a
g/Sun /s//Sunday, /
g/Mon /s//Monday, /
g/Tue /s//Tuesday, /
g/Wed /s//Wednesday, /
g/Thu /s//Thursday, /
g/Fri /s//Friday, /
g/Sat /s//Saturday, /
g/Jan /s//January /
g/Feb /s//February /
g/Mar /s//March /
g/Apr /s//April /
g/Jun /s//June /
g/Jul /s//July /
g/Aug /s//August /
g/Sep /s//September /
g/Oct /s//October /
g/Nov /s//November /
g/Dec /s//December /
g/  /s// /
'as/ ..:..:.. .../,/
'as/^/	"Last update on /
'as/$/.",/
w!
q

Changes to games/backgammon/common_source/message.c.









1

2
3
4
5
6
7








static char sccsid[] = "	message.c	4.1	82/05/11	";


char	*message[] = {
	"Last update on Tuesday, September 16, 1980.",
	"Check the file /usr/public/gammon.news for details.",
	0
};
>
>
>
>
>
>
>
>
|
>


|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved. The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char Msccsid[] = "@(#)Mesgfix	5.1 (Berkeley) 5/29/85";
static char sccsid[] = "@(#)message.c	4.2 (Berkeley) 01/08/86";
#endif not lint

char	*message[] = {
	"Last update on Saturday, March 30, 1985.",
	"Check the file /usr/public/gammon.news for details.",
	0
};

Changes to include/Makefile.

1
2
3
4
5
6
7
8
9
10
11
12
13
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)Makefile	5.9 (Berkeley) 85/08/08
#
# Doing a make install builds /usr/include
#
# Define SHARED to indicate whether you want
# symbolic links to the system source (``symlinks''),
# or a separate copy (``copies'').
# (latter useful in environments where it's





|







1
2
3
4
5
6
7
8
9
10
11
12
13
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)Makefile	5.10 (Berkeley) 86/01/10
#
# Doing a make install builds /usr/include
#
# Define SHARED to indicate whether you want
# symbolic links to the system source (``symlinks''),
# or a separate copy (``copies'').
# (latter useful in environments where it's
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
		rm -rf ${DESTDIR}/usr/include/$$i; \
		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
	done
	rm -rf ${DESTDIR}/usr/include/sys
	ln -s /sys/h ${DESTDIR}/usr/include/sys

copies:
	for i in ${SYSDIRS}; do \
		rm -rf ${DESTDIR}/usr/include/$$i; \
		cd /sys; \
		tar cf - $$i/*.h | (cd ${DESTDIR}/usr/include; tar xpfB -); \
	done
	rm -rf ${DESTDIR}/usr/include/sys;
	mkdir ${DESTDIR}/usr/include/sys; 
	chmod 775 ${DESTDIR}/usr/include/sys;
	(cd /sys/h; tar cf - *.h | (cd ${DESTDIR}/usr/include/sys; tar xpfB -))

tags:
	cwd=/usr/include; \
	for i in ${STD} ${LINKS}; do \
		ctags -a -f ${TAGSFILE} $$cwd/$$i; \
	done

clean:
	rm -f tags







|







|









62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
		rm -rf ${DESTDIR}/usr/include/$$i; \
		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
	done
	rm -rf ${DESTDIR}/usr/include/sys
	ln -s /sys/h ${DESTDIR}/usr/include/sys

copies:
	-for i in ${SYSDIRS}; do \
		rm -rf ${DESTDIR}/usr/include/$$i; \
		cd /sys; \
		tar cf - $$i/*.h | (cd ${DESTDIR}/usr/include; tar xpfB -); \
	done
	rm -rf ${DESTDIR}/usr/include/sys;
	mkdir ${DESTDIR}/usr/include/sys; 
	chmod 775 ${DESTDIR}/usr/include/sys;
	-(cd /sys/h; tar cf - *.h | (cd ${DESTDIR}/usr/include/sys; tar xpfB -))

tags:
	cwd=/usr/include; \
	for i in ${STD} ${LINKS}; do \
		ctags -a -f ${TAGSFILE} $$cwd/$$i; \
	done

clean:
	rm -f tags

Changes to include/arpa/nameser.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)nameser.h	5.7 (Berkeley) 11/01/85
 */

/*
 * Define constants based on rfc883
 */
#define PACKETSZ	512		/* maximum packet size */
#define MAXDNAME	256		/* maximum domain name */





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)nameser.h	5.9 (Berkeley) 01/08/86
 */

/*
 * Define constants based on rfc883
 */
#define PACKETSZ	512		/* maximum packet size */
#define MAXDNAME	256		/* maximum domain name */
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
76
77
78
79
 * Currently defined opcodes
 */
#define QUERY		0		/* standard query */
#define IQUERY		1		/* inverse query */
#define CQUERYM		2		/* completion query (multiple) */
#define CQUERYU		3		/* completion query (unique) */
	/* non standard */
#define UPDATEA		11		/* add resource record */
#define UPDATED		12		/* delete resource record */
#define UPDATEM		13		/* modify resource record */
#define ZONEINIT	14		/* initial zone transfer */
#define ZONEREF		15		/* incremental zone referesh */

/*
 * Currently defined response codes
 */
#define NOERROR		0		/* no error */
#define FORMERR		1		/* format error */
#define SERVFAIL	2		/* server failure */
#define NXDOMAIN	3		/* non existent domain */
#define NOTIMP		4		/* not implemented */
#define REFUSED		5		/* query refused */
	/* non standard */
#define NOCHANGE	15		/* update failed to change db */

/*
 * Type values for resources and queries
 */
#define T_A		1		/* host address */
#define T_NS		2		/* authoritative server */
#define T_MD		3		/* mail destination */
#define T_MF		4		/* mail forwarder */
#define T_CNAME		5		/* connonical name */
#define T_SOA		6		/* start of authority zone */
#define T_MB		7		/* mailbox domain name */
#define T_MG		8		/* mail group member */
#define T_MR		9		/* mail rename name */
#define T_NULL		10		/* null resource record */
#define T_WKS		11		/* well known service */
#define T_PTR		12		/* domain name pointer */
#define T_HINFO		13		/* host information */
#define T_MINFO		14		/* mailbox information */

	/* non standard */
#define T_UINFO		15		/* user (finger) information */
#define T_UID		16		/* user ID */
#define T_GID		17		/* group ID */
	/* Query type values which do not appear in resource records */
#define T_AXFR		252		/* transfer zone of authority */
#define T_MAILB		253		/* transfer mailbox records */
#define T_MAILA		254		/* transfer mail agent records */
#define T_ANY		255		/* wildcard match */

/*







|
|
|
|
|











|


















>

|
|
|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 * Currently defined opcodes
 */
#define QUERY		0		/* standard query */
#define IQUERY		1		/* inverse query */
#define CQUERYM		2		/* completion query (multiple) */
#define CQUERYU		3		/* completion query (unique) */
	/* non standard */
#define UPDATEA		100		/* add resource record */
#define UPDATED		101		/* delete resource record */
#define UPDATEM		102		/* modify resource record */
#define ZONEINIT	103		/* initial zone transfer */
#define ZONEREF		104		/* incremental zone referesh */

/*
 * Currently defined response codes
 */
#define NOERROR		0		/* no error */
#define FORMERR		1		/* format error */
#define SERVFAIL	2		/* server failure */
#define NXDOMAIN	3		/* non existent domain */
#define NOTIMP		4		/* not implemented */
#define REFUSED		5		/* query refused */
	/* non standard */
#define NOCHANGE	100		/* update failed to change db */

/*
 * Type values for resources and queries
 */
#define T_A		1		/* host address */
#define T_NS		2		/* authoritative server */
#define T_MD		3		/* mail destination */
#define T_MF		4		/* mail forwarder */
#define T_CNAME		5		/* connonical name */
#define T_SOA		6		/* start of authority zone */
#define T_MB		7		/* mailbox domain name */
#define T_MG		8		/* mail group member */
#define T_MR		9		/* mail rename name */
#define T_NULL		10		/* null resource record */
#define T_WKS		11		/* well known service */
#define T_PTR		12		/* domain name pointer */
#define T_HINFO		13		/* host information */
#define T_MINFO		14		/* mailbox information */
#define T_MX		15		/* mail routing information */
	/* non standard */
#define T_UINFO		100		/* user (finger) information */
#define T_UID		101		/* user ID */
#define T_GID		102		/* group ID */
	/* Query type values which do not appear in resource records */
#define T_AXFR		252		/* transfer zone of authority */
#define T_MAILB		253		/* transfer mailbox records */
#define T_MAILA		254		/* transfer mail agent records */
#define T_ANY		255		/* wildcard match */

/*

Changes to lib/libc/compat-43/sigvec.2.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)sigvec.2	6.2 (Berkeley) 06/30/85
.\"
.TH SIGVEC 2 ""
.UC 4
.ie t .ds d \(dg
.el .ds d \z'|+'
.ie t .ds b \(bu
.el .ds b @




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)sigvec.2	6.3 (Berkeley) 01/08/86
.\"
.TH SIGVEC 2 ""
.UC 4
.ie t .ds d \(dg
.el .ds d \z'|+'
.ie t .ds b \(bu
.el .ds b @
133
134
135
136
137
138
139


140
141
142
143
144
145
146
SIGTTOU	22\*d	background write attempted to control terminal
SIGIO	23\*b	i/o is possible on a descriptor (see \fIfcntl\fP(2))
SIGXCPU	24	cpu time limit exceeded (see \fIsetrlimit\fP(2))
SIGXFSZ	25	file size limit exceeded (see \fIsetrlimit\fP(2))
SIGVTALRM	26	virtual time alarm (see \fIsetitimer\fP(2))
SIGPROF	27	profiling timer alarm (see \fIsetitimer\fP(2))
SIGWINCH	28\*b	window size change


.fi
.PP
The starred signals in the list above cause a core image
if not caught or ignored.
.PP
Once a signal handler is installed, it remains installed
until another







>
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
SIGTTOU	22\*d	background write attempted to control terminal
SIGIO	23\*b	i/o is possible on a descriptor (see \fIfcntl\fP(2))
SIGXCPU	24	cpu time limit exceeded (see \fIsetrlimit\fP(2))
SIGXFSZ	25	file size limit exceeded (see \fIsetrlimit\fP(2))
SIGVTALRM	26	virtual time alarm (see \fIsetitimer\fP(2))
SIGPROF	27	profiling timer alarm (see \fIsetitimer\fP(2))
SIGWINCH	28\*b	window size change
SIGUSR1	30	user defined signal 1
SIGUSR2	31	user defined signal 2
.fi
.PP
The starred signals in the list above cause a core image
if not caught or ignored.
.PP
Once a signal handler is installed, it remains installed
until another

Changes to lib/libc/gen/setjmp.3.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)setjmp.3	6.1 (Berkeley) 05/15/85
.\"
.TH SETJMP 3 ""
.UC 4
.SH NAME
setjmp, longjmp \- non-local goto
.SH SYNOPSIS
.nf




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)setjmp.3	6.2 (Berkeley) 01/09/86
.\"
.TH SETJMP 3 ""
.UC 4
.SH NAME
setjmp, longjmp \- non-local goto
.SH SYNOPSIS
.nf
57
58
59
60
61
62
63

















64
65
66
67
68
69
70
71
save and restore the signal mask
.IR sigmask (2),
while
.I _setjmp
and
.I _longjmp
manipulate only the C stack and registers.

















.SH "SEE ALSO"
sigvec(2), sigstack(2), signal(3)
.SH BUGS
.I Setjmp
does not save current notion of whether the process is
executing on the signal stack.  The result is that a
longjmp to some place on the signal stack leaves the
signal stack state incorrect.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


<
<
<
<
<
<
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82






save and restore the signal mask
.IR sigmask (2),
while
.I _setjmp
and
.I _longjmp
manipulate only the C stack and registers.
.SH ERRORS
.PP
If the contents of the
.B jmp_buf
are corrupted, or correspond to an environment that has already returned,
.I longjmp
calls the routine 
.IR longjmperror .
If
.I longjmperror
returns the program is aborted.
The default version of 
.I longjmperror
prints the message ``longjmp botch'' to standard error and returns.
User programs wishing to exit more gracefully can write their own
versions of 
.IR longjmperror .
.SH "SEE ALSO"
sigvec(2), sigstack(2), signal(3)






Added lib/libc/gen/setjmperr.c.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)setjmperr.c	5.1 (Berkeley) 01/09/86";
#endif not lint

#define ERRMSG	"longjmp botch\n"

/*
 * This routine is called from longjmp() when an error occurs.
 * Programs that wish to exit gracefully from this error may
 * write their own versions.
 * If this routine returns, the program is aborted.
 */
longjmperror()
{

	write(2, ERRMSG, sizeof(ERRMSG));
}

Changes to lib/libc/gen/signal.3.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)signal.3	6.2 (Berkeley) 11/06/85
.\"
.TH SIGNAL 3C ""
.UC 4
.ie t .ds d \(dg
.el .ds d \z'|+'
.ie t .ds b \(bu
.el .ds b @




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)signal.3	6.3 (Berkeley) 01/08/86
.\"
.TH SIGNAL 3C ""
.UC 4
.ie t .ds d \(dg
.el .ds d \z'|+'
.ie t .ds b \(bu
.el .ds b @
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
SIGTTOU	22\*d	background write attempted to control terminal
SIGIO	23\*b	i/o is possible on a descriptor (see \fIfcntl\fP(2))
SIGXCPU	24	cpu time limit exceeded (see \fIsetrlimit\fP(2))
SIGXFSZ	25	file size limit exceeded (see \fIsetrlimit\fP(2))
SIGVTALRM	26	virtual time alarm (see \fIsetitimer\fP(2))
SIGPROF	27	profiling timer alarm (see \fIsetitimer\fP(2))
SIGWINCH	28\*b	Window size change
SIGUSR1	30\*b	User defined signal 1
SIGUSR2	31\*b	User defined signal 2
.fi
.PP
The starred signals in the list above cause a core image
if not caught or ignored.
.PP
If
.I func







|
|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
SIGTTOU	22\*d	background write attempted to control terminal
SIGIO	23\*b	i/o is possible on a descriptor (see \fIfcntl\fP(2))
SIGXCPU	24	cpu time limit exceeded (see \fIsetrlimit\fP(2))
SIGXFSZ	25	file size limit exceeded (see \fIsetrlimit\fP(2))
SIGVTALRM	26	virtual time alarm (see \fIsetitimer\fP(2))
SIGPROF	27	profiling timer alarm (see \fIsetitimer\fP(2))
SIGWINCH	28\*b	Window size change
SIGUSR1	30	User defined signal 1
SIGUSR2	31	User defined signal 2
.fi
.PP
The starred signals in the list above cause a core image
if not caught or ignored.
.PP
If
.I func

Added lib/libc/gen/ualarm.3.









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)@(#)ualarm.3	6.1 (Berkeley) 01/09/86
.\"
.TH UALARM 3  ""
.UC 6
.SH NAME
ualarm \- schedule signal after specified time
.SH SYNOPSIS
.nf
.B ualarm(value, interval)
.B unsigned value;
.B unsigned interval;
.fi
.SH DESCRIPTION
.ft B
This is a simplified interface to setitimer(2).
.ft R
.PP
.I Ualarm
causes signal SIGALRM, see
.IR signal (3C),
to be sent to the invoking process
in a number of microseconds given by the
.I value
argument.
Unless caught or ignored, the signal terminates the process.
.PP
If the
.I interval
argument is non-zero, the SIGALRM signal will be sent
to the process every
.I interval
microseconds after the timer expires (e.g. after
.I value
microseconds have passed).
.PP
Because of scheduling delays,
resumption of execution of when the signal is
caught may be delayed an arbitrary amount.
The longest specifiable delay time (on the vax) is 2147483647 microseconds.
.PP
The return value is the amount of time previously remaining in the alarm clock.
.sh BUGS
This routine is expensive to use because it is implemented using 
.IR setitimer (2)
and does eight system calls each time it is invoked.
.SH "SEE ALSO"
getitimer(2), setitimer(2), sigpause(2), sigvec(2), signal(3C), sleep(3),
alarm(3), ualarm(3)

Added lib/libc/gen/usleep.3.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)@(#)usleep.3	6.1 (Berkeley) 01/09/86
.\"
.TH USLEEP 3  ""
.UC 6
.SH NAME
usleep \- suspend execution for interval
.SH SYNOPSIS
.nf
.B usleep(useconds)
.B unsigned useconds;
.fi
.SH DESCRIPTION
The current process is suspended from execution for the number
of microseconds specified by the argument.
The actual suspension time may be an arbitrary amount longer
because of other activity in the system.
.PP
The routine is implemented by setting an interval timer
and pausing until it occurs.
The previous state of this timer is saved and restored.
If the sleep time exceeds the time to the expiration of the
previous timer,
the process sleeps only until the signal would have occurred, and the
signal is sent 2 system clock ticks later.
.sh BUGS
This routine is expensive to use because it is implemented using 
.IR setitimer (2)
and does eight system calls each time it is invoked.
It should be implemented using 
.IR select (2).
.SH "SEE ALSO"
setitimer(2), getitimer(2), sigpause(2), ualarm(3), sleep(3), alarm(3)

Changes to lib/libc/net/SCCS/hosttable/gethostnamadr.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22


23
24
25
26
27
28
29
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)gethostnamadr.c	5.3 (Berkeley) 12/10/85";
#endif not lint

#include <stdio.h>
#include <netdb.h>
#include <sys/file.h>
#include <ndbm.h>
#include <ctype.h>

#define	MAXALIASES	35

static struct hostent host;
static char *host_aliases[MAXALIASES];
static char hostbuf[BUFSIZ+1];
static char *host_addrs[2];



/*
 * The following is shared with gethostent.c
 */
extern	char *_host_file;
DBM	*_host_db = (DBM *)NULL;
int	_host_stayopen;	/* set by sethostent(), cleared by endhostent() */







|














>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)gethostnamadr.c	5.4 (Berkeley) 01/09/86";
#endif not lint

#include <stdio.h>
#include <netdb.h>
#include <sys/file.h>
#include <ndbm.h>
#include <ctype.h>

#define	MAXALIASES	35

static struct hostent host;
static char *host_aliases[MAXALIASES];
static char hostbuf[BUFSIZ+1];
static char *host_addrs[2];

int h_errno;

/*
 * The following is shared with gethostent.c
 */
extern	char *_host_file;
DBM	*_host_db = (DBM *)NULL;
int	_host_stayopen;	/* set by sethostent(), cleared by endhostent() */
98
99
100
101
102
103
104


105
106
107
108
109
110
111
        key.dptr = lowname;
        key.dsize = strlen(lowname);
	hp = fetchhost(key);
	if (!_host_stayopen) {
		dbm_close(_host_db);
		_host_db = (DBM *)NULL;
	}


        return (hp);
}

struct hostent *
gethostbyaddr(addr, length, type)
	char *addr;
	register int length;







>
>







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
        key.dptr = lowname;
        key.dsize = strlen(lowname);
	hp = fetchhost(key);
	if (!_host_stayopen) {
		dbm_close(_host_db);
		_host_db = (DBM *)NULL;
	}
	if ( hp == NULL)
		h_errno = HOST_NOT_FOUND;
        return (hp);
}

struct hostent *
gethostbyaddr(addr, length, type)
	char *addr;
	register int length;
120
121
122
123
124
125
126


127
128
129
130
131
132
133
134
135


136
137
		while (hp = gethostent()) {
			if (hp->h_addrtype == type && hp->h_length == length
			    && bcmp(hp->h_addr, addr, length) == 0)
				break;
		}
		if (!_host_stayopen)
			endhostent();


		return (hp);
	}
        key.dptr = addr;
        key.dsize = length;
	hp = fetchhost(key);
	if (!_host_stayopen) {
		dbm_close(_host_db);
		_host_db = (DBM *)NULL;
	}


        return (hp);
}







>
>









>
>


124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
		while (hp = gethostent()) {
			if (hp->h_addrtype == type && hp->h_length == length
			    && bcmp(hp->h_addr, addr, length) == 0)
				break;
		}
		if (!_host_stayopen)
			endhostent();
		if ( hp == NULL)
			h_errno = HOST_NOT_FOUND;
		return (hp);
	}
        key.dptr = addr;
        key.dsize = length;
	hp = fetchhost(key);
	if (!_host_stayopen) {
		dbm_close(_host_db);
		_host_db = (DBM *)NULL;
	}
	if ( hp == NULL)
		h_errno = HOST_NOT_FOUND;
        return (hp);
}

Changes to lib/libc/net/res_debug.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1985 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)res_debug.c	5.8 (Berkeley) 12/01/85";
#endif not lint

#if defined(lint) && !defined(DEBUG)
#define DEBUG
#endif

#include <sys/types.h>







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1985 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)res_debug.c	5.9 (Berkeley) 01/08/86";
#endif not lint

#if defined(lint) && !defined(DEBUG)
#define DEBUG
#endif

#include <sys/types.h>
263
264
265
266
267
268
269







270
271
272
273
274
275
276
		fprintf(file,", retry=%ld", getlong(cp));
		cp += sizeof(u_long);
		fprintf(file,", expire=%ld", getlong(cp));
		cp += sizeof(u_long);
		fprintf(file,", min=%ld\n", getlong(cp));
		cp += sizeof(u_long);
		break;








	case T_MINFO:
		fprintf(file,"\trequests = ");
		cp = p_cdname(cp, msg, file);
		fprintf(file,"\n\terrors = ");
		cp = p_cdname(cp, msg, file);
		break;







>
>
>
>
>
>
>







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
		fprintf(file,", retry=%ld", getlong(cp));
		cp += sizeof(u_long);
		fprintf(file,", expire=%ld", getlong(cp));
		cp += sizeof(u_long);
		fprintf(file,", min=%ld\n", getlong(cp));
		cp += sizeof(u_long);
		break;

	case T_MX:
		fprintf(file,"\tname = ");
		cp = p_cdname(cp, msg, file);
		fprintf(file,", preference = %ld",getlong(cp));
		cp += sizeof(u_long);
		break;

	case T_MINFO:
		fprintf(file,"\trequests = ");
		cp = p_cdname(cp, msg, file);
		fprintf(file,"\n\terrors = ");
		cp = p_cdname(cp, msg, file);
		break;
341
342
343
344
345
346
347


348
349
350
351
352
353
354
		return("CNAME");
	case T_SOA:		/* start of authority zone */
		return("SOA");
	case T_MB:		/* mailbox domain name */
		return("MB");
	case T_MG:		/* mail group member */
		return("MG");


	case T_MR:		/* mail rename name */
		return("MR");
	case T_NULL:		/* null resource record */
		return("NULL");
	case T_WKS:		/* well known service */
		return("WKS");
	case T_PTR:		/* domain name pointer */







>
>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
		return("CNAME");
	case T_SOA:		/* start of authority zone */
		return("SOA");
	case T_MB:		/* mailbox domain name */
		return("MB");
	case T_MG:		/* mail group member */
		return("MG");
	case T_MX:		/* mail routing info */
		return("MX");
	case T_MR:		/* mail rename name */
		return("MR");
	case T_NULL:		/* null resource record */
		return("NULL");
	case T_WKS:		/* well known service */
		return("WKS");
	case T_PTR:		/* domain name pointer */

Changes to lib/libc/net/resolver.3.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1985 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)resolver.3	1.2 (Berkeley) 10/30/85
.\"
.TH RESOLVER 3 "15 November 1985"
.UC 4
.SH NAME
res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
.SH SYNOPSIS
.B #include <sys/types.h>




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1985 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)resolver.3	1.3 (Berkeley) 01/07/86
.\"
.TH RESOLVER 3 "15 November 1985"
.UC 4
.SH NAME
res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
.SH SYNOPSIS
.B #include <sys/types.h>
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
as the name is compressed.
If
.I dnptr
is NULL, we don't try to compress names. If
.I lastdnptr
is NULL, we don't update the list.
.SH FILES
resolv.conf	Contains the default resolver information read by res_init.
There are two types of records in this file, domain and name server.
The domain record specifies the default domain for the resolver to use.
You can have multiple name server records to designate the name servers 
addresses you would like the resolver to try. By using this 
file you don't have to have a name server actually running on your system
and you can have a back up name server to try in the event your local server 
is not responsive.
.SH "SEE ALSO"
named(8), RFC882, RFC883







|
<
<
<
<
<
<
<

|
169
170
171
172
173
174
175
176







177
178
as the name is compressed.
If
.I dnptr
is NULL, we don't try to compress names. If
.I lastdnptr
is NULL, we don't update the list.
.SH FILES
/etc/resolv.conf see resolver(5)







.SH "SEE ALSO"
named(8), resolver(5), RFC882, RFC883

Changes to lib/libc/stdlib/malloc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)malloc.c	5.2 (Berkeley) 10/11/85";
#endif not lint

/*
 * malloc.c (Caltech) 2/21/82
 * Chris Kingsley, kingsley@cit-20.
 *
 * This is a very fast storage allocator.  It allocates blocks of a small 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)malloc.c	5.4 (Berkeley) 01/10/86";
#endif not lint

/*
 * malloc.c (Caltech) 2/21/82
 * Chris Kingsley, kingsley@cit-20.
 *
 * This is a very fast storage allocator.  It allocates blocks of a small 
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92

93
94
95
96
97
98
99
 * nmalloc[i] is the difference between the number of mallocs and frees
 * for a given block size.
 */
static	u_int nmalloc[NBUCKETS];
#include <stdio.h>
#endif

#ifdef DEBUG
#define	ASSERT(p)   if (!(p)) botch("p")

static
botch(s)
	char *s;
{

	printf("assertion botched: %s\n", s);

	abort();
}
#else
#define	ASSERT(p)
#endif

char *







|

>




<
|
>







78
79
80
81
82
83
84
85
86
87
88
89
90
91

92
93
94
95
96
97
98
99
100
 * nmalloc[i] is the difference between the number of mallocs and frees
 * for a given block size.
 */
static	u_int nmalloc[NBUCKETS];
#include <stdio.h>
#endif

#if defined(DEBUG) || defined(RCHECK)
#define	ASSERT(p)   if (!(p)) botch("p")
#include <stdio.h>
static
botch(s)
	char *s;
{

	fprintf(stderr, "\r\nassertion botched: %s\r\n", s);
 	(void) fflush(stderr);		/* just in case user buffered it */
	abort();
}
#else
#define	ASSERT(p)
#endif

char *
142
143
144
145
146
147
148


149
150
151
152
153
154
155
		n = -(sizeof (*op) + RSLOP);
	} else {
		amt = pagesz;
		bucket = pagebucket;
	}
	while (nbytes > amt + n) {
		amt <<= 1;


		bucket++;
	}
	/*
	 * If nothing in hash bucket right now,
	 * request more memory from the system.
	 */
  	if ((op = nextf[bucket]) == NULL) {







>
>







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
		n = -(sizeof (*op) + RSLOP);
	} else {
		amt = pagesz;
		bucket = pagebucket;
	}
	while (nbytes > amt + n) {
		amt <<= 1;
		if (amt == 0)
			return (NULL);
		bucket++;
	}
	/*
	 * If nothing in hash bucket right now,
	 * request more memory from the system.
	 */
  	if ((op = nextf[bucket]) == NULL) {
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190




191


192
193
194
195
196
197
198
#endif
  	return ((char *)(op + 1));
}

/*
 * Allocate more memory to the indicated bucket.
 */
static
morecore(bucket)
	int bucket;
{
  	register union overhead *op;
	register int sz;		/* size of desired block */
  	register int amt;		/* amount to allocate */
  	register int nblks;		/* how many blocks we get */





	sz = 1 << (bucket + 3);


	if (sz < pagesz) {
		amt = pagesz;
  		nblks = amt / sz;
	} else {
		amt = sz + pagesz;
		nblks = 1;
	}







<





|
|

>
>
>
>

>
>







178
179
180
181
182
183
184

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#endif
  	return ((char *)(op + 1));
}

/*
 * Allocate more memory to the indicated bucket.
 */

morecore(bucket)
	int bucket;
{
  	register union overhead *op;
	register int sz;		/* size of desired block */
  	int amt;			/* amount to allocate */
  	int nblks;			/* how many blocks we get */

	/*
	 * sbrk_size <= 0 only for big, FLUFFY, requests (about
	 * 2^30 bytes on a VAX, I think) or for a negative arg.
	 */
	sz = 1 << (bucket + 3);
	if (sz <= 0)
		return;
	if (sz < pagesz) {
		amt = pagesz;
  		nblks = amt / sz;
	} else {
		amt = sz + pagesz;
		nblks = 1;
	}
274
275
276
277
278
279
280
281



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
		 *
		 * Search for the old block of memory on the
		 * free list.  First, check the most common
		 * case (last element free'd), then (this failing)
		 * the last ``realloc_srchlen'' items free'd.
		 * If all lookups fail, then assume the size of
		 * the memory block being realloc'd is the
		 * smallest possible.



		 */
		if ((i = findbucket(op, 1)) < 0 &&
		    (i = findbucket(op, realloc_srchlen)) < 0)
#ifndef RCHECK
			i = 0;
#else
			i = 1;	/* smallest possible w/ RCHECK */
#endif
	}
	onb = 1 << (i + 3);
	if (onb < pagesz)
		onb -= sizeof (*op) + RSLOP;
	else
		onb += pagesz - sizeof (*op) - RSLOP;
	/* avoid the copy if same size block */







|
>
>
>



<
|
<
<
<







282
283
284
285
286
287
288
289
290
291
292
293
294
295

296



297
298
299
300
301
302
303
		 *
		 * Search for the old block of memory on the
		 * free list.  First, check the most common
		 * case (last element free'd), then (this failing)
		 * the last ``realloc_srchlen'' items free'd.
		 * If all lookups fail, then assume the size of
		 * the memory block being realloc'd is the
		 * largest possible (so that all "nbytes" of new
		 * memory are copied into).  Note that this could cause
		 * a memory fault if the old area was tiny, and the moon
		 * is gibbous.  However, that is very unlikely.
		 */
		if ((i = findbucket(op, 1)) < 0 &&
		    (i = findbucket(op, realloc_srchlen)) < 0)

			i = NBUCKETS;



	}
	onb = 1 << (i + 3);
	if (onb < pagesz)
		onb -= sizeof (*op) + RSLOP;
	else
		onb += pagesz - sizeof (*op) - RSLOP;
	/* avoid the copy if same size block */
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#endif
			return(cp);
		} else
			free(cp);
	}
  	if ((res = malloc(nbytes)) == NULL)
  		return (NULL);
  	if (cp != res)			/* common optimization */
		bcopy(cp, res, (nbytes < onb) ? nbytes : onb);
  	return (res);
}

/*
 * Search ``srchlen'' elements of each free list for a block whose
 * header starts at ``freep''.  If srchlen is -1 search the whole list.







|







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#endif
			return(cp);
		} else
			free(cp);
	}
  	if ((res = malloc(nbytes)) == NULL)
  		return (NULL);
  	if (cp != res)		/* common optimization if "compacting" */
		bcopy(cp, res, (nbytes < onb) ? nbytes : onb);
  	return (res);
}

/*
 * Search ``srchlen'' elements of each free list for a block whose
 * header starts at ``freep''.  If srchlen is -1 search the whole list.

Changes to lib/libc/sys/Xsetregid.2.

1
2
3
4
5
6
7
8
9
10
11




12
13
14
15
16
17
18
19
20
21
22
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)Xsetregid.2	6.1 (Berkeley) 05/15/85
.\"
.TH SETREGID 2 ""
.UC 5
.SH NAME
setregid \- set real and effective group ID
.SH SYNOPSIS




.ft B
setregid(rgid, egid)
.br
int rgid, egid;
.ft R
.SH DESCRIPTION
The real and effective group ID's of the current process
are set to the arguments.
Unprivileged users may change the real group
ID to the effective group ID and vice-versa; only the super-user may
make other changes.




|






>
>
>
>



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)Xsetregid.2	6.2 (Berkeley) 01/07/86
.\"
.TH SETREGID 2 ""
.UC 5
.SH NAME
setregid \- set real and effective group ID
.SH SYNOPSIS
.nf
.ft B
#include <sys/types.h>
.PP
.ft B
setregid(rgid, egid)
.br
gid_t rgid, egid;
.ft R
.SH DESCRIPTION
The real and effective group ID's of the current process
are set to the arguments.
Unprivileged users may change the real group
ID to the effective group ID and vice-versa; only the super-user may
make other changes.

Changes to lib/libc/sys/getgid.2.

1
2
3
4
5
6
7
8
9
10
11




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)getgid.2	6.1 (Berkeley) 05/15/85
.\"
.TH GETGID 2 ""
.UC 5
.SH NAME
getgid, getegid \- get group identity
.SH SYNOPSIS




.nf
.ft B
gid = getgid()
int gid;
.PP
.ft B
egid = getegid()
int egid;
.fi
.SH DESCRIPTION
.I Getgid
returns the real group ID of the current process,
.I getegid
the effective group ID.
.PP




|






>
>
>
>



|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)getgid.2	6.2 (Berkeley) 01/07/86
.\"
.TH GETGID 2 ""
.UC 5
.SH NAME
getgid, getegid \- get group identity
.SH SYNOPSIS
.nf
.ft B
#include <sys/types.h>
.PP
.nf
.ft B
gid = getgid()
gid_t gid;
.PP
.ft B
egid = getegid()
gid_t egid;
.fi
.SH DESCRIPTION
.I Getgid
returns the real group ID of the current process,
.I getegid
the effective group ID.
.PP

Changes to lib/libc/sys/getuid.2.

1
2
3
4
5
6
7
8
9
10
11




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)getuid.2	6.2 (Berkeley) 06/28/85
.\"
.TH GETUID 2 ""
.UC 4
.SH NAME
getuid, geteuid \- get user identity
.SH SYNOPSIS




.ft B
.nf
uid = getuid()
int uid;
.PP
.ft B
euid = geteuid()
int euid;
.fi
.SH DESCRIPTION
.I Getuid
returns the real user ID of the current process,
.I geteuid
the effective user ID.
.PP




|






>
>
>
>



|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)getuid.2	6.3 (Berkeley) 01/07/86
.\"
.TH GETUID 2 ""
.UC 4
.SH NAME
getuid, geteuid \- get user identity
.SH SYNOPSIS
.nf
.ft B
#include <sys/types.h>
.PP
.ft B
.nf
uid = getuid()
uid_t uid;
.PP
.ft B
euid = geteuid()
uid_t euid;
.fi
.SH DESCRIPTION
.I Getuid
returns the real user ID of the current process,
.I geteuid
the effective user ID.
.PP

Changes to lib/libc/sys/setuid.2.

1
2
3
4
5
6
7
8
9
10
11
12





13
14
15

16


17
18
19

20
21
22
23
24
25
26
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)setuid.2	6.1 (Berkeley) 05/15/85
.\"
.TH SETUID 3 "" 
.UC 5
.SH NAME
setuid, seteuid, setruid, setgid, setegid, setrgid \- set user and group ID
.SH SYNOPSIS
.nf





.B setuid(uid)
.B seteuid(euid)
.B setruid(ruid)

.PP


.B setgid(gid)
.B setegid(egid)
.B setrgid(rgid)

.fi
.SH DESCRIPTION
.I Setuid
.RI ( setgid )
sets both the real and effective
user ID (group ID) of the current process to
as specified.




|







>
>
>
>
>
|
|
|
>

>
>
|
|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)setuid.2	6.2 (Berkeley) 01/07/86
.\"
.TH SETUID 3 "" 
.UC 5
.SH NAME
setuid, seteuid, setruid, setgid, setegid, setrgid \- set user and group ID
.SH SYNOPSIS
.nf
.ft B
#include <sys/types.h>
.PP
.ft B
.nf
setuid(uid)
seteuid(euid)
setruid(ruid)
uid_t uid, euid, ruid;
.PP
.ft B
.nf
setgid(gid)
setegid(egid)
setrgid(rgid)
gid_t gid, egid, rgid;
.fi
.SH DESCRIPTION
.I Setuid
.RI ( setgid )
sets both the real and effective
user ID (group ID) of the current process to
as specified.

Changes to lib/libc/sys/socket.2.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)socket.2	6.2 (Berkeley) 06/30/85
.\"
.TH SOCKET 2 ""
.UC 5
.SH NAME
socket \- create an endpoint for communication
.SH SYNOPSIS
.nf




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)socket.2	6.3 (Berkeley) 01/07/86
.\"
.TH SOCKET 2 ""
.UC 5
.SH NAME
socket \- create an endpoint for communication
.SH SYNOPSIS
.nf
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
The currently understood formats are
.PP
.RS
.nf
.ta 1.25i 1.75i
AF_UNIX	(UNIX path names),
AF_INET	(ARPA Internet addresses),
AF_PUP	(Xerox PUP-I Internet addresses), and
AF_IMPLINK	(IMP \*(lqhost at IMP\*(rq addresses).
.fi
.RE
.PP
The socket has the indicated
.I type,
which specifies the semantics of communication.  Currently







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
The currently understood formats are
.PP
.RS
.nf
.ta 1.25i 1.75i
AF_UNIX	(UNIX path names),
AF_INET	(ARPA Internet addresses),
AF_NS	(Xerox Network Systems addresses), and
AF_IMPLINK	(IMP \*(lqhost at IMP\*(rq addresses).
.fi
.RE
.PP
The socket has the indicated
.I type,
which specifies the semantics of communication.  Currently
57
58
59
60
61
62
63






64
65
66
67
68
69
70
71
72
73
74
.PP
A SOCK_STREAM type provides sequenced, reliable,
two-way connection based byte streams with an out-of-band data
transmission mechanism.
A SOCK_DGRAM socket supports
datagrams (connectionless, unreliable messages of
a fixed (typically small) maximum length).






SOCK_RAW sockets provide access to internal network interfaces.
The types SOCK_RAW,
which is available only to the super-user, and
SOCK_SEQPACKET and SOCK_RDM, which are planned,
but not yet implemented, are not described here.
.PP
The
.I protocol
specifies a particular protocol to be used with the socket.
Normally only a single protocol exists to support a particular
socket type using a given address format.  However, it is possible







>
>
>
>
>
>



|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.PP
A SOCK_STREAM type provides sequenced, reliable,
two-way connection based byte streams with an out-of-band data
transmission mechanism.
A SOCK_DGRAM socket supports
datagrams (connectionless, unreliable messages of
a fixed (typically small) maximum length).
A SOCK_SEQPACKET socket may provide a sequenced, reliable,
two-way connection-based data transmission path for datagrams
of fixed maximum length; a consumer may be required to read
an entire packet with each read system call.
This facility is protocol specific, and presently implemented
only for AF_NS.
SOCK_RAW sockets provide access to internal network interfaces.
The types SOCK_RAW,
which is available only to the super-user, and
SOCK_RDM, which is planned,
but not yet implemented, are not described here.
.PP
The
.I protocol
specifies a particular protocol to be used with the socket.
Normally only a single protocol exists to support a particular
socket type using a given address format.  However, it is possible
118
119
120
121
122
123
124







125
126
127
128
129
130
131
An error is then indicated if no response can be
elicited on an otherwise
idle connection for a extended period (e.g. 5 minutes).
A SIGPIPE signal is raised if a process sends
on a broken stream; this causes naive processes,
which do not handle the signal, to exit.
.PP







SOCK_DGRAM and SOCK_RAW
sockets allow sending of datagrams to correspondents
named in
.IR send (2)
calls.  It is also possible to receive datagrams at
such a socket with
.IR recv (2).







>
>
>
>
>
>
>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
An error is then indicated if no response can be
elicited on an otherwise
idle connection for a extended period (e.g. 5 minutes).
A SIGPIPE signal is raised if a process sends
on a broken stream; this causes naive processes,
which do not handle the signal, to exit.
.PP
SOCK_SEQPACKET sockets employ the same system calls
as SOCK_STREAM sockets.  The only difference
is that 
.IR read (2)
calls will return only the amount of data requested,
and any remaining in the arriving packet will be discarded.
.PP
SOCK_DGRAM and SOCK_RAW
sockets allow sending of datagrams to correspondents
named in
.IR send (2)
calls.  It is also possible to receive datagrams at
such a socket with
.IR recv (2).

Changes to lib/libc/vax/gen/_setjmp.s.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
	.asciz	"@(#)_setjmp.s	5.2 (Berkeley) 06/05/85"
#endif not lint


/*
 * C library -- _setjmp, _longjmp
 *
 *	_longjmp(a,v)







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
	.asciz	"@(#)_setjmp.s	5.3 (Berkeley) 01/09/86"
#endif not lint


/*
 * C library -- _setjmp, _longjmp
 *
 *	_longjmp(a,v)
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	ret				# unwind stack before signals enabled
3:
	addl2	$8,sp			# compensate for PSL-PC push
4:
	jmp	*4(r1)			# done, return....

botch:
	pushl	$msgend-msg
	pushl	$msg
	pushl	$2
	calls	$3,_write
	halt

	.data
msg:	.ascii	"_longjmp botch\n"
msgend:
reiins:	rei







<
<
<
|

<
<
<
<
<
64
65
66
67
68
69
70



71
72





	ret				# unwind stack before signals enabled
3:
	addl2	$8,sp			# compensate for PSL-PC push
4:
	jmp	*4(r1)			# done, return....

botch:



	calls	$0,_longjmperror
	halt





Changes to lib/libc/vax/gen/setjmp.s.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
	.asciz	"@(#)setjmp.s	5.3 (Berkeley) 08/16/85"
#endif not lint

/*
 * C library -- setjmp, longjmp
 *
 *	longjmp(a,v)
 * will generate a "return(v)" from







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
	.asciz	"@(#)setjmp.s	5.4 (Berkeley) 01/09/86"
#endif not lint

/*
 * C library -- setjmp, longjmp
 *
 *	longjmp(a,v)
 * will generate a "return(v)" from
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
4:
#endif NOCOMPAT

	pushl	r1			# pointer to sigcontext
	calls	$1,_sigreturn		# restore previous context
					# we should never return
botch:
	pushl	$msgend-msg
	pushl	$msg
	pushl	$2
	calls	$3,_write
	halt

	.data
msg:	.ascii	"longjmp botch\n"
msgend:







<
<
<
|

<
<
<
<
83
84
85
86
87
88
89



90
91




4:
#endif NOCOMPAT

	pushl	r1			# pointer to sigcontext
	calls	$1,_sigreturn		# restore previous context
					# we should never return
botch:



	calls	$0,_longjmperror
	halt




Changes to libexec/getty/gettytab.5.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)gettytab.5	6.1 (Berkeley) 05/15/85
.\"
.TH GETTYTAB 5 ""
.UC 5
.SH NAME
gettytab \- terminal configuration data base
.SH SYNOPSIS
/etc/gettytab




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)gettytab.5	6.2 (Berkeley) 01/07/86
.\"
.TH GETTYTAB 5 ""
.UC 5
.SH NAME
gettytab \- terminal configuration data base
.SH SYNOPSIS
/etc/gettytab
52
53
54
55
56
57
58

59
60
61
62
63
64
65
cb	bool	false	use crt backspace mode
cd	num	0	carriage-return delay
ce	bool	false	use crt erase algorithm
ck	bool	false	use crt kill algorithm
cl	str	NULL	screen clear sequence
co	bool	false	console - add \\n after login prompt
ds	str	^Y	delayed suspend character

ec	bool	false	leave echo \s-2OFF\s0
ep	bool	false	terminal uses even parity
er	str	^?	erase character
et	str	^D	end of text (\s-2EOF\s0) character
ev	str	NULL	initial enviroment
f0	num	unused	tty mode flags to write messages
f1	num	unused	tty mode flags to read login name







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cb	bool	false	use crt backspace mode
cd	num	0	carriage-return delay
ce	bool	false	use crt erase algorithm
ck	bool	false	use crt kill algorithm
cl	str	NULL	screen clear sequence
co	bool	false	console - add \\n after login prompt
ds	str	^Y	delayed suspend character
dx	bool	false	set DECCTLQ
ec	bool	false	leave echo \s-2OFF\s0
ep	bool	false	terminal uses even parity
er	str	^?	erase character
et	str	^D	end of text (\s-2EOF\s0) character
ev	str	NULL	initial enviroment
f0	num	unused	tty mode flags to write messages
f1	num	unused	tty mode flags to read login name

Changes to libexec/getty/gettytab.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gettytab.h	5.1 (Berkeley) 04/29/85
 */

/*
 * Getty description definitions.
 */
struct	gettystrs {
	char	*field;		/* name to lookup in gettytab */





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gettytab.h	5.2 (Berkeley) 01/07/86
 */

/*
 * Getty description definitions.
 */
struct	gettystrs {
	char	*field;		/* name to lookup in gettytab */
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
#define	LC	gettyflags[13].value
#define	UC	gettyflags[14].value
#define	IG	gettyflags[15].value
#define	PS	gettyflags[16].value
#define	HC	gettyflags[17].value
#define UB	gettyflags[18].value
#define AB	gettyflags[19].value


int	getent();
long	getnum();
int	getflag();
char	*getstr();

extern	struct gettyflags gettyflags[];
extern	struct gettynums gettynums[];
extern	struct gettystrs gettystrs[];
extern	int hopcount;







>










100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#define	LC	gettyflags[13].value
#define	UC	gettyflags[14].value
#define	IG	gettyflags[15].value
#define	PS	gettyflags[16].value
#define	HC	gettyflags[17].value
#define UB	gettyflags[18].value
#define AB	gettyflags[19].value
#define DX	gettyflags[20].value

int	getent();
long	getnum();
int	getflag();
char	*getstr();

extern	struct gettyflags gettyflags[];
extern	struct gettynums gettynums[];
extern	struct gettystrs gettystrs[];
extern	int hopcount;

Changes to libexec/getty/init.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)init.c	5.1 (Berkeley) 04/29/85";
#endif not lint

/*
 * Getty table initializations.
 *
 * Melbourne getty.
 */







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)init.c	5.2 (Berkeley) 01/07/86";
#endif not lint

/*
 * Getty table initializations.
 *
 * Melbourne getty.
 */
83
84
85
86
87
88
89

90
91
	{ "lc",	0 },			/* terminal las lower case */
	{ "uc",	0 },			/* terminal has no lower case */
	{ "ig",	0 },			/* ignore garbage */
	{ "ps",	0 },			/* do port selector speed select */
	{ "hc",	1 },			/* don't set hangup on close */
	{ "ub", 0 },			/* unbuffered output */
	{ "ab", 0 },			/* auto-baud detect with '\r' */

	{ 0 }
};







>


83
84
85
86
87
88
89
90
91
92
	{ "lc",	0 },			/* terminal las lower case */
	{ "uc",	0 },			/* terminal has no lower case */
	{ "ig",	0 },			/* ignore garbage */
	{ "ps",	0 },			/* do port selector speed select */
	{ "hc",	1 },			/* don't set hangup on close */
	{ "ub", 0 },			/* unbuffered output */
	{ "ab", 0 },			/* auto-baud detect with '\r' */
	{ "dx", 0 },			/* set decctlq */
	{ 0 }
};

Changes to libexec/getty/subr.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)subr.c	5.3 (Berkeley) 10/18/85";
#endif not lint

/*
 * Melbourne getty.
 */
#include <sgtty.h>
#include "gettytab.h"







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)subr.c	5.4 (Berkeley) 01/07/86";
#endif not lint

/*
 * Melbourne getty.
 */
#include <sgtty.h>
#include "gettytab.h"
185
186
187
188
189
190
191



192
193
194
195
196
197
198

	if (EC)
		f |= ECHO;

	if (XC)
		f |= CTLECH;




	return (f);
}

struct delayval {
	unsigned	delay;		/* delay in ms */
	int		bits;
};







>
>
>







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

	if (EC)
		f |= ECHO;

	if (XC)
		f |= CTLECH;

	if (DX)
		f |= DECCTQ;

	return (f);
}

struct delayval {
	unsigned	delay;		/* delay in ms */
	int		bits;
};

Changes to libexec/rlogind/rlogind.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)rlogind.c	5.9 (Berkeley) 11/08/85";
#endif not lint

/*
 * remote login server:
 *	remuser\0
 *	locuser\0
 *	terminal info\0













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)rlogind.c	5.10 (Berkeley) 01/07/86";
#endif not lint

/*
 * remote login server:
 *	remuser\0
 *	locuser\0
 *	terminal info\0
195
196
197
198
199
200
201

202
203
204
205
206
207
208
209
210
211
212


213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230












231
232
233
234
235
236
237
 */
protocol(f, p)
	int f, p;
{
	char pibuf[1024], fibuf[1024], *pbp, *fbp;
	register pcc = 0, fcc = 0;
	int cc;


	/*
	 * Must ignore SIGTTOU, otherwise we'll stop
	 * when we try and set slave pty's window shape
	 * (our controlling tty is the master pty).
	 */
	(void) signal(SIGTTOU, SIG_IGN);
	send(f, oobdata, 1, MSG_OOB);	/* indicate new rlogin */
	for (;;) {
		int ibits = 0, obits = 0;



		if (fcc)
			obits |= (1<<p);
		else
			ibits |= (1<<f);
		if (pcc >= 0)
			if (pcc)
				obits |= (1<<f);
			else
				ibits |= (1<<p);

		if (select(16, &ibits, &obits, 0, 0) < 0) {
			if (errno == EINTR)
				continue;
			fatalperror(f, "select", errno);
		}
		if (ibits == 0 && obits == 0) {
			/* shouldn't happen... */
			sleep(5);
			continue;












		}
		if (ibits & (1<<f)) {
			fcc = read(f, fibuf, sizeof (fibuf));
			if (fcc < 0 && errno == EWOULDBLOCK)
				fcc = 0;
			else {
				register char *cp;







>









|

>
>









>
|




|



>
>
>
>
>
>
>
>
>
>
>
>







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
 */
protocol(f, p)
	int f, p;
{
	char pibuf[1024], fibuf[1024], *pbp, *fbp;
	register pcc = 0, fcc = 0;
	int cc;
	char cntl;

	/*
	 * Must ignore SIGTTOU, otherwise we'll stop
	 * when we try and set slave pty's window shape
	 * (our controlling tty is the master pty).
	 */
	(void) signal(SIGTTOU, SIG_IGN);
	send(f, oobdata, 1, MSG_OOB);	/* indicate new rlogin */
	for (;;) {
		int ibits, obits, ebits;

		ibits = 0;
		obits = 0;
		if (fcc)
			obits |= (1<<p);
		else
			ibits |= (1<<f);
		if (pcc >= 0)
			if (pcc)
				obits |= (1<<f);
			else
				ibits |= (1<<p);
		ebits = (1<<p);
		if (select(16, &ibits, &obits, &ebits, 0) < 0) {
			if (errno == EINTR)
				continue;
			fatalperror(f, "select", errno);
		}
		if (ibits == 0 && obits == 0 && ebits == 0) {
			/* shouldn't happen... */
			sleep(5);
			continue;
		}
#define	pkcontrol(c)	((c)&(TIOCPKT_FLUSHWRITE|TIOCPKT_NOSTOP|TIOCPKT_DOSTOP))
		if (ebits & (1<<p)) {
			cc = read(p, &cntl, 1);
			if (cc == 1 && pkcontrol(cntl)) {
				cntl |= oobdata[0];
				send(f, &cntl, 1, MSG_OOB);
				if (cntl & TIOCPKT_FLUSHWRITE) {
					pcc = 0;
					ibits &= ~(1<<p);
				}
			}
		}
		if (ibits & (1<<f)) {
			fcc = read(f, fibuf, sizeof (fibuf));
			if (fcc < 0 && errno == EWOULDBLOCK)
				fcc = 0;
			else {
				register char *cp;
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
			if (pcc < 0 && errno == EWOULDBLOCK)
				pcc = 0;
			else if (pcc <= 0)
				break;
			else if (pibuf[0] == 0)
				pbp++, pcc--;
			else {
#define	pkcontrol(c)	((c)&(TIOCPKT_FLUSHWRITE|TIOCPKT_NOSTOP|TIOCPKT_DOSTOP))
				if (pkcontrol(pibuf[0])) {
					pibuf[0] |= oobdata[0];
					send(f, &pibuf[0], 1, MSG_OOB);
				}
				pcc = 0;
			}
		}







<







288
289
290
291
292
293
294

295
296
297
298
299
300
301
			if (pcc < 0 && errno == EWOULDBLOCK)
				pcc = 0;
			else if (pcc <= 0)
				break;
			else if (pibuf[0] == 0)
				pbp++, pcc--;
			else {

				if (pkcontrol(pibuf[0])) {
					pibuf[0] |= oobdata[0];
					send(f, &pibuf[0], 1, MSG_OOB);
				}
				pcc = 0;
			}
		}

Changes to local/ditroff/ditroff.old.okeeffe/driver/ifontinfo.c.

1
2
3
4
5
6
7
8
static char sccsid[] = "ifontinfo.c	1.5	(Berkeley)	85/02/26";

/* Font Information for Imagen-style fonts (RST format)
 *      taken from vfontinfo, by Andy Hertzfeld  4/79
 */

#include <stdio.h>
#include <ctype.h>
|







1
2
3
4
5
6
7
8
static char sccsid[] = "ifontinfo.c	1.6	(Berkeley)	86/01/05";

/* Font Information for Imagen-style fonts (RST format)
 *      taken from vfontinfo, by Andy Hertzfeld  4/79
 */

#include <stdio.h>
#include <ctype.h>
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	p.p_linesp = rd4();
	p.p_wordsp = rd4();
	p.p_rot = rd2();
	p.p_cadv = rd1();
	p.p_ladv = rd1();
	p.p_id = rd4();
	p.p_res = rd2();
	if (p.p_res != RES)
	    error("wrong resolution in Font file.");

	i = p.p_glyph - 44;
	idstrings = (char *) malloc (i);
	endstring = idstrings;
	while (i--) if ((*(endstring++) = getc(FID)) == EOF)
	    error("bad preamble in Font file.");








<
<







98
99
100
101
102
103
104


105
106
107
108
109
110
111
	p.p_linesp = rd4();
	p.p_wordsp = rd4();
	p.p_rot = rd2();
	p.p_cadv = rd1();
	p.p_ladv = rd1();
	p.p_id = rd4();
	p.p_res = rd2();



	i = p.p_glyph - 44;
	idstrings = (char *) malloc (i);
	endstring = idstrings;
	while (i--) if ((*(endstring++) = getc(FID)) == EOF)
	    error("bad preamble in Font file.");

Changes to local/tac/tac.c.

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
#ifndef lint
static char sccsid[] = "@(#)tac.c	1.1 06/09/85";
#endif

/*
 * tac.c - Print file segments in reverse order
 *
 * Original line-only version by unknown author off the net.
 * 1985 mods by Jay Lepreau, Univ of Utah, to allocate memory dynamically
 * and handle string bounded segments.

 */

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

/*

|






|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef lint
static char sccsid[] = "@(#)tac.c	1.2 01/11/86";
#endif

/*
 * tac.c - Print file segments in reverse order
 *
 * Original line-only version by unknown author off the net.
 * 1985 mods by Jay Lepreau, Univ of Utah, to allocate memory
 * dynamically and handle string bounded segments (latter idea
 * suggested by Rob Pike).
 */

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

/*
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

	/*
	 * Arrange for the first read to lop off enough to
	 * leave the rest of the file a multiple of readsize.
	 * Since readsize can change, this may not always hold during
	 * the pgm run, but since it usually will, leave it here
	 * for i/o efficiency (page/sector boundaries and all that).
	 * Note: Above statement has never been verified!
	 */
	if ((i = off % readsize) == 0)
	    i = readsize;
	off -= i;

	(void) lseek(fd, off, 0);
	if (read(fd, buf, i) != i) {







|







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

	/*
	 * Arrange for the first read to lop off enough to
	 * leave the rest of the file a multiple of readsize.
	 * Since readsize can change, this may not always hold during
	 * the pgm run, but since it usually will, leave it here
	 * for i/o efficiency (page/sector boundaries and all that).
	 * Note: the efficiency gain has never been verified...
	 */
	if ((i = off % readsize) == 0)
	    i = readsize;
	off -= i;

	(void) lseek(fd, off, 0);
	if (read(fd, buf, i) != i) {

Changes to old/dbx/check.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)check.c	5.1 (Berkeley) 05/31/85";
#endif not lint

static char rcsid[] = "$Header: check.c,v 1.5 84/12/26 10:38:35 linton Exp $";

/*
 * Check a tree for semantic correctness.
 */







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)check.c	5.2 (Berkeley) 01/10/86";
#endif not lint

static char rcsid[] = "$Header: check.c,v 1.5 84/12/26 10:38:35 linton Exp $";

/*
 * Check a tree for semantic correctness.
 */
44
45
46
47
48
49
50




51
52
53
54
55
56
57
58
    Symbol f;

    checkref(p);
    switch (p->op) {
	case O_ASSIGN:
	    p1 = p->value.arg[0];
	    p2 = p->value.arg[1];




	    if (not compatible(p1->nodetype, p2->nodetype)) {
		error("incompatible types");
	    }
	    break;

	case O_CATCH:
	case O_IGNORE:
	    if (p->value.lcon < 0 or p->value.lcon > NSIG) {







>
>
>
>
|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    Symbol f;

    checkref(p);
    switch (p->op) {
	case O_ASSIGN:
	    p1 = p->value.arg[0];
	    p2 = p->value.arg[1];
	    if (varIsSet("$unsafeassign")) {
		if (size(p1->nodetype) != size(p2->nodetype)) {
		    error("incompatible sizes");
		}
	    } else if (not compatible(p1->nodetype, p2->nodetype)) {
		error("incompatible types");
	    }
	    break;

	case O_CATCH:
	case O_IGNORE:
	    if (p->value.lcon < 0 or p->value.lcon > NSIG) {

Changes to old/dbx/fortran.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)fortran.c	5.2 (Berkeley) 09/05/85";
#endif not lint

static char rcsid[] = "$Header: fortran.c,v 1.5 84/12/26 10:39:37 linton Exp $";

/*
 * FORTRAN dependent symbol routines.
 */







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)fortran.c	5.3 (Berkeley) 01/10/86";
#endif not lint

static char rcsid[] = "$Header: fortran.c,v 1.5 84/12/26 10:39:37 linton Exp $";

/*
 * FORTRAN dependent symbol routines.
 */
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "eval.h"
#include "operators.h"
#include "mappings.h"
#include "process.h"
#include "runtime.h"
#include "machine.h"

#define isfloat(range) ( \
    range->symvalue.rangev.upper == 0 and range->symvalue.rangev.lower > 0 \
)

#define isrange(t, name) (t->class == RANGE and istypename(t->type, name))

#define MAXDIM  20








|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "eval.h"
#include "operators.h"
#include "mappings.h"
#include "process.h"
#include "runtime.h"
#include "machine.h"

#define isspecial(range) ( \
    range->symvalue.rangev.upper == 0 and range->symvalue.rangev.lower > 0 \
)

#define isrange(t, name) (t->class == RANGE and istypename(t->type, name))

#define MAXDIM  20

176
177
178
179
180
181
182

183
184
185
186
187
188
189
Symbol eltype;

    switch (s->class) {

	case CONST:
	    
	    printf("parameter %s = ", symname(s));

            printval(s);
	    break;

        case REF:
            printf(" (dummy argument) ");

	case VAR:







>







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
Symbol eltype;

    switch (s->class) {

	case CONST:
	    
	    printf("parameter %s = ", symname(s));
	    eval(s->symvalue.constval);
            printval(s);
	    break;

        case REF:
            printf(" (dummy argument) ");

	case VAR:
286
287
288
289
290
291
292
293
294






295



296

297
298
299
300
301
302
303
304
305
306
307
		printf("\"%.*s\"", len, sp);
	    } else {
		fortran_printarray(s);
	    }
	    break;

	case RANGE:
	     if (isfloat(s)) {
		switch (s->symvalue.rangev.lower) {






		    case sizeof(float):



			prtreal(pop(float));

			break;

		    case sizeof(double):
			if (istypename(s->type,"complex")) {
			    d2 = pop(float);
			    d1 = pop(float);
			    printf("(");
			    prtreal(d1);
			    printf(",");
			    prtreal(d2);
			    printf(")");







|

>
>
>
>
>
>

>
>
>
|
>



|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
		printf("\"%.*s\"", len, sp);
	    } else {
		fortran_printarray(s);
	    }
	    break;

	case RANGE:
	    if (isspecial(s)) {
		switch (s->symvalue.rangev.lower) {
		    case sizeof(short):
			if (istypename(s->type, "logical*2")) {
			    printlogical(pop(short));
			}
			break;

		    case sizeof(float):
			if (istypename(s->type, "logical")) {
			    printlogical(pop(long));
			} else {
			    prtreal(pop(float));
			}
			break;

		    case sizeof(double):
			if (istypename(s->type, "complex")) {
			    d2 = pop(float);
			    d1 = pop(float);
			    printf("(");
			    prtreal(d1);
			    printf(",");
			    prtreal(d2);
			    printf(")");
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340














341
342
343
344
345
346
347
348
349
350
351
352
353
354
355


356
357
358
359
360
361
362
363
364
			prtreal(d1);
			printf(",");
			prtreal(d2);
			printf(")");
			break;
		
		    default:
			panic("bad size \"%d\" for real",
                                  s->symvalue.rangev.lower);
			break;
		}
	    } else {
		printint(popsmall(s), s);
	    }
	    break;

	default:
	    if (ord(s->class) > ord(TYPEREF)) {
		panic("printval: bad class %d", ord(s->class));
	    }
	    error("don't know how to print a %s", fortran_classname(s));
	    /* NOTREACHED */
    }
}















/*
 * Print out an int 
 */

private printint(i, t)
Integer i;
register Symbol t;
{
    if (istypename(t->type, "logical")) {
	printf(((Boolean) i) == true ? "true" : "false");
    }
    else if ( (t->type == t_int) or istypename(t->type, "integer") or
                  istypename(t->type,"integer*2") ) {
	printf("%ld", i);


    } else {
      error("unkown type in fortran printint");
    }
}

/*
 * Print out a null-terminated string (pointer to char)
 * starting at the given address.
 */







|
















>
>
>
>
>
>
>
>
>
>
>
>
>
>









<
<
<
|


>
>

|







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374



375
376
377
378
379
380
381
382
383
384
385
386
387
388
			prtreal(d1);
			printf(",");
			prtreal(d2);
			printf(")");
			break;
		
		    default:
			panic("bad size \"%d\" for special",
                                  s->symvalue.rangev.lower);
			break;
		}
	    } else {
		printint(popsmall(s), s);
	    }
	    break;

	default:
	    if (ord(s->class) > ord(TYPEREF)) {
		panic("printval: bad class %d", ord(s->class));
	    }
	    error("don't know how to print a %s", fortran_classname(s));
	    /* NOTREACHED */
    }
}

/*
 * Print out a logical
 */

private printlogical(i)
Integer i;
{
    if (i == 0) {
	printf(".false.");
    } else {
	printf(".true.");
    }
}

/*
 * Print out an int 
 */

private printint(i, t)
Integer i;
register Symbol t;
{



    if ( (t->type == t_int) or istypename(t->type, "integer") or
                  istypename(t->type,"integer*2") ) {
	printf("%ld", i);
    } else if (istypename(t->type, "addr")) {
	printf("0x%lx", i);
    } else {
	error("unknown type in fortran printint");
    }
}

/*
 * Print out a null-terminated string (pointer to char)
 * starting at the given address.
 */

Changes to old/dbx/runtime.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)runtime.c	5.1 (Berkeley) 05/31/85";
#endif not lint

static char rcsid[] = "$Header: runtime.c,v 1.5 84/12/26 10:41:52 linton Exp $";

/*
 * Runtime organization dependent routines, mostly dealing with
 * activation records.







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)runtime.c	5.2 (Berkeley) 01/10/86";
#endif not lint

static char rcsid[] = "$Header: runtime.c,v 1.5 84/12/26 10:41:52 linton Exp $";

/*
 * Runtime organization dependent routines, mostly dealing with
 * activation records.
797
798
799
800
801
802
803



804

805
806
807
808
809
810
811
Symbol proc;
Node arglist;
{
    Stack *savesp;
    int argc, args_size;

    savesp = sp;



    argc = evalargs(proc, arglist);

    args_size = sp - savesp;
    setreg(STKP, reg(STKP) - args_size);
    dwrite(savesp, reg(STKP), args_size);
    sp = savesp;
    return argc;
}








>
>
>
|
>







797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
Symbol proc;
Node arglist;
{
    Stack *savesp;
    int argc, args_size;

    savesp = sp;
    if (varIsSet("$unsafecall")) {
	argc = unsafe_evalargs(proc, arglist);
    } else {
	argc = evalargs(proc, arglist);
    }
    args_size = sp - savesp;
    setreg(STKP, reg(STKP) - args_size);
    dwrite(savesp, reg(STKP), args_size);
    sp = savesp;
    return argc;
}

944
945
946
947
948
949
950






















951
952
953
954
955
956
957
	++count;
    }
    if (chk) {
	if (formal != nil) {
	    sp = savesp;
	    error("not enough parameters to %s", symname(proc));
	}






















    }
    return count;
}

public procreturn(f)
Symbol f;
{







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
	++count;
    }
    if (chk) {
	if (formal != nil) {
	    sp = savesp;
	    error("not enough parameters to %s", symname(proc));
	}
    }
    return count;
}

/*
 * Evaluate an argument list without concern for matching the formal
 * parameters of a function in type or quantity.  Useful for functions
 * like C's printf().
 */

private integer unsafe_evalargs(proc, arglist)
Symbol proc;
Node arglist;
{
    Node p;
    Integer count;

    count = 0;
    for (p = arglist; p != nil; p = p->value.arg[1]) {
	assert(p->op == O_COMMA);
	eval(p->value.arg[0]);
	++count;
    }
    return count;
}

public procreturn(f)
Symbol f;
{

Changes to old/make/files.c.

1
2
3
4
5
6
7
8
static	char *sccsid = "@(#)files.c	4.11 (Berkeley) 85/08/30";
#include <fcntl.h>

/* UNIX DEPENDENT PROCEDURES */


/* DEFAULT RULES FOR UNIX */

|







1
2
3
4
5
6
7
8
static	char *sccsid = "@(#)files.c	4.12 (Berkeley) 86/01/09";
#include <fcntl.h>

/* UNIX DEPENDENT PROCEDURES */


/* DEFAULT RULES FOR UNIX */

223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
	dirpref = "";
	filepat = pat;
	cp = varptr("VPATH");
	if (*cp->varval == 0) path = ".";
	else {
	       path = pth; 
	       *path = '\0';
	       if (*cp->varval != '.') strcpy(pth,".:");
	       strcat(pth, cp->varval);
	       }
	}
else	{
	*endir = '\0';
	path = strcpy(pth, pat);
	dirpref = concat(pat, "/", temp);







|







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
	dirpref = "";
	filepat = pat;
	cp = varptr("VPATH");
	if (*cp->varval == 0) path = ".";
	else {
	       path = pth; 
	       *path = '\0';
	       if (strncmp(cp->varval, ".:", 2) != 0) strcpy(pth,".:");
	       strcat(pth, cp->varval);
	       }
	}
else	{
	*endir = '\0';
	path = strcpy(pth, pat);
	dirpref = concat(pat, "/", temp);

Changes to old/make/main.c.

1
2
3
4
5
6
7
8
static	char *sccsid = "@(#)main.c	4.7 (Berkeley) 85/08/30";
# include "defs"
/*
command make to update programs.
Flags:	'd'  print out debugging comments
	'p'  print out a version of the input graph
	's'  silent mode--don't print out commands
	'f'  the next argument is the name of the description file;
|







1
2
3
4
5
6
7
8
static	char *sccsid = "@(#)main.c	4.8 (Berkeley) 86/01/09";
# include "defs"
/*
command make to update programs.
Flags:	'd'  print out debugging comments
	'p'  print out a version of the input graph
	's'  silent mode--don't print out commands
	'f'  the next argument is the name of the description file;
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
fin = k;
yylineno = 0;
zznextc = 0;

if( yyparse() )
	fatal("Description file error");

if(fin != NULL)
	fclose(fin);

return(0);
}

printdesc(prntflag)
int prntflag;







|







319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
fin = k;
yylineno = 0;
zznextc = 0;

if( yyparse() )
	fatal("Description file error");

if(fin != NULL && fin != stdin)
	fclose(fin);

return(0);
}

printdesc(prntflag)
int prntflag;

Changes to old/pcc/c2.vax/c21.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static	char sccsid[] = "@(#)c21.c 4.16 08/22/85";
#endif
/* char C21[] = {"@(#)c21.c 1.83 80/10/16 21:18:22 JFR"}; /* sccs ident */

/*
 * C object code improver-- second part
 */


|







1
2
3
4
5
6
7
8
9
#ifndef lint
static	char sccsid[] = "@(#)c21.c 4.17 01/08/86";
#endif
/* char C21[] = {"@(#)c21.c 1.83 80/10/16 21:18:22 JFR"}; /* sccs ident */

/*
 * C object code improver-- second part
 */

255
256
257
258
259
260
261
262
263

264
265
266
267
268
269
270
			switch (shcnt)
			{
			case 1:	pf->subop = WORD; break;
			case 2:	pf->subop = LONG; break;
			case 3:	pf->subop = QUAD; break;
			}
			redunm++; nsaddr++; nchange++;
		}
		goto std;

ashadd:
		/* at this point, RT2 and RT3 are guaranteed to be simple regs*/
		if (shcnt == 1 && equstr(regs[RT2], regs[RT3]))
		{
			/*
			** quickie:
			**	ashl	$1,A,A	>	addl2	A,A







<
|
>







255
256
257
258
259
260
261

262
263
264
265
266
267
268
269
270
			switch (shcnt)
			{
			case 1:	pf->subop = WORD; break;
			case 2:	pf->subop = LONG; break;
			case 3:	pf->subop = QUAD; break;
			}
			redunm++; nsaddr++; nchange++;

			goto std;
		}
ashadd:
		/* at this point, RT2 and RT3 are guaranteed to be simple regs*/
		if (shcnt == 1 && equstr(regs[RT2], regs[RT3]))
		{
			/*
			** quickie:
			**	ashl	$1,A,A	>	addl2	A,A

Added old/pcc/ccom.tahoe/Makefile.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#	Makefile	1.1	86/01/11
#
# Makefile for portable c compiler
#
DESTDIR=
M=	../mip.tahoe
CFLAGS=	-O -I${M} -I.
OBJS=	rodata.o cgram.o xdefs.o scan.o pftn.o trees.o optim.o code.o local.o \
	reader.o local2.o order.o match.o allo.o comm1.o table.o stab.o

all:	ccom alist

ccom: 	${OBJS}
	$(CC) $(LDFLAGS) ${OBJS} -o ccom
alist: alist.c
	$(CC) -o alist $(CFLAGS)  alist.c
	
trees.o: $M/manifest macdefs $M/mfile1 $M/trees.c
	$(CC) -c $(CFLAGS)  $M/trees.c
optim.o: $M/manifest macdefs $M/mfile1 $M/optim.c
	$(CC) -c $(CFLAGS) $M/optim.c
pftn.o: $M/manifest macdefs $M/mfile1 $M/pftn.c
	$(CC) -c $(CFLAGS) $M/pftn.c
code.o: $M/manifest macdefs $M/mfile1
	$(CC) -c $(CFLAGS) code.c
local.o: $M/manifest macdefs $M/mfile1
	$(CC) -c $(CFLAGS) local.c
stab.o: $M/manifest macdefs $M/mfile1
	$(CC) -c $(CFLAGS) stab.c
scan.o: $M/manifest macdefs $M/mfile1 $M/scan.c
	$(CC) -c $(CFLAGS) $M/scan.c
xdefs.o: $M/manifest $M/mfile1 macdefs $M/xdefs.c
	$(CC) -c $(CFLAGS) $M/xdefs.c
cgram.o: $M/manifest $M/mfile1 macdefs cgram.c
	$(CC) -c $(CFLAGS) cgram.c
rodata.o: rodata.c
	$(CC) -c $(CFLAGS) -R rodata.c
rodata.c cgram.c: $M/cgram.y
	$(YACC) $M/cgram.y
	rm -f rodata.c
	./:yyfix yyexca yyact yypact yypgo yyr1 yyr2 yychk yydef
	mv y.tab.c cgram.c
comm1.o: $M/manifest $M/mfile1 $M/common macdefs $M/comm1.c
	$(CC) -c $(CFLAGS) $M/comm1.c
table.o: $M/manifest $M/mfile2 mac2defs macdefs table.c
	$(CC) -c $(CFLAGS) -R table.c
reader.o: $M/manifest $M/mfile2 mac2defs macdefs $M/reader.c
	$(CC) -c $(CFLAGS) $M/reader.c
local2.o: $M/manifest $M/mfile2 mac2defs macdefs
	$(CC) -c $(CFLAGS) local2.c
order.o: $M/manifest $M/mfile2 mac2defs macdefs
	$(CC) -c $(CFLAGS) order.c
match.o: $M/manifest $M/mfile2 mac2defs macdefs $M/match.c
	$(CC) -c $(CFLAGS) $M/match.c
allo.o: $M/manifest $M/mfile2 mac2defs macdefs $M/allo.c
	$(CC) -c $(CFLAGS) $M/allo.c
clean:
	rm -f *.o ccom cgram.c rodata.c
lintall:
	lint -hv -I. -I$M $(CFLAGS) rodata.c cgram.c $M/xdefs.c \
	$M/scan.c $M/pftn.c $M/trees.c $M/optim.c code.c local.c \
	$M/reader.c local2.c order.c $M/match.c $M/allo.c $M/comm1.c table.c

install: all
	-mv ${DESTDIR}/lib/ccom ${DESTDIR}/lib/ccom.old
	install -s ccom ${DESTDIR}/lib/ccom
	install -s alist ${DESTDIR}/lib/alist

Added old/pcc/ccom.tahoe/code.c.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
#ifndef lint
static char sccsid[] = "@(#)code.c	1.1 (Berkeley) 01/11/86";
#endif

# include "mfile1"
# include <sys/types.h>
# include <a.out.h>
# include <stab.h>

int proflg = 0;	/* are we generating profiling code? */
int strftn = 0;  /* is the current function one which returns a value */
int gdebug;
int fdefflag;  /* are we within a function definition ? */
#ifndef STABDOT
char NULLNAME[8];
#endif
int labelno;

branch( n ){
	/* output a branch to label n */
	/* exception is an ordinary function branching to retlab: then, return */
	if( n == retlab && !strftn ){
		register TWORD t;
		register r;
			/* set number of regs in assem comment field */
			/* so optimizers can do a better job */
		r = 0;
		if( retstat & RETVAL ){ /* the function rets a val somewhere */
			t = (&stab[curftn])->stype;
			t = DECREF(t);
			r++;	/* it is at least one */
			if(t == DOUBLE)
				r++;	/* it takes two */
		} else		/* the fn does not ret a val	*/
			r = 2;
		printf( "	ret#%d\n", r );
		}
	else printf( "	jbr 	L%d\n", n );
	}

int lastloc = { -1 };

short log2tab[] = {0, 0, 1, 2, 2, 3, 3, 3, 3};
#define LOG2SZ 9

defalign(n) {
	/* cause the alignment to become a multiple of n */
	n /= SZCHAR;
	if( lastloc != PROG && n > 1 ) printf( "	.align	%d\n", n >= 0 && n < LOG2SZ ? log2tab[n] : 0 );
	}

locctr( l ){
	register temp;
	/* l is PROG, ADATA, DATA, STRNG, ISTRNG, or STAB */

	if( l == lastloc ) return(l);
	temp = lastloc;
	lastloc = l;
	switch( l ){

	case PROG:
		printf( "	.text\n" );
		psline();
		break;

	case DATA:
	case ADATA:
		printf( "	.data\n" );
		break;

	case STRNG:
		printf( "	.data	1\n" );
		break;

	case ISTRNG:
		printf( "	.data	2\n" );
		break;

	case STAB:
		printf( "	.stab\n" );
		break;

	default:
		cerror( "illegal location counter" );
		}

	return( temp );
	}

deflab( n ){
	/* output something to define the current position as label n */
	printf( "L%d:\n", n );
	}

int crslab = 10;

getlab(){
	/* return a number usable for a label */
	return( ++crslab );
	}


efcode(){
	/* code for the end of a function */

	if( strftn ){  /* copy output (in R2) to caller */
		register NODE *l, *r;
		register struct symtab *p;
		register TWORD t;
		register int i;

		p = &stab[curftn];
		t = p->stype;
		t = DECREF(t);

		deflab( retlab );

		i = getlab();	/* label for return area */
#ifndef LCOMM
		printf("	.data\n" );
		printf("	.align	2\n" );
		printf("L%d:	.space	%d\n", i, tsize(t, p->dimoff, p->sizoff)/SZCHAR );
		printf("	.text\n" );
#else
		{ int sz = tsize(t, p->dimoff, p->sizoff) / SZCHAR;
		if (sz % (SZINT/SZCHAR))
			sz += (SZINT/SZCHAR) - (sz % (SZINT/SZCHAR));
		printf("	.lcomm	L%d,%d\n", i, sz);
		}
#endif
		psline();
		printf("	movab	L%d,r1\n", i);

		reached = 1;
		l = block( REG, NIL, NIL, PTR|t, p->dimoff, p->sizoff );
		l->tn.rval = 1;  /* R1 */
		l->tn.lval = 0;  /* no offset */
		r = block( REG, NIL, NIL, PTR|t, p->dimoff, p->sizoff );
		r->tn.rval = 0;  /* R0 */
		r->tn.lval = 0;
		l = buildtree( UNARY MUL, l, NIL );
		r = buildtree( UNARY MUL, r, NIL );
		l = buildtree( ASSIGN, l, r );
		l->in.op = FREE;
		ecomp( l->in.left );
		printf( "	movab	L%d,r0\n", i );
		/* turn off strftn flag, so return sequence will be generated */
		strftn = 0;
		}
	branch( retlab );
	p2bend();
	fdefflag = 0;
	}

int ftlab1, ftlab2;

bfcode( a, n ) int a[]; {
	/* code for the beginning of a function; a is an array of
		indices in stab for the arguments; n is the number */
	register i;
	register temp;
	register struct symtab *p;
	int off;
#ifdef REG_CHAR
	char *toreg();
#endif
	char *rname();

	locctr( PROG );
	p = &stab[curftn];
	printf( "	.align	1\n");
	defnam( p );
	temp = p->stype;
	temp = DECREF(temp);
	strftn = (temp==STRTY) || (temp==UNIONTY);

	retlab = getlab();

	/* routine prolog */

	printf( "	.word	L%d\n", ftnno);
	if (gdebug) {
#ifdef STABDOT
		pstabdot(N_SLINE, lineno);
#else
		pstab(NULLNAME, N_SLINE);
		printf("0,%d,LL%d\n", lineno, labelno);
		printf("LL%d:\n", labelno++);
#endif
	}
	ftlab1 = getlab();
	ftlab2 = getlab();
	printf( "	jbr 	L%d\n", ftlab1);
	printf( "L%d:\n", ftlab2);
	if( proflg ) {	/* profile code */
		i = getlab();
		printf("	pushl	$L%d\n", i);
		printf("	callf	$8,mcount\n");
		printf("	.data\n");
		printf("	.align	2\n");
		printf("L%d:	.long	0\n", i);
		printf("	.text\n");
		psline();
		}

	off = ARGINIT;

	for( i=0; i<n; ++i ){
		p = &stab[a[i]];
		if( p->sclass == REGISTER ){
			temp = p->offset;  /* save register number */
			p->sclass = PARAM;  /* forget that it is a register */
			p->offset = NOOFFSET;
			oalloc( p, &off );
#ifdef REG_CHAR
			printf( "	%s", toreg(p->stype)) );
#else
			printf("	movl");
#endif
			printf( "	%d(fp),%s\n", p->offset/SZCHAR, rname(temp) );
			p->offset = temp;  /* remember register number */
			p->sclass = REGISTER;   /* remember that it is a register */
#ifdef REG_CHAR
			temp = p->stype;
			if( temp==CHAR || temp==SHORT )
				p->stype = INT;
			else if( temp==UCHAR || temp==USHORT )
				p->stype = UNSIGNED;
#endif
			}
		else if( p->stype == STRTY || p->stype == UNIONTY ) {
			p->offset = NOOFFSET;
			if( oalloc( p, &off ) ) cerror( "bad argument" );
			SETOFF( off, ALSTACK );
			}
		else {
			if( oalloc( p, &off ) ) cerror( "bad argument" );
			}

		}
	fdefflag = 1;
	}

bccode(){ /* called just before the first executable statment */
		/* by now, the automatics and register variables are allocated */
	SETOFF( autooff, SZINT );
	/* set aside store area offset */
	p2bbeg( autooff, regvar );
	}

ejobcode( flag ){
	/* called just before final exit */
	/* flag is 1 if errors, 0 if none */
	}

aobeg(){
	/* called before removing automatics from stab */
	}

aocode(p) struct symtab *p; {
	/* called when automatic p removed from stab */
	}

aoend(){
	/* called after removing all automatics from stab */
	}

defnam( p ) register struct symtab *p; {
	/* define the current location as the name p->sname */

	if( p->sclass == EXTDEF ){
		printf( "	.globl	%s\n", exname( p->sname ) );
		}
	if( p->sclass == STATIC && p->slevel>1 ) deflab( p->offset );
	else printf( "%s:\n", exname( p->sname ) );

	}

bycode( t, i ){
#ifdef ASSTRINGS
static	int	lastoctal = 0;
#endif

	/* put byte i+1 in a string */

#ifdef ASSTRINGS

	i &= 077;
	if ( t < 0 ){
		if ( i != 0 )	printf( "\"\n" );
	} else {
		if ( i == 0 ) printf("\t.ascii\t\"");
		if ( t == '\\' || t == '"'){
			lastoctal = 0;
			printf("\\%c", t);
		}
		else if ( t < 040 || t >= 0177 ){
			lastoctal++;
			printf("\\%o",t);
		}
		else if ( lastoctal && '0' <= t && t <= '9' ){
			lastoctal = 0;
			printf("\"\n\t.ascii\t\"%c", t );
		}
		else
		{	
			lastoctal = 0;
			putchar(t);
		}
		if ( i == 077 ) printf("\"\n");
	}
#else

	i &= 07;
	if( t < 0 ){ /* end of the string */
		if( i != 0 ) printf( "\n" );
		}

	else { /* stash byte t into string */
		if( i == 0 ) printf( "	.byte	" );
		else printf( "," );
		printf( "0x%x", t );
		if( i == 07 ) printf( "\n" );
		}
#endif
	}

zecode( n ){
	/* n integer words of zeros */
	OFFSZ temp;
	if( n <= 0 ) return;
	printf( "	.space	%d\n", (SZINT/SZCHAR)*n );
	temp = n;
	inoff += temp*SZINT;
	}

fldal( t ) unsigned t; { /* return the alignment of field of type t */
	uerror( "illegal field type" );
	return( ALINT );
	}

fldty( p ) struct symtab *p; { /* fix up type of field p */
	;
	}

where(c){ /* print location of error  */
	/* c is either 'u', 'c', or 'w' */
	/* GCOS version */
	fprintf( stderr, "%s, line %d: ", ftitle, lineno );
	}


#ifdef REG_CHAR
/* tbl - toreg() returns a pointer to a char string
		  which is the correct  "register move" for the passed type 
 */
struct type_move {TWORD fromtype; char tostrng[8];} toreg_strs[] =
	{
	CHAR, "cvtbl",
	SHORT, "cvtwl",
	UCHAR,	"movzbl",
	USHORT,	"movzwl",
	0, "movl"
	};

char
*toreg(type)
	TWORD type;
{
	struct type_move *p;

	for ( p=toreg_strs; p->fromtype != 0; p++)
		if (p->fromtype == type) return(p->tostrng);

	/* type not found, must be a word type */
	return(p->tostrng);
}
/* tbl */
#endif


main( argc, argv ) char *argv[]; {
#ifdef BUFSTDERR
	char errbuf[BUFSIZ];
	setbuf(stderr, errbuf);
#endif
	return(mainp1( argc, argv ));
	}

struct sw heapsw[SWITSZ];	/* heap for switches */

genswitch(p,n) register struct sw *p;{
	/*	p points to an array of structures, each consisting
		of a constant value and a label.
		The first is >=0 if there is a default label;
		its value is the label number
		The entries p[1] to p[n] are the nontrivial cases
		*/
	register i;
	register CONSZ j;
	register CONSZ unsigned range;
	register dlab, swlab;

	range = p[n].sval-p[1].sval;

	if( range <= 3*n && n>=4 ){ /* implement a direct switch */

		swlab = getlab();
		dlab = p->slab >= 0 ? p->slab : getlab();

		/* already in r0 */
		printf( "	casel	r0,$" );
		printf( CONFMT, p[1].sval );
		printf(",$");
		printf( CONFMT, range);
		printf("\n	.align 1\nL%d:\n", swlab);
		for( i=1,j=p[1].sval; i<=n; j++) {
			printf("	.word	L%d-L%d\n", (j == p[i].sval ? ((j=p[i++].sval), p[i-1].slab) : dlab),
				swlab);
			}

		if( p->slab >= 0 ) branch( dlab );
		else printf("L%d:\n", dlab);
		return;

		}

	if( n>8 ) {	/* heap switch */

		heapsw[0].slab = dlab = p->slab >= 0 ? p->slab : getlab();
		makeheap(p, n, 1);	/* build heap */

		walkheap(1, n);	/* produce code */

		if( p->slab >= 0 )
			branch( dlab );
		else
			printf("L%d:\n", dlab);
		return;
	}

	/* debugging code */

	/* out for the moment
	if( n >= 4 ) werror( "inefficient switch: %d, %d", n, (int) (range/n) );
	*/

	/* simple switch code */

	for( i=1; i<=n; ++i ){
		/* already in r0 */

		printf( "	cmpl	r0,$" );
		printf( CONFMT, p[i].sval );
		printf( "\n	jeql	L%d\n", p[i].slab );
		}

	if( p->slab>=0 ) branch( p->slab );
	}

makeheap(p, m, n)
register struct sw *p;
{
	register int q;

	q = select(m);
	heapsw[n] = p[q];
	if( q>1 ) makeheap(p, q-1, 2*n);
	if( q<m ) makeheap(p+q, m-q, 2*n+1);
}

select(m) {
	register int l,i,k;

	for(i=1; ; i*=2)
		if( (i-1) > m ) break;
	l = ((k = i/2 - 1) + 1)/2;
	return( l + (m-k < l ? m-k : l));
}

walkheap(start, limit)
{
	int label;


	if( start > limit ) return;
	printf( "	cmpl	r0,$" );
	printf( CONFMT, heapsw[start].sval);
	printf("\n	jeql	L%d\n", heapsw[start].slab);
	if( (2*start) > limit ) {
		printf("	jbr 	L%d\n", heapsw[0].slab);
		return;
	}
	if( (2*start+1) <= limit ) {
		label = getlab();
		printf("	jgtr	L%d\n", label);
	} else
		printf("	jgtr	L%d\n", heapsw[0].slab);
	walkheap( 2*start, limit);
	if( (2*start+1) <= limit ) {
		printf("L%d:\n", label);
		walkheap( 2*start+1, limit);
	}
}

Added old/pcc/ccom.tahoe/local.c.

































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
#ifndef lint
static char sccsid[] = "@(#)local.c	1.1 (Berkeley) 01/11/86";
#endif

# include "mfile1"

/*	this file contains code which is dependent on the target machine */

NODE *
clocal(p) register NODE *p; {

	/* this is called to do local transformations on
	   an expression tree preparitory to its being
	   written out in intermediate code.
	*/

	/* the major essential job is rewriting the
	   automatic variables and arguments in terms of
	   REG and OREG nodes */
	/* conversion ops which are not necessary are also clobbered here */
	/* in addition, any special features (such as rewriting
	   exclusive or) are easily handled here as well */

	register struct symtab *q;
	register NODE *r;
	register int o;
	register int m, ml;

	switch( o = p->in.op ){

	case NAME:
		if( p->tn.rval < 0 ) { /* already processed; ignore... */
			return(p);
			}
		q = &stab[p->tn.rval];
		switch( q->sclass ){

		case AUTO:
		case PARAM:
			/* fake up a structure reference */
			r = block( REG, NIL, NIL, PTR+STRTY, 0, 0 );
			r->tn.lval = 0;
			r->tn.rval = STKREG;
			p = stref( block( STREF, r, p, 0, 0, 0 ) );
			break;

		case ULABEL:
		case LABEL:
		case STATIC:
			if( q->slevel == 0 ) break;
			p->tn.lval = 0;
			p->tn.rval = -q->offset;
			break;

		case REGISTER:
			p->in.op = REG;
			p->tn.lval = 0;
			p->tn.rval = q->offset;
#ifdef REG_CHAR
			m = p->in.type;
			if( m==CHAR || m==SHORT )
				p->in.type = INT;
			else if( m==UCHAR || m==USHORT )
				p->in.type = UNSIGNED;
#endif
			break;

			}
		break;

	case LT:
	case LE:
	case GT:
	case GE:
		if( ISPTR( p->in.left->in.type ) || ISPTR( p->in.right->in.type ) ){
			p->in.op += (ULT-LT);
			}
		break;

	case PCONV:
		/* do pointer conversions for char and longs */
		ml = p->in.left->in.type;
		if( ( ml==CHAR || ml==UCHAR || ml==SHORT || ml==USHORT ) && p->in.left->in.op != ICON ) break;

		/* pointers all have the same representation; the type is inherited */

	inherit:
		p->in.left->in.type = p->in.type;
		p->in.left->fn.cdim = p->fn.cdim;
		p->in.left->fn.csiz = p->fn.csiz;
		p->in.op = FREE;
		return( p->in.left );

	case SCONV:
		m = p->in.type;
		ml = p->in.left->in.type;
		if(m == FLOAT || m == DOUBLE) {
			if(p->in.left->in.op==SCONV &&
			 (ml == FLOAT || ml == DOUBLE) &&
			 p->in.left->in.left->in.type==m) {
				p->in.op = p->in.left->in.op = FREE;
				return(p->in.left->in.left);
			}
			if(p->in.left->in.op==FCON)
				goto inherit;
			break;
		}
		if(ml == FLOAT || ml == DOUBLE){
			if (p->in.left->in.op == FCON){
				p->in.left->in.op = FREE;
				p->in.op = ICON;
				p->tn.lval = p->in.left->fpn.dval;
				p->tn.rval = NONAME;
				return(p);
			}
			break;
		}
		/* now, look for conversions downwards */

		if( p->in.left->in.op == ICON ){ /* simulate the conversion here */
			CONSZ val;
			val = p->in.left->tn.lval;
			switch( m ){
			case CHAR:
				p->in.left->tn.lval = (char) val;
				break;
			case UCHAR:
				p->in.left->tn.lval = val & 0XFF;
				break;
			case USHORT:
				p->in.left->tn.lval = val & 0XFFFFL;
				break;
			case SHORT:
				p->in.left->tn.lval = (short)val;
				break;
			case UNSIGNED:
				p->in.left->tn.lval = val & 0xFFFFFFFFL;
				break;
			case INT:
				p->in.left->tn.lval = (int)val;
				break;
				}
			p->in.left->in.type = m;
			}
		else {
			/* meaningful ones are conversion of int to char, int to short,
			   and short to char, and unsigned versions thereof */
			if( m==CHAR || m==UCHAR ){
				if( ml!=CHAR && ml!= UCHAR ) break;
				}
			else if( m==SHORT || m==USHORT ){
				if( ml!=CHAR && ml!=UCHAR && ml!=SHORT && ml!=USHORT ) break;
				}
			}

		/* clobber conversion */
		if( tlen(p) == tlen(p->in.left) ) goto inherit;
		p->in.op = FREE;
		return( p->in.left );  /* conversion gets clobbered */

	case QUEST:	/* the right side should be COLON */
		if((r = p->in.right)->in.op == SCONV) {
			p->in.right = r->in.left;
			p->in.type = r->in.left->in.type;
			r->in.left = p;
			return(r);
		}
		return(p);

	case PVCONV:
	case PMCONV:
		if( p->in.right->in.op != ICON ) cerror( "bad conversion", 0);
		p->in.op = FREE;
		return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) );

	case FLD:
		/* make sure that the second pass does not make the
		   descendant of a FLD operator into a doubly indexed OREG */

		if( p->in.left->in.op == UNARY MUL
				&& (r=p->in.left->in.left)->in.op == PCONV)
			if( r->in.left->in.op == PLUS || r->in.left->in.op == MINUS ) 
				if( ISPTR(r->in.type) ) {
					if( ISUNSIGNED(p->in.left->in.type) )
						p->in.left->in.type = UNSIGNED;
					else
						p->in.left->in.type = INT;
				}
		break;
		case FORTCALL: /* arg must be FLOAT */
			if((r = p->in.right)->in.type != FLOAT)
				p->in.right = clocal(makety(r, FLOAT, 0, FLOAT));
			return(p);
		}

	/* if both sides are FLOAT, so is the op */
	if(optype(o)!=LTYPE && p->in.left->in.type==DOUBLE &&
	 (o==UNARY MINUS || optype(o)==BITYPE && p->in.right->in.type==DOUBLE)) {
		r = p->in.left;
		if(r->in.op==SCONV && r->in.left->in.type==FLOAT) {
			if(optype(o)==BITYPE) {
				r = p->in.right;
				if(r->in.op==SCONV && r->in.left->in.type==FLOAT) {
					r->in.op = FREE;
					p->in.right = r->in.left;
				} else if(r->in.op==FCON)
					r->in.type = FLOAT;
				else
					return(p);
			}
			r = p->in.left;
			p->in.left = r->in.left;
		} else if(optype(o)==BITYPE && r->in.op==FCON) {
			r = p->in.right;
			if(!(r->in.op==SCONV && r->in.left->in.type==FLOAT))
				return(p);
			p->in.right = r->in.left;
			p->in.left->in.type = FLOAT;
		} else
			return(p);
		if(p->in.type==DOUBLE) {
			p->in.type = FLOAT;
			r->in.left = p;
			return(r);
		} else {	/* usually logop */
			r->in.op = FREE;
			return(p);
		}
	}
	return(p);
}

andable( p ) NODE *p; {
	return(1);  /* all names can have & taken on them */
	}

cendarg(){ /* at the end of the arguments of a ftn, set the automatic offset */
	autooff = AUTOINIT;
	}

cisreg( t ) TWORD t; { /* is an automatic variable of type t OK for a register variable */

	if( t==INT || t==UNSIGNED || t==LONG || t==ULONG	/* tbl */
#ifdef REG_CHAR
		|| t==CHAR || t==UCHAR || t==SHORT || t==USHORT		/* tbl */
#endif
		|| ISPTR(t)) return (1);			/* wnj */
	return(0);
	}

NODE *
offcon( off, t, d, s ) OFFSZ off; TWORD t; {

	/* return a node, for structure references, which is suitable for
	   being added to a pointer of type t, in order to be off bits offset
	   into a structure */

	register NODE *p;

	/* t, d, and s are the type, dimension offset, and sizeoffset */
	/* in general they  are necessary for offcon, but not on H'well */

	p = bcon(0);
	p->tn.lval = off/SZCHAR;
	return(p);

	}


static inwd	/* current bit offsed in word */;
static CONSZ word	/* word being built from fields */;

incode( p, sz ) register NODE *p; {

	/* generate initialization code for assigning a constant c
		to a field of width sz */
	/* we assume that the proper alignment has been obtained */
	/* inoff is updated to have the proper final value */
	/* we also assume sz  < SZINT */

	inwd += sz;
	if(inwd > SZINT) cerror("incode: field > int");
	word |= (p->tn.lval&((1L<<sz)-1)) << (SZINT-inwd);
	inoff += sz;
	if(inoff%SZINT == 0) {
		printf( "	.long	0x%08X\n", word);
		word = inwd = 0;
		}
	}

# ifdef PRTDCON
prtdcon( p ) register NODE *p; {
	int i;

	if( p->in.op == FCON ){
		if(p->fpn.dval == 0) {
			p->in.op = ICON;
			p->tn.rval = NONAME;
			return;
		}
		locctr( DATA );
		defalign( ALDOUBLE );
		deflab( i = getlab() );
# ifndef SFCON
		fincode( p->fpn.dval, p->in.type==DOUBLE ? SZDOUBLE : SZFLOAT);
# else
		p->in.type = fincode( p->fpn.dval, 0 );
# endif
		p->tn.lval = 0;
		p->tn.rval = -i;
		p->in.op = NAME;
		}
	}
# endif

fincode( d, sz ) double d; register int sz; {
	/*
	 * output code to initialize space of size sz to the value d
	 * the proper alignment has been obtained
	 * inoff is updated to have the proper final value
	 * this code should be the same for PDP, VAX and Tahoe
	 * SFCON makes use of value to determine type - only where
	 * float<->double conversions are ignored.
	 */

	register struct sh4 {
		unsigned short sh[4];
	} *x;
# ifdef SFCON
	register int type;
# else
	float f;

	if(sz == SZFLOAT) {	/* force rounding */
		f = d;
		d = f;
	}
# endif

	x = (struct sh4 *)&d;
	printf("	.long	0x%04x%04x", x->sh[0], x->sh[1]);
# ifdef SFCON
	if(sz==0)
		if(x->sh[2]==0 && x->sh[3]==0) {
			sz = SZFLOAT;
			type = FLOAT;
		} else {
			sz = SZDOUBLE;
			type = DOUBLE;
		}
# endif
	if(sz == SZDOUBLE) {
		printf(", 0x%04x%04x", x->sh[2], x->sh[3]);
		printf(" # .double %.17g\n", d);
	} else
		printf(" # .float %.8g\n", d);
	inoff += sz;
# ifdef SFCON
	return type;
# endif
	}

cinit( p, sz ) NODE *p; {
	/* arrange for the initialization of p into a space of
	size sz */
	/* the proper alignment has been opbtained */
	/* inoff is updated to have the proper final value */
	ecode( p );
	inoff += sz;
	}

vfdzero( n ){ /* define n bits of zeros in a vfd */

	if( n <= 0 ) return;

	inwd += n;
	inoff += n;
	if( inoff%ALINT ==0 ) {
		printf( "	.long	0x%08X\n", word );
		word = inwd = 0;
		}
	}

char *
exname( p ) char *p; {
	/* make a name look like an external name in the local machine */

#ifndef FLEXNAMES
	static char text[NCHNAM+1];
#else
	static char text[BUFSIZ+1];
#endif

	register int i;

	text[0] = '_';
#ifndef FLEXNAMES
	for( i=1; *p&&i<NCHNAM; ++i ){
#else
	for( i=1; *p; ++i ){
#endif
		text[i] = *p++;
		}

	text[i] = '\0';
#ifndef FLEXNAMES
	text[NCHNAM] = '\0';  /* truncate */
#endif

	return( text );
	}

ctype( type )TWORD type;{ /* map types which are not defined on the local machine */
	switch( BTYPE(type) ){

	case LONG:
		MODTYPE(type,INT);
		break;

	case ULONG:
		MODTYPE(type,UNSIGNED);
		}
	return( type );
	}

noinit() { /* curid is a variable which is defined but
	is not initialized (and not a function );
	This routine returns the stroage class for an uninitialized declaration */

	return(EXTERN);

	}

commdec( id ){ /* make a common declaration for id, if reasonable */
	register struct symtab *q;
	OFFSZ off, tsize();

	q = &stab[id];
	printf( "	.comm	%s,", exname( q->sname ) );
	off = tsize( q->stype, q->dimoff, q->sizoff );
	printf( "%d" /*CONFMT*/, off/SZCHAR );
	printf( "\n" );
	}


isitfloat( s ) char *s; {
	double atof();
	dcon = atof(s);
	return( FCON );
	}

ecode( p ) NODE *p; {

	/* walk the tree and write out the nodes.. */

	if( nerrors ) return;
	p2tree( p );
	p2compile( p );
	}

#ifndef ONEPASS
tlen(p) NODE *p; 
{
	switch(p->in.type) {
		case CHAR:
		case UCHAR:
			return(1);
			
		case SHORT:
		case USHORT:
			return(2);
			
		case DOUBLE:
			return(8);
			
		default:
			return(4);
		}
	}
#endif

Added old/pcc/ccom.tahoe/local2.c.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
#ifndef lint
static char sccsid[] = "@(#)local2.c	1.1 (Berkeley) 01/11/86";
#endif

# include "mfile2"
# include "ctype.h"
# ifdef FORT
int ftlab1, ftlab2;
# endif
/* a lot of the machine dependent parts of the second pass */

# define BITMASK(n) ((1L<<n)-1)

# ifndef ONEPASS
where(c){
	fprintf( stderr, "%s, line %d: ", filename, lineno );
	}
# endif

lineid( l, fn ) char *fn; {
	/* identify line l and file fn */
	printf( "#	line %d, file %s\n", l, fn );
	}

int ent_mask;

eobl2(){
	register OFFSZ spoff;	/* offset from stack pointer */
#ifndef FORT
	extern int ftlab1, ftlab2;
#endif

	spoff = maxoff;
	spoff /= SZCHAR;
	SETOFF(spoff,4);
#ifdef FORT
#ifndef FLEXNAMES
	printf( "	.set	.F%d,%d\n", ftnno, spoff );
#else
	/* SHOULD BE L%d ... ftnno but must change pc/f77 */
	printf( "	.set	LF%d,%d\n", ftnno, spoff );
#endif
	printf( "	.set	LWM%d,0x%x\n", ftnno, ent_mask&0x1ffc|0x1000);
#else
	printf( "	.set	L%d,0x%x\n", ftnno, ent_mask&0x1ffc);
	printf( "L%d:\n", ftlab1);
	if( maxoff > AUTOINIT )
		printf( "	subl3	$%d,fp,sp\n", spoff);
	printf( "	jbr 	L%d\n", ftlab2);
#endif
	ent_mask = 0;
	maxargs = -1;
	}

struct hoptab { int opmask; char * opstring; } ioptab[] = {

	PLUS,	"add",
	MINUS,	"sub",
	MUL,	"mul",
	DIV,	"div",
	MOD,	"div",
	OR,	"or",
	ER,	"xor",
	AND,	"and",
	-1,	""    };

hopcode( f, o ){
	/* output the appropriate string from the above table */

	register struct hoptab *q;

	if(asgop(o))
		o = NOASG o;
	for( q = ioptab;  q->opmask>=0; ++q ){
		if( q->opmask == o ){
			if(f == 'E')
				printf( "e%s", q->opstring);
			else
				printf( "%s%c", q->opstring, tolower(f));
			return;
			}
		}
	cerror( "no hoptab for %s", opst[o] );
	}

char *
rnames[] = {  /* keyed to register number tokens */

	"r0", "r1",
	"r2", "r3", "r4", "r5",
	"r6", "r7", "r8", "r9", "r10", "r11",
	"r12", "fp", "sp", "pc",
	};

/* output register name and update entry mask */
char *
rname(r)
	register int r;
{

	ent_mask |= 1<<r;
	return(rnames[r]);
}

int rstatus[] = {
	SAREG|STAREG, SAREG|STAREG,
	SAREG|STAREG, SAREG|STAREG, SAREG|STAREG, SAREG|STAREG,
	SAREG, SAREG, SAREG, SAREG, SAREG, SAREG,
	SAREG, SAREG, SAREG, SAREG,
	};

tlen(p) NODE *p;
{
	switch(p->in.type) {
		case CHAR:
		case UCHAR:
			return(1);

		case SHORT:
		case USHORT:
			return(2);

		case DOUBLE:
			return(8);

		default:
			return(4);
		}
}

prtype(n) NODE *n;
{
	switch (n->in.type)
		{

		case DOUBLE:
			printf("d");
			return;

		case FLOAT:
			printf("f");
			return;

		case INT:
		case UNSIGNED:
			printf("l");
			return;

		case SHORT:
		case USHORT:
			printf("w");
			return;

		case CHAR:
		case UCHAR:
			printf("b");
			return;

		default:
			if ( !ISPTR( n->in.type ) ) cerror("zzzcode- bad type");
			else {
				printf("l");
				return;
				}
		}
}

zzzcode( p, c ) register NODE *p; {
	register int m;
	int val;
	switch( c ){

	case 'N':  /* logical ops, turned into 0-1 */
		/* use register given by register 1 */
		cbgen( 0, m=getlab(), 'I' );
		deflab( p->bn.label );
		printf( "	clrl	%s\n", rname(getlr( p, '1' )->tn.rval) );
		deflab( m );
		return;

	case 'P':
		cbgen( p->in.op, p->bn.label, c );
		return;

	case 'A':	/* assignment and load (integer only) */
		{
		register NODE *l, *r;

		if (xdebug) eprint(p, 0, &val, &val);
		r = getlr(p, 'R');
		if (optype(p->in.op) == LTYPE || p->in.op == UNARY MUL) {
			l = resc;
			l->in.type = INT;
		} else
			l = getlr(p, 'L');
		if(r->in.type==FLOAT || r->in.type==DOUBLE
		 || l->in.type==FLOAT || l->in.type==DOUBLE)
			cerror("float in ZA");
		if (r->in.op == ICON)
			if(r->in.name[0] == '\0') {
				if (r->tn.lval == 0) {
					printf("clr");
					prtype(l);
					printf("	");
					adrput(l);
					return;
				}
				if (r->tn.lval < 0 && r->tn.lval >= -63) {
					printf("mneg");
					prtype(l);
					r->tn.lval = -r->tn.lval;
					goto ops;
				}
#ifdef MOVAFASTER
			} else {
				printf("movab");
				printf("	");
				acon(r);
				printf(",");
				adrput(l);
				return;
#endif MOVAFASTER
			}

		if (l->in.op == REG) {
			if( tlen(l) < tlen(r) ) {
				!ISUNSIGNED(l->in.type)?
					printf("cvt"):
					printf("movz");
				prtype(l);
				printf("l");
				goto ops;
			} else
				l->in.type = INT;
		}
		if (tlen(l) == tlen(r)) {
			printf("mov");
			prtype(l);
			goto ops;
		} else if (tlen(l) > tlen(r) && ISUNSIGNED(r->in.type))
			printf("movz");
		else
			printf("cvt");
		prtype(r);
		prtype(l);
	ops:
		printf("	");
		adrput(r);
		printf(",");
		adrput(l);
		return;
		}

	case 'B':	/* get oreg value in temp register for shift */
		{
		register NODE *r;
		if (xdebug) eprint(p, 0, &val, &val);
		r = p->in.right;
		if( tlen(r) == sizeof(int) && r->in.type != FLOAT )
			printf("movl");
		else {
			printf(ISUNSIGNED(r->in.type) ? "movz" : "cvt");
			prtype(r);
			printf("l");
			}
		return;
		}

	case 'C':	/* num bytes pushed on arg stack */
		{
		extern int gc_numbytes;
		extern int xdebug;

		if (xdebug) printf("->%d<-",gc_numbytes);

		printf("call%c	$%d",
		 (p->in.left->in.op==ICON && gc_numbytes<60)?'f':'s',
		 gc_numbytes+4);
		/* dont change to double (here's the only place to catch it) */
		if(p->in.type == FLOAT)
			rtyflg = 1;
		return;
		}

	case 'D':	/* INCR and DECR */
		zzzcode(p->in.left, 'A');
		printf("\n	");

	case 'E':	/* INCR and DECR, FOREFF */
 		if (p->in.right->tn.lval == 1)
			{
			printf("%s", (p->in.op == INCR ? "inc" : "dec") );
			prtype(p->in.left);
			printf("	");
			adrput(p->in.left);
			return;
			}
		printf("%s", (p->in.op == INCR ? "add" : "sub") );
		prtype(p->in.left);
		printf("2	");
		adrput(p->in.right);
		printf(",");
		adrput(p->in.left);
		return;

	case 'F':	/* masked constant for fields */
		printf("$%d", (p->in.right->tn.lval&((1<<fldsz)-1))<<fldshf);
		return;

	case 'H':	/* opcode for shift */
		if(p->in.op == LS || p->in.op == ASG LS)
			printf("shll");
		else if(ISUNSIGNED(p->in.left->in.type))
			printf("shrl");
		else
			printf("shar");
		return;

	case 'L':	/* type of left operand */
	case 'R':	/* type of right operand */
		{
		register NODE *n;
		extern int xdebug;

		n = getlr ( p, c);
		if (xdebug) printf("->%d<-", n->in.type);

		prtype(n);
		return;
		}

	case 'M':  /* initiate ediv for mod and unsigned div */
		{
		register char *r;
		m = getlr(p, '1')->tn.rval;
		r = rname(m);
		printf("\tclrl\t%s\n\tmovl\t", r);
		adrput(p->in.left);
		printf(",%s\n", rname(m+1));
		if(!ISUNSIGNED(p->in.type)) { 	/* should be MOD */
			m = getlab();
			printf("\tjgeq\tL%d\n\tmnegl\t$1,%s\n", m, r);
			deflab(m);
		}
		}
		return;

	case 'U':
		/* Truncate int for type conversions:
		    LONG|ULONG -> CHAR|UCHAR|SHORT|USHORT
		    SHORT|USHORT -> CHAR|UCHAR
		   increment offset to correct byte */
		{
		register NODE *p1;
		int dif;

		p1 = p->in.left;
		switch( p1->in.op ){
		case NAME:
		case OREG:
			dif = tlen(p1)-tlen(p);
			p1->tn.lval += dif;
			adrput(p1);
			p1->tn.lval -= dif;
			return;
		default:
			cerror( "Illegal ZU type conversion" );
			return;
			}
		}

	case 'T':	/* rounded structure length for arguments */
		{
		int size;

		size = p->stn.stsize;
		SETOFF( size, 4);
		printf("movab	-%d(sp),sp", size);
		return;
		}

	case 'S':  /* structure assignment */
		{
			register NODE *l, *r;
			register int size;

			if( p->in.op == STASG ){
				l = p->in.left;
				r = p->in.right;

				}
			else if( p->in.op == STARG ){  /* store an arg into a temporary */
				l = getlr( p, '3' );
				r = p->in.left;
				}
			else cerror( "STASG bad" );

			if( r->in.op == ICON ) r->in.op = NAME;
			else if( r->in.op == REG ) r->in.op = OREG;
			else if( r->in.op != OREG ) cerror( "STASG-r" );

			size = p->stn.stsize;

			if( size <= 0 || size > 65535 )
				cerror("structure size <0=0 or >65535");

			switch(size) {
				case 1:
					printf("	movb	");
					break;
				case 2:
					printf("	movw	");
					break;
				case 4:
					printf("	movl	");
					break;
				case 8:
					printf("	movl	");
					upput(r);
					printf(",");
					upput(l);
					printf("\n	movl	");
					break;
				default:
					printf("	movab	");
					adrput(l);
					printf(",r1\n	movab	");
					adrput(r);
					printf(",r0\n	movl	$%d,r2\n	movblk\n", size);
					rname(2);
					goto endstasg;
			}
			adrput(r);
			printf(",");
			adrput(l);
			printf("\n");
		endstasg:
			if( r->in.op == NAME ) r->in.op = ICON;
			else if( r->in.op == OREG ) r->in.op = REG;

			}
		break;

	default:
		cerror( "illegal zzzcode" );
		}
	}

rmove( rt, rs, t ) TWORD t;{
	printf( "	movl	%s,%s\n", rname(rs), rname(rt) );
	if(t==DOUBLE)
		printf( "	movl	%s,%s\n", rname(rs+1), rname(rt+1) );
	}

struct respref
respref[] = {
	INTAREG|INTBREG,	INTAREG|INTBREG,
	INAREG|INBREG,	INAREG|INBREG|SOREG|STARREG|STARNM|SNAME|SCON,
	INTEMP,	INTEMP,
	FORARG,	FORARG,
	INTEMP,	INTAREG|INAREG|INTBREG|INBREG|SOREG|STARREG|STARNM,
	0,	0 };

setregs(){ /* set up temporary registers */
	fregs = 6;	/* tbl- 6 free regs on Tahoe (0-5) */
	}

szty(t) TWORD t;{ /* size, in registers, needed to hold thing of type t */
	return(t==DOUBLE ? 2 : 1 );
	}

rewfld( p ) NODE *p; {
	return(1);
	}

callreg(p) NODE *p; {
	return( R0 );
	}

base( p ) register NODE *p; {
	register int o = p->in.op;

	if( (o==ICON && p->in.name[0] != '\0')) return( 100 ); /* ie no base reg */
	if( o==REG ) return( p->tn.rval );
    if( (o==PLUS || o==MINUS) && p->in.left->in.op == REG && p->in.right->in.op==ICON)
		return( p->in.left->tn.rval );
    if( o==OREG && !R2TEST(p->tn.rval) && (p->in.type==INT || p->in.type==UNSIGNED || ISPTR(p->in.type)) )
		return( p->tn.rval + 0200*1 );
	return( -1 );
	}

offset( p, tyl ) register NODE *p; int tyl; {

	if(tyl > 8) return( -1 );
	if( tyl==1 && p->in.op==REG && (p->in.type==INT || p->in.type==UNSIGNED) ) return( p->tn.rval );
	if( (p->in.op==LS && p->in.left->in.op==REG && (p->in.left->in.type==INT || p->in.left->in.type==UNSIGNED) &&
	      (p->in.right->in.op==ICON && p->in.right->in.name[0]=='\0')
	      && (1<<p->in.right->tn.lval)==tyl))
		return( p->in.left->tn.rval );
	return( -1 );
	}

makeor2( p, q, b, o) register NODE *p, *q; register int b, o; {
	register NODE *t;
	register int i;
	NODE *f;

	p->in.op = OREG;
	f = p->in.left; 	/* have to free this subtree later */

	/* init base */
	switch (q->in.op) {
		case ICON:
		case REG:
		case OREG:
			t = q;
			break;

		case MINUS:
			q->in.right->tn.lval = -q->in.right->tn.lval;
		case PLUS:
			t = q->in.right;
			break;

		case UNARY MUL:
			t = q->in.left->in.left;
			break;

		default:
			cerror("illegal makeor2");
	}

	p->tn.lval = t->tn.lval;
#ifndef FLEXNAMES
	for(i=0; i<NCHNAM; ++i)
		p->in.name[i] = t->in.name[i];
#else
	p->in.name = t->in.name;
#endif

	/* init offset */
	p->tn.rval = R2PACK( (b & 0177), o, (b>>7) );

	tfree(f);
	return;
	}

canaddr( p ) NODE *p; {
	register int o = p->in.op;

	if( o==NAME || o==REG || o==ICON || o==OREG || (o==UNARY MUL && shumul(p->in.left)) ) return(1);
	return(0);
	}

shltype( o, p ) register NODE *p; {
	return( o== REG || o == NAME || o == ICON || o == OREG || ( o==UNARY MUL && shumul(p->in.left)) );
	}

flshape( p ) NODE *p; {
	register int o = p->in.op;

	if( o==NAME || o==REG || o==ICON || o==OREG || (o==UNARY MUL && shumul(p->in.left)) ) return(1);
	return(0);
	}

shtemp( p ) register NODE *p; {
	if( p->in.op == STARG ) p = p->in.left;
	return( p->in.op==NAME || p->in.op ==ICON || p->in.op == OREG || (p->in.op==UNARY MUL && shumul(p->in.left)) );
	}

shumul( p ) register NODE *p; {
	register int o;
	extern int xdebug;

	if (xdebug) {
		 printf("\nshumul:op=%d,lop=%d,rop=%d", p->in.op, p->in.left->in.op, p->in.right->in.op);
		printf(" prname=%s,plty=%d, prlval=%D\n", p->in.right->in.name, p->in.left->in.type, p->in.right->tn.lval);
		}

	o = p->in.op;
	if(( o == NAME || (o == OREG && !R2TEST(p->tn.rval)) || o == ICON )
	 && p->in.type != PTR+DOUBLE)
		return( STARNM );

	return( 0 );
	}

special( p, shape ) register NODE *p; {
	if( shape==SIREG && p->in.op == OREG && R2TEST(p->tn.rval) ) return(1);
	else return(0);
}

adrcon( val ) CONSZ val; {
	printf( "$" );
	printf( CONFMT, val );
	}

conput( p ) register NODE *p; {
	switch( p->in.op ){

	case ICON:
		acon( p );
		return;

	case REG:
		printf( "%s", rname(p->tn.rval) );
		return;

	default:
		cerror( "illegal conput" );
		}
	}

insput( p ) NODE *p; {
	cerror( "insput" );
	}

upput( p ) register NODE *p; {
	/* output the address of the second long in the
	   pair pointed to by p (for DOUBLEs)*/
	CONSZ save;

	if( p->in.op == FLD ){
		p = p->in.left;
		}
	switch( p->in.op ){

	case NAME:
	case OREG:
		save = p->tn.lval;
		p->tn.lval += SZLONG/SZCHAR;
		adrput(p);
		p->tn.lval = save;
		return;

	case REG:
		printf( "%s", rname(p->tn.rval+1) );
		return;

	default:
		cerror( "illegal upper address" );
		}
	}

adrput( p ) register NODE *p; {
	register int r;
	/* output an address, with offsets, from p */

	if( p->in.op == FLD ){
		p = p->in.left;
		}
	switch( p->in.op ){

	case NAME:
		acon( p );
		return;

	case ICON:
		/* addressable value of the constant */
		printf( "$" );
		acon( p );
		return;

	case REG:
		printf( "%s", rname(p->tn.rval) );
		if(p->in.type == DOUBLE)	/* for entry mask */
			(void) rname(p->tn.rval+1);
		return;

	case OREG:
		r = p->tn.rval;
		if( R2TEST(r) ){ /* double indexing */
			register int flags;

			flags = R2UPK3(r);
			if( flags & 1 ) printf("*");
			if( p->tn.lval != 0 || p->in.name[0] != '\0' ) acon(p);
			if( R2UPK1(r) != 100) printf( "(%s)", rname(R2UPK1(r)) );
			printf( "[%s]", rname(R2UPK2(r)) );
			return;
			}
		if( r == FP && p->tn.lval > 0 ){  /* in the argument region */
			if( p->in.name[0] != '\0' ) werror( "bad arg temp" );
			printf( CONFMT, p->tn.lval );
			printf( "(fp)" );
			return;
			}
		if( p->tn.lval != 0 || p->in.name[0] != '\0') acon( p );
		printf( "(%s)", rname(p->tn.rval) );
		return;

	case UNARY MUL:
		/* STARNM or STARREG found */
		if( tshape(p, STARNM) ) {
			printf( "*" );
			adrput( p->in.left);
			}
		return;

	default:
		cerror( "illegal address" );
		return;

		}

	}

acon( p ) register NODE *p; { /* print out a constant */

	if( p->in.name[0] == '\0' ){
		printf( CONFMT, p->tn.lval);
		}
	else if( p->tn.lval == 0 ) {
#ifndef FLEXNAMES
		printf( "%.8s", p->in.name );
#else
		printf( "%s", p->in.name );
#endif
		}
	else {
#ifndef FLEXNAMES
		printf( "%.8s+", p->in.name );
#else
		printf( "%s+", p->in.name );
#endif
		printf( CONFMT, p->tn.lval );
		}
	}

genscall( p, cookie ) register NODE *p; {
	/* structure valued call */
	return( gencall( p, cookie ) );
	}

genfcall( p, cookie ) register NODE *p; {
	register NODE *p1;
	register int m;
	static char *funcops[6] = {
		"sin", "cos", "sqrt", "exp", "log", "atan"
	};

	/* generate function opcodes */
	if(p->in.op==UNARY FORTCALL && p->in.type==FLOAT &&
	 (p1 = p->in.left)->in.op==ICON &&
	 p1->tn.lval==0 && p1->in.type==INCREF(FTN|FLOAT)) {
#ifdef FLEXNAMES
		p1->in.name++;
#else
		strcpy(p1->in.name, p1->in.name[1]);
#endif
		for(m=0; m<6; m++)
			if(!strcmp(p1->in.name, funcops[m]))
				break;
		if(m >= 6)
			uerror("no opcode for fortarn function %s", p1->in.name);
	} else
		uerror("illegal type of fortarn function");
	p1 = p->in.right;
	p->in.op = FORTCALL;
	if(!canaddr(p1))
		order( p1, INAREG|INBREG|SOREG|STARREG|STARNM );
	m = match( p, INTAREG|INTBREG );
	return(m != MDONE);
}

/* tbl */
int gc_numbytes;
/* tbl */

gencall( p, cookie ) register NODE *p; {
	/* generate the call given by p */
	register NODE *p1, *ptemp;
	register int temp, temp1;
	register int m;

	if( p->in.right ) temp = argsize( p->in.right );
	else temp = 0;

	if( p->in.op == STCALL || p->in.op == UNARY STCALL ){
		/* set aside room for structure return */

		if( p->stn.stsize > temp ) temp1 = p->stn.stsize;
		else temp1 = temp;
		}

	if( temp > maxargs ) maxargs = temp;
	SETOFF(temp1,4);

	if( p->in.right ){ /* make temp node, put offset in, and generate args */
		ptemp = talloc();
		ptemp->in.op = OREG;
		ptemp->tn.lval = -1;
		ptemp->tn.rval = SP;
#ifndef FLEXNAMES
		ptemp->in.name[0] = '\0';
#else
		ptemp->in.name = "";
#endif
		ptemp->in.rall = NOPREF;
		ptemp->in.su = 0;
		genargs( p->in.right, ptemp );
		ptemp->in.op = FREE;
		}

	p1 = p->in.left;
	if( p1->in.op != ICON ){
		if( p1->in.op != REG ){
			if( p1->in.op != OREG || R2TEST(p1->tn.rval) ){
				if( p1->in.op != NAME ){
					order( p1, INAREG );
					}
				}
			}
		}

/* tbl
	setup gc_numbytes so reference to ZC works */

	gc_numbytes = temp&(0x3ff);

	p->in.op = UNARY CALL;
	m = match( p, INTAREG|INTBREG );

	return(m != MDONE);
	}

/* tbl */
char *
ccbranches[] = {
	"eql",
	"neq",
	"leq",
	"lss",
	"geq",
	"gtr",
	"lequ",
	"lssu",
	"gequ",
	"gtru",
	};
/* tbl */

cbgen( o, lab, mode ) { /*   printf conditional and unconditional branches */

		if(o != 0 && (o < EQ || o > UGT ))
			cerror( "bad conditional branch: %s", opst[o] );
		printf( "	j%s	L%d\n",
		 o == 0 ? "br" : ccbranches[o-EQ], lab );
	}

nextcook( p, cookie ) NODE *p; {
	/* we have failed to match p with cookie; try another */
	if( cookie == FORREW ) return( 0 );  /* hopeless! */
	if( !(cookie&(INTAREG|INTBREG)) ) return( INTAREG|INTBREG );
	if( !(cookie&INTEMP) && asgop(p->in.op) ) return( INTEMP|INAREG|INTAREG|INTBREG|INBREG );
	return( FORREW );
	}

lastchance( p, cook ) NODE *p; {
	/* forget it! */
	return(0);
	}

optim2( p ) register NODE *p; {
# ifdef ONEPASS
	/* do local tree transformations and optimizations */
# define RV(p) p->in.right->tn.lval
	register int o = p->in.op;
	register int i;

	/* change unsigned mods and divs to logicals (mul is done in mip & c2) */
	if(optype(o) == BITYPE && ISUNSIGNED(p->in.left->in.type)
	 && nncon(p->in.right) && (i=ispow2(RV(p)))>=0){
		switch(o) {
		case DIV:
		case ASG DIV:
			p->in.op = RS;
			RV(p) = i;
			break;
		case MOD:
		case ASG MOD:
			p->in.op = AND;
			RV(p)--;
			break;
		default:
			return;
		}
		if(asgop(o))
			p->in.op = ASG p->in.op;
	}
# endif
}

struct functbl {
	int fop;
	char *func;
} opfunc[] = {
	DIV,		"udiv", 
	ASG DIV,	"udiv", 
	0
};

hardops(p)  register NODE *p; {
	/* change hard to do operators into function calls.  */
	register NODE *q;
	register struct functbl *f;
	register int o;
	register TWORD t, t1, t2;

	o = p->in.op;

	for( f=opfunc; f->fop; f++ ) {
		if( o==f->fop ) goto convert;
	}
	return;

	convert:
	t = p->in.type;
	t1 = p->in.left->in.type;
	t2 = p->in.right->in.type;
	if ( t1 != UNSIGNED && (t2 != UNSIGNED)) return;

	/* need to rewrite tree for ASG OP */
	/* must change ASG OP to a simple OP */
	if( asgop( o ) ) {
		q = talloc();
		q->in.op = NOASG ( o );
		q->in.rall = NOPREF;
		q->in.type = p->in.type;
		q->in.left = tcopy(p->in.left);
		q->in.right = p->in.right;
		p->in.op = ASSIGN;
		p->in.right = q;
		zappost(q->in.left); /* remove post-INCR(DECR) from new node */
		fixpre(q->in.left);	/* change pre-INCR(DECR) to +/-	*/
		p = q;

	}
	/* turn logicals to compare 0 */
	else if( logop( o ) ) {
		ncopy(q = talloc(), p);
		p->in.left = q;
		p->in.right = q = talloc();
		q->in.op = ICON;
		q->in.type = INT;
#ifndef FLEXNAMES
		q->in.name[0] = '\0';
#else
		q->in.name = "";
#endif
		q->tn.lval = 0;
		q->tn.rval = 0;
		p = p->in.left;
	}

	/* build comma op for args to function */
	t1 = p->in.left->in.type;
	t2 = 0;
	if ( optype(p->in.op) == BITYPE) {
		q = talloc();
		q->in.op = CM;
		q->in.rall = NOPREF;
		q->in.type = INT;
		q->in.left = p->in.left;
		q->in.right = p->in.right;
		t2 = p->in.right->in.type;
	} else
		q = p->in.left;

	p->in.op = CALL;
	p->in.right = q;

	/* put function name in left node of call */
	p->in.left = q = talloc();
	q->in.op = ICON;
	q->in.rall = NOPREF;
	q->in.type = INCREF( FTN + p->in.type );
#ifndef FLEXNAMES
		strcpy( q->in.name, f->func );
#else
		q->in.name = f->func;
#endif
	q->tn.lval = 0;
	q->tn.rval = 0;

	}

zappost(p) NODE *p; {
	/* look for ++ and -- operators and remove them */

	register int o, ty;
	register NODE *q;
	o = p->in.op;
	ty = optype( o );

	switch( o ){

	case INCR:
	case DECR:
			q = p->in.left;
			p->in.right->in.op = FREE;  /* zap constant */
			ncopy( p, q );
			q->in.op = FREE;
			return;

		}

	if( ty == BITYPE ) zappost( p->in.right );
	if( ty != LTYPE ) zappost( p->in.left );
}

fixpre(p) NODE *p; {

	register int o, ty;
	o = p->in.op;
	ty = optype( o );

	switch( o ){

	case ASG PLUS:
			p->in.op = PLUS;
			break;
	case ASG MINUS:
			p->in.op = MINUS;
			break;
		}

	if( ty == BITYPE ) fixpre( p->in.right );
	if( ty != LTYPE ) fixpre( p->in.left );
}

NODE * addroreg(l) NODE *l;
				/* OREG was built in clocal()
				 * for an auto or formal parameter
				 * now its address is being taken
				 * local code must unwind it
				 * back to PLUS/MINUS REG ICON
				 * according to local conventions
				 */
{
	cerror("address of OREG taken");
}

# ifndef ONEPASS
main( argc, argv ) char *argv[]; {
	return( mainp2( argc, argv ) );
	}
# endif

myreader(p) register NODE *p; {
	walkf( p, hardops );	/* convert ops to function calls */
	canon( p );		/* expands r-vals for fileds */
	walkf( p, optim2 );
	}

Added old/pcc/ccom.vax/DEBUGS.

















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Copyright (c) 1985 Regents of the University of California.
All rights reserved.  The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

	@(#)DEBUGS	5.1 (Berkeley) 01/08/86

WHAT THE DEBUG FLAGS MEAN:

Debug flags preceded with an X are first pass flags; the rest are
second pass flags.

-Xa:	Print the actions taken for each operator as parse trees are
	assembled, from buildtree().

-Xb:	Extra information from buildtree() on parse tree assembly.  May
	be used to increase the information from -Xa.

-Xd:	Print information about declarations, from many places in pftn.c.
	May be repeated to get still more information.

-Xi:	Information about initializations, from several places in pftn.c.

-a:	From rallo(), print the address of the tree being worked on for
	the purpose of allocating registers, and indicate what this
	tree's requirements have been determined to be.

-e:	Print the expression tree at useful places, e.g. when an
	expression appears in the intermediate code file as a
	statement, or just before store() is called in codgen().

-l:	Print line number and file name at the end of every statement.

-o:	Print the expression tree when order() is called, and whenever
	the loop in order() takes us to the top after a rewrite.  Also
	prints the tree with extra info when a rewrite is forced due
	lack of a matching template.

-r:	Identify the register being worked on and what's in it and
	sometimes why it's being worked on, from rfree(), rbusy() and
	reclaim().

-s:	From tshape(), print the address of the given node and the
	shape that it's being tested against.  The opcode for the node
	is also printed.

-t:	From ttype(), print the node type and the type template which
	the node is being tested against.

-u:	Previously used to debug the Sethi-Ullman algorithm, currently
	defunct.

-v:	Report on multi-level tree matching.  Very verbose.

-x:	Prints intermediate code instructions in mainp2(); also used to
	debug zzzcode(), the routine that does specialized template
	interpretation.

Added old/pcc/ccom.vax/INFO.

























































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Copyright (c) 1985 Regents of the University of California.
All rights reserved.  The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

	@(#)INFO	5.1 (Berkeley) 01/08/86

HOW TO INTERPRET TEMPLATES:

Goals (represented by 'visit' fields) indicate the shape of what is
produced by using a template:

	Goal		Form of result

	FOREFF		Can be used for just side effects.  Used for things
			like initializing data, or gotos.
	INAREG		Result can end up in a register.
	INTAREG		Result can end up in a scratch register.
	INBREG		Result can end up in an index, address or floating
			point register -- not used on the VAX.
	INTBREG		The same except for temporary index registers.
	FORCC		Condition codes are set.
	INTEMP		Computes into a temporary location.
	FORARG		Computes a function argument onto the stack.
	FORREW		Forces the code generator to rewrite the tree.

Shapes are restrictions on operands:

	Shape		Form of operand

	SANY		Anything.

	SAREG		A register.
	STAREG		A temporary register (one that can be stomped on).
	SBREG		A secondary register -- not used on the VAX.
	STBREG		Ditto except this a temporary register.

	SCON		An int (32-bit or smaller) constant.
	SCCON		A short (16-bit) constant.
	SSCON		A char (8-bit) constant.
	SZERO		The constant 0.
	SONE		The constant 1.
	SMONE		The constant -1.

	SCC		Condition codes.

	SNAME		A constant address; not on the stack or indirect
			through a pointer.

	SFLD		A bit field.

	SOREG		A value whose address is the sum of a register and an
			offset.  E.g. 8(ap).
	SSOREG		A 'simple' OREG: not a pointer (e.g. rules out *8(ap)).
	SWADD		A value with an offset that is larger than a byte.
	STARNM		A value whose address is at some known address.
			An indirect value.  E.g. *_a, *8(ap).
	STARREG		Indirect through a register with auto-increment or
			-decrement.

Types restrict the type of an operand.  There are two ways of
representing types in the compiler; one is a specific type that
indicates things like indirection, and the other is used as a template
for the first.  To see whether a type matches a template, you call
ttype().  The template variety is what you see in code templates, and
has its own typedef, TWORD.  Here are some things you can ask for in
the way of type templates:

	Name		What it buys you

	TANY		Matches anything 'within reason'.

	TCHAR		Chars.
	TUCHAR		Unsigned chars.
	TSHORT		Shorts.
	TUSHORT		Unsigned shorts.
	TINT		Ints.
	TLONG		Longs.  (VAX ints.)
	TULONG		Unsigned longs.
	TUNSIGNED	Any unsigned type.
	TWORD		An integral type the size of an int, or a pointer.

	TFLOAT		Floats.
	TDOUBLE		Doubles.

	TSTRUCT		Structures or unions.

	TPTRTO		A pointer.  This must be or'ed in with other types;
			e.g.  TPTRTO|TFLOAT|TDOUBLE matches pointers to floats
			or pointers to doubles.  Can be multiply indirect.
	TPOINT		Complex types -- things with stars or brackets or etc.

	WPTR		Pointer to anything except structures/unions.
	ANYSIGNED	Pointers or signed integral types.
	ANYUSIGNED	Any unsigned integral type.
	ANYFIXED	Any integral type (excludes floating point or structs).

The template may request special resources.  These are indicated by
things in the needs field of a template:

	Needs		Resource wanted

	NAREG		Needs a register.  Can be multiplied up to 4 times
			to get up to 4 registers.
	NBREG		Ditto for secondary registers (not used on the VAX).
	NASL		Can share a register with the left operand.
	NASR		Can share a register with the right operand.
	NTEMP		Needs stack space.  Can be multiplied up to 8 times.
	EITHER		Don't settle for some of A and some of B.

The template indicates where the results end up, too.  The symbols in the
rewrite field have the following meanings:

	Result		Where the result is

	RNULL		Don't care about the result -- clobber it.
	RLEFT		Register associated with the left operand.
	RRIGHT		Register associated with the right operand.
	RESC1		First register requested by 'needs'.
	RESC2		Second register requested by 'needs'.
	RESC3		Third register requested by 'needs'.
	RESCC		The condition codes.
	RNOP		Doesn't make anything -- e.g. initializations, gotos.

The assembly language templates contain capital letter abbreviations
which are expanded in context to whatever is useful.  These
abbreviations may be 1, 2 or 3 characters long; the first character
codes for the length and generally tells what to do.  A standard second
or third character often indicates the location of an object in the
following way:

	Modifier	Meaning

	L		Left operand.
	R		Right operand
	1, 2, 3		Nth requested register (from 'needs').

Below are the various abbreviations; 'n' is used to indicate one of the
standard modifiers:

	Abbreviation	Rewrites as

	An		Address of operand n -- the most common abbreviation.
			Produces register names, externals, almost everything.
	Bn		Byte offset in a word (? -- not used on VAX).
	Cn		Only constants may be written this way.
	F		The rest of the line is ignored if this value is
			only being computed for side effects.
	H		Field shift; used with masks and bit fields.
	In		Illegal -- not currently used.
	L		A label.
	M		Field mask.
	N		Field mask, complemented.
	O[BWLFD]	Opcode string; used to rewrite operands of templates
			with generic opcodes like add, sub, mul.  The modifier
			is changed to lower case and appended.  For example if
			the template is OPFLOAT, the abbreviation is 'OD2' and
			the current node's operand is OPMUL, you get 'muld2'.
	S		Field size.
	T		Rewriting of the register type is suppressed.  I'm not
			sure what's going on but here's the explanation:  'The C
			language requires intermediate results to change type.
			This is inefficient or impossible on some machines; the
			"T" command in match supresses this type changing.'
	Un		Illegal -- not currently used.
	Zx		Local abbreviations (zzzcode()).  The x's are spelled
			out below:
	ZA		Used for straightforward conversions and assignments.
			Clever perhaps to excess in its coding.
	ZB		Gets difficult shapes into register prior to a shift.
	ZC		Interpolates the argument count in a function call.
	ZD		Get the value of the operand, then increment or
			decrement the original, depending on the opcode.
	ZE		Increment or decrement the operand.
	ZF		Produces 'd', 'f' or 'l' depending on whether the
			right operand (the node itself, for unary operators)
			is double, float or long; used for moves into register.
	ZI		Produces the appropriate conditional branch.
	ZL		Opcode type [bwlfd] for the left operand.
	ZN		Produces a jump and a clear to get logical values
			converted into 0 or 1.
	ZP		Just like ZI.
	ZR		Opcode type [bwlfd] for the right operand.
	ZS		Generates a structure assignment.
	ZT		Rounds up structure lengths for struct arguments.
	ZU		Subtracts the value of the constant right operand from
			32 and uses that for unsigned right shift offsets.
	ZZ		Complements the value of the constant right operand of
			a bit instruction and produces it.

Changes to old/pcc/ccom.vax/local2.c.

1
2
3
4
5
6
7
8
9
# ifndef lint
static char *sccsid ="@(#)local2.c	1.12 (Berkeley) 08/23/85";
# endif

# include "pass2.h"
# include "ctype.h"
# ifdef FORT
int ftlab1, ftlab2;
# endif

|







1
2
3
4
5
6
7
8
9
# ifndef lint
static char *sccsid ="@(#)local2.c	1.13 (Berkeley) 01/08/86";
# endif

# include "pass2.h"
# include "ctype.h"
# ifdef FORT
int ftlab1, ftlab2;
# endif
303
304
305
306
307
308
309




































310
311
312
313
314
315
316
				adrput(x);
				putchar('\n');
				putchar('\t');
				r = x;
				}
			l->in.type = (ISUNSIGNED(l->in.type) ? UNSIGNED : INT);
			}





































		if (!mixtypes(l,r)) {
			if (tlen(l) == tlen(r)) {
				putstr("mov");
#ifdef FORT
				if (Oflag)
					prtype(l);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
				adrput(x);
				putchar('\n');
				putchar('\t');
				r = x;
				}
			l->in.type = (ISUNSIGNED(l->in.type) ? UNSIGNED : INT);
			}

		if ((r->in.type == UNSIGNED || r->in.type == ULONG) &&
		    mixtypes(l, r)) {
			int label1, label2;

			label1 = getlab();
			label2 = getlab();

			putstr("movl\t");
			adrput(r);
			putchar(',');
			adrput(l);
			putstr("\n\tbbsc\t$31,");
			adrput(l);
			printf(",L%d\n\tcvtl", label1);
			prtype(l);
			putchar('\t');
			adrput(l);
			putchar(',');
			adrput(l);
			printf("\n\tjbr\tL%d\nL%d:\n\tcvtl", label2, label1);
			prtype(l);
			putchar('\t');
			adrput(l);
			putchar(',');
			adrput(l);
			putstr("\n\tadd");
			prtype(l);
			putstr("2\t$0");
			prtype(l);
			putstr("2.147483648e9,");
			adrput(l);
			printf("\nL%d:", label2);

			return;
			}

		if (!mixtypes(l,r)) {
			if (tlen(l) == tlen(r)) {
				putstr("mov");
#ifdef FORT
				if (Oflag)
					prtype(l);
339
340
341
342
343
344
345

































346
347
348
349
350
351
352
	ops:
		putchar('\t');
		adrput(r);
		putchar(',');
		adrput(l);
		return;
		}


































	case 'B':	/* get oreg value in temp register for left shift */
		{
		register NODE *r;
		if (xdebug) eprint(p, 0, &val, &val);
		r = p->in.right;
		if( tlen(r) == sizeof(int) && r->in.type != FLOAT )







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
	ops:
		putchar('\t');
		adrput(r);
		putchar(',');
		adrput(l);
		return;
		}

	case 'G':	/* i *= f; asgops with int lhs and float rhs */
		{
		register NODE *l, *r, *s;
		int rt;

		l = p->in.left;
		r = p->in.right;
		s = talloc();
		rt = r->in.type;

		s->in.op = SCONV;
		s->in.left = l;
		s->in.type = rt;
		zzzcode(s, 'A');
		putstr("\n\t");

		hopcode(rt == FLOAT ? 'F' : 'D', p->in.op);
		putstr("2\t");
		adrput(r);
		putchar(',');
		adrput(resc);
		putstr("\n\t");

		s->in.op = ASSIGN;
		s->in.left = l;
		s->in.right = resc;
		s->in.type = l->in.type;
		zzzcode(s, 'A');

		s->in.op = FREE;
		return;
		}

	case 'B':	/* get oreg value in temp register for left shift */
		{
		register NODE *r;
		if (xdebug) eprint(p, 0, &val, &val);
		r = p->in.right;
		if( tlen(r) == sizeof(int) && r->in.type != FLOAT )
1073
1074
1075
1076
1077
1078
1079



1080
1081
1082
1083
1084
1085
1086
#if defined(FORT) || defined(SPRECC)
		if( p->in.type == FLOAT || p->in.type == DOUBLE ||
		    l->in.type == FLOAT || l->in.type == DOUBLE )
			return;
#else
		if( mixtypes(p, l) ) return;
#endif



		/* Only trust it to get it right if the size is the same */
		if( tlen(p) != tlen(l) )
			return;

		/* clobber conversion */
		if( l->in.op != FLD )
			l->in.type = p->in.type;







>
>
>







1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
#if defined(FORT) || defined(SPRECC)
		if( p->in.type == FLOAT || p->in.type == DOUBLE ||
		    l->in.type == FLOAT || l->in.type == DOUBLE )
			return;
#else
		if( mixtypes(p, l) ) return;
#endif
		if( l->in.op == PCONV )
			return;

		/* Only trust it to get it right if the size is the same */
		if( tlen(p) != tlen(l) )
			return;

		/* clobber conversion */
		if( l->in.op != FLD )
			l->in.type = p->in.type;

Changes to old/pcc/ccom.vax/order.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)order.c	1.6 (Berkeley) 04/02/85";
#endif lint

# include "pass2.h"

int maxargs = { -1 };

stoasg( p, o ) register NODE *p; {

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)order.c	1.7 (Berkeley) 01/08/86";
#endif lint

# include "pass2.h"

int maxargs = { -1 };

stoasg( p, o ) register NODE *p; {
446
447
448
449
450
451
452

453
454
455
456
457
458
459
	printf( "L%d:\n", l );
	}

genargs( p ) register NODE *p; {
	register NODE *pasg;
	register align;
	register size;


	/* generate code for the arguments */

	/*  first, do the arguments on the right */
	while( p->in.op == CM ){
		genargs( p->in.right );
		p->in.op = FREE;







>







446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
	printf( "L%d:\n", l );
	}

genargs( p ) register NODE *p; {
	register NODE *pasg;
	register align;
	register size;
	int count;

	/* generate code for the arguments */

	/*  first, do the arguments on the right */
	while( p->in.op == CM ){
		genargs( p->in.right );
		p->in.op = FREE;
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483

484
485
486
487
488
489
490
			p->in.op = FREE;
			p = p->in.left;
			}
		else {
			/* make it look beautiful... */
			p->in.op = UNARY MUL;
			canon( p );  /* turn it into an oreg */
			if( p->in.op != OREG ){
				offstar( p->in.left );
				canon( p );
				if( p->in.op != OREG ){
					offstar( p->in.left );
					canon( p );
					if( p->in.op != OREG ) cerror( "stuck starg" );
					}
				}

			}

		pasg = talloc();
		pasg->in.op = STARG;
		pasg->in.rall = NOPREF;
		pasg->stn.stsize = size;
		pasg->stn.stalign = align;







|


<
<
<
<
|
<
>







469
470
471
472
473
474
475
476
477
478




479

480
481
482
483
484
485
486
487
			p->in.op = FREE;
			p = p->in.left;
			}
		else {
			/* make it look beautiful... */
			p->in.op = UNARY MUL;
			canon( p );  /* turn it into an oreg */
			for( count = 0; p->in.op != OREG && count < 10; ++count ){
				offstar( p->in.left );
				canon( p );




				}

			if( p->in.op != OREG ) cerror( "stuck starg" );
			}

		pasg = talloc();
		pasg->in.op = STARG;
		pasg->in.rall = NOPREF;
		pasg->stn.stsize = size;
		pasg->stn.stalign = align;

Changes to old/pcc/ccom.vax/table.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)table.c	1.12 (Berkeley) 12/10/85";
#endif lint

# include "pass2.h"

# define WPTR TPTRTO|TINT|TLONG|TFLOAT|TDOUBLE|TPOINT|TUNSIGNED|TULONG
# define AWD SNAME|SOREG|SCON|STARNM|STARREG
/* tbl */

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)table.c	1.13 (Berkeley) 01/08/86";
#endif lint

# include "pass2.h"

# define WPTR TPTRTO|TINT|TLONG|TFLOAT|TDOUBLE|TPOINT|TUNSIGNED|TULONG
# define AWD SNAME|SOREG|SCON|STARNM|STARREG
/* tbl */
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SCONV,	INTAREG|FORCC,
	SAREG|AWD,	TDOUBLE,
	SANY,	TFLOAT,
		NAREG|NASL,	RESC1|RESCC,
		"	cvtdf	AL,A1\n",

SCONV,	INTAREG|FORCC,
	SAREG|AWD,	ANYSIGNED|TUNSIGNED|TULONG,
	SANY,	TFLOAT,
		NAREG|NASL,	RESC1|RESCC,
		"	cvtZLf	AL,TA1\n",

SCONV,	INTAREG|FORCC,
	SAREG|AWD,	TUCHAR|TUSHORT,
	SANY,	TFLOAT,







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SCONV,	INTAREG|FORCC,
	SAREG|AWD,	TDOUBLE,
	SANY,	TFLOAT,
		NAREG|NASL,	RESC1|RESCC,
		"	cvtdf	AL,A1\n",

SCONV,	INTAREG|FORCC,
	SAREG|AWD,	ANYSIGNED,
	SANY,	TFLOAT,
		NAREG|NASL,	RESC1|RESCC,
		"	cvtZLf	AL,TA1\n",

SCONV,	INTAREG|FORCC,
	SAREG|AWD,	TUCHAR|TUSHORT,
	SANY,	TFLOAT,
746
747
748
749
750
751
752










753
754
755
756
757
758
759
		"	cvtfd	AR,A1\n	OD2	A1,AL\n",

ASG OPFLOAT,	INAREG|INTAREG|FOREFF|FORCC,
	SAREG|AWD,	TFLOAT,
	SAREG|AWD,	TDOUBLE,
		NAREG,	RLEFT|RESC1|RESCC,
		"	cvtfd	AL,A1\n	OD2	AR,A1\n	cvtdf	A1,AL\n",











OPFLOAT,	INAREG|INTAREG|FORCC,
	STAREG,	TDOUBLE,
	SAREG|AWD,	TDOUBLE,
		0,	RLEFT|RESCC,
		"	OD2	AR,AL\n",








>
>
>
>
>
>
>
>
>
>







746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
		"	cvtfd	AR,A1\n	OD2	A1,AL\n",

ASG OPFLOAT,	INAREG|INTAREG|FOREFF|FORCC,
	SAREG|AWD,	TFLOAT,
	SAREG|AWD,	TDOUBLE,
		NAREG,	RLEFT|RESC1|RESCC,
		"	cvtfd	AL,A1\n	OD2	AR,A1\n	cvtdf	A1,AL\n",

ASG OPFLOAT,	INAREG|FOREFF|FORCC,
	SAREG|AWD,	ANYFIXED,
#ifndef SPRECC
	SAREG|AWD,	TDOUBLE,		/* force FLOAT to register */
#else
	SAREG|AWD,	TFLOAT|TDOUBLE,
#endif
		NAREG,	RLEFT|RESCC,	/* usable() knows we need a reg pair */
		"	ZG\n",

OPFLOAT,	INAREG|INTAREG|FORCC,
	STAREG,	TDOUBLE,
	SAREG|AWD,	TDOUBLE,
		0,	RLEFT|RESCC,
		"	OD2	AR,AL\n",

Changes to old/pcc/lint/llibs/llib-lc.

1
2
3
4
5
6
7
8
/*	llib-lc	1.28	85/11/28	*/
/* LINTLIBRARY */
#include <sys/types.h>
#include <fstab.h>
#include <grp.h>
#include <sys/dir.h>
#include <nlist.h>
#include <pwd.h>
|







1
2
3
4
5
6
7
8
/*	llib-lc	1.29	86/01/07	*/
/* LINTLIBRARY */
#include <sys/types.h>
#include <fstab.h>
#include <grp.h>
#include <sys/dir.h>
#include <nlist.h>
#include <pwd.h>
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
int	fcntl(f, c, a) { return (0); }
int	flock( f, o ) { return 0; }
int	fork() { return(0); }
int	fsync( f ) { return 0; }
int	fstat(f, b) struct stat *b; { return(0); }
int	ftruncate( d, l) off_t l; { return 0;}
int	getdtablesize() { return 20 ; }
int	getegid() { return(1); }
int	geteuid() { return(1); }
int	getgid() { return(1); }
int	getgroups( n, g ) int *n, *g; { return 0; }
long	gethostid() { return 1L; }
int	gethostname( n, l ) char *n; int l; { return 0 ;}
int	getitimer( w, v ) struct itimerval *v; { return 0; }
int	getpagesize() { return 1; }
int	getpgrp(p) { return 1; }
int	getpid() { return(1); }
int	getppid() { return(1); }
int	getpriority( w, who) { return 1;}
int	getrlimit( res, rip) struct rlimit *rip; { return 0;}
int	getrusage( res, rip) struct rusage *rip; { return 0;}
int	getsockname(s, name, namelen) char *name; int *namelen; { return(0); }
int	getsockopt( s, level, opt, buf, len ) { return 0;}
int	gettimeofday( t, z ) struct timeval *t; struct timezone *z; { return 0;}
int	getuid() { return(1); }
int	ioctl( d, r, p) char *p; { return 0;}
int	kill(p, s) { return(0); }
int	killpg( pg, s) { return 0;}
int	link(a, b) char *a, *b; { return(0); }
int	listen( s, b ){ return 0; }
off_t	lseek(f, o, d) off_t o; { return(o); }
int	lstat(s, b) char *s; struct stat *b; { return(0); }







|
|
|














|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
int	fcntl(f, c, a) { return (0); }
int	flock( f, o ) { return 0; }
int	fork() { return(0); }
int	fsync( f ) { return 0; }
int	fstat(f, b) struct stat *b; { return(0); }
int	ftruncate( d, l) off_t l; { return 0;}
int	getdtablesize() { return 20 ; }
gid_t	getegid() { return((gid_t)1); }
uid_t	geteuid() { return((uid_t)1); }
gid_t	getgid() { return((gid_t)1); }
int	getgroups( n, g ) int *n, *g; { return 0; }
long	gethostid() { return 1L; }
int	gethostname( n, l ) char *n; int l; { return 0 ;}
int	getitimer( w, v ) struct itimerval *v; { return 0; }
int	getpagesize() { return 1; }
int	getpgrp(p) { return 1; }
int	getpid() { return(1); }
int	getppid() { return(1); }
int	getpriority( w, who) { return 1;}
int	getrlimit( res, rip) struct rlimit *rip; { return 0;}
int	getrusage( res, rip) struct rusage *rip; { return 0;}
int	getsockname(s, name, namelen) char *name; int *namelen; { return(0); }
int	getsockopt( s, level, opt, buf, len ) { return 0;}
int	gettimeofday( t, z ) struct timeval *t; struct timezone *z; { return 0;}
uid_t	getuid() { return((uid_t)1); }
int	ioctl( d, r, p) char *p; { return 0;}
int	kill(p, s) { return(0); }
int	killpg( pg, s) { return 0;}
int	link(a, b) char *a, *b; { return(0); }
int	listen( s, b ){ return 0; }
off_t	lseek(f, o, d) off_t o; { return(o); }
int	lstat(s, b) char *s; struct stat *b; { return(0); }
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
int	sendmsg( s, m, l) struct msghdr m[]; { return l; }
int	setgroups( n, g) int *g; { return 0; }
int	sethostid( h ) long h; { return 0;}
int	sethostname( n, l ) char *n; int l; { return 0 ;}
int	setitimer( w, v, ov ) struct itimerval *v, *ov; { return 0; }
int	setpgrp( g, pg) { return 0; }
int	setpriority( w, who, pri ) { return 1;}
int	setregid( r, e){ return 0; }
int	setreuid( r, e){ return 0; }
int	setrlimit( res, rip) struct rlimit *rip; { return 0;}
	/* VARARGS */
int	setsockopt( s, level, opt, buf, len ) char *buf; { return 0;}
int	settimeofday( t, z ) struct timeval *t; struct timezone *z; { return 0;}
int	shutdown( s, h ){ return 0;}
int	(*signal(c, f))() int (*f)(); { return(f); }
int	sigvec(c, f, m) struct sigvec *f, *m; { return 0; }







|
|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
int	sendmsg( s, m, l) struct msghdr m[]; { return l; }
int	setgroups( n, g) int *g; { return 0; }
int	sethostid( h ) long h; { return 0;}
int	sethostname( n, l ) char *n; int l; { return 0 ;}
int	setitimer( w, v, ov ) struct itimerval *v, *ov; { return 0; }
int	setpgrp( g, pg) { return 0; }
int	setpriority( w, who, pri ) { return 1;}
int	setregid( r, e) gid_t r, e; { return 0; }
int	setreuid( r, e) uid_t r, e; { return 0; }
int	setrlimit( res, rip) struct rlimit *rip; { return 0;}
	/* VARARGS */
int	setsockopt( s, level, opt, buf, len ) char *buf; { return 0;}
int	settimeofday( t, z ) struct timeval *t; struct timezone *z; { return 0;}
int	shutdown( s, h ){ return 0;}
int	(*signal(c, f))() int (*f)(); { return(f); }
int	sigvec(c, f, m) struct sigvec *f, *m; { return 0; }
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
char *	realloc(p, n) char *p; unsigned n; { static char c[1]; return(c);}
char *	rindex(s, c) char *s, c; { return s; }
int	scandir(d, n, s, c) char *d; struct direct *(*n[]); int (*s)(),(*c)();
		{ return 1; }
void	seekdir( p, l) DIR *p; long l; {}
int	setfsent() { return 0; }
int	setgrent() { return 0; }
int	setgid(g) { return(0); }
int	setjmp(e) jmp_buf e; { return(0); }
	setkey(k) char *k; {}
int	setlogmask(m) { return(0); }
	setpwent() {}
long *	setstate( st ) long *st; { return st; }
int	setuid(u) { return(0); }
	sleep(i) unsigned i; {}
int	srand(s){ return s; }
char *	strcat(a, b) char *a, *b; { return a; }
int	strcmp(a, b) char *a, *b; { return(1); }
char *	strcpy(a, b) char *a, *b; { return a; }
int	strlen(s) char *s; { return(1); }
char *	strncat(a, b, n) char *a, *b; { return a;}







|





|







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
char *	realloc(p, n) char *p; unsigned n; { static char c[1]; return(c);}
char *	rindex(s, c) char *s, c; { return s; }
int	scandir(d, n, s, c) char *d; struct direct *(*n[]); int (*s)(),(*c)();
		{ return 1; }
void	seekdir( p, l) DIR *p; long l; {}
int	setfsent() { return 0; }
int	setgrent() { return 0; }
int	setgid(g) gid_t g; { return(0); }
int	setjmp(e) jmp_buf e; { return(0); }
	setkey(k) char *k; {}
int	setlogmask(m) { return(0); }
	setpwent() {}
long *	setstate( st ) long *st; { return st; }
int	setuid(u) uid_t u; { return(0); }
	sleep(i) unsigned i; {}
int	srand(s){ return s; }
char *	strcat(a, b) char *a, *b; { return a; }
int	strcmp(a, b) char *a, *b; { return(1); }
char *	strcpy(a, b) char *a, *b; { return a; }
int	strlen(s) char *s; { return(1); }
char *	strncat(a, b, n) char *a, *b; { return a;}

Changes to old/pcc/lint/lpass1/lint.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)lint.c	1.7	(Berkeley)	10/25/85";
#endif lint

# include "pass1.h"

# include "lmanifest.h"

# include <ctype.h>

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)lint.c	1.8	(Berkeley)	01/08/86";
#endif lint

# include "pass1.h"

# include "lmanifest.h"

# include <ctype.h>
647
648
649
650
651
652
653

654
655
656
657
658
659
660
	   REG and OREG nodes */
	/* conversion ops which are not necessary are also clobbered here */
	/* in addition, any special features (such as rewriting
	   exclusive or) are easily handled here as well */

	register o;
	register unsigned t, tl;


	switch( o = p->in.op ){

	case SCONV:
	case PCONV:
		if( p->in.left->in.type==ENUMTY ){
			p->in.left = pconvert( p->in.left );







>







647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
	   REG and OREG nodes */
	/* conversion ops which are not necessary are also clobbered here */
	/* in addition, any special features (such as rewriting
	   exclusive or) are easily handled here as well */

	register o;
	register unsigned t, tl;
	int s;

	switch( o = p->in.op ){

	case SCONV:
	case PCONV:
		if( p->in.left->in.type==ENUMTY ){
			p->in.left = pconvert( p->in.left );
693
694
695
696
697
698
699














700
701
702
703
704
705
706
		return( p->in.left );

	case PVCONV:
	case PMCONV:
		if( p->in.right->in.op != ICON ) cerror( "bad conversion");
		p->in.op = FREE;
		return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) );















		}

	return(p);
	}

NODE *







>
>
>
>
>
>
>
>
>
>
>
>
>
>







694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
		return( p->in.left );

	case PVCONV:
	case PMCONV:
		if( p->in.right->in.op != ICON ) cerror( "bad conversion");
		p->in.op = FREE;
		return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) );

	case RS:
	case LS:
	case ASG RS:
	case ASG LS:
		if( p->in.right->in.op != ICON )
			break;
		s = p->in.right->tn.lval;
		if( s < 0 )
			werror( "negative shift" );
		else
		if( s >= dimtab[ p->fn.csiz ] )
			werror( "shift greater than size of object" );
		break;

		}

	return(p);
	}

NODE *

Changes to old/pcc/lint/lpass1/macdefs.h.

1
2
3
4
5
6
7
8
/*	@(#)macdefs.h	1.4	(Berkeley)	08/28/85	*/

#if defined(pdp11) || defined(vax)
#define makecc(val,i)  lastcon |= val<<(8*i);  /* pdp-11 womp next char  */
#else
#define makecc(val,i)	lastcon = i ? (val<<8)|lastcon : val
#endif

|







1
2
3
4
5
6
7
8
/*	@(#)macdefs.h	1.5	(Berkeley)	01/08/86	*/

#if defined(pdp11) || defined(vax)
#define makecc(val,i)  lastcon |= val<<(8*i);  /* pdp-11 womp next char  */
#else
#define makecc(val,i)	lastcon = i ? (val<<8)|lastcon : val
#endif

67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
# define bccode()
# define cendarg()
# define incode(a,s) (inoff += (s))
# define fincode(a,s) (inoff += (s) )
# define vfdzero(n) (inoff += (n))
# define aobeg()
# define aoend()


# ifndef unix
# define NOFORTRAN  {extern int pflag; if(pflag) werror( "fortran keyword nonportable" );}
# else
# define NOFORTRAN { werror( "fortran keyword nonportable" ); }
# endif

# define LINT







>








67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# define bccode()
# define cendarg()
# define incode(a,s) (inoff += (s))
# define fincode(a,s) (inoff += (s) )
# define vfdzero(n) (inoff += (n))
# define aobeg()
# define aoend()
# define econvert(p)

# ifndef unix
# define NOFORTRAN  {extern int pflag; if(pflag) werror( "fortran keyword nonportable" );}
# else
# define NOFORTRAN { werror( "fortran keyword nonportable" ); }
# endif

# define LINT

Changes to old/pcc/mip/allo.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)allo.c	4.7 (Berkeley) 08/22/85";
#endif lint

# include "pass2.h"

NODE resc[3];

int busy[REGSZ];

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)allo.c	4.8 (Berkeley) 01/08/86";
#endif lint

# include "pass2.h"

NODE resc[3];

int busy[REGSZ];
195
196
197
198
199
200
201

202
203


204
205

206
207



208
209
210
211
212
213
214
	if( isbreg(r) ){
		if( n&NAMASK ) return(0);
		}
	else {
		if( n & NBMASK ) return(0);
		}
	/*

	 * Have to check for ==, <=, etc. because the result is type INT
	 * but need a register pair temp if either side is real.


	 */
	if( (n&NAMASK) && (szty(p->in.type) == 2 ||

	    logop(p->in.op) && (szty(p->in.left->in.type) == 2 ||
	    szty(p->in.right->in.type) == 2)) ){ /* only do the pairing for real regs */



#ifndef NOEVENODD
		if( r&01 ) return(0);
#endif
		if( !istreg(r+1) ) return( 0 );
		if( busy[r+1] > 1 ) return( 0 );
		if( busy[r] == 0 && busy[r+1] == 0  ||
		    busy[r+1] == 0 && shareit( p, r, n ) ||







>
|
|
>
>

|
>
|
|
>
>
>







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
	if( isbreg(r) ){
		if( n&NAMASK ) return(0);
		}
	else {
		if( n & NBMASK ) return(0);
		}
	/*
	 * Some special cases that require register pairs...
	 * Have to check for ==, <=, etc. because the result is type int
	 * but need a register pair temp if either side is wide.
	 * For +=, *= etc. where lhs is narrow and rhs is wide, the temp
	 * register must be wide.
	 */
	if( (n&NAMASK) &&
	    (szty(p->in.type) == 2 ||
	     (logop(p->in.op) && (szty(p->in.left->in.type) == 2 ||
	      szty(p->in.right->in.type) == 2)) ||
	     (asgop(p->in.op) && szty(p->in.right->in.type) == 2 &&
	      szty(p->in.left->in.type) == 1))
	){
#ifndef NOEVENODD
		if( r&01 ) return(0);
#endif
		if( !istreg(r+1) ) return( 0 );
		if( busy[r+1] > 1 ) return( 0 );
		if( busy[r] == 0 && busy[r+1] == 0  ||
		    busy[r+1] == 0 && shareit( p, r, n ) ||

Changes to old/pcc/mip/optim.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)optim.c	4.6 (Berkeley) 08/22/85";
#endif lint

# include "pass1.h"

# define SWAP(p,q) {sp=p; p=q; q=sp;}
# define RCON(p) (p->in.right->in.op==ICON)
# define RO(p) p->in.right->in.op

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)optim.c	4.7 (Berkeley) 01/08/86";
#endif lint

# include "pass1.h"

# define SWAP(p,q) {sp=p; p=q; q=sp;}
# define RCON(p) (p->in.right->in.op==ICON)
# define RO(p) p->in.right->in.op
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
	case ASG MUL:
		/* change muls to adds or shifts */

		if( (o == MUL || o == ASG MUL) &&
		    nncon(p->in.right) && (i=ispow2(RV(p)))>=0){
			if( i == 0 ) /* multiplication by 1 */
				goto zapright;
			if( i == 1 && optype(LO(p)) == LTYPE){
				/* multiplication by 2 */
				p->in.op = (asgop(o) ? ASG PLUS : PLUS);
				o = p->in.op;
				ncopy(p->in.right, p->in.left);
				}
			else {
				p->in.op = (asgop(o) ? ASG LS : LS);
				o = p->in.op;
				p->in.right->in.type = p->in.right->fn.csiz = INT;
				RV(p) = i;
				}
			}







|
<
<
<
<
<







132
133
134
135
136
137
138
139





140
141
142
143
144
145
146
	case ASG MUL:
		/* change muls to adds or shifts */

		if( (o == MUL || o == ASG MUL) &&
		    nncon(p->in.right) && (i=ispow2(RV(p)))>=0){
			if( i == 0 ) /* multiplication by 1 */
				goto zapright;
			/* c2 will turn 'i << 1' into 'i + i' for us */





			else {
				p->in.op = (asgop(o) ? ASG LS : LS);
				o = p->in.op;
				p->in.right->in.type = p->in.right->fn.csiz = INT;
				RV(p) = i;
				}
			}
176
177
178
179
180
181
182























183
184
185
186
187
188
189
					p->in.op = COMOP; /* side effects */
				}
			else if( o == PLUS || o == MINUS ||
				 o == ASG PLUS || o == ASG MINUS ||
				 o == OR || o == ER ||
				 o == LS || o == RS )
				goto zapright;























			}
		break;

	case ASG DIV:
	case DIV:
		if( nncon( p->in.right ) ){
			if( RV(p) == 0 ) uerror("division by zero");







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
					p->in.op = COMOP; /* side effects */
				}
			else if( o == PLUS || o == MINUS ||
				 o == ASG PLUS || o == ASG MINUS ||
				 o == OR || o == ER ||
				 o == LS || o == RS )
				goto zapright;
			}
		if( o != LS && o != RS )
			break;
		/* FALL THROUGH */

	case ASG RS:
	case ASG LS:
		if( !ISUNSIGNED(p->in.left->in.type) )
			break;
		if( p->in.right->in.op == ICON &&
		    p->in.right->tn.lval < 0 ) {
			/*
			 * Technically negative shifts are illegal
			 * but we can support them, at least with
			 * constants; you take potluck with variables.
			 */
			p->in.right->tn.lval = -p->in.right->tn.lval;
			switch( o ){
			case LS:	p->in.op = RS; break;
			case ASG LS:	p->in.op = ASG RS; break;
			case RS:	p->in.op = LS; break;
			case ASG RS:	p->in.op = ASG LS; break;
				}
			}
		break;

	case ASG DIV:
	case DIV:
		if( nncon( p->in.right ) ){
			if( RV(p) == 0 ) uerror("division by zero");

Changes to old/pcc/mip/pftn.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)pftn.c	1.9 (Berkeley) 08/22/85";
#endif lint

# include "pass1.h"

unsigned int offsz;

struct symtab *schain[MAXSCOPES];	/* sym chains for clearst */

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)pftn.c	1.10 (Berkeley) 01/08/86";
#endif lint

# include "pass1.h"

unsigned int offsz;

struct symtab *schain[MAXSCOPES];	/* sym chains for clearst */
763
764
765
766
767
768
769



770
771
772
773
774
775
776
777
		case 0:
			break;

			}
		}

	if( dimtab[s]==0 ) {



		uerror( "unknown size");
		return( SZINT );
		}
	return( (unsigned int) dimtab[ s ] * mult );
	}

inforce( n ) OFFSZ n; {  /* force inoff to have the value n */
	/* inoff is updated to have the value n */







>
>
>
|







763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
		case 0:
			break;

			}
		}

	if( dimtab[s]==0 ) {
		if( ty == STRTY )
			uerror( "undefined structure" );
		else
			uerror( "unknown size");
		return( SZINT );
		}
	return( (unsigned int) dimtab[ s ] * mult );
	}

inforce( n ) OFFSZ n; {  /* force inoff to have the value n */
	/* inoff is updated to have the value n */
910
911
912
913
914
915
916





917
918
919
920
921
922
923

		if( ISARY(t) ){
			t = DECREF(t);
			++d;
			continue;
			}
		else if( t == STRTY ){





			id = dimtab[pstk->in_x];
			p = &stab[id];
			if( p->sclass != MOS && !(p->sclass&FIELD) ) cerror( "insane structure member list" );
			t = p->stype;
			d = p->dimoff;
			s = p->sizoff;
			off += p->offset;







>
>
>
>
>







913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931

		if( ISARY(t) ){
			t = DECREF(t);
			++d;
			continue;
			}
		else if( t == STRTY ){
			if( dimtab[pstk->in_s] == 0 ){
				uerror( "can't initialize undefined structure" );
				iclass = -1;
				return;
				}
			id = dimtab[pstk->in_x];
			p = &stab[id];
			if( p->sclass != MOS && !(p->sclass&FIELD) ) cerror( "insane structure member list" );
			t = p->stype;
			d = p->dimoff;
			s = p->sizoff;
			off += p->offset;
978
979
980
981
982
983
984

985
986
987
988
989
990
991
# endif

	switch( iclass ){

	case EXTERN:
	case AUTO:
	case REGISTER:

		return;
		}

	pstk = instack;

	t = pstk->in_t;
	d = pstk->in_d;







>







986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# endif

	switch( iclass ){

	case EXTERN:
	case AUTO:
	case REGISTER:
	case -1:
		return;
		}

	pstk = instack;

	t = pstk->in_t;
	d = pstk->in_d;

Changes to old/pcc/mip/trees.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)trees.c	4.9 (Berkeley) 08/22/85";
#endif

# include "pass1.h"

# include <setjmp.h>

int bdebug = 0;

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char *sccsid ="@(#)trees.c	4.10 (Berkeley) 01/08/86";
#endif

# include "pass1.h"

# include <setjmp.h>

int bdebug = 0;
943
944
945
946
947
948
949

950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966

967
968
969
970
971
972
973
		p->in.left = r;
	else
		p->in.right = r;
	return(p);

	}


econvert( p ) register NODE *p; {

	/* change enums to ints, or appropriate types */

	register TWORD ty;

	if( (ty=BTYPE(p->in.type)) == ENUMTY || ty == MOETY ) {
		if( dimtab[ p->fn.csiz ] == SZCHAR ) ty = CHAR;
		else if( dimtab[ p->fn.csiz ] == SZINT ) ty = INT;
		else if( dimtab[ p->fn.csiz ] == SZSHORT ) ty = SHORT;
		else ty = LONG;
		ty = ctype( ty );
		p->fn.csiz = ty;
		MODTYPE(p->in.type,ty);
		if( p->in.op == ICON && ty != LONG ) p->in.type = p->fn.csiz = INT;
		}
	}


NODE *
pconvert( p ) register NODE *p; {

	/* if p should be changed into a pointer, do so */

	if( ISARY( p->in.type) ){







>

















>







943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
		p->in.left = r;
	else
		p->in.right = r;
	return(p);

	}

#ifndef econvert
econvert( p ) register NODE *p; {

	/* change enums to ints, or appropriate types */

	register TWORD ty;

	if( (ty=BTYPE(p->in.type)) == ENUMTY || ty == MOETY ) {
		if( dimtab[ p->fn.csiz ] == SZCHAR ) ty = CHAR;
		else if( dimtab[ p->fn.csiz ] == SZINT ) ty = INT;
		else if( dimtab[ p->fn.csiz ] == SZSHORT ) ty = SHORT;
		else ty = LONG;
		ty = ctype( ty );
		p->fn.csiz = ty;
		MODTYPE(p->in.type,ty);
		if( p->in.op == ICON && ty != LONG ) p->in.type = p->fn.csiz = INT;
		}
	}
#endif

NODE *
pconvert( p ) register NODE *p; {

	/* if p should be changed into a pointer, do so */

	if( ISARY( p->in.type) ){
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092

NODE *
tymatch(p)  register NODE *p; {

	/* satisfy the types of various arithmetic binary ops */

	/* rules are:
		if assignment, op, type of LHS
		if any float or doubles, make double
		if any longs, make long
		otherwise, make int
		if either operand is unsigned, the result is...
	*/

	register TWORD t1, t2, t, tu;







|







1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094

NODE *
tymatch(p)  register NODE *p; {

	/* satisfy the types of various arithmetic binary ops */

	/* rules are:
		if assignment, type of LHS
		if any float or doubles, make double
		if any longs, make long
		otherwise, make int
		if either operand is unsigned, the result is...
	*/

	register TWORD t1, t2, t, tu;
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139

1140
1141

1142
1143
1144
1145
1146
1147
1148
1149
#else
	if (t1 == DOUBLE || t1 == FLOAT || t2 == DOUBLE || t2 == FLOAT)
		t = DOUBLE;
#endif
	else if( t1==LONG || t2==LONG ) t = LONG;
	else t = INT;

	if( asgop(o) ){
		tu = p->in.left->in.type;
		t = t1;
		}
	else {
		tu = (u && UNSIGNABLE(t))?ENUNSIGN(t):t;
		}

	/* because expressions have values that are at least as wide
	   as INT or UNSIGNED, the only conversions needed
	   are those involving FLOAT/DOUBLE, and those
	   from LONG to INT and ULONG to UNSIGNED */


	if( t != t1 ) p->in.left = makety( p->in.left, tu, 0, (int)tu );


	if( t != t2 || o==CAST ) p->in.right = makety( p->in.right, tu, 0, (int)tu );

	if( asgop(o) ){
		p->in.type = p->in.left->in.type;
		p->fn.cdim = p->in.left->fn.cdim;
		p->fn.csiz = p->in.left->fn.csiz;
		}
	else if( !logop(o) ){







|












>
|

>
|







1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
#else
	if (t1 == DOUBLE || t1 == FLOAT || t2 == DOUBLE || t2 == FLOAT)
		t = DOUBLE;
#endif
	else if( t1==LONG || t2==LONG ) t = LONG;
	else t = INT;

	if( o == ASSIGN || o == CAST || o == RETURN ){
		tu = p->in.left->in.type;
		t = t1;
		}
	else {
		tu = (u && UNSIGNABLE(t))?ENUNSIGN(t):t;
		}

	/* because expressions have values that are at least as wide
	   as INT or UNSIGNED, the only conversions needed
	   are those involving FLOAT/DOUBLE, and those
	   from LONG to INT and ULONG to UNSIGNED */

	if( t != t1 && ! asgop(o) )
		p->in.left = makety( p->in.left, tu, 0, (int)tu );

	if( t != t2 || o==CAST )
		p->in.right = makety( p->in.right, tu, 0, (int)tu );

	if( asgop(o) ){
		p->in.type = p->in.left->in.type;
		p->fn.cdim = p->in.left->fn.cdim;
		p->fn.csiz = p->in.left->fn.csiz;
		}
	else if( !logop(o) ){

Changes to old/rogue/machdep.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)machdep.c	5.1 (Berkeley) 05/30/85";
#endif not lint

/*
 * Various installation dependent routines
 *
 * $Revision: 1.7 $, $Date: 85/04/05 11:33:30 $
 */













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)machdep.c	5.2 (Berkeley) 01/09/86";
#endif not lint

/*
 * Various installation dependent routines
 *
 * $Revision: 1.7 $, $Date: 85/04/05 11:33:30 $
 */
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 *			for high load average.
 *	WARNTIME	How much time between warnings when load gets
 *			too high (if not defined, it is the same as
 *			CHECKTIME).
 */

# include	<curses.h>
# include	"extern.h"
# include	<signal.h>
# include	<sys/types.h>
# include	<sys/stat.h>
# include	<sys/file.h>

# ifdef	SCOREFILE

# ifndef	LOCK_EX
static char	*Lockfile = "/tmp/.fredlock";
# endif

# ifndef	NUMSCORES
# 	define	NUMSCORES	10
# 	define	NUMNAME		"Ten"
# endif		NUMSCORES

unsigned int	Numscores = NUMSCORES;







|







<

<







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61

62
63
64
65
66
67
68
 *			for high load average.
 *	WARNTIME	How much time between warnings when load gets
 *			too high (if not defined, it is the same as
 *			CHECKTIME).
 */

# include	<curses.h>
# include	"machdep.h"
# include	<signal.h>
# include	<sys/types.h>
# include	<sys/stat.h>
# include	<sys/file.h>

# ifdef	SCOREFILE


static char	*Lockfile = "/tmp/.fredlock";


# ifndef	NUMSCORES
# 	define	NUMSCORES	10
# 	define	NUMNAME		"Ten"
# endif		NUMSCORES

unsigned int	Numscores = NUMSCORES;
170
171
172
173
174
175
176

177
178

179
180
181
182
183
184
185
 */
getltchars()
{
# ifdef TIOCGLTC
	ioctl(1, TIOCGLTC, &Ltc);
	Got_ltc = TRUE;
	Orig_dsusp = Ltc.t_dsuspc;

	Ltc.t_dsuspc = Ltc.t_suspc;
	ioctl(1, TIOCSLTC, &Ltc);

# endif	TIOCGLTC
}

/*
 * start_score:
 *	Start the scoring sequence
 */







>
|
|
>







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
 */
getltchars()
{
# ifdef TIOCGLTC
	ioctl(1, TIOCGLTC, &Ltc);
	Got_ltc = TRUE;
	Orig_dsusp = Ltc.t_dsuspc;
	if (Orig_dsusp == CTRL(Y)) {
		Ltc.t_dsuspc = Ltc.t_suspc;
		ioctl(1, TIOCSLTC, &Ltc);
	}
# endif	TIOCGLTC
}

/*
 * start_score:
 *	Start the scoring sequence
 */

Changes to old/sysline/sysline.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)sysline.c	5.5 (Berkeley) 11/01/85";
#endif not lint

/*
 * sysline - system status display on 25th line of terminal
 * j.k.foderaro
 *
 * Prints a variety of information on the special status line of terminals













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)sysline.c	5.6 (Berkeley) 01/09/86";
#endif not lint

/*
 * sysline - system status display on 25th line of terminal
 * j.k.foderaro
 *
 * Prints a variety of information on the special status line of terminals
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191




1192
1193
1194
1195
1196
1197
1198
		fflush(stdout);
	}

	/* the "-1" below is to avoid cursor wraparound problems */
	columns = tgetnum("co") - 1;
	if (window) {
		strcpy(to_status_line, "\r");
		strcpy(from_status_line, "");
		cp = dis_status_line;	/* use the clear line sequence */
		*cp++ = '\r';
		tgetstr("ce", &cp);




	} else {
		cp = to_status_line;
		tgetstr("ts", &cp);
		cp = from_status_line;
		tgetstr("fs", &cp);
		cp = dis_status_line;
		tgetstr("ds", &cp);







<



>
>
>
>







1181
1182
1183
1184
1185
1186
1187

1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
		fflush(stdout);
	}

	/* the "-1" below is to avoid cursor wraparound problems */
	columns = tgetnum("co") - 1;
	if (window) {
		strcpy(to_status_line, "\r");

		cp = dis_status_line;	/* use the clear line sequence */
		*cp++ = '\r';
		tgetstr("ce", &cp);
		if (leftline)
			strcpy(from_status_line, dis_status_line + 1);
		else
			strcpy(from_status_line, "");
	} else {
		cp = to_status_line;
		tgetstr("ts", &cp);
		cp = from_status_line;
		tgetstr("fs", &cp);
		cp = dis_status_line;
		tgetstr("ds", &cp);

Changes to old/tar/tar.1.

1
2
3
4
5
6
7
8
.\"	@(#)tar.1	6.2 (Berkeley) 06/07/85
.\"
.TH TAR 1 ""
.AT 3
.SH NAME
tar \- tape archiver
.SH SYNOPSIS
.B tar
|







1
2
3
4
5
6
7
8
.\"	@(#)tar.1	6.3 (Berkeley) 01/07/86
.\"
.TH TAR 1 ""
.AT 3
.SH NAME
tar \- tape archiver
.SH SYNOPSIS
.B tar
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
.TP 10
.B B
Forces input and output blocking to 20 blocks per record.  This option
was added so that 
.I tar
can work across a communications channel where the blocking may not
be maintained.

.PP
If a file name is preceded by 
.BR \-C ,
then 
.I tar
will perform a
.IR chdir (2)
to that file name.  This allows multiple directories not







>
|







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
.TP 10
.B B
Forces input and output blocking to 20 blocks per record.  This option
was added so that 
.I tar
can work across a communications channel where the blocking may not
be maintained.
.TP 10
.B C
If a file name is preceded by 
.BR \-C ,
then 
.I tar
will perform a
.IR chdir (2)
to that file name.  This allows multiple directories not

Changes to sbin/dump/main.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21


22
23
24
25
26
27
28
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)main.c	5.1 (Berkeley) 06/05/85";
#endif not lint

#include "dump.h"

int	notify = 0;	/* notify operator flag */
int	blockswritten = 0;	/* number of blocks written on current tape */
int	tapeno = 0;	/* current tape number */
int	density = 0;	/* density in bytes/0.1" */
int	ntrec = NTREC;	/* # tape blocks in each tape record */
int	cartridge = 0;	/* Assume non-cartridge tape */
#ifdef RDUMP
char	*host;
#endif



main(argc, argv)
	int	argc;
	char	*argv[];
{
	char		*arg;
	int		bflag = 0, i;







|













>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)main.c	5.2 (Berkeley) 01/09/86";
#endif not lint

#include "dump.h"

int	notify = 0;	/* notify operator flag */
int	blockswritten = 0;	/* number of blocks written on current tape */
int	tapeno = 0;	/* current tape number */
int	density = 0;	/* density in bytes/0.1" */
int	ntrec = NTREC;	/* # tape blocks in each tape record */
int	cartridge = 0;	/* Assume non-cartridge tape */
#ifdef RDUMP
char	*host;
#endif
int	anydskipped;	/* set true in mark() if any directories are skipped */
			/* this lets us avoid map pass 2 in some cases */

main(argc, argv)
	int	argc;
	char	*argv[];
{
	char		*arg;
	int		bflag = 0, i;
219
220
221
222
223
224
225

226
227
228

229
230
231
232
233


234
235
236
237
238
239
240
	}
	msiz = roundup(howmany(sblock->fs_ipg * sblock->fs_ncg, NBBY),
		TP_BSIZE);
	clrmap = (char *)calloc(msiz, sizeof(char));
	dirmap = (char *)calloc(msiz, sizeof(char));
	nodmap = (char *)calloc(msiz, sizeof(char));


	msg("mapping (Pass I) [regular files]\n");
	pass(mark, (char *)NULL);		/* mark updates esize */


	do {
		msg("mapping (Pass II) [directories]\n");
		nadded = 0;
		pass(add, dirmap);
	} while(nadded);



	bmapest(clrmap);
	bmapest(nodmap);

	if (cartridge) {
		/* Estimate number of tapes, assuming streaming stops at
		   the end of each block written, and not in mid-block.







>



>
|
|
|
|
|
>
>







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
	}
	msiz = roundup(howmany(sblock->fs_ipg * sblock->fs_ncg, NBBY),
		TP_BSIZE);
	clrmap = (char *)calloc(msiz, sizeof(char));
	dirmap = (char *)calloc(msiz, sizeof(char));
	nodmap = (char *)calloc(msiz, sizeof(char));

	anydskipped = 0;
	msg("mapping (Pass I) [regular files]\n");
	pass(mark, (char *)NULL);		/* mark updates esize */

	if (anydskipped) {
		do {
			msg("mapping (Pass II) [directories]\n");
			nadded = 0;
			pass(add, dirmap);
		} while(nadded);
	} else				/* keep the operators happy */
		msg("mapping (Pass II) [directories]\n");

	bmapest(clrmap);
	bmapest(nodmap);

	if (cartridge) {
		/* Estimate number of tapes, assuming streaming stops at
		   the end of each block written, and not in mid-block.

Changes to sbin/dump/traverse.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)traverse.c	5.2 (Berkeley) 08/05/85";
#endif not lint

#include "dump.h"

pass(fn, map)
	int (*fn)();
	char *map;
{
	struct dinode *dp;
	int bits;
	ino_t maxino;

	maxino = sblock->fs_ipg * sblock->fs_ncg - 1;
	for (ino = 0; ino < maxino; ) {
		if((ino % NBBY) == 0) {
			bits = ~0;
			if(map != NULL)
				bits = *map++;
		}
		ino++;
		if(bits & 1) {
			dp = getino(ino);
			(*fn)(dp);
		}
		bits >>= 1;
	}
}

mark(ip)
	struct dinode *ip;
{
	register f;


	f = ip->di_mode & IFMT;
	if(f == 0)
		return;
	BIS(ino, clrmap);
	if(f == IFDIR)
		BIS(ino, dirmap);
	if ((ip->di_mtime >= spcl.c_ddate || ip->di_ctime >= spcl.c_ddate) &&
	    !BIT(ino, nodmap)) {
		BIS(ino, nodmap);
		if (f != IFREG && f != IFDIR && f != IFLNK) {
			esize += 1;
			return;
		}
		est(ip);
	}

}

add(ip)
	register struct	dinode	*ip;
{
	register int i;
	long filesize;







|





|
|

<
|




|

|



|
<
|
<







|
>


|


|









|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28

29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)traverse.c	5.3 (Berkeley) 01/09/86";
#endif not lint

#include "dump.h"

pass(fn, map)
	register int (*fn)();
	register char *map;
{

	register int bits;
	ino_t maxino;

	maxino = sblock->fs_ipg * sblock->fs_ncg - 1;
	for (ino = 0; ino < maxino; ) {
		if ((ino % NBBY) == 0) {
			bits = ~0;
			if (map != NULL)
				bits = *map++;
		}
		ino++;
		if (bits & 1)

			(*fn)(getino(ino));

		bits >>= 1;
	}
}

mark(ip)
	struct dinode *ip;
{
	register int f;
	extern int anydskipped;

	f = ip->di_mode & IFMT;
	if (f == 0)
		return;
	BIS(ino, clrmap);
	if (f == IFDIR)
		BIS(ino, dirmap);
	if ((ip->di_mtime >= spcl.c_ddate || ip->di_ctime >= spcl.c_ddate) &&
	    !BIT(ino, nodmap)) {
		BIS(ino, nodmap);
		if (f != IFREG && f != IFDIR && f != IFLNK) {
			esize += 1;
			return;
		}
		est(ip);
	} else if (f == IFDIR)
		anydskipped = 1;
}

add(ip)
	register struct	dinode	*ip;
{
	register int i;
	long filesize;

Changes to sbin/ncheck/ncheck.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)ncheck.c	5.3 (Berkeley) 10/08/85";
#endif not lint

/*
 * ncheck -- obtain file names from reading filesystem
 */

#define	NB		500













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)ncheck.c	5.4 (Berkeley) 01/09/86";
#endif not lint

/*
 * ncheck -- obtain file names from reading filesystem
 */

#define	NB		500
277
278
279
280
281
282
283

284
285
286
287
288
289
290
291
{
	register struct direct *dp;
	daddr_t lbn, d;

	for(;;) {
		if (dirp->loc >= dirp->ip->di_size)
			return NULL;

		if ((lbn = lblkno(&sblock, dirp->loc)) == 0) {
			d = bmap(lbn);
			if(d == 0)
				return NULL;
			bread(fsbtodb(&sblock, d), dirp->dbuf,
			    dblksize(&sblock, dirp->ip, lbn));
		}
		dp = (struct direct *)







>
|







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
{
	register struct direct *dp;
	daddr_t lbn, d;

	for(;;) {
		if (dirp->loc >= dirp->ip->di_size)
			return NULL;
		if (blkoff(&sblock, dirp->loc) == 0) {
			lbn = lblkno(&sblock, dirp->loc);
			d = bmap(lbn);
			if(d == 0)
				return NULL;
			bread(fsbtodb(&sblock, d), dirp->dbuf,
			    dblksize(&sblock, dirp->ip, lbn));
		}
		dp = (struct direct *)

Changes to sbin/routed/main.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	5.4 (Berkeley) 11/21/85";
#endif not lint

/*
 * Routing Table Management Daemon
 */
#include "defs.h"
#include <sys/ioctl.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	5.5 (Berkeley) 01/06/86";
#endif not lint

/*
 * Routing Table Management Daemon
 */
#include "defs.h"
#include <sys/ioctl.h>
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

getsocket(domain, type, sin)
	int domain, type;
	struct sockaddr_in *sin;
{
	int s, on = 1;

	if (s = socket(domain, type, 0)) {
		perror("socket");
		syslog(LOG_ERR, "socket: %m");
		return (-1);
	}
	if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
		syslog(LOG_ERR, "setsockopt SO_BROADCAST: %m");
		close(s);







|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

getsocket(domain, type, sin)
	int domain, type;
	struct sockaddr_in *sin;
{
	int s, on = 1;

	if ((s = socket(domain, type, 0)) < 0) {
		perror("socket");
		syslog(LOG_ERR, "socket: %m");
		return (-1);
	}
	if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
		syslog(LOG_ERR, "setsockopt SO_BROADCAST: %m");
		close(s);

Changes to sbin/savecore/savecore.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)savecore.c	5.2 (Berkeley) 09/08/85";
#endif not lint

/*
 * savecore
 */

#include <stdio.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)savecore.c	5.3 (Berkeley) 01/09/86";
#endif not lint

/*
 * savecore
 */

#include <stdio.h>
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
		exit(1);
	}
	ddev = find_dev(dsb.st_dev, S_IFBLK);
	dfd = Open(ddev, 0);
	Lseek(dfd, (long)(SBLOCK * DEV_BSIZE), 0);
	Read(dfd, (char *)&fs, sizeof fs);
	close(dfd);
	spacefree = fs.fs_cstotal.cs_nbfree * fs.fs_bsize / 1024;
	if (read_number("minfree") > spacefree) {
		fprintf(stderr,
		   "savecore: Dump omitted, not enough space on device\n");
		return (0);
	}
	if (fs.fs_cstotal.cs_nbfree * fs.fs_frag + fs.fs_cstotal.cs_nffree <
	    fs.fs_dsize * fs.fs_minfree / 100)
		fprintf(stderr,
			"Dump performed, but free space threshold crossed\n");
	return (1);
}

read_number(fn)
	char *fn;







|
|




<
|







362
363
364
365
366
367
368
369
370
371
372
373
374

375
376
377
378
379
380
381
382
		exit(1);
	}
	ddev = find_dev(dsb.st_dev, S_IFBLK);
	dfd = Open(ddev, 0);
	Lseek(dfd, (long)(SBLOCK * DEV_BSIZE), 0);
	Read(dfd, (char *)&fs, sizeof fs);
	close(dfd);
	spacefree = freespace(&fs, fs.fs_minfree) * fs.fs_fsize / 1024;
	if (spacefree < read_number("minfree")) {
		fprintf(stderr,
		   "savecore: Dump omitted, not enough space on device\n");
		return (0);
	}

	if (freespace(&fs, fs.fs_minfree) < 0)
		fprintf(stderr,
			"Dump performed, but free space threshold crossed\n");
	return (1);
}

read_number(fn)
	char *fn;

Changes to share/dict/words.

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15

16
17
18
19
20
21
22
10th
1st
2nd
3rd
4th
5th
6th
7th
8th
9th
a



Aaron
ABA
Ababa
aback

abalone
abandon
abase
abash
abate
abbas
abbe
<
<
<
<
<
<
<
<
<
<

>
>
>




>

















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16










a
AAA
AAAS
Aarhus
Aaron
ABA
Ababa
aback
abacus
abalone
abandon
abase
abash
abate
abbas
abbe
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
abridgment
abroad
abrogate
abrupt
abscess
abscissa
abscissae
absence
absent
absentee
absenteeism
absentia
absentminded
absinthe
absolute







<







78
79
80
81
82
83
84

85
86
87
88
89
90
91
abridgment
abroad
abrogate
abrupt
abscess
abscissa
abscissae

absent
absentee
absenteeism
absentia
absentminded
absinthe
absolute
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
accessory
accident
accidental
accipiter
acclaim
acclamation
acclimate
acclimatize
accolade
accommodate
accompaniment
accompanist
accompany
accomplice
accomplish







<







136
137
138
139
140
141
142

143
144
145
146
147
148
149
accessory
accident
accidental
accipiter
acclaim
acclamation
acclimate

accolade
accommodate
accompaniment
accompanist
accompany
accomplice
accomplish
170
171
172
173
174
175
176

177
178
179


180
181
182
183
184
185
186
accrue
acculturate
accumulate
accuracy
accurate
accusation
accusative

accuse
accustom
ace


acetate
acetic
acetone
acetylene
ache
achieve
Achilles







>



>
>







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
accrue
acculturate
accumulate
accuracy
accurate
accusation
accusative
accusatory
accuse
accustom
ace
acerbic
acerbity
acetate
acetic
acetone
acetylene
ache
achieve
Achilles
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

275

276
277
278
279
280
281
282
Actaeon
actinic
actinide
actinium
actinolite
actinometer
activate
activation
activism
Acton
actor
actress
Acts
actual
actuarial
actuate
acuity
acumen
acute
acyclic
ad
Ada
adage
adagio
Adair
Adam
adamant
Adams
Adamson
adapt
adaptation
adaptive
add
added
addend
addenda
addendum
addict
Addis
Addison
addition
additional
additive
addle
address
addressee
Addressograph
adduce
Adelaide
Adele
Adelia
Aden

adenoma

adept
adequacy
adequate
adhere
adherent
adhesion
adhesive







<
<



<














<





<







<










>

>







218
219
220
221
222
223
224


225
226
227

228
229
230
231
232
233
234
235
236
237
238
239
240
241

242
243
244
245
246

247
248
249
250
251
252
253

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
Actaeon
actinic
actinide
actinium
actinolite
actinometer
activate


Acton
actor
actress

actual
actuarial
actuate
acuity
acumen
acute
acyclic
ad
Ada
adage
adagio
Adair
Adam
adamant

Adamson
adapt
adaptation
adaptive
add

addend
addenda
addendum
addict
Addis
Addison
addition

additive
addle
address
addressee
Addressograph
adduce
Adelaide
Adele
Adelia
Aden
adenine
adenoma
adenosine
adept
adequacy
adequate
adhere
adherent
adhesion
adhesive
322
323
324
325
326
327
328

329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
Adolphus
Adonis
adopt
adoption
adoptive
adore
adorn

adrenal
adrenaline
Adrian
Adriatic
Adrienne
adrift
adroit
adsorb
adsorbate
adsorption
adsorptive
adulate
adult
adulterate
adulterous
adultery
adulthood
advance
advantage
advantageous
advent
adventitious
adventure
adventurous







>
















<







313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336

337
338
339
340
341
342
343
Adolphus
Adonis
adopt
adoption
adoptive
adore
adorn
adposition
adrenal
adrenaline
Adrian
Adriatic
Adrienne
adrift
adroit
adsorb
adsorbate
adsorption
adsorptive
adulate
adult
adulterate
adulterous
adultery

advance
advantage
advantageous
advent
adventitious
adventure
adventurous
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406

407
408
409
410
411
412
413
affectate
affectionate
afferent
affiance
affidavit
affiliate
affine
affinity
affirm
affirmation
affirmative
affix
afflict
affluence
affluent
afford
afforest
afforestation

affront
Afghan
Afghanistan
aficionado
afield
afire
aflame







<





<




>







380
381
382
383
384
385
386

387
388
389
390
391

392
393
394
395
396
397
398
399
400
401
402
403
affectate
affectionate
afferent
affiance
affidavit
affiliate
affine

affirm
affirmation
affirmative
affix
afflict

affluent
afford
afforest
afforestation
affricate
affront
Afghan
Afghanistan
aficionado
afield
afire
aflame
425
426
427
428
429
430
431

432
433
434
435
436
437
438
afterglow
afterimage
afterlife
aftermath
afternoon
afterthought
afterward

again
against
Agamemnon
agate
Agatha
agave
age







>







415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
afterglow
afterimage
afterlife
aftermath
afternoon
afterthought
afterward
afterword
again
against
Agamemnon
agate
Agatha
agave
age
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
ago
agone
agony
agouti
agrarian
agree
agreeable
agreed
agreeing
Agricola
agricultural
agriculture
agrimony
ague
Agway
ah
ahead
ahem
Ahmadabad
ahoy
aid
Aida
aide
Aides
Aiken
ail







<










|







451
452
453
454
455
456
457

458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
ago
agone
agony
agouti
agrarian
agree
agreeable

agreeing
Agricola
agricultural
agriculture
agrimony
ague
Agway
ah
ahead
ahem
Ahmedabad
ahoy
aid
Aida
aide
Aides
Aiken
ail
514
515
516
517
518
519
520

521
522
523

524
525
526
527
528
529
530
airtight
airway
airy
aisle
Aitken
ajar
Ajax

Akers
akin
Akron

ala
Alabama
Alabamian
alabaster
alacrity
alai
Alameda







>



>







504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
airtight
airway
airy
aisle
Aitken
ajar
Ajax
AK
Akers
akin
Akron
AL
ala
Alabama
Alabamian
alabaster
alacrity
alai
Alameda
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
Albuquerque
Alcestis
alchemy
Alcmena
Alcoa
alcohol
alcoholic
alcoholism
Alcott
alcove
Aldebaran
aldehyde
Alden
alder
alderman







<







543
544
545
546
547
548
549

550
551
552
553
554
555
556
Albuquerque
Alcestis
alchemy
Alcmena
Alcoa
alcohol
alcoholic

Alcott
alcove
Aldebaran
aldehyde
Alden
alder
alderman
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603

604
605
606
607
608
609
610
algaecide
algal
algebra
algebraic
Algenib
Alger
Algeria
Algerian
Algiers
alginate
Algol
Algonquin
algorithm
algorithmic
Alhambra

alia
alias
alibi
Alice
Alicia
alien
alienate







<







>







580
581
582
583
584
585
586

587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
algaecide
algal
algebra
algebraic
Algenib
Alger
Algeria

Algiers
alginate
Algol
Algonquin
algorithm
algorithmic
Alhambra
Ali
alia
alias
alibi
Alice
Alicia
alien
alienate
619
620
621
622
623
624
625

626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
alive
alizarin
alkali
alkaline
alkaloid
all
Allah

allay
allegate
allege
Allegheny
allegiant
allegoric
allegory
Allegra
allegro
allele
allemand
Allen
Allentown
allergic
allergy
alleviate
alley
alleyway
alliance
allied
alligator
Allis
Allison
alliterate
allocable
allocate
allot







>



















<







610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636

637
638
639
640
641
642
643
alive
alizarin
alkali
alkaline
alkaloid
all
Allah
Allan
allay
allegate
allege
Allegheny
allegiant
allegoric
allegory
Allegra
allegro
allele
allemand
Allen
Allentown
allergic
allergy
alleviate
alley
alleyway
alliance

alligator
Allis
Allison
alliterate
allocable
allocate
allot
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
alpha
alphabet
alphabetic
alphanumeric
Alpheratz
Alphonse
alpine
Alps
already
Alsatian
also
Alsop
Altair
altar
alter







<







679
680
681
682
683
684
685

686
687
688
689
690
691
692
alpha
alphabet
alphabetic
alphanumeric
Alpheratz
Alphonse
alpine

already
Alsatian
also
Alsop
Altair
altar
alter
727
728
729
730
731
732
733

734
735
736
737
738
739
740
alveolar
alveoli
alveolus
Alvin
alway
alyssum
am

AMA
Amadeus
amalgam
amalgamate
amanita
amanuensis
amaranth







>







717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
alveolar
alveoli
alveolus
Alvin
alway
alyssum
am
A&M
AMA
Amadeus
amalgam
amalgamate
amanita
amanuensis
amaranth
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
Amelia
ameliorate
amen
amend
amende
Amerada
America
American
Americana
Americanism
americium
Ames
amethyst
amethystine
Amherst
ami
amicable







<

<







758
759
760
761
762
763
764

765

766
767
768
769
770
771
772
Amelia
ameliorate
amen
amend
amende
Amerada
America

Americana

americium
Ames
amethyst
amethystine
Amherst
ami
amicable
804
805
806
807
808
809
810

811
812
813
814
815
816
817
818
819

820
821
822
823
824
825
826
827
828
among
amongst
amoral
amorphous
amort
Amos
amount

amperage
ampere
ampersand
Ampex
amphetamine
amphibian
amphibious
amphibole
amphibology

ample
amplifier
amplify
amplitude
amply
amputate
amra
Amsterdam
Amtrak







>









>

<







793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811

812
813
814
815
816
817
818
among
amongst
amoral
amorphous
amort
Amos
amount
amp
amperage
ampere
ampersand
Ampex
amphetamine
amphibian
amphibious
amphibole
amphibology
amphioxis
ample

amplify
amplitude
amply
amputate
amra
Amsterdam
Amtrak
851
852
853
854
855
856
857

858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
analyst
analytic
anamorphic
anaplasmosis
anarch
anarchic
anarchy

anastigmat
anastigmatic
anastomosis
anastomotic
anathema
Anatole
anatomic
anatomy
ancestor
ancestral
ancestry
anchor
anchorage
anchorite
anchoritism
anchovy
ancient
ancillary
and
Andean
Andersen
Anderson
Andes
andesine
andesite
Andorra
Andover
Andre
Andrea
Andrei
Andrew
Andrews
Andromache
Andromeda
Andy
anecdotal
anecdote
anemone
anent







>














<
















<







841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862

863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878

879
880
881
882
883
884
885
analyst
analytic
anamorphic
anaplasmosis
anarch
anarchic
anarchy
Anastasia
anastigmat
anastigmatic
anastomosis
anastomotic
anathema
Anatole
anatomic
anatomy
ancestor
ancestral
ancestry
anchor
anchorage
anchorite

anchovy
ancient
ancillary
and
Andean
Andersen
Anderson
Andes
andesine
andesite
Andorra
Andover
Andre
Andrea
Andrei
Andrew

Andromache
Andromeda
Andy
anecdotal
anecdote
anemone
anent
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
Angelo
anger
Angie
angiosperm
angle
Angles
Anglican
Anglicanism
angling
Anglo
Anglophobia
Angola
Angora
angry
angst







<







895
896
897
898
899
900
901

902
903
904
905
906
907
908
Angelo
anger
Angie
angiosperm
angle
Angles
Anglican

angling
Anglo
Anglophobia
Angola
Angora
angry
angst
948
949
950
951
952
953
954

955
956
957
958
959
960
961
Anna
annal
Annale
Annalen
Annapolis
Anne
anneal

annex
Annie
annihilate
anniversary
annotate
announce
annoy







>







936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
Anna
annal
Annale
Annalen
Annapolis
Anne
anneal
Annette
annex
Annie
annihilate
anniversary
annotate
announce
annoy
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
ANSI
answer
ant
antacid
Antaeus
antagonism
antagonist
antagonistic
Antarctica
Antares
ante
anteater
antebellum
antecedent
antedate







|







976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
ANSI
answer
ant
antacid
Antaeus
antagonism
antagonist
antarctic
Antarctica
Antares
ante
anteater
antebellum
antecedent
antedate
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043


1044
1045
1046
1047
1048
1049
1050
antigorite
antimony
Antioch
antipasto
antipathy
antiperspirant
antiphonal
antipodes
antiquarian
antiquary
antiquated
antique
antiquity
antisemitic
antisemitism
antithetic
antler
Antoine
Antoinette
Anton
Antonio
Antony


anus
anvil
anxiety
anxious
any
anybody
anybody'd







|





|
|







>
>







1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
antigorite
antimony
Antioch
antipasto
antipathy
antiperspirant
antiphonal
antipode
antiquarian
antiquary
antiquated
antique
antiquity
antisemite
antisemitic
antithetic
antler
Antoine
Antoinette
Anton
Antonio
Antony
antonym
Antwerp
anus
anvil
anxiety
anxious
any
anybody
anybody'd
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
Appleby
applejack
Appleton
appliance
applicable
applicant
applicate
applied
applique
apply
appoint
appointe
appointee
apport
apposite







<







1110
1111
1112
1113
1114
1115
1116

1117
1118
1119
1120
1121
1122
1123
Appleby
applejack
Appleton
appliance
applicable
applicant
applicate

applique
apply
appoint
appointe
appointee
apport
apposite
1161
1162
1163
1164
1165
1166
1167

1168
1169
1170
1171
1172
1173
1174
aquarium
Aquarius
aquatic
aqueduct
aqueous
Aquila
Aquinas

Arab
arabesque
Arabia
Arabic
Araby
Arachne
arachnid







>







1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
aquarium
Aquarius
aquatic
aqueduct
aqueous
Aquila
Aquinas
AR
Arab
arabesque
Arabia
Arabic
Araby
Arachne
arachnid
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212

1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233

1234
1235
1236
1237
1238
1239
1240
archae
archaic
archaism
archangel
archbishop
archdiocese
archenemy
Archer
archery
archetype
archetypical
archfool
Archibald
Archimedes
arching
archipelago
architect
architectonic
architectural
architecture
archival
archive
arcing

arcsin
arcsine
arctan
arctangent
arctic
Arcturus
Arden
ardency
ardent
arduous
are
area
areaway
areawide
arena
arenaceous
aren't
Arequipa
Ares
Argentina
argillaceous

Argive
argo
argon
Argonaut
Argonne
argot
argue







<






<








>







<













>







1181
1182
1183
1184
1185
1186
1187

1188
1189
1190
1191
1192
1193

1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209

1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
archae
archaic
archaism
archangel
archbishop
archdiocese
archenemy

archery
archetype
archetypical
archfool
Archibald
Archimedes

archipelago
architect
architectonic
architectural
architecture
archival
archive
arcing
arclength
arcsin
arcsine
arctan
arctangent
arctic
Arcturus
Arden

ardent
arduous
are
area
areaway
areawide
arena
arenaceous
aren't
Arequipa
Ares
Argentina
argillaceous
arginine
Argive
argo
argon
Argonaut
Argonne
argot
argue
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
armadillo
Armageddon
armament
Armata
armature
armchair
Armco
Armenian
armful
armhole
armillaria
armistice
armload
armoire
Armonk







|







1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
armadillo
Armageddon
armament
Armata
armature
armchair
Armco
Armenia
armful
armhole
armillaria
armistice
armload
armoire
Armonk
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
asbestos
ascend
ascendant
ascension
ascent
ascertain
ascetic
asceticism
ascomycetes
ascribe
ascription
aseptic
ash
ashame
ashen







<







1339
1340
1341
1342
1343
1344
1345

1346
1347
1348
1349
1350
1351
1352
asbestos
ascend
ascendant
ascension
ascent
ascertain
ascetic

ascomycetes
ascribe
ascription
aseptic
ash
ashame
ashen
1377
1378
1379
1380
1381
1382
1383

1384

1385
1386
1387
1388
1389
1390
1391
Asilomar
asinine
ask
askance
askew
asleep
asocial

asparagus

aspect
aspen
asperity
aspersion
asphalt
aspheric
asphyxiate







>

>







1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
Asilomar
asinine
ask
askance
askew
asleep
asocial
asparagine
asparagus
aspartic
aspect
aspen
asperity
aspersion
asphalt
aspheric
asphyxiate
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
assignee
assimilable
assimilate
assist
assistant
associable
associate
associative
assonant
assort
assuage
assume
assumption
assurance
assure
Assyria
Assyriology
Astarte
astatine
aster
asteria
asterisk
asteroid
asteroidal
asthma
astigmat
astigmatic
astigmatism
ASTM
astonish
Astor
Astoria
astound
astraddle
astral







<



















<







1409
1410
1411
1412
1413
1414
1415

1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434

1435
1436
1437
1438
1439
1440
1441
assignee
assimilable
assimilate
assist
assistant
associable
associate

assonant
assort
assuage
assume
assumption
assurance
assure
Assyria
Assyriology
Astarte
astatine
aster
asteria
asterisk
asteroid
asteroidal
asthma
astigmat
astigmatic

ASTM
astonish
Astor
Astoria
astound
astraddle
astral
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479

1480
1481
1482
1483
1484
1485
1486
astronomy
astrophysical
astrophysics
astute
Asuncion
asunder
asylum
asymmetric
asymmetry
asymptote
asymptotic
asynchronous
asynchrony
at
Atalanta
atavism
atavistic
Atchison
ate
Athabascan

atheist
Athena
Athenian
Athens
athlete
athletic
athwart







<












>







1449
1450
1451
1452
1453
1454
1455

1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
astronomy
astrophysical
astrophysics
astute
Asuncion
asunder
asylum

asymmetry
asymptote
asymptotic
asynchronous
asynchrony
at
Atalanta
atavism
atavistic
Atchison
ate
Athabascan
atheism
atheist
Athena
Athenian
Athens
athlete
athletic
athwart
1533
1534
1535
1536
1537
1538
1539

1540
1541
1542
1543
1544
1545
1546
attune
Atwater
Atwood
atypic
Auberge
Aubrey
auburn

auction
auctioneer
audacious
audacity
audible
audience
audio







>







1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
attune
Atwater
Atwood
atypic
Auberge
Aubrey
auburn
Auckland
auction
auctioneer
audacious
audacity
audible
audience
audio
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577

1578
1579
1580
1581

1582
1583
1584
1585
1586
1587
1588
auger
augite
augment
augmentation
augur
august
Augusta
Augustan
Augustine
Augustus
auk
aunt
auntie
aura
aural
Aurelius
aureomycin
auric
Auriga

aurora
Auschwitz
auspices
auspicious

austere
Austin
Australia
Australis
australite
Austria
authentic







<











>




>







1549
1550
1551
1552
1553
1554
1555

1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
auger
augite
augment
augmentation
augur
august
Augusta

Augustine
Augustus
auk
aunt
auntie
aura
aural
Aurelius
aureomycin
auric
Auriga
aurochs
aurora
Auschwitz
auspices
auspicious
austenite
austere
Austin
Australia
Australis
australite
Austria
authentic
1603
1604
1605
1606
1607
1608
1609

1610
1611
1612
1613
1614
1615
1616
autograph
automat
automata
automate
automatic
automaton
automobile

automotive
autonomic
autonomous
autonomy
autopsy
autosuggestible
autotransformer







>







1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
autograph
automat
automata
automate
automatic
automaton
automobile
automorphism
automotive
autonomic
autonomous
autonomy
autopsy
autosuggestible
autotransformer
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
aver
average
averred
averring
averse
aversion
avert
avertive
Avery
Avesta
aviary
aviate
aviatrix
avid
avionic







<







1620
1621
1622
1623
1624
1625
1626

1627
1628
1629
1630
1631
1632
1633
aver
average
averred
averring
averse
aversion
avert

Avery
Avesta
aviary
aviate
aviatrix
avid
avionic
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678

1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689

1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703

1704
1705
1706
1707
1708
1709
1710
awkward
awl
awn
awoke
awry
ax
axe
axes
axial
axiology
axiom
axiomatic
axis
axisymmetric
axle

axon
aye
Ayers
Aylesbury
azalea
Azerbaijan
azimuth
azimuthal
Aztec
Aztecan
azure

b
babbitt
babble
Babcock
babe
Babel
baboon
baby
babyhood
Babylon
Babylonian
babysat
babysit
babysitting

baccarat
Bacchus
Bach
bachelor
bacilli
bacillus
back







<







>











>








<

<



>







1655
1656
1657
1658
1659
1660
1661

1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689

1690

1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
awkward
awl
awn
awoke
awry
ax
axe

axial
axiology
axiom
axiomatic
axis
axisymmetric
axle
axolotl
axon
aye
Ayers
Aylesbury
azalea
Azerbaijan
azimuth
azimuthal
Aztec
Aztecan
azure
AZ
b
babbitt
babble
Babcock
babe
Babel
baboon
baby

Babylon

babysat
babysit
babysitting
baccalaureate
baccarat
Bacchus
Bach
bachelor
bacilli
bacillus
back
1754
1755
1756
1757
1758
1759
1760

1761
1762
1763
1764
1765
1766
1767
bagpipe
bah
Bahama
Bahrein
bail
Bailey
bailiff

Baird
bait
bake
Bakelite
Bakersfield
bakery
Bakhtiari







>







1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
bagpipe
bah
Bahama
Bahrein
bail
Bailey
bailiff
bainite
Baird
bait
bake
Bakelite
Bakersfield
bakery
Bakhtiari
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
balk
Balkan
balky
ball
ballad
Ballard
ballast
balled
ballerina
ballet
balletomane
ballfield
balloon
ballot
ballroom







<







1775
1776
1777
1778
1779
1780
1781

1782
1783
1784
1785
1786
1787
1788
balk
Balkan
balky
ball
ballad
Ballard
ballast

ballerina
ballet
balletomane
ballfield
balloon
ballot
ballroom
1807
1808
1809
1810
1811
1812
1813

1814
1815
1816
1817
1818
1819
1820
Balzac
bam
Bamako
Bamberger
Bambi
bamboo
ban

banal
banana
Banbury
band
bandage
bandgap
bandit







>







1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
Balzac
bam
Bamako
Bamberger
Bambi
bamboo
ban
Banach
banal
banana
Banbury
band
bandage
bandgap
bandit
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
Bangui
banish
banister
banjo
bank
bankrupt
bankruptcy
Banks
banning
banquet
banshee
bantam
banter
Bantu
Bantus
baptism







<
<







1827
1828
1829
1830
1831
1832
1833


1834
1835
1836
1837
1838
1839
1840
Bangui
banish
banister
banjo
bank
bankrupt
bankruptcy


banquet
banshee
bantam
banter
Bantu
Bantus
baptism
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931

1932
1933
1934
1935
1936
1937
1938
1939
1940

1941
1942
1943
1944
1945
1946
1947
Barnet
Barnett
Barney
Barnhard
barnstorm
barnyard
barometer
barometric
baron
baroness
baronet
baronial
barony
baroque
Barr
barrack
barracuda
barrage
barre
barrel
barren
Barrett
barrette
barricade
barrier
barring
Barrington
barrow
Barry
Barrymore
Barstow
bartend
bartender
barter
Barth
Bartholomew
Bartlett
Bartok
Barton
barycentric
basal

base
baseball
baseband
baseboard
Basel
baseline
baseman
basemen
baseplate

bash
bashaw
bashful
basic
basidiomycetes
basil
basilar







<

















<















>









>







1881
1882
1883
1884
1885
1886
1887

1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904

1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
Barnet
Barnett
Barney
Barnhard
barnstorm
barnyard
barometer

baron
baroness
baronet
baronial
barony
baroque
Barr
barrack
barracuda
barrage
barre
barrel
barren
Barrett
barrette
barricade
barrier

Barrington
barrow
Barry
Barrymore
Barstow
bartend
bartender
barter
Barth
Bartholomew
Bartlett
Bartok
Barton
barycentric
basal
basalt
base
baseball
baseband
baseboard
Basel
baseline
baseman
basemen
baseplate
basepoint
bash
bashaw
bashful
basic
basidiomycetes
basil
basilar
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
Batavia
batch
Batchelder
bate
bateau
Bateman
bater
Bates
bath
bathe
bathos
bathrobe
bathroom
bathtub
Bathurst







<







1955
1956
1957
1958
1959
1960
1961

1962
1963
1964
1965
1966
1967
1968
Batavia
batch
Batchelder
bate
bateau
Bateman
bater

bath
bathe
bathos
bathrobe
bathroom
bathtub
Bathurst
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
bawd
bawdy
bawl
Baxter
bay
bayberry
Bayda
bayed
Bayesian
Baylor
bayonet
Bayonne
bayou
Bayport
Bayreuth







<







1990
1991
1992
1993
1994
1995
1996

1997
1998
1999
2000
2001
2002
2003
bawd
bawdy
bawl
Baxter
bay
bayberry
Bayda

Bayesian
Baylor
bayonet
Bayonne
bayou
Bayport
Bayreuth
2026
2027
2028
2029
2030
2031
2032

2033
2034
2035
2036
2037
2038
2039
bean
bear
bearberry
beard
Beardsley
bearish
beast

beat
beaten
beater
beatific
beatify
beatitude
beatnik







>







2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
bean
bear
bearberry
beard
Beardsley
bearish
beast
beastie
beat
beaten
beater
beatific
beatify
beatitude
beatnik
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
beaver
bebop
becalm
became
because
Bechtel
beck
Becker
becket
Beckman
beckon
Becky
become
bed
bedazzle
bedbug
bedding
bedfast
Bedford
bedim
bedimmed
bedimming
bedlam
bedpost







<








<







2039
2040
2041
2042
2043
2044
2045

2046
2047
2048
2049
2050
2051
2052
2053

2054
2055
2056
2057
2058
2059
2060
beaver
bebop
becalm
became
because
Bechtel
beck

becket
Beckman
beckon
Becky
become
bed
bedazzle
bedbug

bedfast
Bedford
bedim
bedimmed
bedimming
bedlam
bedpost
2125
2126
2127
2128
2129
2130
2131

2132
2133
2134
2135
2136
2137
2138
behalf
behave
behavioral
behead
beheld
behind
behold

beige
being
Beirut
bel
Bela
belate
belch







>







2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
behalf
behave
behavioral
behead
beheld
behind
behold
Beijing
beige
being
Beirut
bel
Bela
belate
belch
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194

2195
2196
2197
2198
2199
2200
2201
beman
bemoan
bemuse
Ben
bench
benchmark
bend
Bender
Bendix
beneath
Benedict
Benedictine
benediction

benefactor
benefice
beneficent
beneficial
beneficiary
benefit
Benelux







<





>







2170
2171
2172
2173
2174
2175
2176

2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
beman
bemoan
bemuse
Ben
bench
benchmark
bend

Bendix
beneath
Benedict
Benedictine
benediction
Benedikt
benefactor
benefice
beneficent
beneficial
beneficiary
benefit
Benelux
2213
2214
2215
2216
2217
2218
2219

2220

2221
2222
2223
2224
2225
2226
2227
Bentham
benthic
Bentley
Benton
Benz
Benzedrine
benzene

Beowulf

beplaster
bequeath
bequest
berate
Berea
bereave
bereft







>

>







2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
Bentham
benthic
Bentley
Benton
Benz
Benzedrine
benzene
Beograd
Beowulf
Beresford
beplaster
bequeath
bequest
berate
Berea
bereave
bereft
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337

2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373


2374
2375

2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
Bethlehem
bethought
betide
betoken
betony
betray
betrayal
betrayer
betroth
betrothal
Betsey
Betsy
Bette
betting
bettor
Betty
between
betwixt
bevel
beverage
Beverly
bevy
bewail
beware
bewhisker
bewilder
bewitch
bey
beyond
bezel
bhoy
Bhutan

bianco
bias
biaxial
bib
bibb
Bible
biblical
bibliography
bibliophile
bicameral
bicarbonate
bicep
biceps
bichromate
bicker
biconcave
biconnected
bicycle
bid
biddable
bidding
biddy
bide
bidiagonal
bidirectional
bien
biennial
biennium
bifocal
bifurcate
big
Bigelow
Biggs
bigot
bigotry
biharmonic


bijouterie
bikini

bilateral
bilayer
bile
bilge
bilharziasis
bilinear
bilingual
bilk
bill
billboard
billet
billiard
Billie
Billiken
Billings
billion
billionth
billow
billy
Biltmore
bimetallic
bimetallism







<





<


















>












<






<
|















>
>


>














<







2296
2297
2298
2299
2300
2301
2302

2303
2304
2305
2306
2307

2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338

2339
2340
2341
2342
2343
2344

2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379

2380
2381
2382
2383
2384
2385
2386
Bethlehem
bethought
betide
betoken
betony
betray
betrayal

betroth
betrothal
Betsey
Betsy
Bette

bettor
Betty
between
betwixt
bevel
beverage
Beverly
bevy
bewail
beware
bewhisker
bewilder
bewitch
bey
beyond
bezel
bhoy
Bhutan
Bialystok
bianco
bias
biaxial
bib
bibb
Bible
biblical
bibliography
bibliophile
bicameral
bicarbonate
bicep

bichromate
bicker
biconcave
biconnected
bicycle
bid

bidden
biddy
bide
bidiagonal
bidirectional
bien
biennial
biennium
bifocal
bifurcate
big
Bigelow
Biggs
bigot
bigotry
biharmonic
bijection
bijective
bijouterie
bikini
bilabial
bilateral
bilayer
bile
bilge
bilharziasis
bilinear
bilingual
bilk
bill
billboard
billet
billiard
Billie
Billiken

billion
billionth
billow
billy
Biltmore
bimetallic
bimetallism
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460

2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473

2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
Binghamton
bingle
Bini
binocular
binomial
binuclear
biochemic
biochemist
biochemistry
biograph
biography
biology
biomass
biomedical
biometric
Biometrika
biometry
biophysic
biophysical
biophysicist
biopsy
bioscience
biosphere
biostatistic
biosynthesize
biota
biotic
biotite
bipartisan
bipartite
biplane
bipolar
biracial
birch
bird
birdbath
birdie
birdlike
birdseed
birdwatch
birefringent
Birgit
Birmingham
birth
birthday
birthplace
birthright
biscuit
bisect

bishop
bishopric
Bismarck
Bismark
bismuth
bison
bisque
Bissau
bistable
bistate
bit
bitch
bite

bitt
bitten
bittern
bitternut
bitterroot
bittersweet
bitumen
bituminous
bitwise
bivalve
bivariate
bivouac
biz
bizarre
Bizet
blab
blabbing
black
blackball
blackberry
blackbird
blackboard
blackbody
Blackburn







<
<
<


<
<
<


<
<
<

<
<
<
<












<











>













>
















<







2401
2402
2403
2404
2405
2406
2407



2408
2409



2410
2411



2412




2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424

2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466

2467
2468
2469
2470
2471
2472
2473
Binghamton
bingle
Bini
binocular
binomial
binuclear
biochemic



biography
biology



Biometrika
biometry



biopsy




biota
biotic
biotite
bipartisan
bipartite
biplane
bipolar
biracial
birch
bird
birdbath
birdie

birdseed
birdwatch
birefringent
Birgit
Birmingham
birth
birthday
birthplace
birthright
biscuit
bisect
bisexual
bishop
bishopric
Bismarck
Bismark
bismuth
bison
bisque
Bissau
bistable
bistate
bit
bitch
bite
bitnet
bitt
bitten
bittern
bitternut
bitterroot
bittersweet
bitumen
bituminous
bitwise
bivalve
bivariate
bivouac
biz
bizarre
Bizet
blab

black
blackball
blackberry
blackbird
blackboard
blackbody
Blackburn
2514
2515
2516
2517
2518
2519
2520

2521
2522
2523
2524
2525
2526
2527

2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
blame
blameworthy
blanc
blanch
Blanchard
Blanche
bland

blank
blanket
blare
blaspheme
blasphemous
blasphemy
blast

blat
blatant
blather
blatting
Blatz
blaze
blazon
bleach
bleak
bleary
bleat







>







>



<







2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508

2509
2510
2511
2512
2513
2514
2515
blame
blameworthy
blanc
blanch
Blanchard
Blanche
bland
blandish
blank
blanket
blare
blaspheme
blasphemous
blasphemy
blast
blastula
blat
blatant
blather

Blatz
blaze
blazon
bleach
bleak
bleary
bleat
2571
2572
2573
2574
2575
2576
2577

2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
Blomberg
Blomquist
blond
blonde
blood
bloodbath
bloodhound

bloodroot
bloodshed
bloodshot
bloodstain
bloodstone
bloodstream
bloody
bloom
Bloomfield
Bloomington
bloop
blossom
blot
blotch
blotting
blouse
blow
blowfish
blown
blowup
blubber
bludgeon







>














<







2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569

2570
2571
2572
2573
2574
2575
2576
Blomberg
Blomquist
blond
blonde
blood
bloodbath
bloodhound
bloodline
bloodroot
bloodshed
bloodshot
bloodstain
bloodstone
bloodstream
bloody
bloom
Bloomfield
Bloomington
bloop
blossom
blot
blotch

blouse
blow
blowfish
blown
blowup
blubber
bludgeon
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628

2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
bluff
bluish
Blum
Blumenthal
blunder
blunt
blur
blurring
blurry
blurt
blush
bluster
blustery
blutwurst

Blythe
BMW
boa
boar
board
boardinghouse
boast
boastful
boat
boathouse
boatload
boatman
boatmen
boatswain
boatyard
bob
Bobbie
bobbin
bobbing
bobble
bobby
bobcat
bobolink
Boca
bock
bode
bodhisattva
bodice
bodied
Bodleian
body
bodybuilder
bodybuilding
bodyguard
Boeing
Boeotian
bog
bogey
bogeymen
bogging
boggle
boggy
Bogota







<






>


















<









<






|







2592
2593
2594
2595
2596
2597
2598

2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623

2624
2625
2626
2627
2628
2629
2630
2631
2632

2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
bluff
bluish
Blum
Blumenthal
blunder
blunt
blur

blurry
blurt
blush
bluster
blustery
blutwurst
Blvd
Blythe
BMW
boa
boar
board
boardinghouse
boast
boastful
boat
boathouse
boatload
boatman
boatmen
boatswain
boatyard
bob
Bobbie
bobbin

bobble
bobby
bobcat
bobolink
Boca
bock
bode
bodhisattva
bodice

Bodleian
body
bodybuilder
bodybuilding
bodyguard
Boeing
Boeotia
bog
bogey
bogeymen
bogging
boggle
boggy
Bogota
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
bootlegger
bootlegging
bootstrap
bootstrapping
booty
booze
bop
bopping
borate
borax
Bordeaux
bordello
Borden
border
borderland







<







2729
2730
2731
2732
2733
2734
2735

2736
2737
2738
2739
2740
2741
2742
bootlegger
bootlegging
bootstrap
bootstrapping
booty
booze
bop

borate
borax
Bordeaux
bordello
Borden
border
borderland
2782
2783
2784
2785
2786
2787
2788

2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
borough
Borroughs
borrow
Bosch
Bose
bosom
boson

boss
Boston
Bostonian
Boswell
botanic
botanist
botany
botch
botfly
both







>


<







2756
2757
2758
2759
2760
2761
2762
2763
2764
2765

2766
2767
2768
2769
2770
2771
2772
borough
Borroughs
borrow
Bosch
Bose
bosom
boson
bosonic
boss
Boston

Boswell
botanic
botanist
botany
botch
botfly
both
2812
2813
2814
2815
2816
2817
2818

2819
2820
2821
2822
2823
2824
2825
boulevard
bounce
bouncy
bound
boundary
bounty
bouquet

bourbon
bourgeois
bourgeoisie
bourn
boustrophedon
bout
boutique







>







2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
boulevard
bounce
bouncy
bound
boundary
bounty
bouquet
Bourbaki
bourbon
bourgeois
bourgeoisie
bourn
boustrophedon
bout
boutique
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
boxwood
boxy
boy
boyar
Boyce
boycott
Boyd
boyhood
boyish
Boyle
Boylston
BP
brace
bracelet
bracken







<







2816
2817
2818
2819
2820
2821
2822

2823
2824
2825
2826
2827
2828
2829
boxwood
boxy
boy
boyar
Boyce
boycott
Boyd

boyish
Boyle
Boylston
BP
brace
bracelet
bracken
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
breath
breathe
breathtaking
breathy
breccia
bred
breech
breeches
breed
breeze
breezy
Bremen
bremsstrahlung
Brenda
Brendan







<







2907
2908
2909
2910
2911
2912
2913

2914
2915
2916
2917
2918
2919
2920
breath
breathe
breathtaking
breathy
breccia
bred
breech

breed
breeze
breezy
Bremen
bremsstrahlung
Brenda
Brendan
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
bright
brighten
Brighton
brilliant
Brillouin
brim
brimful
brimming
brimstone
Brindisi
brindle
brine
bring
brink
brinkmanship







<







2964
2965
2966
2967
2968
2969
2970

2971
2972
2973
2974
2975
2976
2977
bright
brighten
Brighton
brilliant
Brillouin
brim
brimful

brimstone
Brindisi
brindle
brine
bring
brink
brinkmanship
3041
3042
3043
3044
3045
3046
3047

3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
bronchi
bronchial
bronchiolar
bronchiole
bronchitis
bronchus
bronco

Bronx
bronze
bronzy
brood
broody
brook
Brooke
Brookhaven
Brookline
Brooklyn
brookside
broom
broomcorn
broth
brothel
brother
brotherhood
brought
brouhaha
brow
browbeaten
brown
Browne
Brownell







>
















<







3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036

3037
3038
3039
3040
3041
3042
3043
bronchi
bronchial
bronchiolar
bronchiole
bronchitis
bronchus
bronco
Brontosaurus
Bronx
bronze
bronzy
brood
broody
brook
Brooke
Brookhaven
Brookline
Brooklyn
brookside
broom
broomcorn
broth
brothel
brother

brought
brouhaha
brow
browbeaten
brown
Browne
Brownell
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
brunette
Brunhilde
Bruno
Brunswick
brunt
brush
brushfire
brushlike
brushwork
brushy
brusque
Brussels
brutal
brute
Bryan







<







3056
3057
3058
3059
3060
3061
3062

3063
3064
3065
3066
3067
3068
3069
brunette
Brunhilde
Bruno
Brunswick
brunt
brush
brushfire

brushwork
brushy
brusque
Brussels
brutal
brute
Bryan
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
bucolic
bud
Budapest
Budd
Buddha
Buddhism
Buddhist
budding
buddy
budge
budget
budgetary
Budweiser
Buena
Buenos







<







3099
3100
3101
3102
3103
3104
3105

3106
3107
3108
3109
3110
3111
3112
bucolic
bud
Budapest
Budd
Buddha
Buddhism
Buddhist

buddy
budge
budget
budgetary
Budweiser
Buena
Buenos
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193

3194
3195
3196
3197
3198
3199
3200
bully
bullyboy
bulrush
bulwark
bum
bumble
bumblebee
bumming
bump
bumptious
bun
bunch
Bundestag
bundle

bundy
bungalow
bungle
bunk
bunkmate
bunny
Bunsen







<






>







3150
3151
3152
3153
3154
3155
3156

3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
bully
bullyboy
bulrush
bulwark
bum
bumble
bumblebee

bump
bumptious
bun
bunch
Bundestag
bundle
Bundoora
bundy
bungalow
bungle
bunk
bunkmate
bunny
Bunsen
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239

3240
3241
3242
3243
3244
3245
3246
burgher
burglar
burglarproof
burglary
Burgundian
Burgundy
burial
buried
Burke
burl
burlap
burlesque
burley
Burlington
burly
Burma
Burmese
burn
Burnett
Burnham
burnish

Burnside
burnt
burp
Burr
burro
Burroughs
burrow







<













>







3189
3190
3191
3192
3193
3194
3195

3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
burgher
burglar
burglarproof
burglary
Burgundian
Burgundy
burial

Burke
burl
burlap
burlesque
burley
Burlington
burly
Burma
Burmese
burn
Burnett
Burnham
burnish
burnout
Burnside
burnt
burp
Burr
burro
Burroughs
burrow
3291
3292
3293
3294
3295
3296
3297

3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329

3330
3331
3332
3333
3334
3335
3336
button
buttonhole
buttonweed
buttress
Buttrick
butyl
butyrate

buxom
Buxtehude
Buxton
buy
buyer
buzz
Buzzard
buzzer
buzzing
buzzword
buzzy
by
bye
Byers
bygone
bylaw
byline
bypass
bypath
byproduct
Byrd
Byrne
byroad
Byron
Byronic
bystander
byte
byway
byword
Byzantine
Byzantium
c

cab
cabal
cabana
cabaret
cabbage
cabdriver
cabin







>




<


<





<


















>







3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272

3273
3274

3275
3276
3277
3278
3279

3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
button
buttonhole
buttonweed
buttress
Buttrick
butyl
butyrate
butyric
buxom
Buxtehude
Buxton
buy

buzz
Buzzard

buzzing
buzzword
buzzy
by
bye

bygone
bylaw
byline
bypass
bypath
byproduct
Byrd
Byrne
byroad
Byron
Byronic
bystander
byte
byway
byword
Byzantine
Byzantium
c
CA
cab
cabal
cabana
cabaret
cabbage
cabdriver
cabin
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440

3441
3442
3443
3444
3445
3446
3447
caliphate
calisthenic
Calkins
call
calla
Callaghan
Callahan
caller
calligraph
calligraphy
calliope
Callisto
callous
callus
calm
caloric
calorie
calorimeter
calorimetric
calorimetry
Calumet
calumniate
calumny
Calvary
calve
Calvert
Calvin
Calvinist
calypso
cam
camaraderie
camber
Cambodia

cambric
Cambridge
Camden
came
camel
camelback
camellia







<










<
<







<





>







3377
3378
3379
3380
3381
3382
3383

3384
3385
3386
3387
3388
3389
3390
3391
3392
3393


3394
3395
3396
3397
3398
3399
3400

3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
caliphate
calisthenic
Calkins
call
calla
Callaghan
Callahan

calligraph
calligraphy
calliope
Callisto
callous
callus
calm
caloric
calorie
calorimeter


Calumet
calumniate
calumny
Calvary
calve
Calvert
Calvin

calypso
cam
camaraderie
camber
Cambodia
Cambrian
cambric
Cambridge
Camden
came
camel
camelback
camellia
3472
3473
3474
3475
3476
3477
3478


3479
3480
3481
3482
3483
3484
3485
Canadian
canal
canary
Canaveral
Canberra
cancel
cancellate


cancer
cancerous
candela
candelabra
candid
candidacy
candidate







>
>







3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
Canadian
canal
canary
Canaveral
Canberra
cancel
cancellate
cancelled
cancelling
cancer
cancerous
candela
candelabra
candid
candidacy
candidate
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516

3517
3518
3519
3520
3521
3522
3523
canker
cankerworm
canna
cannabis
cannel
cannery
cannibal
canning
cannister
cannon
cannonball
cannot
canny
canoe
Canoga
canon
canonic
canopy
can't
cant

cantaloupe
canteen
Canterbury
canterelle
canticle
cantilever
cantle







<












>







3465
3466
3467
3468
3469
3470
3471

3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
canker
cankerworm
canna
cannabis
cannel
cannery
cannibal

cannister
cannon
cannonball
cannot
canny
canoe
Canoga
canon
canonic
canopy
can't
cant
Cantabrigian
cantaloupe
canteen
Canterbury
canterelle
canticle
cantilever
cantle
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554

3555
3556
3557
3558
3559
3560
3561
Capistrano
capita
capital
capitol
Capitoline
capitulate
capo
capping
caprice
capricious
Capricorn

capstan
capstone
capsule
captain
captaincy
caption
captious







<



>







3512
3513
3514
3515
3516
3517
3518

3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
Capistrano
capita
capital
capitol
Capitoline
capitulate
capo

caprice
capricious
Capricorn
capsize
capstan
capstone
capsule
captain
captaincy
caption
captious
3577
3578
3579
3580
3581
3582
3583

3584
3585
3586

3587
3588

3589
3590
3591
3592
3593
3594
3595
3596

3597

3598
3599
3600
3601
3602
3603
3604
Carboloy
carbon
carbonaceous
carbonate
Carbondale
Carbone
carbonic

carbonyl
carborundum
carboxy

carboy
carbuncle

carcass
carcinogen
carcinogenic
carcinoma
card
cardamom
cardboard
cardiac

cardinal

cardiology
cardiovascular
care
careen
career
carefree
careful







>



>


>








>

>







3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
Carboloy
carbon
carbonaceous
carbonate
Carbondale
Carbone
carbonic
carbonium
carbonyl
carborundum
carboxy
carboxylic
carboy
carbuncle
carburetor
carcass
carcinogen
carcinogenic
carcinoma
card
cardamom
cardboard
cardiac
Cardiff
cardinal
cardiod
cardiology
cardiovascular
care
careen
career
carefree
careful
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
Carson
cart
carte
cartel
Cartesian
Carthage
cartilage
cartographer
cartographic
cartography
carton
cartoon
cartridge
cartwheel
Caruso
carve







|
|







3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
Carson
cart
carte
cartel
Cartesian
Carthage
cartilage
cartilaginous
cartographer
cartography
carton
cartoon
cartridge
cartwheel
Caruso
carve
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
cathedral
Catherine
Catherwood
catheter
cathode
cathodic
catholic
Catholicism
Cathy
cation
cationic
catkin
catlike
catnip
Catskill
catsup
cattail
cattle
cattleman
cattlemen







<




<







3715
3716
3717
3718
3719
3720
3721

3722
3723
3724
3725

3726
3727
3728
3729
3730
3731
3732
cathedral
Catherine
Catherwood
catheter
cathode
cathodic
catholic

Cathy
cation
cationic
catkin

catnip
Catskill
catsup
cattail
cattle
cattleman
cattlemen
3814
3815
3816
3817
3818
3819
3820

3821
3822
3823
3824
3825
3826
3827
celesta
celestial
Celia
cell
cellar
cellophane
cellular

cellulose
Celsius
Celtic
cement
cemetery
Cenozoic
censor







>







3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
celesta
celestial
Celia
cell
cellar
cellophane
cellular
celluloid
cellulose
Celsius
Celtic
cement
cemetery
Cenozoic
censor
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873

3874
3875
3876
3877
3878
3879
3880
3881
3882

3883
3884
3885
3886
3887
3888
3889
cereus
cerise
cerium
CERN
certain
certainty
certificate
certified
certify
certiorari
certitude
cerulean
Cervantes

Cesare
cesium
cessation
cession
Cessna
cetera
Cetus
Ceylon
Cezanne

Chablis
Chad
Chadwick
chafe
chaff
chagrin
chain







<





>









>







3833
3834
3835
3836
3837
3838
3839

3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
cereus
cerise
cerium
CERN
certain
certainty
certificate

certify
certiorari
certitude
cerulean
Cervantes
cervix
Cesare
cesium
cessation
cession
Cessna
cetera
Cetus
Ceylon
Cezanne
cf
Chablis
Chad
Chadwick
chafe
chaff
chagrin
chain
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
chalkline
chalky
challenge
Chalmers
chamber
chamberlain
chambermaid
Chambers
chameleon
chamfer
chamois
chamomile
champ
champagne
Champaign







<







3875
3876
3877
3878
3879
3880
3881

3882
3883
3884
3885
3886
3887
3888
chalkline
chalky
challenge
Chalmers
chamber
chamberlain
chambermaid

chameleon
chamfer
chamois
chamomile
champ
champagne
Champaign
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955

3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
chaparral
chapel
chaperon
chaperone
chaplain
Chaplin
Chapman
chapping
chapter
char
character
characteristic
charcoal
chard
charge
chargeable

chariot
charisma
charismatic
charitable
charity
Charles
Charleston
Charley
Charlie
Charlotte
Charlottesville
charm
Charon
charring
chart
Charta
Chartres
chartreuse
chartroom
Charybdis
chase
chasm
chassis
chaste
chastise
chastity
chat
chateau
chateaux
Chatham
Chattanooga
chattel
chatting
chatty
Chaucer
chauffeur
Chauncey
Chautauqua
chaw
cheap







<








>













<


















<







3912
3913
3914
3915
3916
3917
3918

3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940

3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958

3959
3960
3961
3962
3963
3964
3965
chaparral
chapel
chaperon
chaperone
chaplain
Chaplin
Chapman

chapter
char
character
characteristic
charcoal
chard
charge
chargeable
Charlemagne
chariot
charisma
charismatic
charitable
charity
Charles
Charleston
Charley
Charlie
Charlotte
Charlottesville
charm
Charon

chart
Charta
Chartres
chartreuse
chartroom
Charybdis
chase
chasm
chassis
chaste
chastise
chastity
chat
chateau
chateaux
Chatham
Chattanooga
chattel

chatty
Chaucer
chauffeur
Chauncey
Chautauqua
chaw
cheap
4010
4011
4012
4013
4014
4015
4016

4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027

4028
4029
4030
4031
4032
4033
4034
4035
4036

4037
4038
4039
4040
4041
4042
4043
cheekbone
cheeky
cheer
cheerful
cheerleader
cheery
cheese

cheesecloth
cheesy
cheetah
chef
chelate
chemic
chemise
chemisorb
chemisorption
chemist
chemistry

Chen
Cheney
chenille
cherish
Cherokee
cherry
chert
cherub
cherubim

Chesapeake
Cheshire
chess
chest
Chester
Chesterton
chestnut







>











>









>







3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
cheekbone
cheeky
cheer
cheerful
cheerleader
cheery
cheese
cheesecake
cheesecloth
cheesy
cheetah
chef
chelate
chemic
chemise
chemisorb
chemisorption
chemist
chemistry
chemotherapy
Chen
Cheney
chenille
cherish
Cherokee
cherry
chert
cherub
cherubim
Cheryl
Chesapeake
Cheshire
chess
chest
Chester
Chesterton
chestnut
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
chieftain
chiffon
chigger
chignon
chilblain
child
childbirth
childhood
childish
childlike
children
Chile
chili
chill
chilly
chime
chimera







<

<







4039
4040
4041
4042
4043
4044
4045

4046

4047
4048
4049
4050
4051
4052
4053
chieftain
chiffon
chigger
chignon
chilblain
child
childbirth

childish

children
Chile
chili
chill
chilly
chime
chimera
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119

4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132

4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
Chinamen
Chinatown
chinch
chinchilla
chine
Chinese
chink
chinning
Chinook
chinquapin
chip
chipboard
chipmunk
Chippendale
chipping
chiropractor
chirp
chisel
Chisholm
chit
chiton
chivalrous
chivalry
chive
chlorate
chlordane
chloride
chlorine
chloroform
chlorophyll

chloroplatinate
chock
chocolate
Choctaw
choice
choir
choirmaster
choke
chokeberry
cholera
cholesterol
cholinesterase
chomp

choose
choosy
chop
Chopin
chopping
choppy
choral
chorale
chord
chordal
chordata
chordate







<






<















>













>




<







4061
4062
4063
4064
4065
4066
4067

4068
4069
4070
4071
4072
4073

4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107

4108
4109
4110
4111
4112
4113
4114
Chinamen
Chinatown
chinch
chinchilla
chine
Chinese
chink

Chinook
chinquapin
chip
chipboard
chipmunk
Chippendale

chiropractor
chirp
chisel
Chisholm
chit
chiton
chivalrous
chivalry
chive
chlorate
chlordane
chloride
chlorine
chloroform
chlorophyll
chloroplast
chloroplatinate
chock
chocolate
Choctaw
choice
choir
choirmaster
choke
chokeberry
cholera
cholesterol
cholinesterase
chomp
Chomsky
choose
choosy
chop
Chopin

choppy
choral
chorale
chord
chordal
chordata
chordate
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174

4175
4176
4177
4178
4179
4180
4181
Christenson
Christian
Christiana
Christianson
Christie
Christina
Christine
Christlike
Christmas
Christoffel
Christopher
Christy
chromate
chromatic

chromatogram
chromatograph
chromatography
chrome
chromic
chromium
chromosphere







|
|
|




>







4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
Christenson
Christian
Christiana
Christianson
Christie
Christina
Christine
Christmas
Christoffel
Christoph
Christopher
Christy
chromate
chromatic
chromatin
chromatogram
chromatograph
chromatography
chrome
chromic
chromium
chromosphere
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
chuck
chuckle
chuckwalla
chuff
chug
chugging
chum
chumming
chummy
chump
Chungking
chunk
chunky
church
churchgoer







<







4163
4164
4165
4166
4167
4168
4169

4170
4171
4172
4173
4174
4175
4176
chuck
chuckle
chuckwalla
chuff
chug
chugging
chum

chummy
chump
Chungking
chunk
chunky
church
churchgoer
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231

4232
4233
4234
4235
4236
4237
4238
Cicero
Ciceronian
cider
cigar
cigarette
cilia
ciliate
cimcumvention
cinch
Cincinnati
cinder
Cinderella

cinema
cinematic
Cinerama
cinnabar
cinnamon
cinquefoil
cipher







<




>







4190
4191
4192
4193
4194
4195
4196

4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
Cicero
Ciceronian
cider
cigar
cigarette
cilia
ciliate

cinch
Cincinnati
cinder
Cinderella
Cindy
cinema
cinematic
Cinerama
cinnabar
cinnamon
cinquefoil
cipher
4260
4261
4262
4263
4264
4265
4266
4267
4268

4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
circumspect
circumsphere
circumstance
circumstantial
circumvent
circumvention
circus
cirmcumferential
cistern

citadel
citation
cite
citizen
citizenry
citrate
citric
Citroen
citron
citrus
city
cityscape
citywide
civet
civic
civil
civilian
clad
cladding
cladophora
claim
claimant
Claire
clairvoyant
clam
clamber
clamming
clammy
clamp
clamshell
clan
clandestine
clang
clank
clannish
clap
clapboard
Clapeyron
clapping
Clara
Clare
Claremont
Clarence
Clarendon
claret
clarify
clarinet
clarity
Clark
Clarke
clash
clasp
class
classic
classification
classificatory
classify
classmate
classroom
classy
clatter
clattery







<

>


















<







<











<















<







4230
4231
4232
4233
4234
4235
4236

4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256

4257
4258
4259
4260
4261
4262
4263

4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274

4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289

4290
4291
4292
4293
4294
4295
4296
circumspect
circumsphere
circumstance
circumstantial
circumvent
circumvention
circus

cistern
cit
citadel
citation
cite
citizen
citizenry
citrate
citric
Citroen
citron
citrus
city
cityscape
citywide
civet
civic
civil
civilian
clad

cladophora
claim
claimant
Claire
clairvoyant
clam
clamber

clammy
clamp
clamshell
clan
clandestine
clang
clank
clannish
clap
clapboard
Clapeyron

Clara
Clare
Claremont
Clarence
Clarendon
claret
clarify
clarinet
clarity
Clark
Clarke
clash
clasp
class
classic

classificatory
classify
classmate
classroom
classy
clatter
clattery
4383
4384
4385
4386
4387
4388
4389
4390
4391

4392
4393
4394
4395
4396
4397
4398
clinician
clink
Clint
Clinton
Clio
clip
clipboard
clipping
clique

Clive
cloak
cloakroom
clobber
clock
clockwatcher
clockwise







<

>







4349
4350
4351
4352
4353
4354
4355

4356
4357
4358
4359
4360
4361
4362
4363
4364
clinician
clink
Clint
Clinton
Clio
clip
clipboard

clique
clitoris
Clive
cloak
cloakroom
clobber
clock
clockwatcher
clockwise
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437

4438
4439
4440
4441
4442
4443
4444
4445

4446
4447
4448
4449
4450
4451
4452
clothesbrush
clotheshorse
clothesline
clothesman
clothesmen
clothier
Clotho
clotting
cloture
cloud
cloudburst
cloudy
clout
clove
clown
cloy
club
clubbing
clubhouse
clubroom
cluck
clue

clump
clumsy
clung
cluster
clutch
clutter
Clyde
Clytemnestra

coach
coachman
coachmen
coachwork
coadjutor
coagulable
coagulate







<









<




>








>







4382
4383
4384
4385
4386
4387
4388

4389
4390
4391
4392
4393
4394
4395
4396
4397

4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
clothesbrush
clotheshorse
clothesline
clothesman
clothesmen
clothier
Clotho

cloture
cloud
cloudburst
cloudy
clout
clove
clown
cloy
club

clubhouse
clubroom
cluck
clue
Cluj
clump
clumsy
clung
cluster
clutch
clutter
Clyde
Clytemnestra
CO
coach
coachman
coachmen
coachwork
coadjutor
coagulable
coagulate
4503
4504
4505
4506
4507
4508
4509


4510
4511
4512
4513
4514
4515
4516
codebreak
codeposit
codetermine
codeword
codfish
codicil
codify


codpiece
Cody
coed
coeditor
coeducation
coefficient
coequal







>
>







4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
codebreak
codeposit
codetermine
codeword
codfish
codicil
codify
codomain
codon
codpiece
Cody
coed
coeditor
coeducation
coefficient
coequal
4540
4541
4542
4543
4544
4545
4546

4547
4548
4549
4550
4551
4552
4553
cognizant
Cohen
cohere
coherent
cohesion
cohesive
Cohn

cohort
cohosh
coiffure
coil
coin
coinage
coincide







>







4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
cognizant
Cohen
cohere
coherent
cohesion
cohesive
Cohn
cohomology
cohort
cohosh
coiffure
coil
coin
coinage
coincide
4592
4593
4594
4595
4596
4597
4598

4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
Collier
collimate
collinear
Collins
collision
collocation
colloidal

colloquia
colloquial
colloquium
colloquy
collude
collusion
Cologne
Colombia
Colombo
colon
colonel
colonial
colonist
colonnade
colony
Colorado
colorate
coloratura
colorimeter
colorimetry
colossal
Colosseum
colossi
colossus
colt
coltish
coltsfoot







>



















<







4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587

4588
4589
4590
4591
4592
4593
4594
Collier
collimate
collinear
Collins
collision
collocation
colloidal
Colloq
colloquia
colloquial
colloquium
colloquy
collude
collusion
Cologne
Colombia
Colombo
colon
colonel
colonial
colonist
colonnade
colony
Colorado
colorate
coloratura
colorimeter

colossal
Colosseum
colossi
colossus
colt
coltish
coltsfoot
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
Comanche
comatose
comb
combat
combatant
combatted
combinate
combinator
combinatorial
combinatoric
combine
combustible
combustion
come
comeback







<







4602
4603
4604
4605
4606
4607
4608

4609
4610
4611
4612
4613
4614
4615
Comanche
comatose
comb
combat
combatant
combatted
combinate

combinatorial
combinatoric
combine
combustible
combustion
come
comeback
4699
4700
4701
4702
4703
4704
4705

4706
4707
4708
4709
4710
4711
4712
communicant
communicate
communion
communique
commutate
commute
compact

Compagnie
companion
companionway
company
comparative
comparator
compare







>







4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
communicant
communicate
communion
communique
commutate
commute
compact
compactify
Compagnie
companion
companionway
company
comparative
comparator
compare
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
condition
condolence
condone
conduce
conducive
conduct
conductance
conductive
conductor
conduit
cone
coneflower
Conestoga
coney
confabulate







<







4809
4810
4811
4812
4813
4814
4815

4816
4817
4818
4819
4820
4821
4822
condition
condolence
condone
conduce
conducive
conduct
conductance

conductor
conduit
cone
coneflower
Conestoga
coney
confabulate
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
conformance
conformation
confound
confrere
confront
confrontation
Confucian
Confucianism
Confucius
confuse
confusion
confute
congeal
congener
congenial







<







4856
4857
4858
4859
4860
4861
4862

4863
4864
4865
4866
4867
4868
4869
conformance
conformation
confound
confrere
confront
confrontation
Confucian

Confucius
confuse
confusion
confute
congeal
congener
congenial
4921
4922
4923
4924
4925
4926
4927

4928
4929
4930
4931
4932
4933
4934
conifer
coniferous
conjectural
conjecture
conjoin
conjoint
conjugal

conjugate
conjunct
conjuncture
conjure
Conklin
Conley
conn







>







4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
conifer
coniferous
conjectural
conjecture
conjoin
conjoint
conjugal
conjugacy
conjugate
conjunct
conjuncture
conjure
Conklin
Conley
conn
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002

5003
5004
5005
5006
5007
5008
5009
consort
consortium
conspicuous
conspiracy
conspirator
conspiratorial
conspire
Constance
constant
Constantine
Constantinople
constellate
consternate
constituent
constitute
constitution

constrain
constraint
constrict
constrictor
construct
constructible
constructor







<








>







4955
4956
4957
4958
4959
4960
4961

4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
consort
consortium
conspicuous
conspiracy
conspirator
conspiratorial
conspire

constant
Constantine
Constantinople
constellate
consternate
constituent
constitute
constitution
constitutive
constrain
constraint
constrict
constrictor
construct
constructible
constructor
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
continental
contingent
continua
continual
continuant
continuation
continue
continued
continuity
continuo
continuous
continuum
contort
contour
contraband







<







5013
5014
5015
5016
5017
5018
5019

5020
5021
5022
5023
5024
5025
5026
continental
contingent
continua
continual
continuant
continuation
continue

continuity
continuo
continuous
continuum
contort
contour
contraband
5159
5160
5161
5162
5163
5164
5165

5166
5167
5168
5169
5170
5171
5172
copolymer
copperas
Copperfield
copperhead
coppery
copra
coprinus

copter
copy
copybook
copyright
copywriter
coquette
coquina







>







5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
copolymer
copperas
Copperfield
copperhead
coppery
copra
coprinus
coproduct
copter
copy
copybook
copyright
copywriter
coquette
coquina
5251
5252
5253
5254
5255
5256
5257

5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273

5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290

5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305

5306
5307
5308
5309
5310
5311
5312
corsage
cortege
cortex
cortical
Cortland
corundum
coruscate

corvette
Corvus
cos
cosec
coset
Cosgrove
cosh
cosine
cosmetic
cosmic
cosmology
cosmopolitan
cosmos
cosponsor
Cossack
cost

Costello
costume
cosy
cot
cotangent
cotillion
cotman
cotoneaster
cotta
cottage
cotton
cottonmouth
cottonseed
cottonwood
cottony
Cottrell
cotty

couch
cougar
cough
could
couldn't
coulomb
Coulter
council
councilman
councilmen
councilwoman
councilwomen
counsel
counselor
count

countenance
counteract
counterargument
counterattack
counterbalance
counterclockwise
counterexample







>
















>

















>















>







5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
corsage
cortege
cortex
cortical
Cortland
corundum
coruscate
Corvallis
corvette
Corvus
cos
cosec
coset
Cosgrove
cosh
cosine
cosmetic
cosmic
cosmology
cosmopolitan
cosmos
cosponsor
Cossack
cost
Costa
Costello
costume
cosy
cot
cotangent
cotillion
cotman
cotoneaster
cotta
cottage
cotton
cottonmouth
cottonseed
cottonwood
cottony
Cottrell
cotty
cotyledon
couch
cougar
cough
could
couldn't
coulomb
Coulter
council
councilman
councilmen
councilwoman
councilwomen
counsel
counselor
count
countdown
countenance
counteract
counterargument
counterattack
counterbalance
counterclockwise
counterexample
5344
5345
5346
5347
5348
5349
5350

5351
5352
5353
5354
5355
5356
5357
courtesan
courtesy
courthouse
courtier
Courtney
courtroom
courtyard

cousin
couturier
covalent
covariant
covariate
covary
cove







>







5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
courtesan
courtesy
courthouse
courtier
Courtney
courtroom
courtyard
couscous
cousin
couturier
covalent
covariant
covariate
covary
cove
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398

5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
cowslip
cox
coxcomb
coy
coyote
coypu
cozen
cozier
cozy
CPA

crab
crabapple
crabbing
crack
crackle
crackpot
cradle
craft
craftsman
craftsmen
craftspeople
craftsperson
crafty
crag
craggy
Craig
cram
Cramer
cramming
cramp
cranberry
Crandall
crane
cranelike
Cranford
crania
cranium
crank
crankcase
crankshaft
cranky







<


>


<















<




<







5362
5363
5364
5365
5366
5367
5368

5369
5370
5371
5372
5373

5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388

5389
5390
5391
5392

5393
5394
5395
5396
5397
5398
5399
cowslip
cox
coxcomb
coy
coyote
coypu
cozen

cozy
CPA
cpu
crab
crabapple

crack
crackle
crackpot
cradle
craft
craftsman
craftsmen
craftspeople
craftsperson
crafty
crag
craggy
Craig
cram
Cramer

cramp
cranberry
Crandall
crane

Cranford
crania
cranium
crank
crankcase
crankshaft
cranky
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
creak
creaky
cream
creamery
creamy
crease
create
creating
creature
creche
credent
credential
credenza
credible
credit







<







5419
5420
5421
5422
5423
5424
5425

5426
5427
5428
5429
5430
5431
5432
creak
creaky
cream
creamery
creamy
crease
create

creature
creche
credent
credential
credenza
credible
credit
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521

5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545

5546
5547
5548
5549
5550
5551
5552
crevice
crew
crewcut
crewel
crewman
crewmen
crib
cribbing
cricket
cried
crime
Crimea
criminal
crimp
crimson
cringe
crinkle
cripple
crises
crisis
crisp
Crispin
criss
crisscross
criteria
criterion
critic
critique
critter
croak

crochet
crock
crockery
Crockett
crocodile
crocodilian
crocus
croft
Croix
Cromwell
Cromwellian
crone
crony
crook
croon
crop
cropping
Crosby
cross
crossarm
crossbar
crossbill
crosscut
crosshatch

crossover
crosspoint
crossroad
crosstalk
crosswalk
crossway
crosswise







<

<




















>
















<







>







5461
5462
5463
5464
5465
5466
5467

5468

5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505

5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
crevice
crew
crewcut
crewel
crewman
crewmen
crib

cricket

crime
Crimea
criminal
crimp
crimson
cringe
crinkle
cripple
crises
crisis
crisp
Crispin
criss
crisscross
criteria
criterion
critic
critique
critter
croak
Croatia
crochet
crock
crockery
Crockett
crocodile
crocodilian
crocus
croft
Croix
Cromwell
Cromwellian
crone
crony
crook
croon
crop

Crosby
cross
crossarm
crossbar
crossbill
crosscut
crosshatch
crosslink
crossover
crosspoint
crossroad
crosstalk
crosswalk
crossway
crosswise
5585
5586
5587
5588
5589
5590
5591

5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608


5609
5610
5611
5612
5613
5614
5615
crupper
crusade
crush
Crusoe
crust
crutch
crux

cry
cryogenic
cryostat
crypt
cryptanalysis
cryptanalyst
cryptanalytic
cryptic
cryptogram
cryptographer
cryptography
crystal
crystalline
crystallite
crystallographer
crystallography
c's


cub
Cuba
cubbyhole
cube
cubic
cuckoo
cucumber







>

















>
>







5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
crupper
crusade
crush
Crusoe
crust
crutch
crux
Cruz
cry
cryogenic
cryostat
crypt
cryptanalysis
cryptanalyst
cryptanalytic
cryptic
cryptogram
cryptographer
cryptography
crystal
crystalline
crystallite
crystallographer
crystallography
c's
csnet
CT
cub
Cuba
cubbyhole
cube
cubic
cuckoo
cucumber
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
Cunningham
CUNY
cup
cupboard
cupful
Cupid
cupidity
cupping
cupric
cuprous
cur
curate
curb
curbside
curd







<







5618
5619
5620
5621
5622
5623
5624

5625
5626
5627
5628
5629
5630
5631
Cunningham
CUNY
cup
cupboard
cupful
Cupid
cupidity

cupric
cuprous
cur
curate
curb
curbside
curd
5708
5709
5710
5711
5712
5713
5714

5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733

5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744

5745
5746

5747
5748
5749


5750
5751

5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
cute
cutlass
cutler
cutlet
cutoff
cutout
cutover

cutthroat
cutting
cuttlebone
cuttlefish
cutworm
Cyanamid
cyanate
cyanic
cyanide
cybernetics
cycad
Cyclades
cycle
cyclic
cyclist
cyclone
cyclopean
Cyclops
cyclorama

cyclotron
Cygnus
cylinder
cylindric
cynic
Cynthia
cypress
Cyprian
Cypriot
Cyprus
Cyril

Cyrus
cyst

cytochemistry
cytolysis
cytoplasm


czar
czarina

Czechoslovakia
Czerniak
d
dab
dabbing
dabble
Dacca
dachshund
dactyl
dactylic
dad
Dadaism
Dadaist
daddy
Dade
Daedalus
daffodil
daffy
dagger
Dahl







>

<







|









>











>


>



>
>


>




<






|
<







5678
5679
5680
5681
5682
5683
5684
5685
5686

5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731

5732
5733
5734
5735
5736
5737
5738

5739
5740
5741
5742
5743
5744
5745
cute
cutlass
cutler
cutlet
cutoff
cutout
cutover
cutset
cutthroat

cuttlebone
cuttlefish
cutworm
Cyanamid
cyanate
cyanic
cyanide
cybernetic
cycad
Cyclades
cycle
cyclic
cyclist
cyclone
cyclopean
Cyclops
cyclorama
cyclotomic
cyclotron
Cygnus
cylinder
cylindric
cynic
Cynthia
cypress
Cyprian
Cypriot
Cyprus
Cyril
Cyrillic
Cyrus
cyst
cysteine
cytochemistry
cytolysis
cytoplasm
cytosine
CZ
czar
czarina
Czech
Czechoslovakia
Czerniak
d
dab

dabble
Dacca
dachshund
dactyl
dactylic
dad
Dada

daddy
Dade
Daedalus
daffodil
daffy
dagger
Dahl
5781
5782
5783
5784
5785
5786
5787

5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
dais
daisy
Dakar
Dakota
dale
Daley
Dallas

dally
Dalton
Daly
Dalzell
dam
damage
Damascus
damask
dame
damming
damn
damnation
Damon
damp
dampen
damsel
Dan







>









<







5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771

5772
5773
5774
5775
5776
5777
5778
dais
daisy
Dakar
Dakota
dale
Daley
Dallas
Dalhousie
dally
Dalton
Daly
Dalzell
dam
damage
Damascus
damask
dame

damn
damnation
Damon
damp
dampen
damsel
Dan
5829
5830
5831
5832
5833
5834
5835

5836

5837
5838
5839
5840
5841
5842
5843
Darius
dark
darken
darkle
Darlene
darling
darn

Darrell

d'art
dart
Dartmouth
Darwin
Darwinian
dash
dashboard







>

>







5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
Darius
dark
darken
darkle
Darlene
darling
darn
DARPA
Darrell
Darry
d'art
dart
Dartmouth
Darwin
Darwinian
dash
dashboard
5953
5954
5955
5956
5957
5958
5959

5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980

5981
5982
5983
5984
5985
5986
5987
deceptive
decertify
decibel
decide
deciduous
decile
decimal

decipher
decision
decisional
decisive
deck
Decker
declaim
declamation
declamatory
declaration
declarative
declarator
declaratory
declare
declassify
declination
decline
declivity
decode
decolletage
decollimate

decompile
decomposable
decompose
decomposition
decompress
decompression
decontrol







>


<


<















>







5929
5930
5931
5932
5933
5934
5935
5936
5937
5938

5939
5940

5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
deceptive
decertify
decibel
decide
deciduous
decile
decimal
decimate
decipher
decision

decisive
deck

declaim
declamation
declamatory
declaration
declarative
declarator
declaratory
declare
declassify
declination
decline
declivity
decode
decolletage
decollimate
decolonize
decompile
decomposable
decompose
decomposition
decompress
decompression
decontrol
6017
6018
6019
6020
6021
6022
6023

6024
6025
6026
6027
6028
6029
6030
deerskin
deerstalker
deface
default
defeat
defecate
defect

defend
defendant
defensible
defensive
defer
deferent
deferrable







>







5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
deerskin
deerstalker
deface
default
defeat
defecate
defect
defector
defend
defendant
defensible
defensive
defer
deferent
deferrable
6077
6078
6079
6080
6081
6082
6083

6084
6085
6086
6087
6088
6089
6090
delectable
delectate
delegable
delegate
delete
deleterious
deletion

Delhi
Delia
deliberate
delicacy
delicate
delicatessen
delicious







>







6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
delectable
delectate
delegable
delegate
delete
deleterious
deletion
Delft
Delhi
Delia
deliberate
delicacy
delicate
delicatessen
delicious
6124
6125
6126
6127
6128
6129
6130

6131
6132
6133
6134
6135
6136
6137
demagnify
demagogue
demand
demarcate
demark
demean
demented

demerit
demigod
demijohn
demiscible
demise
demit
demitted







>







6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
demagnify
demagogue
demand
demarcate
demark
demean
demented
dementia
demerit
demigod
demijohn
demiscible
demise
demit
demitted
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162


6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194

6195
6196
6197
6198
6199
6200
6201
6202
6203
Dempsey
demultiplex
demur
demure
demurred
demurrer
demurring
demythologize
den
denature


Deneb
Denebola
deniable
denial
denigrate
denizen
Denmark
Dennis
Denny
denominate
denotation
denotative
denote
denouement
denounce
dense
densitometer
densitometric
densitometry
dent
dental
dentistry
Denton
denture
denudation
denude
denumerable
denunciate
Denver
deny
deodorant
deoxyribonucleic

depart
department
departure
depend
dependent
depict
deplete
depletion
deplore







|


>
>

















<
<













>

<







6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160


6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175

6176
6177
6178
6179
6180
6181
6182
Dempsey
demultiplex
demur
demure
demurred
demurrer
demurring
demystify
den
denature
dendrite
dendritic
Deneb
Denebola
deniable
denial
denigrate
denizen
Denmark
Dennis
Denny
denominate
denotation
denotative
denote
denouement
denounce
dense
densitometer


dent
dental
dentistry
Denton
denture
denudation
denude
denumerable
denunciate
Denver
deny
deodorant
deoxyribonucleic
deoxyribose
depart

departure
depend
dependent
depict
deplete
depletion
deplore
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
deprave
deprecate
deprecatory
depreciable
depreciate
depress
depressant
depressed
depressible
depressing
depression
depressive
depressor
deprivation
deprive
depth
deputation







<

<







6194
6195
6196
6197
6198
6199
6200

6201

6202
6203
6204
6205
6206
6207
6208
deprave
deprecate
deprecatory
depreciable
depreciate
depress
depressant

depressible

depression
depressive
depressor
deprivation
deprive
depth
deputation
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
despoil
despond
despondent
despot
despotic
dessert
dessicate
destabilize
destinate
destine
destiny
destitute
destroy
destruct
destructor
desuetude
desultory
desynchronize
detach
detail
detain
d'etat
detect
detector
detent







<









<







6264
6265
6266
6267
6268
6269
6270

6271
6272
6273
6274
6275
6276
6277
6278
6279

6280
6281
6282
6283
6284
6285
6286
despoil
despond
despondent
despot
despotic
dessert
dessicate

destinate
destine
destiny
destitute
destroy
destruct
destructor
desuetude
desultory

detach
detail
detain
d'etat
detect
detector
detent
6321
6322
6323
6324
6325
6326
6327

6328
6329
6330
6331
6332
6333
6334
deterrent
deterring
detest
detestation
detonable
detonate
detour

detract
detractor
detriment
Detroit
deuce
deus
deuterate







>







6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
deterrent
deterring
detest
detestation
detonable
detonate
detour
detoxify
detract
detractor
detriment
Detroit
deuce
deus
deuterate
6356
6357
6358
6359
6360
6361
6362

6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386

6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
dewar
dewdrop
Dewey
Dewitt
dewy
dexter
dexterity

dextrous
dey
Dhabi
dharma
diabase
diabetes
diabetic
diabolic
diachronic
diacritical
diadem
diagnosable
diagnose
diagnoses
diagnosis
diagnostic
diagnostician
diagonal
diagram
diagrammatic
dial
dialect
dialectic
dialogue

dialysis
diamagnetic
diamagnetism
diameter
diametric
diamond
Diana
Diane
Dianne
diaper
diaphanous
diaphragm







>









|



<










>




<







6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352

6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367

6368
6369
6370
6371
6372
6373
6374
dewar
dewdrop
Dewey
Dewitt
dewy
dexter
dexterity
dextrose
dextrous
dey
Dhabi
dharma
diabase
diabetes
diabetic
diabolic
diachronic
diacritic
diadem
diagnosable
diagnose

diagnosis
diagnostic
diagnostician
diagonal
diagram
diagrammatic
dial
dialect
dialectic
dialogue
dialup
dialysis
diamagnetic
diamagnetism
diameter

diamond
Diana
Diane
Dianne
diaper
diaphanous
diaphragm
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446


6447
6448
6449
6450
6451
6452
6453
did
didactic
diddle
didn't
Dido
die
Diebold
died
Diego
diehard
dieldrin
dielectric
diem
diesel
diet
dietary
dietetic
diethylstilbestrol
dietician
Dietrich
diety
Dietz


differ
different
differentiable
differential
differentiate
difficult
difficulty







<














>
>







6401
6402
6403
6404
6405
6406
6407

6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
did
didactic
diddle
didn't
Dido
die
Diebold

Diego
diehard
dieldrin
dielectric
diem
diesel
diet
dietary
dietetic
diethylstilbestrol
dietician
Dietrich
diety
Dietz
diffeomorphic
diffeomorphism
differ
different
differentiable
differential
differentiate
difficult
difficulty
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
digram
digress
digression
dihedral
dilapidate
dilatation
dilate
dilation
dilatory
dilemma
dilettante
diligent
dill
Dillon
dilogarithm
diluent
dilute
dilution
dim
dime
dimension
dimethyl
diminish
diminution
diminutive
dimming
dimple
din
Dinah
dine
ding
dinghy
dingo







<

















<







6451
6452
6453
6454
6455
6456
6457

6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474

6475
6476
6477
6478
6479
6480
6481
digram
digress
digression
dihedral
dilapidate
dilatation
dilate

dilatory
dilemma
dilettante
diligent
dill
Dillon
dilogarithm
diluent
dilute
dilution
dim
dime
dimension
dimethyl
diminish
diminution
diminutive

dimple
din
Dinah
dine
ding
dinghy
dingo
6516
6517
6518
6519
6520
6521
6522

6523


6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542

6543
6544
6545
6546
6547
6548
6549
Dionysus
Diophantine
diopter
diorama
diorite
dioxide
dip

diphthong


diploma
diplomacy
diplomat
diplomatic
dipole
dipping
Dirac
dire
direct
director
directorate
directory
directrices
directrix
dirge
Dirichlet
dirt
dirty
Dis

disambiguate
disastrous
disburse
disc
discern
discernible
disciple







>

>
>





<













>







6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506

6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
Dionysus
Diophantine
diopter
diorama
diorite
dioxide
dip
diphtheria
diphthong
diploid
diploidy
diploma
diplomacy
diplomat
diplomatic
dipole

Dirac
dire
direct
director
directorate
directory
directrices
directrix
dirge
Dirichlet
dirt
dirty
Dis
disaccharide
disambiguate
disastrous
disburse
disc
discern
discernible
disciple
6582
6583
6584
6585
6586
6587
6588

6589
6590
6591
6592
6593
6594
6595
Disney
Disneyland
disparage
disparate
dispel
dispelled
dispelling

dispensary
dispensate
dispense
dispersal
disperse
dispersible
dispersion







>







6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
Disney
Disneyland
disparage
disparate
dispel
dispelled
dispelling
dispensable
dispensary
dispensate
dispense
dispersal
disperse
dispersible
dispersion
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
disruptive
dissemble
disseminate
dissension
dissertation
dissident
dissipate
dissociable
dissociate
dissonant
dissuade
distaff
distal
distant
distillate
distillery
distinct
distinguish
distort
distortion
distraught
distribution
distributive
distributor
district
disturb
disturbance







<

<









<







6584
6585
6586
6587
6588
6589
6590

6591

6592
6593
6594
6595
6596
6597
6598
6599
6600

6601
6602
6603
6604
6605
6606
6607
disruptive
dissemble
disseminate
dissension
dissertation
dissident
dissipate

dissociate

dissuade
distaff
distal
distant
distillate
distillery
distinct
distinguish
distort

distraught
distribution
distributive
distributor
district
disturb
disturbance
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
divestiture
divide
dividend
divination
divine
divisible
division
divisional
divisive
divisor
divorce
divorcee
divulge
Dixie
dixieland







<







6627
6628
6629
6630
6631
6632
6633

6634
6635
6636
6637
6638
6639
6640
divestiture
divide
dividend
divination
divine
divisible
division

divisive
divisor
divorce
divorcee
divulge
Dixie
dixieland
6689
6690
6691
6692
6693
6694
6695

6696
6697
6698
6699
6700
6701
6702
documentation
DOD
Dodd
dodecahedra
dodecahedral
dodecahedron
dodge

Dodson
doe
doesn't
d'oeuvre
doff
dog
dogbane







>







6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
documentation
DOD
Dodd
dodecahedra
dodecahedral
dodecahedron
dodge
dodo
Dodson
doe
doesn't
d'oeuvre
doff
dog
dogbane
6717
6718
6719
6720
6721
6722
6723

6724
6725
6726
6727
6728
6729
6730
Dolan
dolce
doldrum
dole
doleful
doll
dollar

dolly
dolomite
dolomitic
Dolores
dolphin
dolt
doltish







>







6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
Dolan
dolce
doldrum
dole
doleful
doll
dollar
dollop
dolly
dolomite
dolomitic
Dolores
dolphin
dolt
doltish
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
donate
done
Doneck
donkey
Donna
Donnelly
Donner
donning
donnybrook
donor
Donovan
don't
doodle
Dooley
Doolittle







<







6728
6729
6730
6731
6732
6733
6734

6735
6736
6737
6738
6739
6740
6741
donate
done
Doneck
donkey
Donna
Donnelly
Donner

donnybrook
donor
Donovan
don't
doodle
Dooley
Doolittle
6786
6787
6788
6789
6790
6791
6792

6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
Doric
Doris
dormant
dormitory
Dorothea
Dorothy
Dorset

dosage
dose
dosimeter
dossier
Dostoevsky
dot
dote
dotting
double
Doubleday
doubleheader
doublet
doubleton
doubloon
doubt







>







<







6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776

6777
6778
6779
6780
6781
6782
6783
Doric
Doris
dormant
dormitory
Dorothea
Dorothy
Dorset
Dortmund
dosage
dose
dosimeter
dossier
Dostoevsky
dot
dote

double
Doubleday
doubleheader
doublet
doubleton
doubloon
doubt
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
downbeat
downcast
downdraft
Downey
downfall
downgrade
downhill
Downing
downplay
downpour
downright
Downs
downside
downslope
downspout
downstairs
downstream
downtown
downtrend







<



<







6803
6804
6805
6806
6807
6808
6809

6810
6811
6812

6813
6814
6815
6816
6817
6818
6819
downbeat
downcast
downdraft
Downey
downfall
downgrade
downhill

downplay
downpour
downright

downside
downslope
downspout
downstairs
downstream
downtown
downtrend
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
drawl
drawn
dread
dreadful
dreadnought
dream
dreamboat
dreamlike
dreamt
dreamy
dreary
dredge
dreg
drench
dress
dressmake
dressy
drew
Drexel
Dreyfuss
drib
dribble
dried
drier
drift
drill
drink
drip
dripping
drippy
Driscoll
drive
driven
driveway
drizzle
drizzly
droll
dromedary
drone
drool
droop
droopy
drop
drophead
droplet
dropout
dropping
drosophila
dross
drought
drove
drown
drowse
drowsy
drub
drubbing
drudge
drudgery
drug
drugging
drugstore
druid
drum
drumhead
drumlin
drumming
Drummond
drunk
drunkard
drunken
Drury
dry
dryad
Dryden
d's
du
dual
dualism
Duane
dub
Dubhe
dubious
dubitable
Dublin
ducat







<














<
<




<

















<








<









<











<







6859
6860
6861
6862
6863
6864
6865

6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879


6880
6881
6882
6883

6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900

6901
6902
6903
6904
6905
6906
6907
6908

6909
6910
6911
6912
6913
6914
6915
6916
6917

6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928

6929
6930
6931
6932
6933
6934
6935
drawl
drawn
dread
dreadful
dreadnought
dream
dreamboat

dreamt
dreamy
dreary
dredge
dreg
drench
dress
dressmake
dressy
drew
Drexel
Dreyfuss
drib
dribble


drift
drill
drink
drip

drippy
Driscoll
drive
driven
driveway
drizzle
drizzly
droll
dromedary
drone
drool
droop
droopy
drop
drophead
droplet
dropout

drosophila
dross
drought
drove
drown
drowse
drowsy
drub

drudge
drudgery
drug
drugging
drugstore
druid
drum
drumhead
drumlin

Drummond
drunk
drunkard
drunken
Drury
dry
dryad
Dryden
d's
du
dual

Duane
dub
Dubhe
dubious
dubitable
Dublin
ducat
7016
7017
7018
7019
7020
7021
7022

7023

7024
7025
7026
7027
7028
7029
7030
duopoly
dupe
duplex
duplicable
duplicate
duplicity
DuPont

durable

Durango
duration
Durer
duress
Durham
during
Durkee







>

>







6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
duopoly
dupe
duplex
duplicable
duplicate
duplicity
DuPont
Duquesne
durable
durance
Durango
duration
Durer
duress
Durham
during
Durkee
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
dwelt
Dwight
dwindle
Dwyer
dyad
dyadic
dye
dyer
dying
Dyke
Dylan
dynamic
dynamism
dynamite
dynamo







|







7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
dwelt
Dwight
dwindle
Dwyer
dyad
dyadic
dye
dyeing
dying
Dyke
Dylan
dynamic
dynamism
dynamite
dynamo
7121
7122
7123
7124
7125
7126
7127

7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145


7146
7147
7148
7149
7150
7151
7152
Eben
ebony
ebullient
eccentric
Eccles
ecclesiastic
echelon

echinoderm
echo
echoes
eclat
eclectic
eclipse
ecliptic
eclogue
Ecole
ecology
econometric
Econometrica
economic
economist
economy
ecosystem
ecstasy
ecstatic


Ecuador
ecumenic
ecumenist
Ed
Eddie
eddy
edelweiss







>


















>
>







7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
Eben
ebony
ebullient
eccentric
Eccles
ecclesiastic
echelon
echidna
echinoderm
echo
echoes
eclat
eclectic
eclipse
ecliptic
eclogue
Ecole
ecology
econometric
Econometrica
economic
economist
economy
ecosystem
ecstasy
ecstatic
ectoderm
ectopic
Ecuador
ecumenic
ecumenist
Ed
Eddie
eddy
edelweiss
7171
7172
7173
7174
7175
7176
7177

7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
editorial
Edmonds
Edmondson
Edmonton
Edmund
Edna
EDT

educable
educate
Edward
Edwardian
Edwards
Edwin
Edwina
eel
eelgrass
EEOC
e'er
eerie







>




|







7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
editorial
Edmonds
Edmondson
Edmonton
Edmund
Edna
EDT
Eduardo
educable
educate
Edward
Edwardian
Edwardine
Edwin
Edwina
eel
eelgrass
EEOC
e'er
eerie
7204
7205
7206
7207
7208
7209
7210

7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230

7231
7232
7233
7234
7235
7236
7237
efflorescent
effluent
effluvia
effluvium
effort
effusive
eft

egalitarian
Egan
egg
egghead
eggplant
eggshell
ego
egocentric
egotism
egotist
egregious
egress
egret
Egypt
Egyptian
eh
Ehrlich
eider
eidetic
eigenfunction

eigenstate
eigenvalue
eigenvector
eight
eighteen
eighteenth
eightfold







>




















>







7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
efflorescent
effluent
effluvia
effluvium
effort
effusive
eft
e.g
egalitarian
Egan
egg
egghead
eggplant
eggshell
ego
egocentric
egotism
egotist
egregious
egress
egret
Egypt
Egyptian
eh
Ehrlich
eider
eidetic
eigenfunction
eigenspace
eigenstate
eigenvalue
eigenvector
eight
eighteen
eighteenth
eightfold
7319
7320
7321
7322
7323
7324
7325

7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
Elizabeth
Elizabethan
elk
Elkhart
ell
Ella
Ellen

Elliott
ellipse
ellipsis
ellipsoid
ellipsoidal
ellipsometer
ellipsometry
elliptic
Ellis
Ellison
Ellsworth
Ellwood
elm
Elmer







>






<







7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306

7307
7308
7309
7310
7311
7312
7313
Elizabeth
Elizabethan
elk
Elkhart
ell
Ella
Ellen
Elliot
Elliott
ellipse
ellipsis
ellipsoid
ellipsoidal
ellipsometer

elliptic
Ellis
Ellison
Ellsworth
Ellwood
elm
Elmer
7372
7373
7374
7375
7376
7377
7378

7379
7380
7381
7382
7383
7384

7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398

7399
7400
7401
7402
7403
7404

7405
7406
7407
7408
7409
7410
7411
embargo
embargoes
embark
embarrass
embassy
embattle
embed

embedded
embedder
embedding
embellish
ember
embezzle

emblematic
embodiment
embody
embolden
emboss
embouchure
embower
embrace
embraceable
embrittle
embroider
embroidery
embroil
embryo

embryonic
emcee
emendable
emerald
emerge
emergent

emeritus
Emerson
Emery
emigrant
emigrate
Emil
Emile







>






>














>






>







7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
embargo
embargoes
embark
embarrass
embassy
embattle
embed
embeddable
embedded
embedder
embedding
embellish
ember
embezzle
emblem
emblematic
embodiment
embody
embolden
emboss
embouchure
embower
embrace
embraceable
embrittle
embroider
embroidery
embroil
embryo
embryology
embryonic
emcee
emendable
emerald
emerge
emergent
emeriti
emeritus
Emerson
Emery
emigrant
emigrate
Emil
Emile
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487

7488
7489
7490

7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540

7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
emitting
emma
Emmanuel
Emmett
emolument
Emory
emotion
emotional
empathy
emperor
emphases
emphasis
emphatic
emphysema
emphysematous
empire
empiric
emplace
employ
employed
employee
employer
employing
emporium
empower
empress
empty
emulate
emulsify
emulsion
en
enact
enamel
encamp
encapsulate
encase
encephalitis
enchain
enchant
enchantress
encipher
encircle
enclave
enclose
enclosure
encode
encomia
encomium
encompass
encore
encounter
encourage
encroach
encrust
encrypt
encryption
encumber
encumbrance
encyclical
encyclopedic
end
endanger
endear
endgame
Endicott

endogamous
endogamy
endogenous

endorse
endosperm
endothelial
endothermic
endow
endpoint
endurance
endure
enemy
energetic
energy
enervate
enfant
enfeeble
Enfield
enforce
enforceable
enforcible
enfranchise
Eng
engage
Engel
engender
engine
engineer
England
Englander
Engle
Englewood
English
Englishman
Englishmen
engrave
engross
engulf
enhance
Enid
enigma
enigmatic
enjoin
enjoinder
enjoy
enlarge
enlargeable
enlighten
enlist
enliven
enmesh
enmity
Enoch

enormity
enormous
Enos
enough
enquire
enquiry
enrage
enrapture
enrich
Enrico
enroll
enrollee
ensconce
ensemble
enshroud
ensign
enslave
ensnare
enstatite
ensue
ensure
entail
entangle
entendre
enter
enterprise
entertain
enthalpy
enthrall
enthrone
enthusiasm
enthusiast
enthusiastic
entice
entire
entirety
entitle
entity
entomb
entomology
entourage
entrain
entrance
entranceway
entrant
entrap
entrapping
entreat
entreaty
entree
entrench
entrepreneur
entrepreneurial
entropy
entrust
entry
entwine
enumerable
enumerate
enunciable
enunciate
envelop
envelope
envenom
enviable
envious
environ
envisage
envision
envoy
envy
enzymatic
enzyme
enzymology
Eocene
eohippus







<











<

<
<








<

<

<

<
<

<
<

<
<
<


<

<
<

<
<



<


<
<


>



>






<






<
<
<


<



<









<
<
<




<

<
<

<
<
<
<


>






<
<
<

<



<
<
<
<

<
<
<
<





<
<






<

<


<
<


<
<
<
<
<
<



<

<






<



<
<







7401
7402
7403
7404
7405
7406
7407

7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418

7419


7420
7421
7422
7423
7424
7425
7426
7427

7428

7429

7430


7431


7432



7433
7434

7435


7436


7437
7438
7439

7440
7441


7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454

7455
7456
7457
7458
7459
7460



7461
7462

7463
7464
7465

7466
7467
7468
7469
7470
7471
7472
7473
7474



7475
7476
7477
7478

7479


7480




7481
7482
7483
7484
7485
7486
7487
7488
7489



7490

7491
7492
7493




7494




7495
7496
7497
7498
7499


7500
7501
7502
7503
7504
7505

7506

7507
7508


7509
7510






7511
7512
7513

7514

7515
7516
7517
7518
7519
7520

7521
7522
7523


7524
7525
7526
7527
7528
7529
7530
emitting
emma
Emmanuel
Emmett
emolument
Emory
emotion

empathy
emperor
emphases
emphasis
emphatic
emphysema
emphysematous
empire
empiric
emplace
employ

employee


emporium
empower
empress
empty
emulate
emulsify
emulsion
en

enamel

encapsulate

encephalitis


enchantress


enclave



encomia
encomium

encore


encroach


encryption
encumber
encumbrance

encyclopedic
end


endgame
Endicott
endoderm
endogamous
endogamy
endogenous
endomorphism
endorse
endosperm
endothelial
endothermic
endow
endpoint

endure
enemy
energetic
energy
enervate
enfant



enforceable
enforcible

Eng
engage
Engel

engine
engineer
England
Englander
Engle
Englewood
English
Englishman
Englishmen



enhance
Enid
enigma
enigmatic

enjoinder


enlargeable




enmity
Enoch
enol
enormity
enormous
Enos
enough
enquire
enquiry



Enrico

enrollee
ensconce
ensemble




enstatite




entendre
enter
enterprise
entertain
enthalpy


enthusiasm
enthusiast
enthusiastic
entice
entire
entirety

entity

entomology
entourage


entranceway
entrant






entrepreneur
entrepreneurial
entropy

entry

enumerable
enumerate
enunciable
enunciate
envelop
envelope

enviable
envious
environ


envoy
envy
enzymatic
enzyme
enzymology
Eocene
eohippus
7634
7635
7636
7637
7638
7639
7640

7641
7642
7643
7644
7645
7646
7647

7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658

7659
7660
7661
7662
7663
7664
7665
epidermis
epigenetic
epigram
epigrammatic
epigraph
epileptic
epilogue

Epiphany
epiphyseal
epiphysis
episcopal
Episcopalian
episcopate
episode

epistemology
epistle
epistolatory
epitaph
epitaxial
epitaxy
epithelial
epithelium
epithet
epitome
epoch

epoxy
epsilon
Epsom
Epstein
equable
equal
equanimity







>







>











>







7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
epidermis
epigenetic
epigram
epigrammatic
epigraph
epileptic
epilogue
epimorphism
Epiphany
epiphyseal
epiphysis
episcopal
Episcopalian
episcopate
episode
episodic
epistemology
epistle
epistolatory
epitaph
epitaxial
epitaxy
epithelial
epithelium
epithet
epitome
epoch
epochal
epoxy
epsilon
Epsom
Epstein
equable
equal
equanimity
7695
7696
7697
7698
7699
7700
7701

7702
7703
7704
7705
7706
7707

7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
Erato
Eratosthenes
erbium
ERDA
ere
erect
erg

ergodic
Eric
Erich
Erickson
Ericsson
Erie

Erlenmeyer
Ernest
Ernestine
Ernie
Ernst
erode
erodible
Eros
erosible
erosion
erosive
erotic
erotica
err
errancy
errand
errant
errantry
errata
erratic
erratum
Errol







>






>














<







7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640

7641
7642
7643
7644
7645
7646
7647
Erato
Eratosthenes
erbium
ERDA
ere
erect
erg
ergative
ergodic
Eric
Erich
Erickson
Ericsson
Erie
Erik
Erlenmeyer
Ernest
Ernestine
Ernie
Ernst
erode
erodible
Eros
erosible
erosion
erosive
erotic
erotica
err

errand
errant
errantry
errata
erratic
erratum
Errol
7740
7741
7742
7743
7744
7745
7746

7747
7748
7749
7750
7751
7752
7753
e's
escadrille
escalate
escapade
escape
escapee
escheat

eschew
escort
escritoire
escrow
escutcheon
Eskimo
Esmark







>







7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
e's
escadrille
escalate
escapade
escape
escapee
escheat
Escherichia
eschew
escort
escritoire
escrow
escutcheon
Eskimo
Esmark
7772
7773
7774
7775
7776
7777
7778

7779
7780
7781
7782
7783
7784
7785
esteem
Estella
ester
Estes
Esther
estimable
estimate

estop
estoppal
estrange
estuarine
estuary
et
eta







>







7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
esteem
Estella
ester
Estes
Esther
estimable
estimate
Estonia
estop
estoppal
estrange
estuarine
estuary
et
eta
7811
7812
7813
7814
7815
7816
7817

7818
7819
7820
7821
7822
7823
7824
Eucharist
Euclid
Euclidean
eucre
Eugene
Eugenia
eugenic

Euler
Eulerian
eulogy
Eumenides
Eunice
euphemism
euphemist







>







7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
Eucharist
Euclid
Euclidean
eucre
Eugene
Eugenia
eugenic
eukaryote
Euler
Eulerian
eulogy
Eumenides
Eunice
euphemism
euphemist
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
evocate
evoke
evolution
evolutionary
evolve
evzone
ewe
Ewing
exacerbate
exact
exaggerate
exalt
exaltation
exam
examination
examine
example
exasperate
exasperater
excavate
exceed
excel
excelled
excellent
excelling
excelsior
except
exception
exceptional
excerpt
excess
excessive
exchange
exchangeable
exchequer
excisable







<




















<







7806
7807
7808
7809
7810
7811
7812

7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832

7833
7834
7835
7836
7837
7838
7839
evocate
evoke
evolution
evolutionary
evolve
evzone
ewe

exacerbate
exact
exaggerate
exalt
exaltation
exam
examination
examine
example
exasperate
exasperater
excavate
exceed
excel
excelled
excellent
excelling
excelsior
except
exception

excerpt
excess
excessive
exchange
exchangeable
exchequer
excisable
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941

7942
7943
7944
7945
7946
7947
7948
exclude
exclusion
exclusionary
exclusive
excommunicate
excoriate
excrescent
excresence
excrete
excretion
excretory
excruciate

exculpatory
excursion
excursus
excusable
excuse
execrable
execrate







<




>







7849
7850
7851
7852
7853
7854
7855

7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
exclude
exclusion
exclusionary
exclusive
excommunicate
excoriate
excrescent

excrete
excretion
excretory
excruciate
exculpate
exculpatory
excursion
excursus
excusable
excuse
execrable
execrate
8086
8087
8088
8089
8090
8091
8092

8093
8094
8095
8096
8097
8098
8099
8100
extoller
extolling
extort
extra
extracellular
extract
extractor

extraditable
extralegal
extramarital
extraneous
extraordinary
extrapolate
extraterrestrial
extravagant







>
|







8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
extoller
extolling
extort
extra
extracellular
extract
extractor
extradite
extradition
extralegal
extramarital
extraneous
extraordinary
extrapolate
extraterrestrial
extravagant
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
extrinsic
extroversion
extrovert
extrude
extrusion
extrusive
exuberant
exudation
exude
exult
exultant
exultation
Exxon
eye
eyeball
eyebright
eyebrow
eyed
eyeful
eyeglass
eyelash
eyelet
eyelid
eyepiece
eyesight







|









<







8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044

8045
8046
8047
8048
8049
8050
8051
extrinsic
extroversion
extrovert
extrude
extrusion
extrusive
exuberant
exudate
exude
exult
exultant
exultation
Exxon
eye
eyeball
eyebright
eyebrow

eyeful
eyeglass
eyelash
eyelet
eyelid
eyepiece
eyesight
8163
8164
8165
8166
8167
8168
8169

8170
8171
8172
8173
8174
8175
8176
fadeout
faery
Fafnir
fag
Fahey
Fahrenheit
fail

failsoft
failure
fain
faint
fair
Fairchild
Fairfax







>







8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
fadeout
faery
Fafnir
fag
Fahey
Fahrenheit
fail
failsafe
failsoft
failure
fain
faint
fair
Fairchild
Fairfax
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
fallen
fallible
falloff
fallout
fallow
Falmouth
false
falsehood
falsify
Falstaff
falter
fame
familial
familiar
familiarly
familism
family
famine
famish
famous
fan
fanatic
fanciful
fancy
fanfare
fanfold
fang
fangled
fanning
Fanny
fanout
fantasia
fantasist
fantastic
fantasy
fantod







<






<













<







8110
8111
8112
8113
8114
8115
8116

8117
8118
8119
8120
8121
8122

8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135

8136
8137
8138
8139
8140
8141
8142
fallen
fallible
falloff
fallout
fallow
Falmouth
false

falsify
Falstaff
falter
fame
familial
familiar

familism
family
famine
famish
famous
fan
fanatic
fanciful
fancy
fanfare
fanfold
fang
fangled

Fanny
fanout
fantasia
fantasist
fantastic
fantasy
fantod
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
feathery
feature
Feb
febrile
February
fecund
fed
Fedders
federal
federate
Fedora
fee
feeble
feed
feedback







<







8217
8218
8219
8220
8221
8222
8223

8224
8225
8226
8227
8228
8229
8230
feathery
feature
Feb
febrile
February
fecund
fed

federal
federate
Fedora
fee
feeble
feed
feedback
8353
8354
8355
8356
8357
8358
8359

8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
fermion
fermium
fern
Fernando
fernery
ferocious
ferocity

Ferrer
ferret
ferric
ferris
ferrite
ferroelectric
ferromagnet
ferromagnetic
ferromagnetism
ferrous
ferruginous
ferrule
ferry
fertile
fervent
fescue







>








<







8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284

8285
8286
8287
8288
8289
8290
8291
fermion
fermium
fern
Fernando
fernery
ferocious
ferocity
Ferreira
Ferrer
ferret
ferric
ferris
ferrite
ferroelectric
ferromagnet
ferromagnetic

ferrous
ferruginous
ferrule
ferry
fertile
fervent
fescue
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401

8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
feverish
few
fiance
fiancee
fiasco
fiat
fib
fibbing
fiberboard
Fiberglas
Fibonacci

fibrin
fibrosis
fibrous
fiche
fickle
fiction
fictitious
fictive
fiddle
fiddlestick
fide
fidelity
fidget
fiducial
fief
fiefdom
field
Fields
fieldstone
fieldwork
fiend
fiendish
fierce
fiery
fiesta







<



>

















<







8307
8308
8309
8310
8311
8312
8313

8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334

8335
8336
8337
8338
8339
8340
8341
feverish
few
fiance
fiancee
fiasco
fiat
fib

fiberboard
Fiberglas
Fibonacci
fibration
fibrin
fibrosis
fibrous
fiche
fickle
fiction
fictitious
fictive
fiddle
fiddlestick
fide
fidelity
fidget
fiducial
fief
fiefdom
field

fieldstone
fieldwork
fiend
fiendish
fierce
fiery
fiesta
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
file
filet
filial
filibuster
filigree
Filipino
fill
filled
filler
fillet
fillip
filly
film
filmdom
filmmake
filmstrip







<
<







8360
8361
8362
8363
8364
8365
8366


8367
8368
8369
8370
8371
8372
8373
file
filet
filial
filibuster
filigree
Filipino
fill


fillet
fillip
filly
film
filmdom
filmmake
filmstrip
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
finale
finance
financial
financier
finch
find
fine
finesse
finessed
finessing
finger
fingernail
fingerprint
fingertip
finial
finicky







|
|







8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
finale
finance
financial
financier
finch
find
fine
finery
finesse
finessing
finger
fingernail
fingerprint
fingertip
finial
finicky
8507
8508
8509
8510
8511
8512
8513

8514
8515
8516
8517
8518
8519
8520
fireproof
fireside
Firestone
firewall
firewood
firework
firm

first
firsthand
fiscal
Fischbein
Fischer
fish
fisherman







>







8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
fireproof
fireside
Firestone
firewall
firewood
firework
firm
firmware
first
firsthand
fiscal
Fischbein
Fischer
fish
fisherman
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548

8549
8550
8551
8552
8553
8554
8555
fissure
fist
fisticuff
fit
Fitch
Fitchburg
fitful
fitting
Fitzgerald
Fitzpatrick
Fitzroy
five
fivefold
fix
fixate
fixture
Fizeau
fizzle
fjord

flabbergast
flack
flag
flagellate
flageolet
flagging
Flagler







<











>







8444
8445
8446
8447
8448
8449
8450

8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
fissure
fist
fisticuff
fit
Fitch
Fitchburg
fitful

Fitzgerald
Fitzpatrick
Fitzroy
five
fivefold
fix
fixate
fixture
Fizeau
fizzle
fjord
FL
flabbergast
flack
flag
flagellate
flageolet
flagging
Flagler
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
flammable
Flanagan
Flanders
flange
flank
flannel
flap
flapping
flare
flash
flashback
flashlight
flashy
flask
flat







<







8483
8484
8485
8486
8487
8488
8489

8490
8491
8492
8493
8494
8495
8496
flammable
Flanagan
Flanders
flange
flank
flannel
flap

flare
flash
flashback
flashlight
flashy
flask
flat
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
Fletcher
flew
flex
flexible
flexural
flexure
flick
flier
flight
flimsy
flinch
fling
flint
flintlock
flinty
flip
flipflop
flippant
flipping
flirt
flirtation
flirtatious
flit
flitting
Flo
float
floc
flocculate
flock
floe
flog
flogging
flood
floodgate
floodlight
floodlit
floor
floorboard
flop
flopping
floppy
flora
floral
Florence
Florentine
florican
florid







<










<




<















<







8528
8529
8530
8531
8532
8533
8534

8535
8536
8537
8538
8539
8540
8541
8542
8543
8544

8545
8546
8547
8548

8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563

8564
8565
8566
8567
8568
8569
8570
Fletcher
flew
flex
flexible
flexural
flexure
flick

flight
flimsy
flinch
fling
flint
flintlock
flinty
flip
flipflop
flippant

flirt
flirtation
flirtatious
flit

Flo
float
floc
flocculate
flock
floe
flog
flogging
flood
floodgate
floodlight
floodlit
floor
floorboard
flop

floppy
flora
floral
Florence
Florentine
florican
florid
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
flowchart
flowerpot
flowery
flown
Floyd
flu
flub
flubbing
fluctuate
flue
fluency
fluent
fluff
fluffy
fluid
fluke
flung
fluoresce







<


<







8584
8585
8586
8587
8588
8589
8590

8591
8592

8593
8594
8595
8596
8597
8598
8599
flowchart
flowerpot
flowery
flown
Floyd
flu
flub

fluctuate
flue

fluent
fluff
fluffy
fluid
fluke
flung
fluoresce
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726

8727
8728
8729
8730
8731
8732
8733
FM
FMC
foal
foam
foamflower
foamy
fob
fobbing
focal
foci
focus
focussed
fodder
foe
fog

fogging
foggy
fogy
foible
foil
foist
fold







<







>







8619
8620
8621
8622
8623
8624
8625

8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
FM
FMC
foal
foam
foamflower
foamy
fob

focal
foci
focus
focussed
fodder
foe
fog
Fogarty
fogging
foggy
fogy
foible
foil
foist
fold
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
follicular
follow
followeth
folly
Fomalhaut
fond
fondle
fondly
font
Fontaine
Fontainebleau
food
foodstuff
fool
foolhardy







<







8651
8652
8653
8654
8655
8656
8657

8658
8659
8660
8661
8662
8663
8664
follicular
follow
followeth
folly
Fomalhaut
fond
fondle

font
Fontaine
Fontainebleau
food
foodstuff
fool
foolhardy
8819
8820
8821
8822
8823
8824
8825

8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855

8856
8857
8858
8859
8860
8861
8862
forlorn
form
formal
formaldehyde
formant
format
formate

formatting
formic
Formica
formidable
Formosa
formula
formulae
formulaic
formulate
Forrest
forsake
forsaken
forsook
forswear
Forsythe
fort
forte
Fortescue
forth
forthcome
forthright
forthwith
fortieth
fortify
fortin
fortiori
fortitude
fortnight
Fortran
fortress

fortunate
fortune
forty
forum
forward
Foss
fossil







>









<


















|

>







8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741

8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
forlorn
form
formal
formaldehyde
formant
format
formate
formatted
formatting
formic
Formica
formidable
Formosa
formula
formulae
formulaic
formulate

forsake
forsaken
forsook
forswear
Forsythe
fort
forte
Fortescue
forth
forthcome
forthright
forthwith
fortieth
fortify
fortin
fortiori
fortitude
fortnight
fortran
fortress
fortuitous
fortunate
fortune
forty
forum
forward
Foss
fossil
8902
8903
8904
8905
8906
8907
8908

8909
8910
8911
8912
8913

8914
8915
8916
8917
8918

8919
8920

8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
fragmentation
fragrant
frail
frailty
frambesia
frame
framework

franc
franca
France
Frances
franchise

Francis
Franciscan
Francisco
francium
franco

frangipani
frank

Frankfort
Frankfurt
frankfurter
franklin
frantic
Franz
Fraser
fraternal
fraternity
Frau
fraud
fraudulent
fraught
fray
frayed
Frazier
frazzle
freak
freakish
freckle
Fred
Freddie
Freddy
Frederic
Frederick
Fredericks
Fredericksburg
Fredericton
Fredholm
Fredrickson
free
freeboot
freed
Freedman
freedmen
freedom
freehand
freehold
freeing
freeman
freemen
Freeport
freer
freest
freestone
freethink
Freetown
freeway
freewheel
freeze
freight







>





>





>


>














<










<






<









<
<







8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845

8846
8847
8848
8849
8850
8851
8852
8853
8854
8855

8856
8857
8858
8859
8860
8861

8862
8863
8864
8865
8866
8867
8868
8869
8870


8871
8872
8873
8874
8875
8876
8877
fragmentation
fragrant
frail
frailty
frambesia
frame
framework
Fran
franc
franca
France
Frances
franchise
Francine
Francis
Franciscan
Francisco
francium
franco
Francoise
frangipani
frank
Frankel
Frankfort
Frankfurt
frankfurter
franklin
frantic
Franz
Fraser
fraternal
fraternity
Frau
fraud
fraudulent
fraught
fray

Frazier
frazzle
freak
freakish
freckle
Fred
Freddie
Freddy
Frederic
Frederick

Fredericksburg
Fredericton
Fredholm
Fredrickson
free
freeboot

Freedman
freedmen
freedom
freehand
freehold
freeing
freeman
freemen
Freeport


freestone
freethink
Freetown
freeway
freewheel
freeze
freight
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
freshen
freshman
freshmen
freshwater
Fresnel
Fresno
fret
fretting
Freud
Freudian
Frey
Freya
friable
friar
fricative
Frick
friction
frictional
Friday
fried
Friedman
friend
frieze
frigate
Frigga
fright
frighten
frightful







<









<

|
|







8888
8889
8890
8891
8892
8893
8894

8895
8896
8897
8898
8899
8900
8901
8902
8903

8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
freshen
freshman
freshmen
freshwater
Fresnel
Fresno
fret

Freud
Freudian
Frey
Freya
friable
friar
fricative
Frick
friction

Friday
Friedman
Friedrich
friend
frieze
frigate
Frigga
fright
frighten
frightful
9036
9037
9038
9039
9040
9041
9042

9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053

9054
9055
9056
9057
9058
9059
9060
frosty
froth
frothy
frown
frowzy
froze
frozen

Fruehauf
frugal
fruit
fruitful
fruition
frustrate
frustrater
frustum
fry
Frye
f's

FTC
Fuchs
Fuchsia
fudge
fuel
fugal
fugitive







>











>







8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
frosty
froth
frothy
frown
frowzy
froze
frozen
fructose
Fruehauf
frugal
fruit
fruitful
fruition
frustrate
frustrater
frustum
fry
Frye
f's
Ft
FTC
Fuchs
Fuchsia
fudge
fuel
fugal
fugitive
9075
9076
9077
9078
9079
9080
9081

9082
9083
9084
9085
9086
9087
9088
fume
fumigant
fumigate
fun
function
functionary
functor

fund
fundamental
funeral
funereal
fungal
fungi
fungible







>







8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
fume
fumigant
fumigate
fun
function
functionary
functor
functorial
fund
fundamental
funeral
funereal
fungal
fungi
fungible
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
furlong
furlough
Furman
furnace
furnish
furniture
furrier
furring
furrow
furry
further
furthermore
furthermost
furthest
furtive







<







9006
9007
9008
9009
9010
9011
9012

9013
9014
9015
9016
9017
9018
9019
furlong
furlough
Furman
furnace
furnish
furniture
furrier

furrow
furry
further
furthermore
furthermost
furthest
furtive
9123
9124
9125
9126
9127
9128
9129

9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
fussy
fusty
futile
future
fuzz
fuzzy
g

gab
gabardine
gabbing
gabble
gabbro
Gaberones
gable
Gabon
Gabriel
Gabrielle
gad
gadding
gadfly
gadget
gadgetry
gadolinium
gadwall
Gaelic
gaff







>


<








<







9029
9030
9031
9032
9033
9034
9035
9036
9037
9038

9039
9040
9041
9042
9043
9044
9045
9046

9047
9048
9049
9050
9051
9052
9053
fussy
fusty
futile
future
fuzz
fuzzy
g
GA
gab
gabardine

gabble
gabbro
Gaberones
gable
Gabon
Gabriel
Gabrielle
gad

gadfly
gadget
gadgetry
gadolinium
gadwall
Gaelic
gaff
9160
9161
9162
9163
9164
9165
9166

9167
9168
9169
9170
9171
9172
9173
Gainesville
gainful
gait
Gaithersburg
gal
gala
galactic

Galapagos
Galatea
Galatia
galaxy
Galbreath
gale
Galen







>







9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
Gainesville
gainful
gait
Gaithersburg
gal
gala
galactic
galactose
Galapagos
Galatea
Galatia
galaxy
Galbreath
gale
Galen
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
gash
gasify
gasket
gaslight
gasoline
gasp
Gaspee
gassing
gassy
Gaston
gastrointestinal
gastronome
gastronomy
gate
Gates







<







9165
9166
9167
9168
9169
9170
9171

9172
9173
9174
9175
9176
9177
9178
gash
gasify
gasket
gaslight
gasoline
gasp
Gaspee

gassy
Gaston
gastrointestinal
gastronome
gastronomy
gate
Gates
9313
9314
9315
9316
9317
9318
9319

9320
9321
9322

9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339


9340
9341
9342
9343
9344
9345
9346
gel
gelable
gelatin
gelatine
gelatinous
geld
gem

Gemini
gemlike
Gemma

gender
gene
genealogy
genera
general
generate
generic
generosity
generous
Genesco
genesis
genetic
Geneva
Genevieve
genial
genie
genii


genius
Genoa
genotype
genre
gent
genteel
gentian







>

<

>

















>
>







9218
9219
9220
9221
9222
9223
9224
9225
9226

9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
gel
gelable
gelatin
gelatine
gelatinous
geld
gem
geminate
Gemini

Gemma
gemstone
gender
gene
genealogy
genera
general
generate
generic
generosity
generous
Genesco
genesis
genetic
Geneva
Genevieve
genial
genie
genii
genital
genitive
genius
Genoa
genotype
genre
gent
genteel
gentian
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
geodetic
geoduck
Geoffrey
geographer
geography
geology
geometer
geometric
geometrician
geometry
geophysical
geophysics
geopolitic
George
Georgetown
Georgia
Gerald







<

<







9269
9270
9271
9272
9273
9274
9275

9276

9277
9278
9279
9280
9281
9282
9283
geodetic
geoduck
Geoffrey
geographer
geography
geology
geometer

geometrician

geophysical
geophysics
geopolitic
George
Georgetown
Georgia
Gerald
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
gerundive
gestalt
Gestapo
gesticulate
gesture
get
getaway
getting
Getty
Gettysburg
geyser
Ghana
ghastly
Ghent
gherkin
ghetto
ghost
ghostlike
ghostly
ghoul
ghoulish
Giacomo
giant
giantess
gibberish
gibbet
gibbon
Gibbons
gibbous
Gibbs
gibby
gibe
giblet
Gibraltar
Gibson







<









<
<








<







9308
9309
9310
9311
9312
9313
9314

9315
9316
9317
9318
9319
9320
9321
9322
9323


9324
9325
9326
9327
9328
9329
9330
9331

9332
9333
9334
9335
9336
9337
9338
gerundive
gestalt
Gestapo
gesticulate
gesture
get
getaway

Getty
Gettysburg
geyser
Ghana
ghastly
Ghent
gherkin
ghetto
ghost


ghoul
ghoulish
Giacomo
giant
giantess
gibberish
gibbet
gibbon

gibbous
Gibbs
gibby
gibe
giblet
Gibraltar
Gibson
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
Gina
ginger
gingham
gingko
ginkgo
ginmill
Ginn
ginning
Gino
Ginsberg
Ginsburg
ginseng
Giovanni
giraffe
gird







<







9370
9371
9372
9373
9374
9375
9376

9377
9378
9379
9380
9381
9382
9383
Gina
ginger
gingham
gingko
ginkgo
ginmill
Ginn

Gino
Ginsberg
Ginsburg
ginseng
Giovanni
giraffe
gird
9506
9507
9508
9509
9510
9511
9512

9513
9514
9515
9516
9517
9518
9519
Gladys
glamor
glamorous
glamour
glance
gland
glandular

glare
Glasgow
glass
glassine
glassware
glasswort
glassy







>







9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
Gladys
glamor
glamorous
glamour
glance
gland
glandular
glans
glare
Glasgow
glass
glassine
glassware
glasswort
glassy
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574


9575
9576
9577
9578
9579
9580
9581
9582
9583


9584
9585
9586
9587
9588
9589
9590
Gloria
Gloriana
glorify
glorious
glory
gloss
glossary
glossed
glossolalia
glossy
glottal
glottis
Gloucester
glove
glow
glue
glued
gluey
gluing
glum
glut


glutamic
glutinous
glutting
glutton
glyceride
glycerin
glycerinate
glycerine
glycerol


glycol
glyph
GM
GMT
gnarl
gnash
gnat







<







|
|

<


>
>


<






>
>







9456
9457
9458
9459
9460
9461
9462

9463
9464
9465
9466
9467
9468
9469
9470
9471
9472

9473
9474
9475
9476
9477
9478

9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
Gloria
Gloriana
glorify
glorious
glory
gloss
glossary

glossolalia
glossy
glottal
glottis
Gloucester
glove
glow
glucose
glue
gluey

glum
glut
glutamate
glutamine
glutamic
glutinous

glutton
glyceride
glycerin
glycerinate
glycerine
glycerol
glycine
glycogen
glycol
glyph
GM
GMT
gnarl
gnash
gnat
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
god
Goddard
goddess
godfather
Godfrey
godhead
godkin
godlike
godmother
godparent
godsend
godson
Godwin
godwit
goer
goes
Goethe
Goff
gog
goggle
Gogh
gogo







<






<







9511
9512
9513
9514
9515
9516
9517

9518
9519
9520
9521
9522
9523

9524
9525
9526
9527
9528
9529
9530
god
Goddard
goddess
godfather
Godfrey
godhead
godkin

godmother
godparent
godsend
godson
Godwin
godwit

goes
Goethe
Goff
gog
goggle
Gogh
gogo
9647
9648
9649
9650
9651
9652
9653

9654
9655
9656
9657
9658
9659
9660
gondola
gone
gong
Gonzales
Gonzalez
goober
good

Goode
Goodman
Goodrich
goodwill
Goodwin
goody
Goodyear







>







9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
gondola
gone
gong
Gonzales
Gonzalez
goober
good
goodbye
Goode
Goodman
Goodrich
goodwill
Goodwin
goody
Goodyear
9684
9685
9686
9687
9688
9689
9690


9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719

9720
9721
9722
9723
9724
9725
9726
gossamer
gossip
got
Gotham
Gothic
gotten
Gottfried


gouge
Gould
gourd
gourmet
gout
govern
governance
governess
governor
gown
GPO
grab
grabbing
grace
graceful
gracious
grackle
grad
gradate
grade
gradient
gradual
graduate
Grady
Graff
graft
graham
grail
grain

grammar
grammarian
grammatic
granary
grand
grandchild
grandchildren







>
>












<
















>







9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606

9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
gossamer
gossip
got
Gotham
Gothic
gotten
Gottfried
Goucher
Gouda
gouge
Gould
gourd
gourmet
gout
govern
governance
governess
governor
gown
GPO
grab

grace
graceful
gracious
grackle
grad
gradate
grade
gradient
gradual
graduate
Grady
Graff
graft
graham
grail
grain
grainy
grammar
grammarian
grammatic
granary
grand
grandchild
grandchildren
9813
9814
9815
9816
9817
9818
9819

9820
9821
9822
9823
9824
9825
9826
greenwood
Greer
greet
Greg
gregarious
Gregg
Gregory

grenade
Grendel
Grenoble
Gresham
Greta
Gretchen
grew







>







9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
greenwood
Greer
greet
Greg
gregarious
Gregg
Gregory
gremlin
grenade
Grendel
Grenoble
Gresham
Greta
Gretchen
grew
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
grievance
grieve
grievous
griffin
Griffith
grill
grille
grilled
grillwork
grim
grimace
Grimaldi
grime
Grimes
Grimm
grin
grind
grindstone
grinning
grip
gripe
grippe
gripping
grisly
grist
gristmill
Griswold
grit
gritty
grizzle







<










<



<







9739
9740
9741
9742
9743
9744
9745

9746
9747
9748
9749
9750
9751
9752
9753
9754
9755

9756
9757
9758

9759
9760
9761
9762
9763
9764
9765
grievance
grieve
grievous
griffin
Griffith
grill
grille

grillwork
grim
grimace
Grimaldi
grime
Grimes
Grimm
grin
grind
grindstone

grip
gripe
grippe

grisly
grist
gristmill
Griswold
grit
gritty
grizzle
9880
9881
9882
9883
9884
9885
9886

9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907

9908
9909

9910
9911
9912
9913
9914
9915
9916
9917
9918
9919

9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941

9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
grotesque
Groton
ground
groundsel
groundskeep
groundwork
group

grout
grove
grovel
Grover
grow
growl
grown
grownup
growth
grub
grubbing
grubby
grudge
gruesome
gruff
grumble
Grumman
grunt
gryphon
g's
GSA

Guam
guanidine

guano
guarantee
guaranteeing
guaranty
guard
guardhouse
Guardia
guardian
Guatemala
gubernatorial

Guenther
guerdon
guernsey
guerrilla
guess
guesswork
guest
guffaw
Guggenheim
Guiana
guidance
guide
guidebook
guideline
guidepost
guiding
guignol
guild
guildhall
guile
Guilford
guillemot

guilt
guilty
guinea
guise
guitar
gules
gulf
gull
Gullah
gullet
gullible
gully
gulp
gum
gumbo
gumming
gummy
gumption
gumshoe
gun
Gunderson
gunfight
gunfire
gunflint
gunk
gunky
gunman
gunmen
gunnery
gunning
gunny
gunplay
gunpowder
gunshot
gunsling
Gunther
gurgle







>










<










>


>










>















<






>















|













<







9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799

9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839

9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875

9876
9877
9878
9879
9880
9881
9882
grotesque
Groton
ground
groundsel
groundskeep
groundwork
group
groupoid
grout
grove
grovel
Grover
grow
growl
grown
grownup
growth
grub

grubby
grudge
gruesome
gruff
grumble
Grumman
grunt
gryphon
g's
GSA
GU
Guam
guanidine
guanine
guano
guarantee
guaranteeing
guaranty
guard
guardhouse
Guardia
guardian
Guatemala
gubernatorial
Guelph
Guenther
guerdon
guernsey
guerrilla
guess
guesswork
guest
guffaw
Guggenheim
Guiana
guidance
guide
guidebook
guideline
guidepost

guignol
guild
guildhall
guile
Guilford
guillemot
guillotine
guilt
guilty
guinea
guise
guitar
gules
gulf
gull
Gullah
gullet
gullible
gully
gulp
gum
gumbo
gumdrop
gummy
gumption
gumshoe
gun
Gunderson
gunfight
gunfire
gunflint
gunk
gunky
gunman
gunmen
gunnery

gunny
gunplay
gunpowder
gunshot
gunsling
Gunther
gurgle
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
Gustavus
gusto
gusty
gut
Gutenberg
Guthrie
gutsy
gutting
guttural
guy
Guyana
guzzle
Gwen
Gwyn
gym
gymnasium
gymnast
gymnastic
gymnosperm
gyp
gypping
gypsite
gypsum
gypsy
gyrate
gyrfalcon
gyro
gyrocompass







<












<







9892
9893
9894
9895
9896
9897
9898

9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910

9911
9912
9913
9914
9915
9916
9917
Gustavus
gusto
gusty
gut
Gutenberg
Guthrie
gutsy

guttural
guy
Guyana
guzzle
Gwen
Gwyn
gym
gymnasium
gymnast
gymnastic
gymnosperm
gyp

gypsite
gypsum
gypsy
gyrate
gyrfalcon
gyro
gyrocompass
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
hacienda
hack
hackberry
Hackett
hackle
hackmatack
hackney
hackneyed
hacksaw
had
Hadamard
Haddad
haddock
Hades
Hadley







<







9933
9934
9935
9936
9937
9938
9939

9940
9941
9942
9943
9944
9945
9946
hacienda
hack
hackberry
Hackett
hackle
hackmatack
hackney

hacksaw
had
Hadamard
Haddad
haddock
Hades
Hadley
10087
10088
10089
10090
10091
10092
10093

10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
Halloween
hallucinate
hallway
halma
halo
halocarbon
halogen

Halsey
Halstead
halt
halvah
halve
Halverson
ham
Hamal
Hamburg
hamburger
Hamilton
Hamiltonian
hamlet
Hamlin
hammerhead
hamming
hammock
Hammond
hamper
Hampshire
Hampton
hamster
Han







>











<



<







9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006

10007
10008
10009

10010
10011
10012
10013
10014
10015
10016
Halloween
hallucinate
hallway
halma
halo
halocarbon
halogen
Halpern
Halsey
Halstead
halt
halvah
halve
Halverson
ham
Hamal
Hamburg
hamburger
Hamilton

hamlet
Hamlin
hammerhead

hammock
Hammond
hamper
Hampshire
Hampton
hamster
Han
10141
10142
10143
10144
10145
10146
10147

10148
10149
10150
10151
10152
10153
10154
handmaiden
handout
handset
handshake
handsome
handspike
handstand

handwrite
handwritten
handy
handyman
handymen
Haney
Hanford







>







10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
handmaiden
handout
handset
handshake
handsome
handspike
handstand
handwaving
handwrite
handwritten
handy
handyman
handymen
Haney
Hanford
10173
10174
10175
10176
10177
10178
10179



10180
10181
10182

10183
10184
10185
10186
10187
10188
10189
10190
10191

10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213

10214
10215
10216
10217
10218

10219
10220
10221
10222
10223
10224
10225
Hansel
Hansen
hansom
Hanson
Hanukkah
hap
haphazard



happen
happenstance
happy

harangue
harass
Harbin
harbinger
Harcourt
hard
hardbake
hardboard
hardboiled

harden
hardhat
Hardin
Harding
hardscrabble
hardtack
hardtop
hardware
hardwood
hardworking
hardy
hare
harelip
harem
hark
Harlan
Harlem
Harley
harm
harmful
Harmon
harmonic

harmonious
harmony
harness
Harold
harp

harpsichord
Harpy
Harriet
Harriman
Harrington
Harris
Harrisburg







>
>
>



>









>



<


















>





>







10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100

10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
Hansel
Hansen
hansom
Hanson
Hanukkah
hap
haphazard
haploid
haploidy
haplology
happen
happenstance
happy
Hapsburg
harangue
harass
Harbin
harbinger
Harcourt
hard
hardbake
hardboard
hardboiled
hardcopy
harden
hardhat
Hardin

hardscrabble
hardtack
hardtop
hardware
hardwood
hardworking
hardy
hare
harelip
harem
hark
Harlan
Harlem
Harley
harm
harmful
Harmon
harmonic
harmonica
harmonious
harmony
harness
Harold
harp
harpoon
harpsichord
Harpy
Harriet
Harriman
Harrington
Harris
Harrisburg
10255
10256
10257
10258
10259
10260
10261

10262
10263
10264
10265
10266
10267

10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
hater
Hatfield
hath
Hathaway
hatred
Hatteras
Hattie

Haugen
haughty
haul
haulage
haunch
haunt

Havana
have
haven
haven't
Havilland
havoc
haw
Hawaii
Hawaiian
hawk
Hawkins
Hawley
hawthorn
Hawthorne
hay
Hayden
Haydn
Hayes
hayfield
Haynes
Hays
haystack
hayward
hazard
hazardous
haze
hazel
hazelnut







>






>




















<







10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196

10197
10198
10199
10200
10201
10202
10203
hater
Hatfield
hath
Hathaway
hatred
Hatteras
Hattie
Hattiesburg
Haugen
haughty
haul
haulage
haunch
haunt
Hausdorff
Havana
have
haven
haven't
Havilland
havoc
haw
Hawaii
Hawaiian
hawk
Hawkins
Hawley
hawthorn
Hawthorne
hay
Hayden
Haydn
Hayes
hayfield
Haynes

haystack
hayward
hazard
hazardous
haze
hazel
hazelnut
10307
10308
10309
10310
10311
10312
10313

10314
10315
10316

10317
10318
10319
10320
10321
10322
10323
headquarter
headroom
headset
headsman
headsmen
headstand
headstone

headwall
headwater
headway

heady
heal
Healey
health
healthful
healthy
Healy







>



>







10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
headquarter
headroom
headset
headsman
headsmen
headstand
headstone
headstrong
headwall
headwater
headway
headwind
heady
heal
Healey
health
healthful
healthy
Healy
10370
10371
10372
10373
10374
10375
10376

10377
10378
10379
10380
10381
10382
10383
10384

10385
10386
10387
10388
10389
10390
10391
Hegelian
hegemony
Heidelberg
heigh
height
heighten
Heine

Heinz
heir
heiress
Heisenberg
held
Helen
Helena
Helene

helical
helicopter
heliocentric
heliotrope
helium
helix
he'll







>








>







10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
Hegelian
hegemony
Heidelberg
heigh
height
heighten
Heine
Heinrich
Heinz
heir
heiress
Heisenberg
held
Helen
Helena
Helene
Helga
helical
helicopter
heliocentric
heliotrope
helium
helix
he'll
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
Helvetica
hem
hematite
Hemingway
hemisphere
hemispheric
hemlock
hemming
hemoglobin
hemolytic
hemorrhage
hemorrhoid
hemosiderin
hemp
Hempstead
hen
henbane
hence
henceforth
henchman
henchmen
Henderson
Hendrick
Hendricks
Hendrickson
henequen
Henley
Henning
henpeck
Henri
Henrietta
henry
hepatica
hepatitis
Hepburn







<















<



<







10322
10323
10324
10325
10326
10327
10328

10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343

10344
10345
10346

10347
10348
10349
10350
10351
10352
10353
Helvetica
hem
hematite
Hemingway
hemisphere
hemispheric
hemlock

hemoglobin
hemolytic
hemorrhage
hemorrhoid
hemosiderin
hemp
Hempstead
hen
henbane
hence
henceforth
henchman
henchmen
Henderson
Hendrick

Hendrickson
henequen
Henley

henpeck
Henri
Henrietta
henry
hepatica
hepatitis
Hepburn
10472
10473
10474
10475
10476
10477
10478

10479
10480
10481
10482
10483
10484

10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508

10509
10510

10511
10512
10513
10514
10515
10516
10517
hereunder
hereunto
herewith
heritable
heritage
Herkimer
Herman

hermeneutic
Hermes
hermetic
Hermite
hermitian
Hermosa

hero
Herodotus
heroes
heroic
heroin
heroine
heroism
heron
herpes
herpetology
Herr
herring
herringbone
Herschel
herself
Hershel
Hershey
hertz
Hertzog
hesitant
hesitate
hesitater
Hesperus
Hess

Hessian
Hester

heterodyne
heterogamous
heterogeneity
heterogeneous
heterosexual
heterostructure
heterozygous







>






>











<












>


>







10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406

10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
hereunder
hereunto
herewith
heritable
heritage
Herkimer
Herman
Hermann
hermeneutic
Hermes
hermetic
Hermite
hermitian
Hermosa
Hernandez
hero
Herodotus
heroes
heroic
heroin
heroine
heroism
heron
herpes
herpetology
Herr

herringbone
Herschel
herself
Hershel
Hershey
hertz
Hertzog
hesitant
hesitate
hesitater
Hesperus
Hess
Hesse
Hessian
Hester
heterocyclic
heterodyne
heterogamous
heterogeneity
heterogeneous
heterosexual
heterostructure
heterozygous
10535
10536
10537
10538
10539
10540
10541

10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
hexagonal
hexameter
hexane
hey
heyday
hi
Hiatt

Hiawatha
hibachi
Hibbard
hibernate
Hibernia
hick
Hickey
Hickman
hickory
Hicks
hid
hidalgo
hidden
hide
hideaway
hideous
hideout
hierarchal
hierarchic
hierarchy
hieratic
hieroglyphic
Hieronymus
hifalutin
Higgins
high
highball
highboy
highest
highfalutin
highhanded
highland
highlight
highroad
hightail
highway







>









<


















<







10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463

10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481

10482
10483
10484
10485
10486
10487
10488
hexagonal
hexameter
hexane
hey
heyday
hi
Hiatt
hiatus
Hiawatha
hibachi
Hibbard
hibernate
Hibernia
hick
Hickey
Hickman
hickory

hid
hidalgo
hidden
hide
hideaway
hideous
hideout
hierarchal
hierarchic
hierarchy
hieratic
hieroglyphic
Hieronymus
hifalutin
Higgins
high
highball
highboy

highfalutin
highhanded
highland
highlight
highroad
hightail
highway
10585
10586
10587
10588
10589
10590
10591

10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614

10615
10616
10617
10618
10619
10620
10621
10622
10623
10624

10625

10626


10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
Hildebrand
hill
hillbilly
Hillcrest
Hillel
hillman
hillmen

hillside
hilltop
hilly
hilt
Hilton
hilum
him
Himalaya
himself
hind
hindmost
hindrance
hindsight
Hindu
Hinduism
Hines
hinge
Hinman
hint
hinterland
hip
hipping
hippo

hippodrome
hippopotamus
hippy
hipster
Hiram
hire
hireling
Hiroshi
Hiroshima
Hirsch

his

hiss


histochemic
histochemistry
histogram
histology
historian
historic
historiography
history
histrionic
hit
Hitachi
hitch
Hitchcock
hither
hitherto
Hitler
hitting
hive
ho
hoagie
Hoagland
hoagy
hoar
hoard







>














<






|
|
>










>

>

>
>
















<







10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517

10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558

10559
10560
10561
10562
10563
10564
10565
Hildebrand
hill
hillbilly
Hillcrest
Hillel
hillman
hillmen
hillock
hillside
hilltop
hilly
hilt
Hilton
hilum
him
Himalaya
himself
hind
hindmost
hindrance
hindsight
Hindu

Hines
hinge
Hinman
hint
hinterland
hip
hippo
Hippocrates
Hippocratic
hippodrome
hippopotamus
hippy
hipster
Hiram
hire
hireling
Hiroshi
Hiroshima
Hirsch
hirsute
his
Hispanic
hiss
histamine
histidine
histochemic
histochemistry
histogram
histology
historian
historic
historiography
history
histrionic
hit
Hitachi
hitch
Hitchcock
hither
hitherto
Hitler

hive
ho
hoagie
Hoagland
hoagy
hoar
hoard
10706
10707
10708
10709
10710
10711
10712

10713
10714
10715
10716
10717
10718
10719
holography
Holst
Holstein
holster
holt
Holyoke
holystone

homage
home
homebound
homebuilder
homebuilding
homecoming
homeland







>







10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
holography
Holst
Holstein
holster
holt
Holyoke
holystone
Hom
homage
home
homebound
homebuilder
homebuilding
homecoming
homeland
10737
10738
10739
10740
10741
10742
10743

10744
10745
10746

10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763

10764
10765

10766
10767
10768
10769
10770
10771
10772
homogeneous
homologous
homologue
homology
homomorphic
homomorphism
homonym

homosexual
homotopy
homozygous

Honda
hondo
Honduras
hone
honest
honesty
honey
honeybee
honeycomb
honeydew
honeymoon
honeysuckle
Honeywell
hong
honk
Honolulu
honorarium

honorary
honoree

Honshu
hooch
hood
hoodlum
hoof
hoofmark
hook







>



>

















>


>







10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
homogeneous
homologous
homologue
homology
homomorphic
homomorphism
homonym
homophobia
homosexual
homotopy
homozygous
homunculus
Honda
hondo
Honduras
hone
honest
honesty
honey
honeybee
honeycomb
honeydew
honeymoon
honeysuckle
Honeywell
hong
honk
Honolulu
honorarium
honoraria
honorary
honoree
honorific
Honshu
hooch
hood
hoodlum
hoof
hoofmark
hook
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
Hoover
hooves
hop
hope
hopeful
Hopkins
Hopkinsian
hopping
hopple
hopscotch
Horace
Horatio
horde
horehound
horizon







<







10701
10702
10703
10704
10705
10706
10707

10708
10709
10710
10711
10712
10713
10714
Hoover
hooves
hop
hope
hopeful
Hopkins
Hopkinsian

hopple
hopscotch
Horace
Horatio
horde
horehound
horizon
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
horror
horse
horseback
horsedom
horseflesh
horsefly
horsehair
horselike
horseman
horsemen
horseplay
horsepower
horseshoe
horsetail
horsewoman







<







10733
10734
10735
10736
10737
10738
10739

10740
10741
10742
10743
10744
10745
10746
horror
horse
horseback
horsedom
horseflesh
horsefly
horsehair

horseman
horsemen
horseplay
horsepower
horseshoe
horsetail
horsewoman
10888
10889
10890
10891
10892
10893
10894

10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
hub
Hubbard
Hubbell
hubbub
hubby
Huber
Hubert

huck
huckleberry
huckster
huddle
Hudson
hue
hued
huff
Huffman
hug
huge
hugging
Huggins
Hugh







>






<







10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819

10820
10821
10822
10823
10824
10825
10826
hub
Hubbard
Hubbell
hubbub
hubby
Huber
Hubert
hubris
huck
huckleberry
huckster
huddle
Hudson
hue

huff
Huffman
hug
huge
hugging
Huggins
Hugh
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
humerus
humid
humidify
humidistat
humiliate
humility
Hummel
humming
hummingbird
hummock
humorous
hump
humpback
Humphrey
humpty
humus
Hun
hunch
hundred
hundredfold
hundredth
hung
Hungarian
Hungary
hungry
hunk
hunt
Hunter
Huntington
Huntley
Huntsville
Hurd
hurdle
hurl
hurley







<



















<







10838
10839
10840
10841
10842
10843
10844

10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863

10864
10865
10866
10867
10868
10869
10870
humerus
humid
humidify
humidistat
humiliate
humility
Hummel

hummingbird
hummock
humorous
hump
humpback
Humphrey
humpty
humus
Hun
hunch
hundred
hundredfold
hundredth
hung
Hungarian
Hungary
hungry
hunk
hunt

Huntington
Huntley
Huntsville
Hurd
hurdle
hurl
hurley
10999
11000
11001
11002
11003
11004
11005

11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021

11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034


11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053

11054

11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078

11079
11080
11081
11082
11083
11084
11085
11086
11087

11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100

11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113

11114
11115
11116

11117
11118
11119
11120
11121
11122
11123
hydroelectric
hydrofluoric
hydrogen
hydrogenate
hydrology
hydrolysis
hydrometer

hydrophilic
hydrophobia
hydrophobic
hydrosphere
hydrostatic
hydrothermal
hydrous
hydroxide
hydroxy
hydroxyl
hydroxylate
hyena
hygiene
hygrometer
hygroscopic
hying

hymen
hymn
hymnal
hyperbola
hyperbolic
hyperboloid
hyperboloidal
hypertensive
hyphen
hyphenate
hypnosis
hypnotic
hypoactive


hypocrisy
hypocrite
hypocritic
hypocycloid
hypodermic
hypophyseal
hypotenuse
hypothalamic
hypothalamus
hypotheses
hypothesis
hypothetic
hypothyroid
hysterectomy
hysteresis
hysteria
hysteric
hysteron
i

iambic

Iberia
ibex
ibid
ibis
IBM
Ibn
Icarus
ICC
ice
iceberg
icebox
iceland
Icelandic
ichneumon
icicle
icing
icon
iconoclasm
iconoclast
icosahedra
icosahedral
icosahedron
icy
I'd

Ida
Idaho
idea
ideal
ideate
idempotent
identical
identify
identity

ideology
idiocy
idiom
idiomatic
idiosyncrasy
idiosyncratic
idiot
idiotic
idle
idol
idolatry
idyll
idyllic

IEEE
if
iffy
Ifni
igloo
igneous
ignite
ignition
ignoble
ignominious
ignoramus
ignorant
ignore

ii
iii
Ike

ileum
iliac
Iliad
I'll
ill
illegal
illegible







>
















>













>
>



















>

>















|








>









>













>













>



>







10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
hydroelectric
hydrofluoric
hydrogen
hydrogenate
hydrology
hydrolysis
hydrometer
hydronium
hydrophilic
hydrophobia
hydrophobic
hydrosphere
hydrostatic
hydrothermal
hydrous
hydroxide
hydroxy
hydroxyl
hydroxylate
hyena
hygiene
hygrometer
hygroscopic
hying
Hyman
hymen
hymn
hymnal
hyperbola
hyperbolic
hyperboloid
hyperboloidal
hypertensive
hyphen
hyphenate
hypnosis
hypnotic
hypoactive
hypochlorite
hypochlorous
hypocrisy
hypocrite
hypocritic
hypocycloid
hypodermic
hypophyseal
hypotenuse
hypothalamic
hypothalamus
hypotheses
hypothesis
hypothetic
hypothyroid
hysterectomy
hysteresis
hysteria
hysteric
hysteron
i
IA
iambic
Ian
Iberia
ibex
ibid
ibis
IBM
Ibn
Icarus
ICC
ice
iceberg
icebox
iceland
Icelandic
ichneumon
icicle
icky
icon
iconoclasm
iconoclast
icosahedra
icosahedral
icosahedron
icy
I'd
ID
Ida
Idaho
idea
ideal
ideate
idempotent
identical
identify
identity
ideolect
ideology
idiocy
idiom
idiomatic
idiosyncrasy
idiosyncratic
idiot
idiotic
idle
idol
idolatry
idyll
idyllic
i.e
IEEE
if
iffy
Ifni
igloo
igneous
ignite
ignition
ignoble
ignominious
ignoramus
ignorant
ignore
Igor
ii
iii
Ike
IL
ileum
iliac
Iliad
I'll
ill
illegal
illegible
11138
11139
11140
11141
11142
11143
11144

11145
11146
11147
11148
11149
11150
11151
illusory
illustrate
illustrious
Ilona
Ilyushin
I'm
image

imagery
imaginary
imaginate
imagine
imbalance
imbecile
imbibe







>







11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
illusory
illustrate
illustrious
Ilona
Ilyushin
I'm
image
imagen
imagery
imaginary
imaginate
imagine
imbalance
imbecile
imbibe
11164
11165
11166
11167
11168
11169
11170

11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
immediate
immemorial
immense
immerse
immersion
immigrant
immigrate

imminent
immobile
immobility
immoderate
immodest
immodesty
immoral
immortal
immovable
immune
immunization
immunoelectrophoresis
immutable
imp
impact
impair
impale
impalpable







>










<







11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109

11110
11111
11112
11113
11114
11115
11116
immediate
immemorial
immense
immerse
immersion
immigrant
immigrate
immiscible
imminent
immobile
immobility
immoderate
immodest
immodesty
immoral
immortal
immovable
immune

immunoelectrophoresis
immutable
imp
impact
impair
impale
impalpable
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
indescribable
indestructible
indeterminable
indeterminacy
indeterminate
index
India
Indian
Indiana
Indianapolis
indicant
indicate
indices
indict
Indies







<







11361
11362
11363
11364
11365
11366
11367

11368
11369
11370
11371
11372
11373
11374
indescribable
indestructible
indeterminable
indeterminacy
indeterminate
index
India

Indiana
Indianapolis
indicant
indicate
indices
indict
Indies
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478

11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
indisposition
indisputable
indissoluble
indistinct
indistinguishable
indium
individual
individualism
individuate
indivisible
Indochina
indoctrinate

indolent
indomitable
Indonesia
Indonesian
indoor
indorse
indubitable
induce
inducible
induct
inductance
inductee
inductor
indulge
indulgent
industrial
industrialism
industrious
industry
indwell
indy
ineducable
ineffable
ineffective







<




>



<












<







11394
11395
11396
11397
11398
11399
11400

11401
11402
11403
11404
11405
11406
11407
11408

11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420

11421
11422
11423
11424
11425
11426
11427
indisposition
indisputable
indissoluble
indistinct
indistinguishable
indium
individual

individuate
indivisible
Indochina
indoctrinate
Indoeuropean
indolent
indomitable
Indonesia

indoor
indorse
indubitable
induce
inducible
induct
inductance
inductee
inductor
indulge
indulgent
industrial

industrious
industry
indwell
indy
ineducable
ineffable
ineffective
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
inexplicit
inexpressible
inextinguishable
inextricable
infallible
infamous
infamy
infancy
infant
infantile
infantry
infantryman
infantrymen
infarct
infatuate







<







11459
11460
11461
11462
11463
11464
11465

11466
11467
11468
11469
11470
11471
11472
inexplicit
inexpressible
inextinguishable
inextricable
infallible
infamous
infamy

infant
infantile
infantry
infantryman
infantrymen
infarct
infatuate
11579
11580
11581
11582
11583
11584
11585

11586
11587
11588
11589
11590
11591
11592
infix
inflame
inflammable
inflammation
inflammatory
inflate
inflater

inflect
inflexible
inflict
inflow
influence
influent
influential







>







11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
infix
inflame
inflammable
inflammation
inflammatory
inflate
inflater
inflationary
inflect
inflexible
inflict
inflow
influence
influent
influential
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687

11688
11689
11690
11691
11692
11693
11694
inlay
inlet
Inman
inmate
inn
innards
innate
inner
innermost
inning
innocent
innocuous
innovate
innuendo
innumerable
inoculate
inoperable
inoperative
inopportune
inordinate
inorganic
input

inquest
inquire
inquiry
inquisition
inquisitive
inquisitor
inroad







<

|












>







11591
11592
11593
11594
11595
11596
11597

11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
inlay
inlet
Inman
inmate
inn
innards
innate

innermost
innkeeper
innocent
innocuous
innovate
innuendo
innumerable
inoculate
inoperable
inoperative
inopportune
inordinate
inorganic
input
inputting
inquest
inquire
inquiry
inquisition
inquisitive
inquisitor
inroad
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
inspect
inspector
inspiration
inspire
instable
install
installation
installment
instance
instant
instantaneous
instantiate
instead
instep
instigate
instill







<
<







11654
11655
11656
11657
11658
11659
11660


11661
11662
11663
11664
11665
11666
11667
inspect
inspector
inspiration
inspire
instable
install
installation


instant
instantaneous
instantiate
instead
instep
instigate
instill
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
interceptor
intercom
interdict
interest
interfere
interference
interferometer
interferometric
interferometry
interim
interior
interject
interlude
intermediary
intermit
intermittent







<
<







11721
11722
11723
11724
11725
11726
11727


11728
11729
11730
11731
11732
11733
11734
interceptor
intercom
interdict
interest
interfere
interference
interferometer


interim
interior
interject
interlude
intermediary
intermit
intermittent
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
into
intolerable
intolerant
intonate
intone
intoxicant
intoxicate
intracity
intractable
intradepartment
intramural
intramuscular
intranasal
intransigent
intransitive
intraoffice
intrastate
intravenous
intrepid
intricacy
intricate
intrigue
intrinsic
introduce
introduction







<

<
<
<
<


<
<
<







11766
11767
11768
11769
11770
11771
11772

11773




11774
11775



11776
11777
11778
11779
11780
11781
11782
into
intolerable
intolerant
intonate
intone
intoxicant
intoxicate

intractable




intransigent
intransitive



intrepid
intricacy
intricate
intrigue
intrinsic
introduce
introduction
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
irrecoverable
irredeemable
irredentism
irredentist
irreducible
irrefutable
irregular
irrelevancy
irrelevant
irremediable
irremovable
irreparable
irreplaceable
irrepressible
irreproachable







<







11887
11888
11889
11890
11891
11892
11893

11894
11895
11896
11897
11898
11899
11900
irrecoverable
irredeemable
irredentism
irredentist
irreducible
irrefutable
irregular

irrelevant
irremediable
irremovable
irreparable
irreplaceable
irrepressible
irreproachable
12009
12010
12011
12012
12013
12014
12015

12016
12017
12018
12019
12020
12021
12022
Irwin
i's
is
Isaac
Isaacson
Isabel
Isabella

Isaiah
isentropic
Isfahan
Ising
isinglass
Isis
Islam







>







11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
Irwin
i's
is
Isaac
Isaacson
Isabel
Isabella
Isadore
Isaiah
isentropic
Isfahan
Ising
isinglass
Isis
Islam
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049

12050
12051
12052
12053
12054
12055
12056
isolate
Isolde
isomer
isomorph
isomorphic
isopleth
isotherm
isothermal
isotope
isotopic
isotropic
isotropy
Israel
Israeli
Israelite
issuance
issuant
issue
Istanbul

it
Italian
italic
Italy
itch
it'd
item







<

<
<




<



>







11944
11945
11946
11947
11948
11949
11950

11951


11952
11953
11954
11955

11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
isolate
Isolde
isomer
isomorph
isomorphic
isopleth
isotherm

isotope


isotropy
Israel
Israeli
Israelite

issuant
issue
Istanbul
Istvan
it
Italian
italic
Italy
itch
it'd
item
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110

12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
Iverson
ivory
ivy
ix
Izvestia
j
jab
jabbing
Jablonsky
jack
jackanapes
jackass
jackboot
jackdaw
jacket
Jackie
jackknife
Jackman
jackpot
Jackson
Jacksonian
Jacksonville
Jacky
JACM
Jacob
Jacobean
Jacobi
Jacobian
Jacobite
Jacobs
Jacobsen
Jacobson
Jacobus
Jacqueline
Jacques
jade
Jaeger
jag
jagging
jaguar
jail

Jakarta
jake
jalopy
jam
Jamaica
jamboree
James
Jamestown
jamming
Jan
Jane
Janeiro
Janet
jangle
Janice
janissary
janitor
janitorial
Janos
Jansenist
January
Janus
Japan
Japanese
jar
jargon
jarring
Jarvin
Jason
jasper
jaundice
jaunty
Java
javelin
jaw
jawbone
jay
jazz
jazzy
jealous
jealousy
jean
Jeannie
Jed
jeep
Jeff
Jefferson
Jeffersonian
Jeffrey
Jehovah
jejune
jejunum
jelly
jellyfish
Jenkins







<












<








<











>








<

















<




















<







11980
11981
11982
11983
11984
11985
11986

11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998

11999
12000
12001
12002
12003
12004
12005
12006

12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026

12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043

12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063

12064
12065
12066
12067
12068
12069
12070
Iverson
ivory
ivy
ix
Izvestia
j
jab

Jablonsky
jack
jackanapes
jackass
jackboot
jackdaw
jacket
Jackie
jackknife
Jackman
jackpot
Jackson

Jacksonville
Jacky
JACM
Jacob
Jacobean
Jacobi
Jacobian
Jacobite

Jacobsen
Jacobson
Jacobus
Jacqueline
Jacques
jade
Jaeger
jag
jagging
jaguar
jail
Jaime
Jakarta
jake
jalopy
jam
Jamaica
jamboree
James
Jamestown

Jan
Jane
Janeiro
Janet
jangle
Janice
janissary
janitor
janitorial
Janos
Jansenist
January
Janus
Japan
Japanese
jar
jargon

Jarvin
Jason
jasper
jaundice
jaunty
Java
javelin
jaw
jawbone
jay
jazz
jazzy
jealous
jealousy
jean
Jeannie
Jed
jeep
Jeff
Jefferson

Jeffrey
Jehovah
jejune
jejunum
jelly
jellyfish
Jenkins
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
Jessica
Jessie
jest
Jesuit
Jesus
jet
jetliner
jetting
jettison
Jew
jewel
Jewell
jewelry
Jewett
Jewish







<







12091
12092
12093
12094
12095
12096
12097

12098
12099
12100
12101
12102
12103
12104
Jessica
Jessie
jest
Jesuit
Jesus
jet
jetliner

jettison
Jew
jewel
Jewell
jewelry
Jewett
Jewish
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
jive
Jo
Joan
Joanna
Joanne
Joaquin
job
jobbing
jobholder
jock
jockey
jockstrap
jocose
jocular
jocund
Joe
Joel
joey
jog
jogging
joggle
Johann
Johannes
Johannesburg
Johansen
Johanson
John
Johnny
Johns
Johnsen
Johnson
Johnston
Johnstown
join
joint
joke







<




















<







12122
12123
12124
12125
12126
12127
12128

12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148

12149
12150
12151
12152
12153
12154
12155
jive
Jo
Joan
Joanna
Joanne
Joaquin
job

jobholder
jock
jockey
jockstrap
jocose
jocular
jocund
Joe
Joel
joey
jog
jogging
joggle
Johann
Johannes
Johannesburg
Johansen
Johanson
John
Johnny

Johnsen
Johnson
Johnston
Johnstown
join
joint
joke
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
Josephson
Josephus
Joshua
Josiah
joss
jostle
jot
jotting
joule
jounce
journal
journalese
journey
journeyman
journeymen







<







12173
12174
12175
12176
12177
12178
12179

12180
12181
12182
12183
12184
12185
12186
Josephson
Josephus
Joshua
Josiah
joss
jostle
jot

joule
jounce
journal
journalese
journey
journeyman
journeymen
12317
12318
12319
12320
12321
12322
12323

12324
12325
12326
12327
12328
12329
12330
judo
Judson
Judy
jug
jugate
jugging
juggle

juice
juicy
juju
jujube
juke
Jukes
julep







>







12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
judo
Judson
Judy
jug
jugate
jugging
juggle
Jugoslavia
juice
juicy
juju
jujube
juke
Jukes
julep
12352
12353
12354
12355
12356
12357
12358

12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
junkerdom
junketeer
junky
Juno
junta
Jupiter
Jura

jure
juridic
jurisdiction
jurisprudent
jurisprudential
juror
jury
just
justice
justiciable
justify
Justine
Justinian
jut
jute
Jutish
jutting
juvenile
juxtapose
juxtaposition
k
Kabuki
Kabul
Kaddish







>
















<







12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277

12278
12279
12280
12281
12282
12283
12284
junkerdom
junketeer
junky
Juno
junta
Jupiter
Jura
Jurassic
jure
juridic
jurisdiction
jurisprudent
jurisprudential
juror
jury
just
justice
justiciable
justify
Justine
Justinian
jut
jute
Jutish

juvenile
juxtapose
juxtaposition
k
Kabuki
Kabul
Kaddish
12405
12406
12407
12408
12409
12410
12411

12412
12413
12414
12415
12416
12417
12418
kapok
kappa
Karachi
Karamazov
karate
Karen
Karl

Karol
Karp
karyatid
Kaskaskia
Kate
Katharine
Katherine







>







12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
kapok
kappa
Karachi
Karamazov
karate
Karen
Karl
karma
Karol
Karp
karyatid
Kaskaskia
Kate
Katharine
Katherine
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471

12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
Kendall
Kennan
Kennecott
Kennedy
kennel
Kenneth
Kenney
kenning
keno
Kensington
Kent
Kenton
Kentucky
Kenya
Kenyon
Kepler
kept
kerchief
Kermit
kern
kernel

kerosene
Kerr
kerry
kerygma
Kessler
kestrel
ketch
ketchup
ketone
ketosis
Kettering
kettle
Kevin
key
keyboard
keyed
Keyes
keyhole
Keynes
Keynesian
keynote
keypunch
keys
keystone
keyword
khaki
khan
Khartoum
Khmer
Khrushchev
kibbutzim
kibitz
kick
kickback
kickoff
kid
Kidde
kiddie
kidding
kidnap
kidnapping
kidney
Kieffer
Kiev
Kiewit
Kigali
Kikuyu
Kilgore
kill
killdeer
killjoy
kilobit
kilobuck
kilobyte
kilogauss
kilohertz
kilohm
kilojoule
kiloton
kilovolt
kilowatt
kiloword
Kim
Kimball
Kimberly
kimono
kin
kind
kindergarten







<













>















<






<















|
|











<
<
<
<
<

<
<
<
<
<







12354
12355
12356
12357
12358
12359
12360

12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389

12390
12391
12392
12393
12394
12395

12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423





12424





12425
12426
12427
12428
12429
12430
12431
Kendall
Kennan
Kennecott
Kennedy
kennel
Kenneth
Kenney

keno
Kensington
Kent
Kenton
Kentucky
Kenya
Kenyon
Kepler
kept
kerchief
Kermit
kern
kernel
Kernighan
kerosene
Kerr
kerry
kerygma
Kessler
kestrel
ketch
ketchup
ketone
ketosis
Kettering
kettle
Kevin
key
keyboard

Keyes
keyhole
Keynes
Keynesian
keynote
keypunch

keystone
keyword
khaki
khan
Khartoum
Khmer
Khrushchev
kibbutzim
kibitz
kick
kickback
kickoff
kid
Kidde
kiddie
kidnap
kidnapped
kidnapping
kidney
Kieffer
Kiev
Kiewit
Kigali
Kikuyu
Kilgore
kill
killdeer
killjoy





kilohm





Kim
Kimball
Kimberly
kimono
kin
kind
kindergarten
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583

12584
12585
12586
12587
12588
12589
12590
Kirchner
Kirchoff
kirk
Kirkland
Kirkpatrick
Kirov
kiss
kissing
kit
Kitakyushu
kitchen
kitchenette
kite
kitten
kittenish
kittle
kitty
kiva
kivu
Kiwanis

Klan
Klaus
klaxon
kleenex
Klein
Kline
Klux







<












>







12455
12456
12457
12458
12459
12460
12461

12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
Kirchner
Kirchoff
kirk
Kirkland
Kirkpatrick
Kirov
kiss

kit
Kitakyushu
kitchen
kitchenette
kite
kitten
kittenish
kittle
kitty
kiva
kivu
Kiwanis
kiwi
Klan
Klaus
klaxon
kleenex
Klein
Kline
Klux
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638

12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651

12652
12653
12654
12655

12656
12657

12658
12659
12660
12661
12662
12663

12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674

12675
12676
12677
12678
12679
12680
12681
12682
12683
12684

12685
12686
12687
12688
12689
12690
12691


12692

12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707

12708
12709
12710

12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
kneecap
kneel
knelt
knew
knick
Knickerbocker
knife
knifelike
knight
Knightsbridge
knit
knitting
knives
knob
knobby
knock
knockdown
knockout
knoll
knot
Knott
knotting
knotty
know
knoweth
knowhow
knowledge
knowledgeable
Knowles
Knowlton
known
Knox
Knoxville
knuckle
knuckleball
Knudsen
Knudson
knurl
Knutsen
Knutson
koala

Koch
Kochab
Kodachrome
kodak
Kodiak
Koenig
Koenigsberg
kohlrabi
koinonia
kola
kolkhoz
kombu
Kong

Koppers
Koran
Korea
kosher

Kowalewski
Kowalski

kraft
Krakatoa
Krakow
Kramer
Krause
kraut

Kremlin
Kresge
Krieger
Krishna
Kristin
Kronecker
Krueger
Kruger
Kruse
krypton
k's

Ku
kudo
kudzu
Kuhn
kulak
kumquat
Kurd
Kurt
Kuwait
kwashiorkor

Kyle
Kyoto
l
la
lab
Laban
label


labile

laboratory
laborious
labour
Labrador
labradorite
labyrinth
lac
lace
lacerate
Lacerta
lacewing
Lachesis
lack
lackadaisic
lackey

lacquer
lacrosse
lactate

lacuna
lacunae
lacustrine
lacy
lad
laden
ladle
lady
ladyfern
ladylike
Lafayette
lag
lager
lagging
lagoon
Lagos
Lagrange







<



<









<



















>













>




>


>






>











>










>







>
>

>















>



>









<







12489
12490
12491
12492
12493
12494
12495

12496
12497
12498

12499
12500
12501
12502
12503
12504
12505
12506
12507

12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619

12620
12621
12622
12623
12624
12625
12626
kneecap
kneel
knelt
knew
knick
Knickerbocker
knife

knight
Knightsbridge
knit

knives
knob
knobby
knock
knockdown
knockout
knoll
knot
Knott

knotty
know
knoweth
knowhow
knowledge
knowledgeable
Knowles
Knowlton
known
Knox
Knoxville
knuckle
knuckleball
Knudsen
Knudson
knurl
Knutsen
Knutson
koala
Kobayashi
Koch
Kochab
Kodachrome
kodak
Kodiak
Koenig
Koenigsberg
kohlrabi
koinonia
kola
kolkhoz
kombu
Kong
Konrad
Koppers
Koran
Korea
kosher
Kovacs
Kowalewski
Kowalski
Kowloon
kraft
Krakatoa
Krakow
Kramer
Krause
kraut
Krebs
Kremlin
Kresge
Krieger
Krishna
Kristin
Kronecker
Krueger
Kruger
Kruse
krypton
k's
KS
Ku
kudo
kudzu
Kuhn
kulak
kumquat
Kurd
Kurt
Kuwait
kwashiorkor
KY
Kyle
Kyoto
l
la
lab
Laban
label
labia
labial
labile
lability
laboratory
laborious
labour
Labrador
labradorite
labyrinth
lac
lace
lacerate
Lacerta
lacewing
Lachesis
lack
lackadaisic
lackey
laconic
lacquer
lacrosse
lactate
lactose
lacuna
lacunae
lacustrine
lacy
lad
laden
ladle
lady
ladyfern

Lafayette
lag
lager
lagging
lagoon
Lagos
Lagrange
12735
12736
12737
12738
12739
12740
12741

12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
laissez
laity
lake
Lakehurst
lakeside
lam
Lamar

lamb
lambda
lambert
lame
lamellar
lament
lamentation
laminate
lamming
lamp
lampblack
lamplight
lampoon
lamprey
Lana
Lancashire







>







|
|







12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
laissez
laity
lake
Lakehurst
lakeside
lam
Lamar
Lamarck
lamb
lambda
lambert
lame
lamellar
lament
lamentation
laminar
laminate
lamp
lampblack
lamplight
lampoon
lamprey
Lana
Lancashire
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
Laotian
lap
lapel
lapelled
lapidary
Laplace
lappet
lapping
lapse
Laramie
larceny
larch
lard
Laredo
Lares







<







12687
12688
12689
12690
12691
12692
12693

12694
12695
12696
12697
12698
12699
12700
Laotian
lap
lapel
lapelled
lapidary
Laplace
lappet

lapse
Laramie
larceny
larch
lard
Laredo
Lares
12819
12820
12821
12822
12823
12824
12825

12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847

12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
lascar
lascivious
lase
lash
lass
lasso
last

latch
late
latent
later
latera
lateral
Lateran
laterite
latest
latex
lath
lathe
Lathrop
Latin
Latinate
latitude
latitudinal
latitudinary
Latrobe
latter
lattice
latus

laud
laudanum
laudatory
Lauderdale
Laue
laugh
laughingstock
Laughlin
laughter
launch
launder
laundry
laura
laureate
laurel
Lauren
Laurence
Laurent
Laurentian
Laurie
Lausanne
lava
lavabo
lavatory







>








<













>
















<







12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733

12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763

12764
12765
12766
12767
12768
12769
12770
lascar
lascivious
lase
lash
lass
lasso
last
Laszlo
latch
late
latent
later
latera
lateral
Lateran
laterite

latex
lath
lathe
Lathrop
Latin
Latinate
latitude
latitudinal
latitudinary
Latrobe
latter
lattice
latus
Latvia
laud
laudanum
laudatory
Lauderdale
Laue
laugh
laughingstock
Laughlin
laughter
launch
launder
laundry
laura
laureate
laurel
Lauren

Laurent
Laurentian
Laurie
Lausanne
lava
lavabo
lavatory
12947
12948
12949
12950
12951
12952
12953

12954
12955
12956
12957
12958
12959
12960
ledge
lee
leech
Leeds
leek
leer
leery

leeward
leeway
left
leftmost
leftover
leftward
lefty







>







12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
ledge
lee
leech
Leeds
leek
leer
leery
Leeuwenhoek
leeward
leeway
left
leftmost
leftover
leftward
lefty
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009

13010
13011
13012
13013
13014
13015
13016
length
lengthen
lengthwise
lengthy
lenient
Lenin
Leningrad
Leninism
Leninist
Lennox
Lenny

lens
lent
Lenten
lenticular
lentil
Leo
Leon







<
<


>







12899
12900
12901
12902
12903
12904
12905


12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
length
lengthen
lengthwise
lengthy
lenient
Lenin
Leningrad


Lennox
Lenny
Lenore
lens
lent
Lenten
lenticular
lentil
Leo
Leon
13041
13042
13043
13044
13045
13046
13047
13048
13049

13050

13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062

13063
13064
13065
13066
13067
13068
13069
lethal
lethargy
Lethe
Letitia
letterhead
letterman
lettermen
letting
lettuce

leukemia

levee
level
lever
leverage
Levi
Levin
Levine
Levis
levitate
Leviticus
Levitt
levity

levy
lew
lewd
lewis
lexical
lexicography
lexicon







<

>

>












>







12940
12941
12942
12943
12944
12945
12946

12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
lethal
lethargy
Lethe
Letitia
letterhead
letterman
lettermen

lettuce
leucine
leukemia
Lev
levee
level
lever
leverage
Levi
Levin
Levine
Levis
levitate
Leviticus
Levitt
levity
levulose
levy
lew
lewd
lewis
lexical
lexicography
lexicon
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
licensee
licensor
licentious
lichen
lick
licorice
lid
lidding
lie
Liechtenstein
lied
lien
lieu
lieutenant
life
lifeblood
lifeboat
lifeguard
lifelike
lifelong
lifespan
lifestyle
lifetime
LIFO
lift
ligament







<


<







<







12996
12997
12998
12999
13000
13001
13002

13003
13004

13005
13006
13007
13008
13009
13010
13011

13012
13013
13014
13015
13016
13017
13018
licensee
licensor
licentious
lichen
lick
licorice
lid

lie
Liechtenstein

lien
lieu
lieutenant
life
lifeblood
lifeboat
lifeguard

lifelong
lifespan
lifestyle
lifetime
LIFO
lift
ligament
13139
13140
13141
13142
13143
13144
13145

13146
13147
13148
13149
13150
13151
13152
lilac
Lilian
Lillian
Lilliputian
Lilly
lilt
lily

Lima
limb
limbic
limbo
lime
limelight
Limerick







>







13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
lilac
Lilian
Lillian
Lilliputian
Lilly
lilt
lily
lim
Lima
limb
limbic
limbo
lime
limelight
Limerick
13174
13175
13176
13177
13178
13179
13180

13181
13182
13183
13184
13185
13186
13187
lineage
lineal
linear
linebacker
lineman
linemen
linen

lineup
linger
lingerie
lingo
lingua
lingual
linguist







>







13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
lineage
lineal
linear
linebacker
lineman
linemen
linen
lineprinter
lineup
linger
lingerie
lingo
lingua
lingual
linguist
13228
13229
13230
13231
13232
13233
13234

13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247

13248
13249

13250
13251
13252
13253
13254
13255
13256
lithic
lithium
lithograph
lithography
lithology
lithosphere
lithospheric

litigant
litigate
litigious
litmus
litterbug
little
littleneck
Littleton
Litton
littoral
liturgic
liturgy
live

Livermore
Liverpool

liverwort
livery
livestock
liveth
livid
Livingston
livre







>













>


>







13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
lithic
lithium
lithograph
lithography
lithology
lithosphere
lithospheric
Lithuania
litigant
litigate
litigious
litmus
litterbug
little
littleneck
Littleton
Litton
littoral
liturgic
liturgy
live
liven
Livermore
Liverpool
Liverpudlian
liverwort
livery
livestock
liveth
livid
Livingston
livre
13314
13315
13316
13317
13318
13319
13320

13321
13322
13323
13324
13325
13326
13327
Logan
logarithm
logarithmic
loge
loggerhead
logging
logic

logistic
logjam
loin
loincloth
Loire
Lois
loiter







>







13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
Logan
logarithm
logarithmic
loge
loggerhead
logging
logic
logician
logistic
logjam
loin
loincloth
Loire
Lois
loiter
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372

13373

13374
13375
13376

13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
looseleaf
loosen
loosestrife
loot
lop
lope
Lopez
lopping
lopseed
lopsided
loquacious
loquacity

lord

lore
Lorelei
Loren

Lorinda
Lorraine
Los
losable
lose
loss
lossy
lost
lot
lotion







<




>

>



>


<







13265
13266
13267
13268
13269
13270
13271

13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284

13285
13286
13287
13288
13289
13290
13291
looseleaf
loosen
loosestrife
loot
lop
lope
Lopez

lopseed
lopsided
loquacious
loquacity
loquat
lord
lordosis
lore
Lorelei
Loren
Lorenz
Lorinda
Lorraine

losable
lose
loss
lossy
lost
lot
lotion
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
Loveland
lovelorn
low
lowboy
lowdown
Lowe
Lowell
lower
lowland
Lowry
loy
loyal
loyalty
lozenge
l's







<







13316
13317
13318
13319
13320
13321
13322

13323
13324
13325
13326
13327
13328
13329
Loveland
lovelorn
low
lowboy
lowdown
Lowe
Lowell

lowland
Lowry
loy
loyal
loyalty
lozenge
l's
13515
13516
13517
13518
13519
13520
13521

13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541

13542
13543
13544
13545
13546
13547
13548
13549
13550
13551

13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574

13575
13576
13577

13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
luxe
Luxembourg
luxuriant
luxuriate
luxurious
luxury
Luzon

lycopodium
Lydia
lye
lying
Lykes
Lyle
Lyman
lymph
lymphocyte
lymphoma
lynch
Lynchburg
Lynn
lynx
Lyon
Lyons
Lyra
lyric
lyricism
lysergic

m
ma
Mabel
Mac
macabre
macaque
MacArthur
Macassar
Macbeth
MacDonald

mace
Macedon
Macedonia
MacGregor
Mach
Machiavelli
machination
machine
machinelike
machinery
machismo
macho
macintosh
mack
MacKenzie
mackerel
Mackey
Mackinac
Mackinaw
mackintosh
MacMillan
Macon
macro

macromolecule
macrophage
macroscopic

mad
Madagascar
madam
Madame
madcap
madden
madding
Maddox
made
Madeira
Madeleine
Madeline
madhouse
Madison







>















<


|

>










>








<














>



>






<







13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441

13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465

13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490

13491
13492
13493
13494
13495
13496
13497
luxe
Luxembourg
luxuriant
luxuriate
luxurious
luxury
Luzon
L'vov
lycopodium
Lydia
lye
lying
Lykes
Lyle
Lyman
lymph
lymphocyte
lymphoma
lynch
Lynchburg
Lynn
lynx
Lyon

Lyra
lyric
Lysenko
lysergic
lysine
m
ma
Mabel
Mac
macabre
macaque
MacArthur
Macassar
Macbeth
MacDonald
MacDougall
mace
Macedon
Macedonia
MacGregor
Mach
Machiavelli
machination
machine

machinery
machismo
macho
macintosh
mack
MacKenzie
mackerel
Mackey
Mackinac
Mackinaw
mackintosh
MacMillan
Macon
macro
macromolecular
macromolecule
macrophage
macroscopic
macrostructure
mad
Madagascar
madam
Madame
madcap
madden

Maddox
made
Madeira
Madeleine
Madeline
madhouse
Madison
13607
13608
13609
13610
13611
13612
13613

13614
13615
13616
13617
13618
13619
13620
maggot
maggoty
magi
magic
magician
magisterial
magistrate

magna
magnanimity
magnanimous
magnate
magnesia
magnesite
magnesium







>







13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
maggot
maggoty
magi
magic
magician
magisterial
magistrate
magma
magna
magnanimity
magnanimous
magnate
magnesia
magnesite
magnesium
13646
13647
13648
13649
13650
13651
13652

13653
13654
13655
13656
13657
13658
13659
mailman
mailmen
maim
main
Maine
mainland
mainline

mainstream
maintain
maintenance
maitre
majestic
majesty
major







>







13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
mailman
mailmen
maim
main
Maine
mainland
mainline
mainstay
mainstream
maintain
maintenance
maitre
majestic
majesty
major
13706
13707
13708
13709
13710
13711
13712

13713
13714
13715
13716
13717
13718
13719
malposed
malpractice
Malraux
malt
Malta
Maltese
Malton

maltreat
mambo
mamma
mammal
mammalian
mammoth
man







>







13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
malposed
malpractice
Malraux
malt
Malta
Maltese
Malton
maltose
maltreat
mambo
mamma
mammal
mammalian
mammoth
man
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
Manfred
manganese
mange
mangel
mangle
Manhattan
manhole
manhood
mania
maniac
maniacal
manic
manifest
manifestation
manifold
manikin
Manila
manipulable
manipulate
Manitoba
mankind
Manley
Mann
manna
mannequin
mannerism
manning
manometer
manometric
manor
manpower
Mans
manse
manservant
Mansfield
mansion
manslaughter
mantel
mantic







<

















<
<

<


<







13646
13647
13648
13649
13650
13651
13652

13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669


13670

13671
13672

13673
13674
13675
13676
13677
13678
13679
Manfred
manganese
mange
mangel
mangle
Manhattan
manhole

mania
maniac
maniacal
manic
manifest
manifestation
manifold
manikin
Manila
manipulable
manipulate
Manitoba
mankind
Manley
Mann
manna
mannequin


manometer

manor
manpower

manse
manservant
Mansfield
mansion
manslaughter
mantel
mantic
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
Manville
many
manzanita
Mao
Maori
map
maple
mapping
mar
marathon
maraud
marble
Marc
Marceau
Marcel







<







13693
13694
13695
13696
13697
13698
13699

13700
13701
13702
13703
13704
13705
13706
Manville
many
manzanita
Mao
Maori
map
maple

mar
marathon
maraud
marble
Marc
Marceau
Marcel
13814
13815
13816
13817
13818
13819
13820

13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837

13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880

13881
13882

13883
13884
13885
13886
13887
13888
13889
Margery
margin
marginal
marginalia
Margo
Marguerite
maria

Marie
Marietta
marigold
marijuana
Marilyn
marimba
Marin
marina
marinade
marinate
marine
Marino
Mario
Marion
marionette
marital
maritime

Marjorie
Marjory
mark
market
marketeer
marketplace
marketwise
Markham
Markov
Markovian
Marks
marksman
marksmen
Marlboro
Marlborough
Marlene
marlin
Marlowe
marmalade
marmot
maroon
marque
marquee
marquess
Marquette
marquis
marriage
marriageable
married
Marrietta
marring
Marriott
marrow
marrowbone
marry
Mars
Marseilles
marsh
Marsha
marshal
Marshall
marshland
marshmallow

mart
marten

Martha
martial
Martian
martin
Martinez
martingale
martini







>

















>










<

















<

<




<







>


>







13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752

13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769

13770

13771
13772
13773
13774

13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
Margery
margin
marginal
marginalia
Margo
Marguerite
maria
Marianne
Marie
Marietta
marigold
marijuana
Marilyn
marimba
Marin
marina
marinade
marinate
marine
Marino
Mario
Marion
marionette
marital
maritime
marjoram
Marjorie
Marjory
mark
market
marketeer
marketplace
marketwise
Markham
Markov
Markovian

marksman
marksmen
Marlboro
Marlborough
Marlene
marlin
Marlowe
marmalade
marmot
maroon
marque
marquee
marquess
Marquette
marquis
marriage
marriageable

Marrietta

Marriott
marrow
marrowbone
marry

Marseilles
marsh
Marsha
marshal
Marshall
marshland
marshmallow
marsupial
mart
marten
martensite
Martha
martial
Martian
martin
Martinez
martingale
martini
13900
13901
13902
13903
13904
13905
13906


13907
13908
13909
13910
13911
13912
13913
Maryland
mascara
masculine
maser
Maseru
mash
mask


mason
Masonic
Masonite
masonry
masque
masquerade
mass







>
>







13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
Maryland
mascara
masculine
maser
Maseru
mash
mask
masochism
masochist
mason
Masonic
Masonite
masonry
masque
masquerade
mass
13956
13957
13958
13959
13960
13961
13962

13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975

13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
matriculate
matrimonial
matrimony
matrix
matroid
matron
Matson

matte
Matthew
Matthews
matting
mattock
mattress
Mattson
maturate
mature
maudlin
maul
Maureen
Maurice

Maurine
Mauritania
Mauritius
mausoleum
mauve
maverick
Mavis
maw
mawkish
Mawr
Max
maxim
maxima
maximal
Maximilian
maximum
Maxine
maxwell







>


<
<









>










|







13861
13862
13863
13864
13865
13866
13867
13868
13869
13870


13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
matriculate
matrimonial
matrimony
matrix
matroid
matron
Matson
Matsumoto
matte
Matthew


mattock
mattress
Mattson
maturate
mature
maudlin
maul
Maureen
Maurice
Mauricio
Maurine
Mauritania
Mauritius
mausoleum
mauve
maverick
Mavis
maw
mawkish
Mawr
max
maxim
maxima
maximal
Maximilian
maximum
Maxine
maxwell
14012
14013
14014
14015
14016
14017
14018

14019
14020
14021
14022
14023
14024
14025
MBA
Mbabane
McAdams
McAllister
McBride
McCabe
McCall

McCann
McCarthy
McCarty
McCauley
McClain
McClellan
McClure







>







13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
MBA
Mbabane
McAdams
McAllister
McBride
McCabe
McCall
McCallum
McCann
McCarthy
McCarty
McCauley
McClain
McClellan
McClure
14065
14066
14067
14068
14069
14070
14071

14072

14073
14074
14075
14076
14077
14078
14079
McLeod
McMahon
McMillan
McMullen
McNally
McNaughton
McNeil

McPherson

me
mead
meadow
meadowland
meadowsweet
meager
meal







>

>







13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
McLeod
McMahon
McMillan
McMullen
McNally
McNaughton
McNeil
McNulty
McPherson
MD
me
mead
meadow
meadowland
meadowsweet
meager
meal
14094
14095
14096
14097
14098
14099
14100

14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115

14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132

14133
14134
14135
14136
14137
14138
14139
mechanism
mechanist
mecum
medal
medallion
meddle
Medea

media
medial
median
mediate
medic
medicate
Medici
medicinal
medicine
medico
mediocre
mediocrity
meditate
Mediterranean
medium

medley
Medusa
meek
meet
meetinghouse
Meg
megabit
megabyte
megahertz
megalomania
megalomaniac
megaton
megavolt
megawatt
megaword
megohm
Meier

Meistersinger
Mekong
Mel
melamine
melancholy
Melanesia
melange







>















>

















>







14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
mechanism
mechanist
mecum
medal
medallion
meddle
Medea
Medford
media
medial
median
mediate
medic
medicate
Medici
medicinal
medicine
medico
mediocre
mediocrity
meditate
Mediterranean
medium
medlar
medley
Medusa
meek
meet
meetinghouse
Meg
megabit
megabyte
megahertz
megalomania
megalomaniac
megaton
megavolt
megawatt
megaword
megohm
Meier
meiosis
Meistersinger
Mekong
Mel
melamine
melancholy
Melanesia
melange
14174
14175
14176
14177
14178
14179
14180

14181
14182
14183
14184
14185
14186


14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
men
menace
menagerie
menarche
mend
mendacious
mendacity

mendelevium
Mendelssohn
Menelaus
menfolk
menhaden
menial


Menlo
Mennonite
menstruate
mensurable
mensuration
mental
mention
mentor
menu
Menzies
Mephistopheles
mercantile
Mercator
Mercedes
mercenary
mercer
merchandise
merchant
merciful
mercilessly
Merck
mercurial
mercuric
mercury
mercy
mere
Meredith







>






>
>



















<







14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119

14120
14121
14122
14123
14124
14125
14126
men
menace
menagerie
menarche
mend
mendacious
mendacity
Mendel
mendelevium
Mendelssohn
Menelaus
menfolk
menhaden
menial
meningitis
meniscus
Menlo
Mennonite
menstruate
mensurable
mensuration
mental
mention
mentor
menu
Menzies
Mephistopheles
mercantile
Mercator
Mercedes
mercenary
mercer
merchandise
merchant
merciful

Merck
mercurial
mercuric
mercury
mercy
mere
Meredith
14232
14233
14234
14235
14236
14237
14238

14239

14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259

14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310

14311

14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
Mervin
mesa
mescal
mescaline
mesenteric
mesh
mesmeric

meson

Mesozoic
mesquite
mess
message
messenger
Messiah
messieurs
Messrs
messy
met
metabole
metabolic
metabolism
metabolite
metal
metallic
metalliferous
metallography
metalloid
metallurgic

metallurgy
metalwork
metamorphic
metamorphism
metamorphose
metamorphosis
metaphor
metaphoric
Metcalf
mete
meteor
meteoric
meteorite
meteoritic
meteorology
meter
methacrylate
methane
method
methodic
Methodism
Methodist
methodology
Methuen
Methuselah
methyl
methylene
meticulous
metier
metric
metro
metronome
metropolis
metropolitan
mettle
mettlesome
Metzler
mew
Mexican
Mexico
Meyer
Meyers
mezzo
mi
Miami
miasma
miasmal
mica
mice
Michael
Michaelangelo

Michelangelo

Michelin
Michelson
michigan
Mickelson
Mickey
Micky
micro
microbial
microcosm
micrography
microjoule
micron
Micronesia
microscopy
mid
Midas
midband
midday







>

>




















>


















|
|
|
|



















<









>

>










<







14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216

14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238

14239
14240
14241
14242
14243
14244
14245
Mervin
mesa
mescal
mescaline
mesenteric
mesh
mesmeric
mesoderm
meson
Mesopotamia
Mesozoic
mesquite
mess
message
messenger
Messiah
messieurs
Messrs
messy
met
metabole
metabolic
metabolism
metabolite
metal
metallic
metalliferous
metallography
metalloid
metallurgic
metallurgist
metallurgy
metalwork
metamorphic
metamorphism
metamorphose
metamorphosis
metaphor
metaphoric
Metcalf
mete
meteor
meteoric
meteorite
meteoritic
meteorology
meter
methacrylate
methane
methanol
methionine
method
methodic
methodology
Methuen
Methuselah
methyl
methylene
meticulous
metier
metric
metro
metronome
metropolis
metropolitan
mettle
mettlesome
Metzler
mew
Mexican
Mexico
Meyer

mezzo
mi
Miami
miasma
miasmal
mica
mice
Michael
Michaelangelo
Michel
Michelangelo
Michele
Michelin
Michelson
michigan
Mickelson
Mickey
Micky
micro
microbial
microcosm
micrography

micron
Micronesia
microscopy
mid
Midas
midband
midday
14345
14346
14347
14348
14349
14350
14351

14352
14353
14354
14355
14356

14357
14358
14359
14360
14361
14362
14363
midscale
midsection
midshipman
midshipmen
midspan
midst
midstream

midway
midweek
Midwest
Midwestern
midwife

midwives
mien
miff
mig
might
mightn't
mighty







>





>







14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
midscale
midsection
midshipman
midshipmen
midspan
midst
midstream
midterm
midway
midweek
Midwest
Midwestern
midwife
midwinter
midwives
mien
miff
mig
might
mightn't
mighty
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427

14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438

14439
14440
14441
14442
14443
14444
14445
milky
mill
Millard
millenarian
millenia
millennia
millennium
miller
millet
milliammeter
milliampere
Millie
millihenry
millijoule
Millikan
millinery
million
millionaire
millionth
millipede
millisecond
millivolt
millivoltmeter
milliwatt
Mills
millstone
milord
milt
Milton
Miltonic
Milwaukee
mimeograph
mimesis
mimetic
Mimi
mimic
mimicked
mimicking

minaret
mince
mincemeat
mind
Mindanao
mindful
mine
minefield
mineral
mineralogy
Minerva

minesweeper
mingle
mini
miniature
minicomputer
minim
minima







<

<
<

<
<






<
<
<
<
<













>











>







14308
14309
14310
14311
14312
14313
14314

14315


14316


14317
14318
14319
14320
14321
14322





14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
milky
mill
Millard
millenarian
millenia
millennia
millennium

millet


Millie


Millikan
millinery
million
millionaire
millionth
millipede





millstone
milord
milt
Milton
Miltonic
Milwaukee
mimeograph
mimesis
mimetic
Mimi
mimic
mimicked
mimicking
min
minaret
mince
mincemeat
mind
Mindanao
mindful
mine
minefield
mineral
mineralogy
Minerva
minestrone
minesweeper
mingle
mini
miniature
minicomputer
minim
minima
14454
14455
14456
14457
14458
14459
14460

14461
14462
14463
14464
14465
14466
14467
Minnesota
Minnie
minnow
Minoan
minor
Minos
minot

Minsky
minstrel
minstrelsy
mint
minuend
minuet
minus







>







14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
Minnesota
Minnie
minnow
Minoan
minor
Minos
minot
Minsk
Minsky
minstrel
minstrelsy
mint
minuend
minuet
minus
14482
14483
14484
14485
14486
14487
14488

14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516


14517
14518
14519
14520
14521
14522
14523
14524

14525

14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
mirror
mirth
misanthrope
misanthropic
miscegenation
miscellaneous
miscellany

mischievous
miscreant
miser
misery
misnomer
misogynist
misogyny
mispronunciation
miss
misshapen
missile
mission
missionary
Mississippi
Mississippian
missive
Missoula
Missouri
Missy
mist
mistletoe
mistress
misty
MIT
Mitchell
mite
miterwort
mitigate


mitral
mitre
mitt
mitten
mix
mixture
mixup
Mizar

mnemonic

moan
moat
mob
mobbing
mobcap
Mobil
mobile
mobility
mobster
moccasin
mock







>







<




















>
>








>

>



<







14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407

14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443

14444
14445
14446
14447
14448
14449
14450
mirror
mirth
misanthrope
misanthropic
miscegenation
miscellaneous
miscellany
miscible
mischievous
miscreant
miser
misery
misnomer
misogynist
misogyny

miss
misshapen
missile
mission
missionary
Mississippi
Mississippian
missive
Missoula
Missouri
Missy
mist
mistletoe
mistress
misty
MIT
Mitchell
mite
miterwort
mitigate
mitochondria
mitosis
mitral
mitre
mitt
mitten
mix
mixture
mixup
Mizar
MN
mnemonic
MO
moan
moat
mob

mobcap
Mobil
mobile
mobility
mobster
moccasin
mock
14569
14570
14571
14572
14573
14574
14575

14576
14577
14578
14579
14580
14581
14582
moist
moisten
moisture
molal
molar
molasses
mold

moldboard
mole
molecular
molecule
molehill
molest
Moliere







>







14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
moist
moisten
moisture
molal
molar
molasses
mold
Moldavia
moldboard
mole
molecular
molecule
molehill
molest
Moliere
14603
14604
14605
14606
14607
14608
14609

14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621

14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646

14647
14648
14649
14650
14651
14652
14653
Mona
Monaco
monad
monadic
monarch
monarchic
monarchy

monastery
monastic
monaural
Monday
monel
monetarism
monetary
money
moneymake
moneywort
Mongolia
mongoose

Monica
monies
monitor
monitory
monk
monkey
monkeyflower
monkish
Monmouth
Monoceros
monochromatic
monochromator
monocotyledon
monocular
monogamous
monogamy
monolith
monologist
monologue
monomer
monomeric
monomial
Monongahela
monopoly
monotonous

monoxide
Monroe
Monrovia
Monsanto
monsieur
monsoon
monster







>












>










<

<












>







14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548

14549

14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
Mona
Monaco
monad
monadic
monarch
monarchic
monarchy
Monash
monastery
monastic
monaural
Monday
monel
monetarism
monetary
money
moneymake
moneywort
Mongolia
mongoose
monic
Monica
monies
monitor
monitory
monk
monkey
monkeyflower
monkish
Monmouth
Monoceros

monochromator

monocular
monogamous
monogamy
monolith
monologist
monologue
monomer
monomeric
monomial
Monongahela
monopoly
monotonous
monotreme
monoxide
Monroe
Monrovia
Monsanto
monsieur
monsoon
monster
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
monument
moo
mood
moody
moon
Mooney
moonlight
moonlike
moonlit
moor
Moore
Moorish
moose
moot
mop
mopping
moraine
moral
morale
Moran
morass
moratorium
Moravia







<







<







14590
14591
14592
14593
14594
14595
14596

14597
14598
14599
14600
14601
14602
14603

14604
14605
14606
14607
14608
14609
14610
monument
moo
mood
moody
moon
Mooney
moonlight

moonlit
moor
Moore
Moorish
moose
moot
mop

moraine
moral
morale
Moran
morass
moratorium
Moravia
14711
14712
14713
14714
14715
14716
14717

14718
14719
14720
14721
14722
14723
14724
Moroccan
Morocco
moron
morose
morpheme
morphemic
morphine

morphology
morphophonemic
Morrill
morris
Morrison
Morrissey
Morristown







>







14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
Moroccan
Morocco
moron
morose
morpheme
morphemic
morphine
morphism
morphology
morphophonemic
Morrill
morris
Morrison
Morrissey
Morristown
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
mossy
most
mot
motel
motet
moth
mother
motherhood
motherland
motif
motion
motivate
motive
motley
motor







<







14662
14663
14664
14665
14666
14667
14668

14669
14670
14671
14672
14673
14674
14675
mossy
most
mot
motel
motet
moth
mother

motherland
motif
motion
motivate
motive
motley
motor
14784
14785
14786
14787
14788
14789
14790
14791
14792


14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
movie
mow
Moyer
Mozart
MPH
Mr
Mrs
Ms
m's


mu
much
mucilage
muck
mucosa
mucus
mud
Mudd
mudding
muddle
muddlehead
muddy
mudguard
mudsling
Mueller
muezzin







<

>
>








<







14698
14699
14700
14701
14702
14703
14704

14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715

14716
14717
14718
14719
14720
14721
14722
movie
mow
Moyer
Mozart
MPH
Mr
Mrs

m's
Ms
Mt
mu
much
mucilage
muck
mucosa
mucus
mud
Mudd

muddle
muddlehead
muddy
mudguard
mudsling
Mueller
muezzin
14825
14826
14827
14828
14829
14830
14831

14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
mullah
mullein
Mullen
mulligan
mulligatawny
mullion
multi

multinomial
multiple
multiplex
multiplexor
multipliable
multiplicand
multiplication
multiplicative
multiplicity
multiply
multitude
multitudinous
mum
mumble
Mumford
mummy
munch







>


|
|
|




<







14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755

14756
14757
14758
14759
14760
14761
14762
mullah
mullein
Mullen
mulligan
mulligatawny
mullion
multi
multifarious
multinomial
multiple
multiplet
multiplex
multiplexor
multiplicand
multiplication
multiplicative
multiplicity

multitude
multitudinous
mum
mumble
Mumford
mummy
munch
14896
14897
14898
14899
14900
14901
14902

14903
14904
14905
14906
14907
14908
14909
must
mustache
mustachio
mustang
mustard
mustn't
musty

mutandis
mutant
mutate
mutatis
mute
mutilate
mutineer







>







14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
must
mustache
mustachio
mustang
mustard
mustn't
musty
mutagen
mutandis
mutant
mutate
mutatis
mute
mutilate
mutineer
14927
14928
14929
14930
14931
14932
14933

14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968

14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005

15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
Myers
mylar
mynah
Mynheer
myocardial
myocardium
myofibril

myopia
myopic
myosin
Myra
myriad
Myron
myrrh
myrtle
myself
mysterious
mystery
mystic
mystify
mystique
myth
mythic
mythology
n
NAACP
nab
nabbing
Nabisco
Nadine
nadir
nag
Nagasaki
nagging
Nagoya
Nagy
naiad
nail
Nair
Nairobi
naive
naivete

naked
name
nameable
nameplate
namesake
Nan
Nancy
Nanette
Nanking
nanosecond
Nantucket
Naomi
nap
napkin
Naples
Napoleon
Napoleonic
napping
Narbonne
narcissist
narcissus
narcosis
narcotic
Narragansett
narrate
narrow
nary
NASA
nasal
nascent
Nash
Nashua
Nashville
Nassau
nasturtium
nasty
Nat

natal
Natalie
Natchez
Nathan
Nathaniel
nation
nationhood
nationwide
native
NATO
natty
natural
nature
naturopath







>




















<














>

















<



















>






<







14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869

14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901

14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927

14928
14929
14930
14931
14932
14933
14934
Myers
mylar
mynah
Mynheer
myocardial
myocardium
myofibril
myoglobin
myopia
myopic
myosin
Myra
myriad
Myron
myrrh
myrtle
myself
mysterious
mystery
mystic
mystify
mystique
myth
mythic
mythology
n
NAACP
nab

Nabisco
Nadine
nadir
nag
Nagasaki
nagging
Nagoya
Nagy
naiad
nail
Nair
Nairobi
naive
naivete
Nakayama
naked
name
nameable
nameplate
namesake
Nan
Nancy
Nanette
Nanking
nanosecond
Nantucket
Naomi
nap
napkin
Naples
Napoleon
Napoleonic

Narbonne
narcissist
narcissus
narcosis
narcotic
Narragansett
narrate
narrow
nary
NASA
nasal
nascent
Nash
Nashua
Nashville
Nassau
nasturtium
nasty
Nat
Nate
natal
Natalie
Natchez
Nathan
Nathaniel
nation

nationwide
native
NATO
natty
natural
nature
naturopath
15035
15036
15037
15038
15039
15040
15041

15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
Nazareth
Nazi
Nazism
NBC
NBS
NC
NCAA

NCR
ND
Ndjamena
ne
Neal
Neanderthal
Neapolitan
near
nearby
nearest
nearsighted
neat
neater
neath
Nebraska
nebula
nebulae







>









<







14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966

14967
14968
14969
14970
14971
14972
14973
Nazareth
Nazi
Nazism
NBC
NBS
NC
NCAA
NCO
NCR
ND
Ndjamena
ne
Neal
Neanderthal
Neapolitan
near
nearby

nearsighted
neat
neater
neath
Nebraska
nebula
nebulae
15069
15070
15071
15072
15073
15074
15075

15076
15077
15078
15079
15080
15081
15082
necromancy
necromantic
necropsy
necrosis
necrotic
nectar
nectareous

nectary
Ned
nee
need
needful
needham
needle







>







14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
necromancy
necromantic
necropsy
necrosis
necrotic
nectar
nectareous
nectarine
nectary
Ned
nee
need
needful
needham
needle
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
nest
nestle
Nestor
net
nether
Netherlands
netherworld
netting
nettle
nettlesome
network
Neumann
neural
neuralgia
neurasthenic







<







15040
15041
15042
15043
15044
15045
15046

15047
15048
15049
15050
15051
15052
15053
nest
nestle
Nestor
net
nether
Netherlands
netherworld

nettle
nettlesome
network
Neumann
neural
neuralgia
neurasthenic
15165
15166
15167
15168
15169
15170
15171

15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191

15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211

15212
15213
15214
15215
15216
15217
15218
newborn
Newcastle
newcomer
newel
Newell
newfound
Newfoundland

newlywed
Newman
Newport
newsboy
newscast
newsletter
newsman
newsmen
newspaper
newspaperman
newspapermen
newsreel
newsstand
Newsweek
newt
newton
Newtonian
next
Nguyen
NH

Niagara
Niamey
nib
nibble
Nibelung
nibs
Nicaragua
nice
nicety
niche
Nicholas
Nicholls
Nichols
Nicholson
nichrome
nick
nickel
nickname
Nicodemus
Nicosia

nicotine
niece
Nielsen
Nielson
Nietzsche
Niger
Nigeria







>




















>





<














>







15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113

15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
newborn
Newcastle
newcomer
newel
Newell
newfound
Newfoundland
newline
newlywed
Newman
Newport
newsboy
newscast
newsletter
newsman
newsmen
newspaper
newspaperman
newspapermen
newsreel
newsstand
Newsweek
newt
newton
Newtonian
next
Nguyen
NH
niacin
Niagara
Niamey
nib
nibble
Nibelung

Nicaragua
nice
nicety
niche
Nicholas
Nicholls
Nichols
Nicholson
nichrome
nick
nickel
nickname
Nicodemus
Nicosia
nicotinamide
nicotine
niece
Nielsen
Nielson
Nietzsche
Niger
Nigeria
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276


15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297

15298
15299
15300
15301
15302
15303


15304
15305
15306
15307


15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321

15322
15323
15324
15325
15326
15327
15328
ninetieth
ninety
Nineveh
ninth
Niobe
niobium
nip
nipping
nipple
Nippon
nirvana
nit
nitpick
nitrate
nitric
nitride
nitrite
nitrogen
nitrogenous
nitroglycerine
nitrous
nitty
Nixon
NJ
NM


no
NOAA
Noah
nob
Nobel
nobelium
noble
nobleman
noblemen
noblesse
nobody
nobody'd
nocturnal
nocturne
nod
nodal
nodding
node
nodular
nodule
Noel

noise
noisemake
noisy
Nolan
Noll
nolo


nomenclature
nominal
nominate
nominee


non
nonce
nonchalant
nondescript
none
nonetheless
nonogenarian
nonsensic
noodle
nook
noon
noontime
noose
nor

Nordhoff
Nordstrom
Noreen
Norfolk
norm
Norma
normal







<

















>
>
















<




>






>
>




>
>














>







15169
15170
15171
15172
15173
15174
15175

15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210

15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
ninetieth
ninety
Nineveh
ninth
Niobe
niobium
nip

nipple
Nippon
nirvana
nit
nitpick
nitrate
nitric
nitride
nitrite
nitrogen
nitrogenous
nitroglycerine
nitrous
nitty
Nixon
NJ
NM
NNE
NNW
no
NOAA
Noah
nob
Nobel
nobelium
noble
nobleman
noblemen
noblesse
nobody
nobody'd
nocturnal
nocturne
nod
nodal

node
nodular
nodule
Noel
Noetherian
noise
noisemake
noisy
Nolan
Noll
nolo
nomad
nomadic
nomenclature
nominal
nominate
nominee
nomogram
nomograph
non
nonce
nonchalant
nondescript
none
nonetheless
nonogenarian
nonsensic
noodle
nook
noon
noontime
noose
nor
Nora
Nordhoff
Nordstrom
Noreen
Norfolk
norm
Norma
normal
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374

15375
15376

15377
15378
15379
15380
15381
15382
15383
nosebleed
nostalgia
nostalgic
Nostradamus
Nostrand
nostril
not
notarize
notary
notate
notch
note
notebook
noteworthy
nothing
notice
noticeable
notify
notion

notoriety
notorious

Nottingham
notwithstanding
Nouakchott
noun
nourish
nouveau
Nov







<











>


>







15279
15280
15281
15282
15283
15284
15285

15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
nosebleed
nostalgia
nostalgic
Nostradamus
Nostrand
nostril
not

notary
notate
notch
note
notebook
noteworthy
nothing
notice
noticeable
notify
notion
notocord
notoriety
notorious
Notre
Nottingham
notwithstanding
Nouakchott
noun
nourish
nouveau
Nov
15417
15418
15419
15420
15421
15422
15423

15424
15425
15426
15427
15428
15429
15430
nude
nudge
nugatory
nugget
nuisance
null
nullify

numb
numerable
numeral
numerate
numeric
Numerische
numerology







>







15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
nude
nudge
nugatory
nugget
nuisance
null
nullify
Nullstellensatz
numb
numerable
numeral
numerate
numeric
Numerische
numerology
15444
15445
15446
15447
15448
15449
15450
15451
15452


15453
15454
15455
15456
15457
15458
15459
nutmeg
nutria
nutrient
nutrition
nutritious
nutritive
nutshell
nutting
nuzzle


NY
NYC
nylon
nymph
nymphomania
nymphomaniac
Nyquist







<

>
>







15369
15370
15371
15372
15373
15374
15375

15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
nutmeg
nutria
nutrient
nutrition
nutritious
nutritive
nutshell

nuzzle
NV
NW
NY
NYC
nylon
nymph
nymphomania
nymphomaniac
Nyquist
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489

15490
15491
15492
15493
15494
15495
15496
obese
obey
obfuscate
obfuscatory
obituary
object
objectify
objectivity
objector
objet

obligate
obligatory
oblige
oblique
obliterate
oblivion
oblivious







<


>







15406
15407
15408
15409
15410
15411
15412

15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
obese
obey
obfuscate
obfuscatory
obituary
object
objectify

objector
objet
oblate
obligate
obligatory
oblige
oblique
obliterate
oblivion
oblivious
15510
15511
15512
15513
15514
15515
15516

15517
15518
15519

15520
15521
15522
15523
15524
15525
15526
obsess
obsession
obsessive
obsidian
obsolescent
obsolete
obstacle

obstinacy
obstinate
obstruct

obtain
obtrude
obtrusive
obverse
obviate
obvious
ocarina







>



>







15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
obsess
obsession
obsessive
obsidian
obsolescent
obsolete
obstacle
obstetric
obstinacy
obstinate
obstruct
obstruent
obtain
obtrude
obtrusive
obverse
obviate
obvious
ocarina
15553
15554
15555
15556
15557
15558
15559

15560
15561
15562
15563
15564
15565
15566
octagon
octagonal
octahedra
octahedral
octahedron
octal
octane

octave
Octavia
octennial
octet
octile
octillion
October







>







15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
octagon
octagonal
octahedra
octahedral
octahedron
octal
octane
octant
octave
Octavia
octennial
octet
octile
octillion
October
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
officeholder
officemate
official
officialdom
officiate
officio
officious
offing
offload
offsaddle
offset
offsetting
offshoot
offshore
offspring







<







15528
15529
15530
15531
15532
15533
15534

15535
15536
15537
15538
15539
15540
15541
officeholder
officemate
official
officialdom
officiate
officio
officious

offload
offsaddle
offset
offsetting
offshoot
offshore
offspring
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639

15640
15641
15642
15643
15644
15645
15646
15647
15648
15649

15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666


15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685

15686
15687
15688
15689
15690
15691
15692
15693
15694


15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706

15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722

15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
oilcloth
oilman
oilmen
oilseed
oily
oint
OK
Okay
Okinawa
Oklahoma
Olaf

old
olden
Oldenburg
Oldsmobile
oldster
oldy
oleander
O'Leary
olefin
oleomargarine

Olga
oligarchic
oligarchy
oligoclase
oligopoly
Olin
olive
Oliver
Olivetti
Olivia
olivine
Olsen
Olson
Olympia
Olympic
Omaha
Oman


omega
omelet
omen
omicron
ominous
omission
omit
omitted
omitting
omnibus
omnipotent
omnipresent
omniscient
on
once
oncology
oncoming
one
Oneida

onerous
oneself
onetime
oneupmanship
ongoing
onion
onlooker
onlooking
only


Onondaga
onrush
onrushing
onset
onslaught
Ontario
onto
ontogeny
ontology
onus
onward
onyx

oodles
ooze
opacity
opal
opalescent
opaque
OPEC
Opel
open
opera
operable
operand
operant
operate
operatic
operetta

Ophiucus
opiate
opinion
opinionate
opium
opossum
Oppenheimer
opponent
opportune
opposable
oppose
opposite
opposition
oppress
oppression
oppressive
oppressor
opprobrium
opt
opthalmic
opthalmologic
opthalmology
optic
optima
optimal
optimism
optimist
optimistic
optimum
option
optoacoustic
optoisolate
optometric
optometrist
optometry
opulent
opus
or
oracle
oral







|



>










>







<









>
>



















>









>
>












>
















>




















<






<




<







15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586

15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678

15679
15680
15681
15682
15683
15684

15685
15686
15687
15688

15689
15690
15691
15692
15693
15694
15695
oilcloth
oilman
oilmen
oilseed
oily
oint
OK
okay
Okinawa
Oklahoma
Olaf
Olav
old
olden
Oldenburg
Oldsmobile
oldster
oldy
oleander
O'Leary
olefin
oleomargarine
olfactory
Olga
oligarchic
oligarchy
oligoclase
oligopoly
Olin
olive

Olivetti
Olivia
olivine
Olsen
Olson
Olympia
Olympic
Omaha
Oman
ombudsman
ombudsperson
omega
omelet
omen
omicron
ominous
omission
omit
omitted
omitting
omnibus
omnipotent
omnipresent
omniscient
on
once
oncology
oncoming
one
Oneida
O'Neill
onerous
oneself
onetime
oneupmanship
ongoing
onion
onlooker
onlooking
only
onomatopoeia
onomatopoeic
Onondaga
onrush
onrushing
onset
onslaught
Ontario
onto
ontogeny
ontology
onus
onward
onyx
oocyte
oodles
ooze
opacity
opal
opalescent
opaque
OPEC
Opel
open
opera
operable
operand
operant
operate
operatic
operetta
operon
Ophiucus
opiate
opinion
opinionate
opium
opossum
Oppenheimer
opponent
opportune
opposable
oppose
opposite
opposition
oppress
oppression
oppressive
oppressor
opprobrium
opt
opthalmic

opthalmology
optic
optima
optimal
optimism
optimist

optimum
option
optoacoustic
optoisolate

optometrist
optometry
opulent
opus
or
oracle
oral
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
orchestral
orchestrate
orchid
orchis
ordain
ordeal
order
orderly
ordinal
ordinance
ordinary
ordinate
ordnance
ore
oregano







<







15708
15709
15710
15711
15712
15713
15714

15715
15716
15717
15718
15719
15720
15721
orchestral
orchestrate
orchid
orchis
ordain
ordeal
order

ordinal
ordinance
ordinary
ordinate
ordnance
ore
oregano
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
Orion
Orkney
Orlando
Orleans
ornament
ornamentation
ornate
ornately
ornery
orographic
orography
Orono
orphan
orphanage
Orpheus
Orphic
Orr







<

<







15742
15743
15744
15745
15746
15747
15748

15749

15750
15751
15752
15753
15754
15755
15756
Orion
Orkney
Orlando
Orleans
ornament
ornamentation
ornate

ornery

orography
Orono
orphan
orphanage
Orpheus
Orphic
Orr
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900

15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928

15929
15930
15931
15932
15933
15934
15935
ostrich
O'Sullivan
Oswald
Othello
other
otherwise
otherworld
otherworldly
Otis
Ott
Ottawa
otter
Otto
Ottoman
Ouagadougou
ouch
ought
oughtn't
ounce
our
ourselves
oust
out
outermost
outlandish
outlawry
outrageous

ouzel
ouzo
ova
oval
ovary
ovate
oven
ovenbird
over
overhang
overt
overture
Ovid
oviform
ow
owe
Owens
owing
owl
owly
own
ox
oxalate
oxalic
oxcart
oxen
oxeye
Oxford

oxidant
oxidate
oxide
Oxnard
oxygen
oxygenate
oyster







|



















>









<







<










>







15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840

15841
15842
15843
15844
15845
15846
15847

15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
ostrich
O'Sullivan
Oswald
Othello
other
otherwise
otherworld
otiose
Otis
Ott
Ottawa
otter
Otto
Ottoman
Ouagadougou
ouch
ought
oughtn't
ounce
our
ourselves
oust
out
outermost
outlandish
outlawry
outrageous
ouvre
ouzel
ouzo
ova
oval
ovary
ovate
oven
ovenbird
over

overt
overture
Ovid
oviform
ow
owe
Owens

owl
owly
own
ox
oxalate
oxalic
oxcart
oxen
oxeye
Oxford
Oxonian
oxidant
oxidate
oxide
Oxnard
oxygen
oxygenate
oyster
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
pacify
pack
package
Packard
packet
pact
pad
padding
paddle
paddock
paddy
padlock
padre
paean
pagan







<







15878
15879
15880
15881
15882
15883
15884

15885
15886
15887
15888
15889
15890
15891
pacify
pack
package
Packard
packet
pact
pad

paddle
paddock
paddy
padlock
padre
paean
pagan
16015
16016
16017
16018
16019
16020
16021


16022
16023
16024
16025
16026
16027
16028
16029
16030

16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
pamper
pamphlet
pan
panacea
panama
pancake
Pancho


panda
Pandanus
pandemic
pandemonium
pander
Pandora
pane
panel
pang

panic
panicked
panicky
panicle
panjandrum
panning
panoply
panorama
panoramic
pansy
pant
pantheism
pantheist







>
>









>





<







15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967

15968
15969
15970
15971
15972
15973
15974
pamper
pamphlet
pan
panacea
panama
pancake
Pancho
pancreas
pancreatic
panda
Pandanus
pandemic
pandemonium
pander
Pandora
pane
panel
pang
panhandle
panic
panicked
panicky
panicle
panjandrum

panoply
panorama
panoramic
pansy
pant
pantheism
pantheist
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
parallax
parallel
parallelepiped
paralysis
paramagnet
paramagnetic
parameter
parametric
paramilitary
paramount
Paramus
paranoia
paranoiac
paranoid
paranormal







<







16018
16019
16020
16021
16022
16023
16024

16025
16026
16027
16028
16029
16030
16031
parallax
parallel
parallelepiped
paralysis
paramagnet
paramagnetic
parameter

paramilitary
paramount
Paramus
paranoia
paranoiac
paranoid
paranormal
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
paregoric
parent
parentage
parental
parentheses
parenthesis
parenthetic
parenthood
Pareto
pariah
parimutuel
Paris
parish
parishioner
Parisian
park
Parke
Parkinson
parkish
parkland
parklike
Parks
parkway
parlance
parlay
parley
parliament
parliamentarian
parliamentary
parochial
parody
parole
parolee
parquet
Parr
Parrish
parrot
parrotlike
parry
parse
Parsifal
parsimonious
parsimony
parsley
parsnip
parson
parsonage
Parsons
part
partake
Parthenon
partial
participant
participate
participle







<












<
<















<









<







16047
16048
16049
16050
16051
16052
16053

16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065


16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080

16081
16082
16083
16084
16085
16086
16087
16088
16089

16090
16091
16092
16093
16094
16095
16096
paregoric
parent
parentage
parental
parentheses
parenthesis
parenthetic

Pareto
pariah
parimutuel
Paris
parish
parishioner
Parisian
park
Parke
Parkinson
parkish
parkland


parkway
parlance
parlay
parley
parliament
parliamentarian
parliamentary
parochial
parody
parole
parolee
parquet
Parr
Parrish
parrot

parry
parse
Parsifal
parsimonious
parsimony
parsley
parsnip
parson
parsonage

part
partake
Parthenon
partial
participant
participate
participle
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
pass
passage
passageway
Passaic
passband
passe
passenger
passer
passerby
passion
passionate
passivate
passive
Passover
passport







<







16112
16113
16114
16115
16116
16117
16118

16119
16120
16121
16122
16123
16124
16125
pass
passage
passageway
Passaic
passband
passe
passenger

passerby
passion
passionate
passivate
passive
Passover
passport
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
patron
patronage
patroness
Patsy
pattern
Patterson
Patti
patting
Patton
patty
paucity
Paul
Paula
Paulette
Pauli







<







16180
16181
16182
16183
16184
16185
16186

16187
16188
16189
16190
16191
16192
16193
patron
patronage
patroness
Patsy
pattern
Patterson
Patti

Patton
patty
paucity
Paul
Paula
Paulette
Pauli
16291
16292
16293
16294
16295
16296
16297

16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316

16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
payday
paymaster
Payne
payoff
payroll
Paz
PBS

pea
Peabody
peace
peaceable
peaceful
peacemake
peacetime
peach
Peachtree
peacock
peafowl
peak
peaky
peal
Peale
peanut
pear
Pearce
pearl

pearlstone
Pearson
peasant
peasanthood
Pease
peat
pebble
pecan
peccary
peck
Pecos







>



















>



<







16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244

16245
16246
16247
16248
16249
16250
16251
payday
paymaster
Payne
payoff
payroll
Paz
PBS
PDP
pea
Peabody
peace
peaceable
peaceful
peacemake
peacetime
peach
Peachtree
peacock
peafowl
peak
peaky
peal
Peale
peanut
pear
Pearce
pearl
pearlite
pearlstone
Pearson
peasant

Pease
peat
pebble
pecan
peccary
peck
Pecos
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
pedestrian
pediatric
pediatrician
pedigree
pediment
Pedro
pee
peed
peek
peel
peep
peephole
peepy
peer
peg







<







16266
16267
16268
16269
16270
16271
16272

16273
16274
16275
16276
16277
16278
16279
pedestrian
pediatric
pediatrician
pedigree
pediment
Pedro
pee

peek
peel
peep
peephole
peepy
peer
peg
16384
16385
16386
16387
16388
16389
16390

16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409

16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
Penelope
penetrable
penetrate
penguin
Penh
penicillin
peninsula

penitent
penitential
penitentiary
penman
penmen
Penn
penna
pennant
penning
Pennsylvania
penny
pennyroyal
Penrose
Pensacola
pension
pensive
pent
pentagon
pentagonal

pentane
Pentecost
pentecostal
penthouse
penultimate
penumbra
penurious
penury
peony
people
Peoria
pep
peppergrass
peppermint
pepperoni
peppery
pepping
peppy
Pepsi
PepsiCo
peptide
per
perceive
percent







>








<










>
















<







16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322

16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349

16350
16351
16352
16353
16354
16355
16356
Penelope
penetrable
penetrate
penguin
Penh
penicillin
peninsula
penis
penitent
penitential
penitentiary
penman
penmen
Penn
penna
pennant

Pennsylvania
penny
pennyroyal
Penrose
Pensacola
pension
pensive
pent
pentagon
pentagonal
pentagram
pentane
Pentecost
pentecostal
penthouse
penultimate
penumbra
penurious
penury
peony
people
Peoria
pep
peppergrass
peppermint
pepperoni
peppery

peppy
Pepsi
PepsiCo
peptide
per
perceive
percent
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
perplex
perquisite
Perry
persecute
persecution
persecutory
Perseus
perseverance
persevere
Pershing
Persia
Persian
persiflage
persimmon
persist
persistent
person
persona
personage







|



<







16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444

16445
16446
16447
16448
16449
16450
16451
perplex
perquisite
Perry
persecute
persecution
persecutory
Perseus
perseverant
persevere
Pershing
Persia

persiflage
persimmon
persist
persistent
person
persona
personage
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598

16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611

16612
16613
16614
16615
16616
16617
16618
16619
16620
16621

16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
pesticide
pestilent
pestilential
pestle
pet
petal
Pete
Peter
Peters
Petersburg
Petersen
Peterson
petit
petite
petition
petrel
petri
petrify
petrochemical
petroglyph
petrol
petroleum
petrology
petticoat
petting
petty
petulant
petunia
Peugeot
pew
pewee
pewter
pfennig
Pfizer

phagocyte
phalanger
phalanx
phalarope
phantasy
phantom
pharmaceutic
pharmacist
pharmacology
pharmacopoeia
pharmacy
phase
PhD

pheasant
Phelps
phenol
phenolic
phenomena
phenomenal
phenomenology
phenomenon
phenotype
phenyl

phi
Phil
Philadelphia
philanthrope
philanthropic
philanthropy
philharmonic
Philip
Philippine
Philistine
Phillips
philodendron
philology
philosoph
philosophic
philosophy
Phipps
phloem







<
<















<









>













>










>










|







16487
16488
16489
16490
16491
16492
16493


16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508

16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
pesticide
pestilent
pestilential
pestle
pet
petal
Pete


Petersburg
Petersen
Peterson
petit
petite
petition
petrel
petri
petrify
petrochemical
petroglyph
petrol
petroleum
petrology
petticoat

petty
petulant
petunia
Peugeot
pew
pewee
pewter
pfennig
Pfizer
phage
phagocyte
phalanger
phalanx
phalarope
phantasy
phantom
pharmaceutic
pharmacist
pharmacology
pharmacopoeia
pharmacy
phase
PhD
Ph.D
pheasant
Phelps
phenol
phenolic
phenomena
phenomenal
phenomenology
phenomenon
phenotype
phenyl
phenylalanine
phi
Phil
Philadelphia
philanthrope
philanthropic
philanthropy
philharmonic
Philip
Philippine
Philistine
Phillip
philodendron
philology
philosoph
philosophic
philosophy
Phipps
phloem
16657
16658
16659
16660
16661
16662
16663

16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
phosphide
phosphine
phosphor
phosphoresce
phosphorescent
phosphoric
phosphorus

photo
photogenic
photography
photolysis
photolytic
photometric
photometry
photon
phrase
phrasemake
phraseology
phthalate
phycomycetes







>





<







16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591

16592
16593
16594
16595
16596
16597
16598
phosphide
phosphine
phosphor
phosphoresce
phosphorescent
phosphoric
phosphorus
phosphorylate
photo
photogenic
photography
photolysis
photolytic

photometry
photon
phrase
phrasemake
phraseology
phthalate
phycomycetes
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795

16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
pinhole
pinion
pink
pinkie
pinkish
pinnacle
pinnate
pinning
pinochle
pinpoint
pinscher
Pinsky
pint
pintail
pinto
pinwheel
pinxter
pion
pioneer

pious
pip
pipe
pipeline
Piper
pipette
pipsissewa
piquant
pique
piracy
Piraeus
pirate







<











>




<







16699
16700
16701
16702
16703
16704
16705

16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721

16722
16723
16724
16725
16726
16727
16728
pinhole
pinion
pink
pinkie
pinkish
pinnacle
pinnate

pinochle
pinpoint
pinscher
Pinsky
pint
pintail
pinto
pinwheel
pinxter
pion
pioneer
Piotr
pious
pip
pipe
pipeline

pipette
pipsissewa
piquant
pique
piracy
Piraeus
pirate
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844

16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
pitchstone
piteous
pitfall
pith
pithy
pitiable
pitiful
pitilessly
pitman
Pitney
Pitt
pitting
Pittsburgh
Pittsfield
Pittston
pituitary
pity
Pius
pivot
pivotal
pixel
pixy
pizza
pizzicato

placate
placater
place
placeable
placebo
placeholder
placenta
placental
placid
plagiarism
plagiarist
plagioclase
plague
plagued
plaguey
plaid
plain
Plainfield
plaintiff
plaintive
plan
planar
Planck
plane
planeload
planet
planetaria
planetarium
planetary
planetesimal
planetoid
plank
plankton
planning
planoconcave
planoconvex
plant
plantain
plantation
plaque
plasm
plasma
plasmon
plaster
plastic
plastisol
plastron
plat
plate
plateau
platelet
platen
platform
platinize
platinum
platitude
platitudinous
Plato
platonic
Platonism
Platonist
platoon
Platte
platting
plausible
play
playa
playback
playboy
playful
playground







<



<












>













<



















<



















<









|







16742
16743
16744
16745
16746
16747
16748

16749
16750
16751

16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777

16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796

16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815

16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
pitchstone
piteous
pitfall
pith
pithy
pitiable
pitiful

pitman
Pitney
Pitt

Pittsburgh
Pittsfield
Pittston
pituitary
pity
Pius
pivot
pivotal
pixel
pixy
pizza
pizzicato
Pl
placate
placater
place
placeable
placebo
placeholder
placenta
placental
placid
plagiarism
plagiarist
plagioclase
plague

plaguey
plaid
plain
Plainfield
plaintiff
plaintive
plan
planar
Planck
plane
planeload
planet
planetaria
planetarium
planetary
planetesimal
planetoid
plank
plankton

planoconcave
planoconvex
plant
plantain
plantation
plaque
plasm
plasma
plasmon
plaster
plastic
plastisol
plastron
plat
plate
plateau
platelet
platen
platform

platinum
platitude
platitudinous
Plato
platonic
Platonism
Platonist
platoon
Platte
platypus
plausible
play
playa
playback
playboy
playful
playground
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964

16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977

16978
16979
16980
16981
16982
16983

16984
16985
16986
16987
16988
16989
16990

16991
16992
16993

16994
16995
16996
16997
16998
16999
17000
plenty
plenum
plethora
pleura
pleural
Plexiglas
pliable
pliancy
pliant
pliers
plight
Pliny
Pliocene
plod
plodding
plop
plopping
plot
plotting
plover
plow
plowman
plowshare
pluck
plucky
plug

pluggable
plugging
plum
plumage
plumb
plumbago
plumbate
plume
plummet
plump
plunder
plunge
plunk

plural
plus
plush
plushy
Plutarch
Pluto

plutonium
ply
Plymouth
plyscore
plywood
PM
pneumatic

pneumonia
Po
poach

pocket
pocketbook
pocketful
Pocono
pod
podge
podia







<

<




<

<

<







>













>






>







>



>







16856
16857
16858
16859
16860
16861
16862

16863

16864
16865
16866
16867

16868

16869

16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
plenty
plenum
plethora
pleura
pleural
Plexiglas
pliable

pliant

plight
Pliny
Pliocene
plod

plop

plot

plover
plow
plowman
plowshare
pluck
plucky
plug
plugboard
pluggable
plugging
plum
plumage
plumb
plumbago
plumbate
plume
plummet
plump
plunder
plunge
plunk
pluperfect
plural
plus
plush
plushy
Plutarch
Pluto
pluton
plutonium
ply
Plymouth
plyscore
plywood
PM
pneumatic
pneumococcus
pneumonia
Po
poach
POBox
pocket
pocketbook
pocketful
Pocono
pod
podge
podia
17008
17009
17010
17011
17012
17013
17014

17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041

17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052

17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066

17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
pogo
pogrom
poi
poignant
Poincare
poinsettia
point

poise
poison
poisonous
Poisson
poke
pokerface
pol
Poland
polar
polarimeter
polarimetry
Polaris
polariscope
polariton
polarogram
polarograph
polarography
Polaroid
polaron
pole
polecat
polemic
police
policeman
policemen
policy
polio

polis
polish
Politburo
polite
politic
politician
politicking
politico
polity
Polk
polka

poll
Pollard
pollcadot
pollen
pollock
polloi
pollutant
pollute
pollution
Pollux
polo
polonaise
polonium
polopony

polygon
polygonal
polygynous
polyhedra
polyhedral
polyhedron
Polyhymnia
polymer
polymerase
polymeric
polymorph
polymorphic
polynomial
Polyphemus
polyphony
polypropylene
polytechnic
polytope
polytypy
pomade
pomegranate
Pomona
pomp







>










<
















>











>


|
|










>















|







16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942

16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
pogo
pogrom
poi
poignant
Poincare
poinsettia
point
pointwise
poise
poison
poisonous
Poisson
poke
pokerface
pol
Poland
polar
polarimeter

Polaris
polariscope
polariton
polarogram
polarograph
polarography
Polaroid
polaron
pole
polecat
polemic
police
policeman
policemen
policy
polio
poliomyelitis
polis
polish
Politburo
polite
politic
politician
politicking
politico
polity
Polk
polka
polkadot
poll
Pollard
pollen
pollinate
pollock
polloi
pollutant
pollute
pollution
Pollux
polo
polonaise
polonium
polopony
polyploidy
polygon
polygonal
polygynous
polyhedra
polyhedral
polyhedron
Polyhymnia
polymer
polymerase
polymeric
polymorph
polymorphic
polynomial
Polyphemus
polyphony
polysaccharide
polytechnic
polytope
polytypy
pomade
pomegranate
Pomona
pomp
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126


17127
17128
17129
17130
17131
17132
17133
poop
poor
pop
pope
popish
poplar
poplin
popping
poppy
populace
popular
populate


populous
porcelain
porch
porcine
porcupine
pore
pork







<




>
>







17035
17036
17037
17038
17039
17040
17041

17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
poop
poor
pop
pope
popish
poplar
poplin

poppy
populace
popular
populate
populism
populist
populous
porcelain
porch
porcine
porcupine
pore
pork
17156
17157
17158
17159
17160
17161
17162

17163
17164
17165
17166
17167
17168
17169
17170
17171

17172
17173
17174
17175
17176
17177
17178
portraiture
portray
portrayal
Portsmouth
Portugal
Portuguese
portulaca

pose
Poseidon
poseur
posey
posh
posit
position
positive
positron

posse
posseman
possemen
possess
possession
possessive
possessor







>









>







17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
portraiture
portray
portrayal
Portsmouth
Portugal
Portuguese
portulaca
posable
pose
Poseidon
poseur
posey
posh
posit
position
positive
positron
Posner
posse
posseman
possemen
possess
possession
possessive
possessor
17196
17197
17198
17199
17200
17201
17202

17203
17204
17205
17206
17207
17208
17209
postmaster
postmen
postmortem
postmultiply
postoperative
postorder
postpone

postprocess
postprocessor
postscript
postulate
posture
postwar
posy







>







17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
postmaster
postmen
postmortem
postmultiply
postoperative
postorder
postpone
postposition
postprocess
postprocessor
postscript
postulate
posture
postwar
posy
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248

17249
17250
17251
17252
17253
17254

17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
potentiometer
pothole
potion
potlatch
Potomac
potpourri
pottery
potting
Potts
pouch
Poughkeepsie
poultice
poultry
pounce
pound
pour
pout
poverty
pow
powder
powderpuff
powdery
Powell
power
powerful
Powers
Poynting
ppm

practicable
practical
practice
practise
practitioner
Prado

pragmatic
pragmatism
pragmatist
Prague
prairie
praise
praiseworthy
pram
prance
prank
praseodymium
Pratt
Pravda
pray
prayer
prayerful
preach
preachy
preamble
Precambrian
precarious
precaution
precautionary
precede
precedent
precept
precess
precession
precinct
precious
precipice
precipitable
precipitate
precipitous
precise
precision
preclude
precocious
precocity
precursor
predatory
predecessor
predicament
predicate
predict
predictor
predilect
predispose
predisposition
predominant
predominate
preeminent
preempt
preemption
preemptive
preemptor
preen
prefab
prefabricate
preface
prefatory
prefect
prefecture
prefer
preference
preferential
preferred
preferring
prefix
pregnant
prehistoric
prejudice
prejudicial
preliminary
prelude
premature
premeditate
premier
premiere
premise
premium
premonition
premonitory
Prentice
preoccupy
prep
preparation
preparative
preparatory
prepare
preponderant
preponderate
preposition
preposterous
prepping
prerequisite
prerogative
presage
Presbyterian
Prescott
prescribe
prescript
prescription
prescriptive
presence
present
presentation
presentational
preservation
preserve
preside
president
presidential
press
pressure
prestidigitate
prestige
prestigious
presto
Preston
presume
presumed
presuming
presumption
presumptive
presumptuous
presuppose
presupposition
pretend
pretense
pretension
pretentious
pretext
Pretoria
pretty
prevail
prevalent
prevent
prevention
preventive
preview
previous
prexy
prey
Priam
price
prick
prickle







<

















|


>






>














<



<


<
<
<



<











<







<
<
<
<
<






<
<








<

<

<


<
<





<

<







<

<
<

<


<
<


<
<

<

<











<



<
<
<
<
<
<

<




<


<







17145
17146
17147
17148
17149
17150
17151

17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193

17194
17195
17196

17197
17198



17199
17200
17201

17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212

17213
17214
17215
17216
17217
17218
17219





17220
17221
17222
17223
17224
17225


17226
17227
17228
17229
17230
17231
17232
17233

17234

17235

17236
17237


17238
17239
17240
17241
17242

17243

17244
17245
17246
17247
17248
17249
17250

17251


17252

17253
17254


17255
17256


17257

17258

17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269

17270
17271
17272






17273

17274
17275
17276
17277

17278
17279

17280
17281
17282
17283
17284
17285
17286
potentiometer
pothole
potion
potlatch
Potomac
potpourri
pottery

Potts
pouch
Poughkeepsie
poultice
poultry
pounce
pound
pour
pout
poverty
pow
powder
powderpuff
powdery
Powell
power
powerful
powerhouse
Poynting
ppm
PR
practicable
practical
practice
practise
practitioner
Prado
praecox
pragmatic
pragmatism
pragmatist
Prague
prairie
praise
praiseworthy
pram
prance
prank
praseodymium
Pratt
Pravda
pray

prayerful
preach
preachy

Precambrian
precarious



precedent
precept
precess

precinct
precious
precipice
precipitable
precipitate
precipitous
precise
precision
preclude
precocious
precocity

predatory
predecessor
predicament
predicate
predict
predictor
predilect





preempt
preemption
preemptive
preemptor
preen
prefab


prefatory
prefect
prefecture
prefer
preference
preferential
preferred
preferring

pregnant

prejudice

preliminary
prelude


premier
premiere
premise
premium
premonition

Prentice

prep
preparation
preparative
preparatory
prepare
preponderant
preponderate

preposterous


prerogative

Presbyterian
Prescott


prescription
prescriptive


presentation

preservation

preside
president
presidential
press
pressure
prestidigitate
prestige
prestigious
presto
Preston
presume

presuming
presumption
presumptive






pretentious

Pretoria
pretty
prevail
prevalent

prevention
preventive

previous
prexy
prey
Priam
price
prick
prickle
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
primacy
primal
primary
primate
prime
primeval
primitive
primitivism
primp
primrose
prince
princess
Princeton
principal
Principia







<







17294
17295
17296
17297
17298
17299
17300

17301
17302
17303
17304
17305
17306
17307
primacy
primal
primary
primate
prime
primeval
primitive

primp
primrose
prince
princess
Princeton
principal
Principia
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
privy
prize
prizewinning
pro
probabilist
probate
probe
probity
problem
problematic
procaine
procedural
procedure
proceed
process







<







17326
17327
17328
17329
17330
17331
17332

17333
17334
17335
17336
17337
17338
17339
privy
prize
prizewinning
pro
probabilist
probate
probe

problem
problematic
procaine
procedural
procedure
proceed
process
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
procrustean
Procrustes
Procter
proctor
procure
Procyon
prod
prodding
prodigal
prodigious
prodigy
produce
producible
product
productivity
Prof
profane
profess
profession
professional
professor
professorial
proffer
proficient
profile
profit
profligate







<






<




<







17347
17348
17349
17350
17351
17352
17353

17354
17355
17356
17357
17358
17359

17360
17361
17362
17363

17364
17365
17366
17367
17368
17369
17370
procrustean
Procrustes
Procter
proctor
procure
Procyon
prod

prodigal
prodigious
prodigy
produce
producible
product

Prof
profane
profess
profession

professor
professorial
proffer
proficient
profile
profit
profligate
17507
17508
17509
17510
17511
17512
17513

17514
17515
17516
17517
17518

17519
17520
17521
17522
17523

17524
17525
17526
17527
17528

17529
17530
17531
17532
17533
17534
17535
prohibit
prohibition
prohibitive
prohibitory
project
projectile
projector

Prokofieff
prolate
proletariat
proliferate
prolific

prolix
prologue
prolong
prolongate
prolusion

promenade
Promethean
Prometheus
promethium
prominent

promiscuous
promise
promote
promotion
prompt
promptitude
promulgate







>





>





>





>







17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
prohibit
prohibition
prohibitive
prohibitory
project
projectile
projector
prokaryote
Prokofieff
prolate
proletariat
proliferate
prolific
proline
prolix
prologue
prolong
prolongate
prolusion
prom
promenade
Promethean
Prometheus
promethium
prominent
promiscuity
promiscuous
promise
promote
promotion
prompt
promptitude
promulgate
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
proponent
proportion
proportionate
propos
proposal
propose
proposition
propping
proprietary
proprietor
propriety
proprioception
proprioceptive
propulsion
propyl







<







17448
17449
17450
17451
17452
17453
17454

17455
17456
17457
17458
17459
17460
17461
proponent
proportion
proportionate
propos
proposal
propose
proposition

proprietary
proprietor
propriety
proprioception
proprioceptive
propulsion
propyl
17615
17616
17617
17618
17619
17620
17621

17622
17623
17624
17625
17626
17627
17628
proteolytic
protest
protestant
protestation
prothonotary
protocol
proton

protoplasm
protoplasmic
prototype
prototypic
Protozoa
protozoan
protract







>







17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
proteolytic
protest
protestant
protestation
prothonotary
protocol
proton
Protophyta
protoplasm
protoplasmic
prototype
prototypic
Protozoa
protozoan
protract
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
proverbial
provide
provident
providential
province
provincial
provision
provisional
proviso
provocateur
provocation
provocative
provoke
provost
prow







<







17522
17523
17524
17525
17526
17527
17528

17529
17530
17531
17532
17533
17534
17535
proverbial
provide
provident
providential
province
provincial
provision

proviso
provocateur
provocation
provocative
provoke
provost
prow
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702

17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733

17734
17735
17736
17737
17738
17739
17740
psycho
psychoacoustic
psychoanalysis
psychoanalyst
psychoanalytic
psychobiology
psychology
psychometric
psychometry
psychopath
psychopathic
psychophysic
psychophysical
psychophysics
psychophysiology
psychopomp
psychoses
psychosis
psychosomatic
psychotherapeutic
psychotherapist
psychotherapy
psychotic
psyllium
PTA
ptarmigan

Ptolemaic
Ptolemy
pub
puberty
pubescent
public
publication
publish
Puccini
puck
puckish
pudding
puddingstone
puddle
puddly
pueblo
puerile
Puerto
puff
puffball
puffed
puffery
puffin
puffy
pug
Pugh
puissant
puke
Pulaski
Pulitzer
pull

pulley
Pullman
pullover
pulmonary
pulp
pulpit
pulsar







<




<
<












>




















<










>







17559
17560
17561
17562
17563
17564
17565

17566
17567
17568
17569


17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602

17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
psycho
psychoacoustic
psychoanalysis
psychoanalyst
psychoanalytic
psychobiology
psychology

psychometry
psychopath
psychopathic
psychophysic


psychophysiology
psychopomp
psychoses
psychosis
psychosomatic
psychotherapeutic
psychotherapist
psychotherapy
psychotic
psyllium
PTA
ptarmigan
pterodactyl
Ptolemaic
Ptolemy
pub
puberty
pubescent
public
publication
publish
Puccini
puck
puckish
pudding
puddingstone
puddle
puddly
pueblo
puerile
Puerto
puff
puffball

puffery
puffin
puffy
pug
Pugh
puissant
puke
Pulaski
Pulitzer
pull
pullback
pulley
Pullman
pullover
pulmonary
pulp
pulpit
pulsar
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
punditry
pungent
Punic
punish
punitive
punk
punky
punning
punster
punt
puny
pup
pupal
pupate
pupil







<







17636
17637
17638
17639
17640
17641
17642

17643
17644
17645
17646
17647
17648
17649
punditry
pungent
Punic
punish
punitive
punk
punky

punster
punt
puny
pup
pupal
pupate
pupil
17779
17780
17781
17782
17783
17784
17785

17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809


17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830

17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
pure
purgation
purgative
purgatory
purge
purify
Purina

Puritan
puritanic
purl
purloin
purple
purport
purpose
purposeful
purposive
purr
purse
purslane
pursuant
pursue
pursuer
pursuit
purvey
purveyor
purview
pus
Pusan
Pusey
push
pushbutton


pussy
pussycat
put
putative
Putnam
putt
putty
puzzle
PVC
Pygmalion
pygmy
Pyhrric
pyknotic
Pyle
Pyongyang
pyracanth
pyramid
pyramidal
pyre
Pyrex
pyridine

pyrite
pyroelectric
pyrolyse
pyrolysis
pyrometer
pyrometry
pyrophosphate
pyrotechnic
pyroxene
pyroxenite
Pythagoras
Pythagorean
python







>














<









>
>











|









>





<







17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679

17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717

17718
17719
17720
17721
17722
17723
17724
pure
purgation
purgative
purgatory
purge
purify
Purina
purine
Puritan
puritanic
purl
purloin
purple
purport
purpose
purposeful
purposive
purr
purse
purslane
pursuant
pursue

pursuit
purvey
purveyor
purview
pus
Pusan
Pusey
push
pushbutton
pushout
pushpin
pussy
pussycat
put
putative
Putnam
putt
putty
puzzle
PVC
Pygmalion
pygmy
Pyrrhic
pyknotic
Pyle
Pyongyang
pyracanth
pyramid
pyramidal
pyre
Pyrex
pyridine
pyrimidine
pyrite
pyroelectric
pyrolyse
pyrolysis
pyrometer

pyrophosphate
pyrotechnic
pyroxene
pyroxenite
Pythagoras
Pythagorean
python
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
quaff
quagmire
quahog
quail
quaint
quake
Quakeress
qualified
qualify
qualitative
quality
qualm
quandary
quanta
Quantico







<







17748
17749
17750
17751
17752
17753
17754

17755
17756
17757
17758
17759
17760
17761
quaff
quagmire
quahog
quail
quaint
quake
Quakeress

qualify
qualitative
quality
qualm
quandary
quanta
Quantico
17925
17926
17927
17928
17929
17930
17931

17932
17933
17934
17935
17936
17937
17938
quick
quicken
quickie
quicklime
quicksand
quicksilver
quickstep

quiescent
quiet
quietus
quill
quillwort
quilt
quince







>







17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
quick
quicken
quickie
quicklime
quicksand
quicksilver
quickstep
quid
quiescent
quiet
quietus
quill
quillwort
quilt
quince
17953
17954
17955
17956
17957
17958
17959

17960
17961
17962
17963
17964
17965
17966
quite
Quito
quitting
quiver
Quixote
quixotic
quiz

quizzical
quo
quod
quonset
quorum
quota
quotation







>







17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
quite
Quito
quitting
quiver
Quixote
quixotic
quiz
quizzes
quizzical
quo
quod
quonset
quorum
quota
quotation
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
radioastronomy
radiocarbon
radiochemical
radiochemistry
radiography
radiology
radiometer
radiometric
radiometry
radiophysics
radiosonde
radiosterilize
radiotherapy
radish
radium
radius
radix
radon
Rae







<
<


<







17883
17884
17885
17886
17887
17888
17889


17890
17891

17892
17893
17894
17895
17896
17897
17898
radioastronomy
radiocarbon
radiochemical
radiochemistry
radiography
radiology
radiometer


radiophysics
radiosonde

radiotherapy
radish
radium
radius
radix
radon
Rae
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
Ralph
Ralston
ram
Ramada
Raman
ramble
ramify
ramming
Ramo
ramp
rampage
rampant
rampart
ramrod
Ramsey







<







17931
17932
17933
17934
17935
17936
17937

17938
17939
17940
17941
17942
17943
17944
Ralph
Ralston
ram
Ramada
Raman
ramble
ramify

Ramo
ramp
rampage
rampant
rampart
ramrod
Ramsey
18078
18079
18080
18081
18082
18083
18084

18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
range
rangeland
Rangoon
rangy
Ranier
rank
Rankin

rankle
ransack
ransom
rant
Raoul
rap
rapacious
rape
Raphael
rapid
rapier
rapping
rapport
rapprochement
rapt
rapture
rare
rarefy
Raritan
rarity
rasa
rascal
rash
Rasmussen
rasp
raspberry
raster







>











<







<







17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974

17975
17976
17977
17978
17979
17980
17981

17982
17983
17984
17985
17986
17987
17988
range
rangeland
Rangoon
rangy
Ranier
rank
Rankin
Rankine
rankle
ransack
ransom
rant
Raoul
rap
rapacious
rape
Raphael
rapid
rapier

rapport
rapprochement
rapt
rapture
rare
rarefy
Raritan

rasa
rascal
rash
Rasmussen
rasp
raspberry
raster
18119
18120
18121
18122
18123
18124
18125

18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144

18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
ratio
ratiocinate
rationale
rattail
rattle
rattlesnake
raucous

ravage
rave
ravel
raven
ravenous
ravine
ravish
raw
rawboned
rawhide
Rawlinson
ray
Rayleigh
Raymond
Raytheon
raze
razor
razorback
RCA

R&D
re
reach
reactant
reactionary
read
readout
ready
Reagan
reagent
real
realisable
realm
realtor
realty
ream
reap







>



















>









<







17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032

18033
18034
18035
18036
18037
18038
18039
ratio
ratiocinate
rationale
rattail
rattle
rattlesnake
raucous
Raul
ravage
rave
ravel
raven
ravenous
ravine
ravish
raw
rawboned
rawhide
Rawlinson
ray
Rayleigh
Raymond
Raytheon
raze
razor
razorback
RCA
Rd
R&D
re
reach
reactant
reactionary
read
readout
ready
Reagan

real
realisable
realm
realtor
realty
ream
reap
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
rebellious
rebuke
rebut
rebuttal
rebutted
rebutting
recalcitrant
recant
recappable
recede
receipt
receive
recent
receptacle
reception
receptive
receptor







<
<
<







18049
18050
18051
18052
18053
18054
18055



18056
18057
18058
18059
18060
18061
18062
rebellious
rebuke
rebut
rebuttal
rebutted
rebutting
recalcitrant



receipt
receive
recent
receptacle
reception
receptive
receptor
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
reclamation
recline
recluse
recompense
reconcile
recondite
reconnaissance
record
recoup
recourse
recovery
recriminate
recruit
rectangle
rectangular
rectifier
rectify
rectilinear
rectitude
rector
rectory
recumbent
recuperate
recur
recurred
recurrent
recurring
recursion
recursive
recusant
recuse
red
redact
redactor
redbird
redbud
redcoat
redden
reddish
redeem
redemption
redemptive
redhead
Redmond
redneck
redound
redpoll
redshank
redstart
Redstone
redtop
reduce
reducible
reduct
redundant
redwood
reed
reedbuck
reedy
reef
reek







<
<
<















<


<










<













<







18077
18078
18079
18080
18081
18082
18083



18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098

18099
18100

18101
18102
18103
18104
18105
18106
18107
18108
18109
18110

18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123

18124
18125
18126
18127
18128
18129
18130
reclamation
recline
recluse
recompense
reconcile
recondite
reconnaissance



recovery
recriminate
recruit
rectangle
rectangular
rectifier
rectify
rectilinear
rectitude
rector
rectory
recumbent
recuperate
recur
recurred

recurring
recursion

recusant
recuse
red
redact
redactor
redbird
redbud
redcoat
redden
reddish

redemption
redemptive
redhead
Redmond
redneck
redound
redpoll
redshank
redstart
Redstone
redtop
reduce
reducible

redundant
redwood
reed
reedbuck
reedy
reef
reek
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
referenda
referendum
referent
referential
referral
referred
referring
refinery
reflect
reflectance
reflector
reflexive
reforestation
reformatory
refract
refractometer
refractory
refrain
refrigerate
refuge







<




<







18139
18140
18141
18142
18143
18144
18145

18146
18147
18148
18149

18150
18151
18152
18153
18154
18155
18156
referenda
referendum
referent
referential
referral
referred
referring

reflect
reflectance
reflector
reflexive

reformatory
refract
refractometer
refractory
refrain
refrigerate
refuge
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316

18317
18318
18319
18320
18321
18322
18323
18324
18325

18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
regime
regimen
regiment
regimentation
Regina
Reginald
region
regional
Regis
registrable
registrant
registrar
registration
registry
regress
regression

regret
regretful
regrettable
regretted
regretting
regular
regulate
regulatory
Regulus

rehabilitate
rehearsal
rehearse
Reich
Reid
reign
Reilly
reimbursable
reimburse
rein
reindeer
reinforce
Reinhold
reinstate
reject
rejoice
rejoinder
relate
relax
relaxation
relay
releasable
relevant
reliable
reliant
relic
relict
relief
relieve
religion
religiosity







<








>









>


















<

<


<







18167
18168
18169
18170
18171
18172
18173

18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210

18211

18212
18213

18214
18215
18216
18217
18218
18219
18220
regime
regimen
regiment
regimentation
Regina
Reginald
region

Regis
registrable
registrant
registrar
registration
registry
regress
regression
regressive
regret
regretful
regrettable
regretted
regretting
regular
regulate
regulatory
Regulus
regurgitate
rehabilitate
rehearsal
rehearse
Reich
Reid
reign
Reilly
reimbursable
reimburse
rein
reindeer
reinforce
Reinhold
reinstate
reject
rejoice
rejoinder
relate

relaxation

releasable
relevant

reliant
relic
relict
relief
relieve
religion
religiosity
18390
18391
18392
18393
18394
18395
18396

18397
18398
18399
18400
18401
18402
18403
renaissance
renal
Renault
rend
render
rendezvous
rendition

renegotiable
renewal
Renoir
renounce
renovate
renown
Rensselaer







>







18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
renaissance
renal
Renault
rend
render
rendezvous
rendition
Rene
renegotiable
renewal
Renoir
renounce
renovate
renown
Rensselaer
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
residuary
residue
residuum
resign
resignation
resilient
resin
resinlike
resiny
resist
resistant
resistible
resistive
resistor
resolute







<







18338
18339
18340
18341
18342
18343
18344

18345
18346
18347
18348
18349
18350
18351
residuary
residue
residuum
resign
resignation
resilient
resin

resiny
resist
resistant
resistible
resistive
resistor
resolute
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
restrain
restraint
restrict
restroom
result
resultant
resume
resuming
resumption
resurgent
resurrect
resuscitate
ret
retail
retain







<







18380
18381
18382
18383
18384
18385
18386

18387
18388
18389
18390
18391
18392
18393
restrain
restraint
restrict
restroom
result
resultant
resume

resumption
resurgent
resurrect
resuscitate
ret
retail
retain
18547
18548
18549
18550
18551
18552
18553

18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564

18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
retort
retract
retribution
retrieval
retrieve
retroactive
retrofit

retrofitting
retrograde
retrogress
retrogressive
retrorocket
retrospect
retrovision
return
Reub
Reuben
Reuters

reveal
revel
revelation
revelatory
revelry
revenge
revenue
rever
reverberate
revere
reverend
reverent
reverie
reversal
reverse
reversible
reversion
revert
revertive
revery
revet
revile
revisable
revisal
revise
revision







>











>


















<







18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447

18448
18449
18450
18451
18452
18453
18454
retort
retract
retribution
retrieval
retrieve
retroactive
retrofit
retrofitted
retrofitting
retrograde
retrogress
retrogressive
retrorocket
retrospect
retrovision
return
Reub
Reuben
Reuters
rev
reveal
revel
revelation
revelatory
revelry
revenge
revenue
rever
reverberate
revere
reverend
reverent
reverie
reversal
reverse
reversible
reversion
revert

revery
revet
revile
revisable
revisal
revise
revision
18633
18634
18635
18636
18637
18638
18639

18640
18641
18642
18643
18644
18645


18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673

18674
18675
18676
18677
18678
18679

18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
rhombi
rhombic
rhombus
rhubarb
rhyme
rhythm
rhythmic

rib
ribald
ribbing
ribbon
riboflavin
ribonucleic


Rica
rice
rich
Richard
Richards
Richardson
Richfield
Richmond
Richter
rick
rickets
Rickettsia
rickety
rickshaw
Rico
ricochet
rid
riddance
ridden
ridding
riddle
ride
ridge
ridgepole
Ridgway
ridicule
ridiculous
Riemann

riffle
rifle
rifleman
riflemen
rift
rig

Rigel
rigging
Riggs
right
righteous
rightful
rightmost
rightward
rigid
rigorous
Riley
rill
rilly
rim
rime
rimming
rimy
Rinehart
ring
ringlet
ringside
rink
rinse
Rio
Riordan
riot
riotous
rip
riparian
ripe
ripen
Ripley
ripoff
ripping
ripple
rise
risen
risible
risk
risky
Ritchie







>


<



>
>




<














<








>






>















<

















<







18497
18498
18499
18500
18501
18502
18503
18504
18505
18506

18507
18508
18509
18510
18511
18512
18513
18514
18515

18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529

18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560

18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577

18578
18579
18580
18581
18582
18583
18584
rhombi
rhombic
rhombus
rhubarb
rhyme
rhythm
rhythmic
RI
rib
ribald

ribbon
riboflavin
ribonucleic
ribose
ribosome
Rica
rice
rich
Richard

Richardson
Richfield
Richmond
Richter
rick
rickets
Rickettsia
rickety
rickshaw
Rico
ricochet
rid
riddance
ridden

riddle
ride
ridge
ridgepole
Ridgway
ridicule
ridiculous
Riemann
Riemannian
riffle
rifle
rifleman
riflemen
rift
rig
Riga
Rigel
rigging
Riggs
right
righteous
rightful
rightmost
rightward
rigid
rigorous
Riley
rill
rilly
rim
rime

rimy
Rinehart
ring
ringlet
ringside
rink
rinse
Rio
Riordan
riot
riotous
rip
riparian
ripe
ripen
Ripley
ripoff

ripple
rise
risen
risible
risk
risky
Ritchie
18730
18731
18732
18733
18734
18735
18736

18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800

18801
18802
18803
18804
18805
18806
18807
riverfront
riverine
riverside
rivet
Riviera
rivulet
Riyadh

roach
road
roadbed
roadblock
roadhouse
roadside
roadster
roadway
roam
roar
roast
rob
robbery
robbin
robbing
Robbins
robe
Robert
Roberta
Roberto
Roberts
Robertson
robin
Robinson
robot
robotics
robust
Rochester
rock
rockabye
rockaway
rockbound
Rockefeller
rocket
Rockford
Rockies
Rockland
rocklike
Rockwell
rocky
rococo
rod
rode
rodent
rodeo
Rodgers
Rodney
Rodriguez
roe
roebuck
Roentgen
Roger
Rogers
rogue
roil
roister
Roland
role
roll
rollback
rollick
Rollins
Roman
romance

Romano
romantic
Rome
Romeo
romp
Romulus
Ron







>














<
<




<
















<














<











>







18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615


18616
18617
18618
18619

18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635

18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649

18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
riverfront
riverine
riverside
rivet
Riviera
rivulet
Riyadh
RNA
roach
road
roadbed
roadblock
roadhouse
roadside
roadster
roadway
roam
roar
roast
rob
robbery
robbin


robe
Robert
Roberta
Roberto

Robertson
robin
Robinson
robot
robotics
robust
Rochester
rock
rockabye
rockaway
rockbound
Rockefeller
rocket
Rockford
Rockies
Rockland

Rockwell
rocky
rococo
rod
rode
rodent
rodeo
Rodgers
Rodney
Rodriguez
roe
roebuck
Roentgen
Roger

rogue
roil
roister
Roland
role
roll
rollback
rollick
Rollins
Roman
romance
Romania
Romano
romantic
Rome
Romeo
romp
Romulus
Ron
18833
18834
18835
18836
18837
18838
18839

18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851

18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
Roseland
rosemary
Rosen
Rosenberg
Rosenblum
Rosenthal
Rosenzweig

rosette
Ross
roster
rostrum
rosy
rot
Rotarian
rotary
rotate
ROTC
rotenone
Roth

rotogravure
rotor
rototill
rotten
rotting
rotund
rotunda
rouge
rough
roughcast
roughen
roughish







>












>




<







18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718

18719
18720
18721
18722
18723
18724
18725
Roseland
rosemary
Rosen
Rosenberg
Rosenblum
Rosenthal
Rosenzweig
Rosetta
rosette
Ross
roster
rostrum
rosy
rot
Rotarian
rotary
rotate
ROTC
rotenone
Roth
Rothschild
rotogravure
rotor
rototill
rotten

rotund
rotunda
rouge
rough
roughcast
roughen
roughish
18886
18887
18888
18889
18890
18891
18892

18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906

18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926

18927
18928
18929
18930
18931
18932
18933
Rowena
Rowland
Rowley
Roy
royal
royalty
Royce

RPM
r's
RSVP
Ruanda
rub
rubbery
rubbing
rubbish
rubble
rubdown
Rube
Ruben
rubicund
rubidium

rubric
ruby
ruckus
rudder
ruddy
rude
rudiment
rudimentary
Rudolf
Rudolph
Rudy
Rudyard
rue
rueful
ruffian
ruffle
rufous
Rufus
rug
ruin

ruinous
rule
rum
Rumania
rumble
rumen
Rumford







>






<







>




















>







18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761

18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
Rowena
Rowland
Rowley
Roy
royal
royalty
Royce
Roxbury
RPM
r's
RSVP
Ruanda
rub
rubbery

rubbish
rubble
rubdown
Rube
Ruben
rubicund
rubidium
Rubin
rubric
ruby
ruckus
rudder
ruddy
rude
rudiment
rudimentary
Rudolf
Rudolph
Rudy
Rudyard
rue
rueful
ruffian
ruffle
rufous
Rufus
rug
ruin
ruination
ruinous
rule
rum
Rumania
rumble
rumen
Rumford
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
runaway
rundown
rune
rung
Runge
runic
runneth
running
Runnymede
runoff
runt
runty
runway
Runyon
rupee







<







18806
18807
18808
18809
18810
18811
18812

18813
18814
18815
18816
18817
18818
18819
runaway
rundown
rune
rung
Runge
runic
runneth

Runnymede
runoff
runt
runty
runway
Runyon
rupee
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000

19001

19002
19003
19004
19005
19006
19007
19008
Ruth
ruthenium
Rutherford
ruthless
rutile
Rutland
Rutledge
rutting
rutty
Rwanda
Ryan
Rydberg
Ryder
rye
s
sa
sabbath
sabbatical
Sabina
Sabine
sable
sabotage
sabra
sac

sachem

sack
sacral
sacrament
Sacramento
sacred
sacrifice
sacrificial







<
















>

>







18840
18841
18842
18843
18844
18845
18846

18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
Ruth
ruthenium
Rutherford
ruthless
rutile
Rutland
Rutledge

rutty
Rwanda
Ryan
Rydberg
Ryder
rye
s
sa
sabbath
sabbatical
Sabina
Sabine
sable
sabotage
sabra
sac
saccharine
sachem
Sachs
sack
sacral
sacrament
Sacramento
sacred
sacrifice
sacrificial
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
said
Saigon
sail
sailboat
sailfish
sailor
saint
sainthood
sake
Sal
Salaam
salacious
salad
salamander
salami
salaried
salary
sale
Salem
Salerno
salesgirl
Salesian
saleslady







<







<







18903
18904
18905
18906
18907
18908
18909

18910
18911
18912
18913
18914
18915
18916

18917
18918
18919
18920
18921
18922
18923
said
Saigon
sail
sailboat
sailfish
sailor
saint

sake
Sal
Salaam
salacious
salad
salamander
salami

salary
sale
Salem
Salerno
salesgirl
Salesian
saleslady
19072
19073
19074
19075
19076
19077
19078

19079
19080
19081
19082
19083
19084
19085
salivate
Salk
Salle
sallow
sally
salmon
salmonberry

salon
saloon
saloonkeep
salsify
salt
saltbush
saltwater







>







18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
salivate
Salk
Salle
sallow
sally
salmon
salmonberry
salmonella
salon
saloon
saloonkeep
salsify
salt
saltbush
saltwater
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
sand
sandal
sandalwood
sandbag
sandblast
Sandburg
sanderling
Sanders
Sanderson
sandhill
Sandia
sandman
sandpaper
sandpile
sandpiper







<







18985
18986
18987
18988
18989
18990
18991

18992
18993
18994
18995
18996
18997
18998
sand
sandal
sandalwood
sandbag
sandblast
Sandburg
sanderling

Sanderson
sandhill
Sandia
sandman
sandpaper
sandpile
sandpiper
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177

19178
19179
19180
19181
19182
19183
19184
19185
19186
19187

19188
19189
19190
19191
19192
19193
19194
Sao
sap
sapiens
sapient
sapling
saponify
sapphire
sapping
sappy
sapsucker
Sara
Saracen
Sarah
Saran
Sarasota
Saratoga
sarcasm
sarcastic

sarcoma
sardine
sardonic
Sargent
sari
sarsaparilla
sarsparilla
sash
sashay
Saskatchewan

sassafras
sat
satan
satanic
satellite
satiable
satiate







<










>










>







19022
19023
19024
19025
19026
19027
19028

19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
Sao
sap
sapiens
sapient
sapling
saponify
sapphire

sappy
sapsucker
Sara
Saracen
Sarah
Saran
Sarasota
Saratoga
sarcasm
sarcastic
sarcophagus
sarcoma
sardine
sardonic
Sargent
sari
sarsaparilla
sarsparilla
sash
sashay
Saskatchewan
Saskatoon
sassafras
sat
satan
satanic
satellite
satiable
satiate
19252
19253
19254
19255
19256
19257
19258

19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278

19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
scaffold
Scala
scalar
scald
scale
scallop
scalp

scamp
scan
scandal
scandalous
Scandinavia
scandium
scanning
scant
scanty
scapegoat
scapula
scapular
scar
Scarborough
scarce
scare
scarecrow
scarf
scarface
scarify

scarlet
Scarsdale
scarves
scary
scat
scathe
scatterbrain
scattergun
scatting
scaup
scavenge
scenario
scene
scenery
scenic
scent







>






<













>








<







19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128

19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150

19151
19152
19153
19154
19155
19156
19157
scaffold
Scala
scalar
scald
scale
scallop
scalp
scam
scamp
scan
scandal
scandalous
Scandinavia
scandium

scant
scanty
scapegoat
scapula
scapular
scar
Scarborough
scarce
scare
scarecrow
scarf
scarface
scarify
Scarlatti
scarlet
Scarsdale
scarves
scary
scat
scathe
scatterbrain
scattergun

scaup
scavenge
scenario
scene
scenery
scenic
scent
19347
19348
19349
19350
19351
19352
19353

19354
19355
19356
19357
19358
19359
19360
Schumann
Schuster
Schuyler
Schuylkill
Schwab
Schwartz
Schweitzer

sciatica
science
scientific
scientist
scimitar
scintillate
scion







>







19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
Schumann
Schuster
Schuyler
Schuylkill
Schwab
Schwartz
Schweitzer
Sci
sciatica
science
scientific
scientist
scimitar
scintillate
scion
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
scourge
scout
scowl
scrabble
scraggly
scram
scramble
scramming
Scranton
scrap
scrapbook
scrape
scrapping
scratch
scratchy
scrawl
scrawny
scream
screech
screechy







<




<







19257
19258
19259
19260
19261
19262
19263

19264
19265
19266
19267

19268
19269
19270
19271
19272
19273
19274
scourge
scout
scowl
scrabble
scraggly
scram
scramble

Scranton
scrap
scrapbook
scrape

scratch
scratchy
scrawl
scrawny
scream
screech
screechy
19427
19428
19429
19430
19431
19432
19433

19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463

19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476

19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
script
scription
scriptural
scripture
scriven
scroll
scrooge

scrounge
scrub
scrubbing
scrumptious
scruple
scrupulosity
scrupulous
scrutable
scrutiny
scuba
scud
scudding
scuff
scuffle
scull
sculpin
sculpt
sculptor
sculptural
sculpture
scum
scurrilous
scurry
scurvy
scuttle
scutum
Scylla
scythe
Scythia
SD

sea
seaboard
seacoast
seafare
seafood
Seagram
seagull
seahorse
seal
sealant
seam
seaman
seamen

seamy
Sean
seance
seaport
seaquake
sear
search
searchlight
Sears
seashore
seaside
season
seasonal
seat
seater
Seattle







>


<








<


















>













>








<







19289
19290
19291
19292
19293
19294
19295
19296
19297
19298

19299
19300
19301
19302
19303
19304
19305
19306

19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347

19348
19349
19350
19351
19352
19353
19354
script
scription
scriptural
scripture
scriven
scroll
scrooge
scrotum
scrounge
scrub

scrumptious
scruple
scrupulosity
scrupulous
scrutable
scrutiny
scuba
scud

scuff
scuffle
scull
sculpin
sculpt
sculptor
sculptural
sculpture
scum
scurrilous
scurry
scurvy
scuttle
scutum
Scylla
scythe
Scythia
SD
SE
sea
seaboard
seacoast
seafare
seafood
Seagram
seagull
seahorse
seal
sealant
seam
seaman
seamen
seamstress
seamy
Sean
seance
seaport
seaquake
sear
search
searchlight

seashore
seaside
season
seasonal
seat
seater
Seattle
19564
19565
19566
19567
19568
19569
19570

19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
selector
Selectric
Selena
selenate
selenite
selenium
self

selfish
Selfridge
Selkirk
sell
seller
sellout
Selma
seltzer
selves
Selwyn
semantic
semaphore







>




<







19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437

19438
19439
19440
19441
19442
19443
19444
selector
Selectric
Selena
selenate
selenite
selenium
self
selfadjoint
selfish
Selfridge
Selkirk
sell

sellout
Selma
seltzer
selves
Selwyn
semantic
semaphore
19631
19632
19633
19634
19635
19636
19637

19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649

19650
19651

19652

19653
19654
19655
19656
19657
19658
19659

19660
19661
19662
19663
19664
19665
19666
septennial
septic
septillion
septuagenarian
septum
sepuchral
sepulchral

sequel
sequent
sequential
sequester
sequestration
sequin
sequitur
Sequoia
sera
seraglio
serape
seraphim

serenade
serendipitous

serene

serge
sergeant
Sergei
serial
seriatim
series
serif

serious
sermon
serology
Serpens
serpent
serpentine
serum







>












>


>

>







>







19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
septennial
septic
septillion
septuagenarian
septum
sepuchral
sepulchral
seq
sequel
sequent
sequential
sequester
sequestration
sequin
sequitur
Sequoia
sera
seraglio
serape
seraphim
Serbia
serenade
serendipitous
serendipity
serene
serf
serge
sergeant
Sergei
serial
seriatim
series
serif
serine
serious
sermon
serology
Serpens
serpent
serpentine
serum
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
sesame
session
set
setback
Seth
Seton
setscrew
setting
settle
setup
seven
sevenfold
seventeen
seventeenth
seventh







<







19546
19547
19548
19549
19550
19551
19552

19553
19554
19555
19556
19557
19558
19559
sesame
session
set
setback
Seth
Seton
setscrew

settle
setup
seven
sevenfold
seventeen
seventeenth
seventh
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
shear
Shearer
sheath
sheathe
sheave
she'd
shed
shedding
Shedir
Sheehan
sheen
sheep
sheepskin
sheer
sheet







<







19656
19657
19658
19659
19660
19661
19662

19663
19664
19665
19666
19667
19668
19669
shear
Shearer
sheath
sheathe
sheave
she'd
shed

Shedir
Sheehan
sheen
sheep
sheepskin
sheer
sheet
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871

19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
Sherlock
Sherman
Sherrill
sherry
Sherwin
Sherwood
shibboleth
shied
shield
Shields
shift
shifty
shill
Shiloh
shim
shimming
shimmy
shin
shinbone
shine
shingle
Shinto
shiny
ship
shipboard
shipbuild
shipbuilding
shiplap
Shipley
shipman
shipmate
shipmen
shipping
shipshape
shipwreck
shipyard
shire
shirk
Shirley
shirt
shirtmake
shish
shitepoke
shiv
shiver
shivery

shoal
shock
Shockley
shod
shoddy
shoe
shoehorn
shoelace
shoemake
shoestring
shoji
shone
shoo
shoofly
shook
shoot
shop
shopkeep
shopping
shopworn
shore
shoreline
short
shortage
shortcoming
shortcut







<

<





<
















<













>


















<







19691
19692
19693
19694
19695
19696
19697

19698

19699
19700
19701
19702
19703

19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719

19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751

19752
19753
19754
19755
19756
19757
19758
Sherlock
Sherman
Sherrill
sherry
Sherwin
Sherwood
shibboleth

shield

shift
shifty
shill
Shiloh
shim

shimmy
shin
shinbone
shine
shingle
Shinto
shiny
ship
shipboard
shipbuild
shipbuilding
shiplap
Shipley
shipman
shipmate
shipmen

shipshape
shipwreck
shipyard
shire
shirk
Shirley
shirt
shirtmake
shish
shitepoke
shiv
shiver
shivery
Shmuel
shoal
shock
Shockley
shod
shoddy
shoe
shoehorn
shoelace
shoemake
shoestring
shoji
shone
shoo
shoofly
shook
shoot
shop
shopkeep

shopworn
shore
shoreline
short
shortage
shortcoming
shortcut
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
showpiece
showplace
showroom
showy
shrank
shrapnel
shred
shredding
Shreveport
shrew
shrewd
shrewish
shriek
shrift
shrike







<







19781
19782
19783
19784
19785
19786
19787

19788
19789
19790
19791
19792
19793
19794
showpiece
showplace
showroom
showy
shrank
shrapnel
shred

Shreveport
shrew
shrewd
shrewish
shriek
shrift
shrike
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
shuck
shudder
shuddery
shuffle
shuffleboard
Shulman
shun
shunning
shunt
shut
shutdown
shutoff
shutout
shutting
shuttle
shuttlecock
shy
Shylock
sial
SIAM
Siamese







<





<







19812
19813
19814
19815
19816
19817
19818

19819
19820
19821
19822
19823

19824
19825
19826
19827
19828
19829
19830
shuck
shudder
shuddery
shuffle
shuffleboard
Shulman
shun

shunt
shut
shutdown
shutoff
shutout

shuttle
shuttlecock
shy
Shylock
sial
SIAM
Siamese
20012
20013
20014
20015
20016
20017
20018

20019
20020
20021
20022
20023
20024
20025
Sidney
siege
Siegel
Siegfried
Sieglinda
Siegmund
Siemens

sienna
sierra
siesta
sieve
sift
sigh
sight







>







19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
Sidney
siege
Siegel
Siegfried
Sieglinda
Siegmund
Siemens
Siena
sienna
sierra
siesta
sieve
sift
sigh
sight
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084

20085
20086
20087
20088
20089
20090
20091
sima
similar
simile
similitude
simmer
Simmons
Simon
Simons
Simonson
simper
simple
simplectic
simpleminded
simpleton
simplex

simplicity
simplify
simplistic
simply
Simpson
Sims
simulate







<







>







19929
19930
19931
19932
19933
19934
19935

19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
sima
similar
simile
similitude
simmer
Simmons
Simon

Simonson
simper
simple
simplectic
simpleminded
simpleton
simplex
simplicial
simplicity
simplify
simplistic
simply
Simpson
Sims
simulate
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
singsong
singular
sinh
sinister
sinistral
sink
sinkhole
sinning
sinter
sinuous
sinus
sinusoid
sinusoidal
Sioux
sip
sipping
sir
sire
siren
Sirius
sis
sisal
siskin
sister
Sistine
Sisyphean
Sisyphus
sit
site
sitting
situ
situate
situs
siva
six
sixfold
sixgun







<







<













<







19971
19972
19973
19974
19975
19976
19977

19978
19979
19980
19981
19982
19983
19984

19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997

19998
19999
20000
20001
20002
20003
20004
singsong
singular
sinh
sinister
sinistral
sink
sinkhole

sinter
sinuous
sinus
sinusoid
sinusoidal
Sioux
sip

sir
sire
siren
Sirius
sis
sisal
siskin
sister
Sistine
Sisyphean
Sisyphus
sit
site

situ
situate
situs
siva
six
sixfold
sixgun
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192

20193
20194
20195
20196
20197
20198
20199
sketch
sketchbook
sketchpad
sketchy
skew
ski
skid
skidding
skiddy
skied
skiff
skill
skillet
skillful
skim
skimming
skimp
skimpy
skin
skindive
skinning
skinny
skip
skipjack
skipping
Skippy
skirmish
skirt
skit
skittle

skulk
skull
skullcap
skullduggery
skunk
sky
Skye







<

<





<




<



<





>







20019
20020
20021
20022
20023
20024
20025

20026

20027
20028
20029
20030
20031

20032
20033
20034
20035

20036
20037
20038

20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
sketch
sketchbook
sketchpad
sketchy
skew
ski
skid

skiddy

skiff
skill
skillet
skillful
skim

skimp
skimpy
skin
skindive

skinny
skip
skipjack

Skippy
skirmish
skirt
skit
skittle
Skopje
skulk
skull
skullcap
skullduggery
skunk
sky
Skye
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237

20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
slack
slacken
sladang
slag
slain
slake
slam
slamming
slander
slanderous
slang
slant
slap
slapping
slapstick
slash
slat
slate
slater
slatting
slaughter
slaughterhouse
Slav
slave
slavery
Slavic
slavish

slay
sled
sledding
sledge
sledgehammer
sleek
sleep
sleepwalk
sleepy
sleet







<





<





<







>


<







20063
20064
20065
20066
20067
20068
20069

20070
20071
20072
20073
20074

20075
20076
20077
20078
20079

20080
20081
20082
20083
20084
20085
20086
20087
20088
20089

20090
20091
20092
20093
20094
20095
20096
slack
slacken
sladang
slag
slain
slake
slam

slander
slanderous
slang
slant
slap

slapstick
slash
slat
slate
slater

slaughter
slaughterhouse
Slav
slave
slavery
Slavic
slavish
Slavonic
slay
sled

sledge
sledgehammer
sleek
sleep
sleepwalk
sleepy
sleet
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294

20295

20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
slime
slimy
sling
slingshot
slip
slippage
slippery
slipping
slit
slither
slitting
sliver
slivery
Sloan
Sloane
slob
Slocum
sloe
slog
slogan
sloganeer
slogging
sloop
slop
slope
slopping
sloppy
slosh
slot
sloth
slothful
slouch
slough

sloven

slow
slowdown
sludge
slug
slugging
sluggish
sluice
slum
slumber
slumming
slump
slung
slur
slurp
slurring
slurry
sly
smack
small
smaller
Smalley
smallish
smallpox
smalltime
smart
smash
smattering
smear
smell
smelt
smile
smirk
smith
smithereens
Smithfield
Smithson
Smithsonian
smithy
smitten
smog
smoke
smokehouse
smokescreen
smokestack







<


<














<







>

>









<




<




<
















<







20111
20112
20113
20114
20115
20116
20117

20118
20119

20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133

20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152

20153
20154
20155
20156

20157
20158
20159
20160

20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176

20177
20178
20179
20180
20181
20182
20183
slime
slimy
sling
slingshot
slip
slippage
slippery

slit
slither

sliver
slivery
Sloan
Sloane
slob
Slocum
sloe
slog
slogan
sloganeer
slogging
sloop
slop
slope

sloppy
slosh
slot
sloth
slothful
slouch
slough
Slovakia
sloven
Slovenia
slow
slowdown
sludge
slug
slugging
sluggish
sluice
slum
slumber

slump
slung
slur
slurp

slurry
sly
smack
small

Smalley
smallish
smallpox
smalltime
smart
smash
smattering
smear
smell
smelt
smile
smirk
smith
smithereens
Smithfield
Smithson

smithy
smitten
smog
smoke
smokehouse
smokescreen
smokestack
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
snack
snafu
snag
snagging
snail
snake
snakebird
snakelike
snakeroot
snap
snapback
snapdragon
snapping
snappish
snappy
snapshot
snare
snark
snarl
snatch
snazzy
sneak
sneaky
sneer
sneeze
snell
snick
Snider
sniff
sniffle
sniffly
snifter
snigger
snip
snipe
snippet
snippy
snivel







<




<

















<







20199
20200
20201
20202
20203
20204
20205

20206
20207
20208
20209

20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226

20227
20228
20229
20230
20231
20232
20233
snack
snafu
snag
snagging
snail
snake
snakebird

snakeroot
snap
snapback
snapdragon

snappish
snappy
snapshot
snare
snark
snarl
snatch
snazzy
sneak
sneaky
sneer
sneeze
snell
snick
Snider
sniff
sniffle

snifter
snigger
snip
snipe
snippet
snippy
snivel
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432

20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
snow
snowball
snowfall
snowflake
snowstorm
snowy
snub
snubbing
snuff
snuffer
snuffle
snuffly
snug
snuggle
snuggly
snyaptic
Snyder
so
soak
soap
soapstone
soapsud
soapy
soar
sob
sobbing
sober
sobriety
sobriquet

soccer
sociable
social
societal
Societe
society
socioeconomic
sociology
sociometric
sociometry
sock
socket
sockeye
Socrates
Socratic
sod
soda
sodden
sodding
sodium
sofa
soffit
Sofia
soft
softball
soften







<

<

<













<



>








<









<







20245
20246
20247
20248
20249
20250
20251

20252

20253

20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266

20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278

20279
20280
20281
20282
20283
20284
20285
20286
20287

20288
20289
20290
20291
20292
20293
20294
snow
snowball
snowfall
snowflake
snowstorm
snowy
snub

snuff

snuffle

snug
snuggle
snuggly
snyaptic
Snyder
so
soak
soap
soapstone
soapsud
soapy
soar
sob

sober
sobriety
sobriquet
Soc
soccer
sociable
social
societal
Societe
society
socioeconomic
sociology

sociometry
sock
socket
sockeye
Socrates
Socratic
sod
soda
sodden

sodium
sofa
soffit
Sofia
soft
softball
soften
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488

20489
20490
20491
20492
20493
20494
20495
sold
solder
soldier
soldiery
sole
solecism
solemn
solemnity
solenoid
solicit
solicitation
solicitor
solicitous
solicitude
solid
solidarity
solidify
soliloquy
solipsism
solitary

solitude
solo
Solomon
Solon
solstice
soluble
solute







<












>







20305
20306
20307
20308
20309
20310
20311

20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
sold
solder
soldier
soldiery
sole
solecism
solemn

solenoid
solicit
solicitation
solicitor
solicitous
solicitude
solid
solidarity
solidify
soliloquy
solipsism
solitary
soliton
solitude
solo
Solomon
Solon
solstice
soluble
solute
20519
20520
20521
20522
20523
20524
20525

20526
20527
20528
20529
20530
20531
20532
sometime
somewhat
somewhere
sommelier
Sommerfeld
somnolent
son

sonar
sonata
song
songbag
songbook
songful
sonic







>







20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
sometime
somewhat
somewhere
sommelier
Sommerfeld
somnolent
son
sonant
sonar
sonata
song
songbag
songbook
songful
sonic
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575

20576
20577
20578
20579
20580
20581
20582
sophism
sophisticate
sophistry
Sophoclean
Sophocles
sophomore
sophomoric
sopping
soprano
sora
sorb
sorcery
sordid
sore
Sorensen
Sorenson
sorghum
sorority
sorption
sorrel
sorrow
sorrowful
sorry
sort
sortie
sou
souffle

sought
soul
soulful
sound
soundproof
soup
sour







<



















>







20386
20387
20388
20389
20390
20391
20392

20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
sophism
sophisticate
sophistry
Sophoclean
Sophocles
sophomore
sophomoric

soprano
sora
sorb
sorcery
sordid
sore
Sorensen
Sorenson
sorghum
sorority
sorption
sorrel
sorrow
sorrowful
sorry
sort
sortie
sou
souffle
sough
sought
soul
soulful
sound
soundproof
soup
sour
20610
20611
20612
20613
20614
20615
20616

20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
soy
soya
soybean
spa
space
spacecraft
spacesuit

spacious
spade
spaghetti
Spain
spalding
span
spandrel
spangle
Spaniard
spaniel
Spanish
spanning
spar
spare
sparge
spark
sparkle
Sparkman
sparky
sparling
sparring
sparrow
sparse
Sparta
Spartan
spasm
spastic
spat
spate
spatial
spatlum
spatterdock
spatula
Spaulding
spavin
spawn
spay
spayed
speak
speakeasy
spear
spearhead
spearmint
spec
special







>











<








<



<












<







20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465

20466
20467
20468
20469
20470
20471
20472
20473

20474
20475
20476

20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488

20489
20490
20491
20492
20493
20494
20495
soy
soya
soybean
spa
space
spacecraft
spacesuit
spacetime
spacious
spade
spaghetti
Spain
spalding
span
spandrel
spangle
Spaniard
spaniel
Spanish

spar
spare
sparge
spark
sparkle
Sparkman
sparky
sparling

sparrow
sparse
Sparta

spasm
spastic
spat
spate
spatial
spatlum
spatterdock
spatula
Spaulding
spavin
spawn
spay

speak
speakeasy
spear
spearhead
spearmint
spec
special
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
Spector
spectra
spectral
spectrogram
spectrograph
spectrography
spectrometer
spectrometric
spectrometry
spectrophotometer
spectrophotometric
spectrophotometry
spectroscope
spectroscopic
spectroscopy
spectrum
specular
speculate
sped







<
<

<
<







20507
20508
20509
20510
20511
20512
20513


20514


20515
20516
20517
20518
20519
20520
20521
Spector
spectra
spectral
spectrogram
spectrograph
spectrography
spectrometer


spectrophotometer


spectroscope
spectroscopic
spectroscopy
spectrum
specular
speculate
sped
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780

20781
20782
20783
20784
20785
20786
20787
spin
spinach
spinal
spindle
spine
spinnaker
spinneret
spinning
spinodal
spinoff
spinster
spiny
spiral
spire
spirit
spiritual
Spiro
spit
spite
spiteful
spitfire
spitting
spittle
spitz
splash
splashy
splat
splay
splayed
spleen
spleenwort
splendid
splenetic
splice
spline
splint
splintery
split
splitting
splotch
splotchy
splurge
splutter
spoil
spoilage
Spokane
spoke
spoken
spokesman
spokesmen

sponge
spongy
sponsor
spontaneity
spontaneous
spoof
spook







<













<






<









<











>







20561
20562
20563
20564
20565
20566
20567

20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580

20581
20582
20583
20584
20585
20586

20587
20588
20589
20590
20591
20592
20593
20594
20595

20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
spin
spinach
spinal
spindle
spine
spinnaker
spinneret

spinodal
spinoff
spinster
spiny
spiral
spire
spirit
spiritual
Spiro
spit
spite
spiteful
spitfire

spittle
spitz
splash
splashy
splat
splay

spleen
spleenwort
splendid
splenetic
splice
spline
splint
splintery
split

splotch
splotchy
splurge
splutter
spoil
spoilage
Spokane
spoke
spoken
spokesman
spokesmen
spokesperson
sponge
spongy
sponsor
spontaneity
spontaneous
spoof
spook
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
sportsmen
sportswear
sportswriter
sportswriting
sporty
spot
spotlight
spotting
spotty
spouse
spout
Sprague
sprain
sprang
sprawl







<







20623
20624
20625
20626
20627
20628
20629

20630
20631
20632
20633
20634
20635
20636
sportsmen
sportswear
sportswriter
sportswriting
sporty
spot
spotlight

spotty
spouse
spout
Sprague
sprain
sprang
sprawl
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
spumoni
spun
spunk
spur
spurge
spurious
spurn
spurring
spurt
sputnik
sputter
spy
spyglass
squabble
squad







<







20660
20661
20662
20663
20664
20665
20666

20667
20668
20669
20670
20671
20672
20673
spumoni
spun
spunk
spur
spurge
spurious
spurn

spurt
sputnik
sputter
spy
spyglass
squabble
squad
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883

20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
squeeze
squelch
Squibb
squid
squill
squint
squire
squirehood
squirm
squirmy
squirrel
squirt
squishy
Sri
s's

SST
St
St.
stab
stabbing
stabile
stable
stableman
stablemen
staccato
stack
Stacy







<







>

|
|

<







20694
20695
20696
20697
20698
20699
20700

20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712

20713
20714
20715
20716
20717
20718
20719
squeeze
squelch
Squibb
squid
squill
squint
squire

squirm
squirmy
squirrel
squirt
squishy
Sri
s's
SSE
SST
SSW
St
stab

stabile
stable
stableman
stablemen
staccato
stack
Stacy
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
stargaze
stark
Starkey
starlet
starlight
starling
Starr
starring
start
startle
startup
starvation
starve
stash
stasis
state
Staten
stater
stateroom
statesman
statesmanlike
statesmen
statewide
static
stationarity
stationary
stationery
stationmaster







<












<







20785
20786
20787
20788
20789
20790
20791

20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803

20804
20805
20806
20807
20808
20809
20810
stargaze
stark
Starkey
starlet
starlight
starling
Starr

start
startle
startup
starvation
starve
stash
stasis
state
Staten
stater
stateroom
statesman

statesmen
statewide
static
stationarity
stationary
stationery
stationmaster
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014


21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025

21026
21027
21028

21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061

21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
statute
statutory
Stauffer
staunch
Staunton
stave
stay
stayed
stead
steadfast
steady
steak
steal
stealth
stealthy
steam
steamboat
steamy


Stearns
steed
steel
Steele
steelmake
steely
Steen
steep
steepen
steeple
steeplebush

steer
steeve
Stefan

stein
Steinberg
Steiner
stella
stellar
stem
stemming
stench
stencil
stenographer
stenography
stenotype
step
stepchild
Stephanie
stephanotis
Stephen
Stephens
Stephenson
stepmother
steppe
stepping
steprelation
stepson
stepwise
steradian
stereo
stereography
stereoscopy
sterile
sterling
stern
sternal

Sterno
sternum
steroid
stethoscope
Stetson
Steuben
Steve
stevedore
Steven
Stevens
Stevenson
stew
steward
stewardess
Stewart
stick
stickle







<










>
>











>



>






<










<



<











>









<







20819
20820
20821
20822
20823
20824
20825

20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859

20860
20861
20862
20863
20864
20865
20866
20867
20868
20869

20870
20871
20872

20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893

20894
20895
20896
20897
20898
20899
20900
statute
statutory
Stauffer
staunch
Staunton
stave
stay

stead
steadfast
steady
steak
steal
stealth
stealthy
steam
steamboat
steamy
stearate
stearic
Stearns
steed
steel
Steele
steelmake
steely
Steen
steep
steepen
steeple
steeplebush
steeplechase
steer
steeve
Stefan
Stegosaurus
stein
Steinberg
Steiner
stella
stellar
stem

stench
stencil
stenographer
stenography
stenotype
step
stepchild
Stephanie
stephanotis
Stephen

Stephenson
stepmother
steppe

steprelation
stepson
stepwise
steradian
stereo
stereography
stereoscopy
sterile
sterling
stern
sternal
Sternberg
Sterno
sternum
steroid
stethoscope
Stetson
Steuben
Steve
stevedore
Steven

Stevenson
stew
steward
stewardess
Stewart
stick
stickle
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
stinky
stint
stipend
stipple
stipulate
stir
Stirling
stirring
stirrup
stitch
stochastic
stock
stockade
stockbroker
stockholder
Stockholm
stockpile
stockroom
Stockton
stocky
stodgy
stoic
stoichiometric
stoichiometry
stoke
Stokes
stole
stolen
stolid
stomach







<














<







20925
20926
20927
20928
20929
20930
20931

20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945

20946
20947
20948
20949
20950
20951
20952
stinky
stint
stipend
stipple
stipulate
stir
Stirling

stirrup
stitch
stochastic
stock
stockade
stockbroker
stockholder
Stockholm
stockpile
stockroom
Stockton
stocky
stodgy
stoic

stoichiometry
stoke
Stokes
stole
stolen
stolid
stomach
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169

21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
stoop
stop
stopband
stopcock
stopgap
stopover
stoppage
stopping
stopwatch
storage
store
storehouse
storekeep
storeroom
Storey
stork
storm
stormbound
stormy
story
storyboard
storyteller
stout
stove
stow
stowage

strabismic
strabismus
straddle
strafe
straggle
straight
straightaway
straighten
straightforward
straightway
strain
strait
strand
strange
strangle
strangulate
strap
strapping
strata
stratagem
strategic
strategist
strategy
Stratford
stratify







<


















>

















<







20964
20965
20966
20967
20968
20969
20970

20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006

21007
21008
21009
21010
21011
21012
21013
stoop
stop
stopband
stopcock
stopgap
stopover
stoppage

stopwatch
storage
store
storehouse
storekeep
storeroom
Storey
stork
storm
stormbound
stormy
story
storyboard
storyteller
stout
stove
stow
stowage
stowaway
strabismic
strabismus
straddle
strafe
straggle
straight
straightaway
straighten
straightforward
straightway
strain
strait
strand
strange
strangle
strangulate
strap

strata
stratagem
strategic
strategist
strategy
Stratford
stratify
21207
21208
21209
21210
21211
21212
21213

21214
21215
21216
21217
21218
21219
21220
21221
21222
21223

21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
streamside
street
streetcar
strength
strengthen
strenuous
streptococcus

stress
stressful
stretch
strewn
striate
stricken
Strickland
strict
stricture
stride

strife
strike
strikebreak
string
stringent
stringy
strip
stripe
stripping
striptease
strive
striven
strobe
stroboscopic
strode
stroke
stroll
Strom
Stromberg
strong
stronghold
strongroom
strontium
strop
strophe
stropping
strove
struck
structural
structure
struggle
strum
strumming
strung
strut
strutting
strychnine
Stuart
stub
stubbing
stubble
stubborn
stubby
stucco
stuck
stud
studding
Studebaker
student
studio
studious
study
stuff
stuffy
stultify
stumble
stump
stumpage
stumpy
stun
stung
stunk
stunning
stunt
stupefy
stupendous
stupid
stupor
Sturbridge
sturdy







>










>








<
















<






<


<



<






<















<







21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052

21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068

21069
21070
21071
21072
21073
21074

21075
21076

21077
21078
21079

21080
21081
21082
21083
21084
21085

21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100

21101
21102
21103
21104
21105
21106
21107
streamside
street
streetcar
strength
strengthen
strenuous
streptococcus
streptomycin
stress
stressful
stretch
strewn
striate
stricken
Strickland
strict
stricture
stride
strident
strife
strike
strikebreak
string
stringent
stringy
strip
stripe

striptease
strive
striven
strobe
stroboscopic
strode
stroke
stroll
Strom
Stromberg
strong
stronghold
strongroom
strontium
strop
strophe

strove
struck
structural
structure
struggle
strum

strung
strut

strychnine
Stuart
stub

stubble
stubborn
stubby
stucco
stuck
stud

Studebaker
student
studio
studious
study
stuff
stuffy
stultify
stumble
stump
stumpage
stumpy
stun
stung
stunk

stunt
stupefy
stupendous
stupid
stupor
Sturbridge
sturdy
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
stylus
stymie
styrene
Styrofoam
Styx
suave
sub
subbing
subject
subjectivity
sublimate
subliminal
submersible
submit
submittal
submitted
submitting







<

|







21118
21119
21120
21121
21122
21123
21124

21125
21126
21127
21128
21129
21130
21131
21132
21133
stylus
stymie
styrene
Styrofoam
Styx
suave
sub

subject
subjunctive
sublimate
subliminal
submersible
submit
submittal
submitted
submitting
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
substantive
substituent
substitute
substitution
substitutionary
substrate
subsume
subsumed
subsuming
subterfuge
subterranean
subtle
subtlety
subtly
subtrahend
suburb







<
<







21143
21144
21145
21146
21147
21148
21149


21150
21151
21152
21153
21154
21155
21156
substantive
substituent
substitute
substitution
substitutionary
substrate
subsume


subterfuge
subterranean
subtle
subtlety
subtly
subtrahend
suburb
21354
21355
21356
21357
21358
21359
21360

21361
21362
21363
21364
21365
21366
21367
successor
succinct
succubus
succumb
such
suck
suckling

suction
sud
Sudan
Sudanese
sudden
suds
sue







>







21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
successor
succinct
succubus
succumb
such
suck
suckling
sucrose
suction
sud
Sudan
Sudanese
sudden
suds
sue
21384
21385
21386
21387
21388
21389
21390

21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436

21437
21438
21439
21440
21441
21442
21443
21444

21445
21446
21447
21448
21449
21450
21451
suicidal
suicide
suit
suitcase
suite
suitor
sulfa

sulfate
sulfide
sulfite
sulfonamide
sulfur
sulfuric
sulfurous
sulk
sulky
sullen
Sullivan
sully
sulphur
sultan
sultry
sum
sumac
Sumatra
Sumerian
summand
summarily
summary
summate
Summers
summertime
summing
summit
summitry
summon
Sumner
sumptuous
Sumter
sun
sunbeam
sunbonnet
sunburn
sunburnt
Sunday
sunder
sundew
sundial
sundown
sundry
sunfish
sunflower
sung

sunk
sunken
sunlight
sunlit
sunning
sunny
Sunnyvale
sunrise

sunset
sunshade
sunshine
sunshiny
sunspot
suntan
suntanned







>


















|

<


<

<




















>




<



>







21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223

21224
21225

21226

21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251

21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
suicidal
suicide
suit
suitcase
suite
suitor
sulfa
sulfanilamide
sulfate
sulfide
sulfite
sulfonamide
sulfur
sulfuric
sulfurous
sulk
sulky
sullen
Sullivan
sully
sulphur
sultan
sultry
sum
sumac
Sumatra
Sumeria
summand

summary
summate

summertime

summit
summitry
summon
Sumner
sumptuous
Sumter
sun
sunbeam
sunbonnet
sunburn
sunburnt
Sunday
sunder
sundew
sundial
sundown
sundry
sunfish
sunflower
sung
sunglasses
sunk
sunken
sunlight
sunlit

sunny
Sunnyvale
sunrise
sunscreen
sunset
sunshade
sunshine
sunshiny
sunspot
suntan
suntanned
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
superfluity
superfluous
superintendent
superior
superlative
superlunary
supernatant
superposable
supersede
superstition
superstitious
supervene
supervisory
supine
supping
supplant
supple
supplementary
supplicate
supply
support
supposable







<






<







21272
21273
21274
21275
21276
21277
21278

21279
21280
21281
21282
21283
21284

21285
21286
21287
21288
21289
21290
21291
superfluity
superfluous
superintendent
superior
superlative
superlunary
supernatant

supersede
superstition
superstitious
supervene
supervisory
supine

supplant
supple
supplementary
supplicate
supply
support
supposable
21498
21499
21500
21501
21502
21503
21504


21505
21506
21507
21508
21509
21510
21511
surface
surfactant
surfeit
surge
surgeon
surgery
surgical


surmise
surmount
surname
surpass
surplus
surprise
surreal







>
>







21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
surface
surfactant
surfeit
surge
surgeon
surgery
surgical
surjection
surjective
surmise
surmount
surname
surpass
surplus
surprise
surreal
21521
21522
21523
21524
21525
21526
21527

21528
21529
21530
21531
21532
21533
21534
surveyor
survival
survive
survivor
Sus
Susan
Susanne

susceptible
sushi
Susie
suspect
suspend
suspense
suspension







>







21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
surveyor
survival
survive
survivor
Sus
Susan
Susanne
susceptance
susceptible
sushi
Susie
suspect
suspend
suspense
suspension
21542
21543
21544
21545
21546
21547
21548

21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593

21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
Sutton
suture
Suzanne
suzerain
suzerainty
Suzuki
svelte

swab
swabbing
swabby
swag
Swahili
swain
swallow
swallowtail
swam
swami
swamp
swampy
swan
swank
swanky
swanlike
Swanson
swap
swapping
swarm
swart
Swarthmore
Swarthout
swarthy
swastika
swat
swatch
swath
swathe
swatting
sway
Swaziland
swear
sweat
sweatband
sweater
sweatshirt
sweaty
Swede
Sweden
Swedish
Sweeney
sweep
sweepstake
sweet

sweetheart
sweetish
swell
swelt
swelter
Swenson
swept
swerve
swift
swig
swigging
swim
swimming
swimsuit
swindle
swine
swing
swingable
swingy
swipe







>

<













<


<










<















>












<







21354
21355
21356
21357
21358
21359
21360
21361
21362

21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375

21376
21377

21378
21379
21380
21381
21382
21383
21384
21385
21386
21387

21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415

21416
21417
21418
21419
21420
21421
21422
Sutton
suture
Suzanne
suzerain
suzerainty
Suzuki
svelte
SW
swab

swabby
swag
Swahili
swain
swallow
swallowtail
swam
swami
swamp
swampy
swan
swank
swanky

Swanson
swap

swarm
swart
Swarthmore
Swarthout
swarthy
swastika
swat
swatch
swath
swathe

sway
Swaziland
swear
sweat
sweatband
sweater
sweatshirt
sweaty
Swede
Sweden
Swedish
Sweeney
sweep
sweepstake
sweet
sweeten
sweetheart
sweetish
swell
swelt
swelter
Swenson
swept
swerve
swift
swig
swigging
swim

swimsuit
swindle
swine
swing
swingable
swingy
swipe
21642
21643
21644
21645
21646
21647
21648


21649
21650

21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662

21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683

21684
21685
21686
21687
21688
21689
21690
sycophantic
Sydney
syenite
Sykes
syllabic
syllabify
syllable


syllogism
syllogistic

sylvan
Sylvania
Sylvester
Sylvia
symbiosis
symbiotic
symbol
symbolic
symmetric
symmetry
sympathetic
sympathy

symphonic
symphony
symposia
symposium
symptom
symptomatic
synagogue
synapse
synapses
synaptic
synchronism
synchronous
synchrony
synchrotron
syncopate
syndic
syndicate
syndrome
synergism
synergistic
synergy

synod
synonym
synonymous
synonymy
synopses
synopsis
synoptic







>
>


>








<



>








<












>







21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470

21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482

21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
sycophantic
Sydney
syenite
Sykes
syllabic
syllabify
syllable
syllabi
syllabus
syllogism
syllogistic
Sylow
sylvan
Sylvania
Sylvester
Sylvia
symbiosis
symbiotic
symbol
symbolic

symmetry
sympathetic
sympathy
symplectic
symphonic
symphony
symposia
symposium
symptom
symptomatic
synagogue
synapse

synaptic
synchronism
synchronous
synchrony
synchrotron
syncopate
syndic
syndicate
syndrome
synergism
synergistic
synergy
Synge
synod
synonym
synonymous
synonymy
synopses
synopsis
synoptic
21698
21699
21700
21701
21702
21703
21704
21705
21706

21707

21708
21709
21710
21711
21712
21713
21714
21715
21716
syringe
syrinx
syrup
syrupy
system
systematic
systemic
systemization
systemwide

t

tab
tabbing
tabernacle
table
tableau
tableaux
tablecloth
tableland
tablespoon







|
|
>

>

<







21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522

21523
21524
21525
21526
21527
21528
21529
syringe
syrinx
syrup
syrupy
system
systematic
systemic
systemwide
syzygy
Szilard
t
TA
tab

tabernacle
table
tableau
tableaux
tablecloth
tableland
tablespoon
21742
21743
21744
21745
21746
21747
21748

21749

21750
21751
21752
21753
21754
21755
21756
taft
tag
tagging
Tahiti
Tahoe
tail
tailgate

tailor

taint
Taipei
Taiwan
take
taken
takeoff
takeover







>

>







21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
taft
tag
tagging
Tahiti
Tahoe
tail
tailgate
tailspin
tailor
tailwind
taint
Taipei
Taiwan
take
taken
takeoff
takeover
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874

21875
21876
21877
21878
21879
21880
21881
tangible
tangle
tango
tangy
tanh
tank
tannin
tanning
tansy
tantalum
Tantalus
tantamount
tantrum
Tanya
Tanzania
tao
Taoist
Taos
tap
tapa
tape
taper
tapestry
tapeworm
tapir
tapis
tappa
tappet
tapping
tar
tara
tarantara
tarantula
Tarbell
tardy
target
tariff
tarnish
tarpaper
tarpaulin
tarpon
tarring
tarry
Tarrytown
tart
tartar
Tartary
Tarzan
task
taskmaster
Tasmania
Tass
tassel
taste
tasteful
tasting
tasty
tat
tate
tater
tatting
tattle
tattler
tattletale
tattoo
tatty
tau
taught
taunt
Taurus
taut
tautology
tavern
taverna
tawdry
tawny
tax
taxation
taxi
taxicab
taxied

taxonomy
taxpayer
taxpaying
Taylor
tea
teacart
teach







<








<
<










<












<


















<




















>







21609
21610
21611
21612
21613
21614
21615

21616
21617
21618
21619
21620
21621
21622
21623


21624
21625
21626
21627
21628
21629
21630
21631
21632
21633

21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645

21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663

21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
tangible
tangle
tango
tangy
tanh
tank
tannin

tansy
tantalum
Tantalus
tantamount
tantrum
Tanya
Tanzania
tao


tap
tapa
tape
taper
tapestry
tapeworm
tapir
tapis
tappa
tappet

tar
tara
tarantara
tarantula
Tarbell
tardy
target
tariff
tarnish
tarpaper
tarpaulin
tarpon

tarry
Tarrytown
tart
tartar
Tartary
Tarzan
task
taskmaster
Tasmania
Tass
tassel
taste
tasteful
tasting
tasty
tat
tate
tater

tattle
tattler
tattletale
tattoo
tatty
tau
taught
taunt
Taurus
taut
tautology
tavern
taverna
tawdry
tawny
tax
taxation
taxi
taxicab
taxied
taxiway
taxonomy
taxpayer
taxpaying
Taylor
tea
teacart
teach
21897
21898
21899
21900
21901
21902
21903

21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928

21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
teaspoon
teaspoonful
teat
tech
technetium
technic
technician

technique
technology
tectonic
tecum
ted
tedding
Teddy
tedious
tedium
tee
teeing
teem
teen
teenage
teensy
teet
teeth
teethe
teetotal
Teflon
Tegucigalpa
Teheran
Tehran
tektite
Tektronix

telecommunicate
teleconference
Teledyne
Telefunken
telegram
telegraph
telegraphy
telekinesis
telemeter
telemetric
telemetry
teleology
teleost
telepathic
telepathy
telephone
telephonic
telephony
telephotography
teleprinter
teleprocessing
teleprompter
telescope
telescopic
teletype
teletypesetting
teletypewrite
televise
television
Telex
tell
teller
tellurium
temerity
temper
tempera
temperance
temperate
temperature







>




|
<



















>









<
<




















<







21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719

21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748


21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768

21769
21770
21771
21772
21773
21774
21775
teaspoon
teaspoonful
teat
tech
technetium
technic
technician
Technion
technique
technology
tectonic
tecum
Ted

Teddy
tedious
tedium
tee
teeing
teem
teen
teenage
teensy
teet
teeth
teethe
teetotal
Teflon
Tegucigalpa
Teheran
Tehran
tektite
Tektronix
Tel
telecommunicate
teleconference
Teledyne
Telefunken
telegram
telegraph
telegraphy
telekinesis
telemeter


teleology
teleost
telepathic
telepathy
telephone
telephonic
telephony
telephotography
teleprinter
teleprocessing
teleprompter
telescope
telescopic
teletype
teletypesetting
teletypewrite
televise
television
Telex
tell

tellurium
temerity
temper
tempera
temperance
temperate
temperature
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
tennis
Tennyson
tenon
tenor
tense
tensile
tension
tensional
tensor
tenspot
tent
tentacle
tentative
tenth
tenuous







<







21804
21805
21806
21807
21808
21809
21810

21811
21812
21813
21814
21815
21816
21817
tennis
Tennyson
tenon
tenor
tense
tensile
tension

tensor
tenspot
tent
tentacle
tentative
tenth
tenuous
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
testimonial
testimony
testy
tetanus
tete
tether
tetrachloride
tetrafluouride
tetragonal
tetrahedra
tetrahedral
tetrahedron
tetravalent
Teutonic
Texaco







|







21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
testimonial
testimony
testy
tetanus
tete
tether
tetrachloride
tetrafluoride
tetragonal
tetrahedra
tetrahedral
tetrahedron
tetravalent
Teutonic
Texaco
22097
22098
22099
22100
22101
22102
22103


22104
22105
22106
22107
22108
22109
22110
the
Thea
theatric
Thebes
thee
theft
their


Thelma
them
thematic
theme
themselves
then
thence







>
>







21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
the
Thea
theatric
Thebes
thee
theft
their
theism
theist
Thelma
them
thematic
theme
themselves
then
thence
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
thereunder
thereupon
therewith
thermal
thermionic
thermistor
thermo
thermocouple
thermodynamic
thermoelastic
thermoelectric
Thermofax
thermometer
thermometric
thermometry
thermomigrate
thermonuclear
thermopile
thermoplastic
thermopower
thermosetting
thermostable
thermostat
thermostatic
thesaurus
these
theses
Theseus
thesis
thespian
theta







<
<
<
<

<
<
<
<
<
<
<
<
<
<

<







21950
21951
21952
21953
21954
21955
21956




21957










21958

21959
21960
21961
21962
21963
21964
21965
thereunder
thereupon
therewith
thermal
thermionic
thermistor
thermo




Thermofax










thermostat

thesaurus
these
theses
Theseus
thesis
thespian
theta
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
thigh
thimble
Thimbu
thin
thine
thing
think
thinning
thinnish
thiocyanate
thiouracil
third
thirst
thirsty
thirteen







<







21980
21981
21982
21983
21984
21985
21986

21987
21988
21989
21990
21991
21992
21993
thigh
thimble
Thimbu
thin
thine
thing
think

thinnish
thiocyanate
thiouracil
third
thirst
thirsty
thirteen
22227
22228
22229
22230
22231
22232
22233

22234
22235
22236
22237
22238
22239
22240
22241

22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284

22285
22286
22287
22288
22289
22290
22291



22292
22293
22294
22295
22296
22297
22298
those
thou
though
thought
thoughtful
thousand
thousandth

thrash
thread
threadbare
threat
threaten
three
threefold
threesome

thresh
threshold
threw
thrice
thrift
thrifty
thrill
thrips
thrive
throat
throaty
throb
throbbing
throes
thrombosis
throne
throng
throttle
through
throughout
throughput
throw
throwback
thrown
thrum
thrumming
thrush
thrust
Thruway
Thuban
thud
thudding
thug
thuggee
Thule
thulium
thumb
thumbnail
thump
thunder
thunderclap
thunderflower
thunderous

thunderstorm
Thurman
Thursday
thus
thwack
thwart
thy



thyratron
thyroglobulin
thyroid
thyroidal
thyronine
thyrotoxic
thyroxine







>








>












<












<





<











>







>
>
>







22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048

22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060

22061
22062
22063
22064
22065

22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
those
thou
though
thought
thoughtful
thousand
thousandth
thrall
thrash
thread
threadbare
threat
threaten
three
threefold
threesome
threonine
thresh
threshold
threw
thrice
thrift
thrifty
thrill
thrips
thrive
throat
throaty
throb

throes
thrombosis
throne
throng
throttle
through
throughout
throughput
throw
throwback
thrown
thrum

thrush
thrust
Thruway
Thuban
thud

thug
thuggee
Thule
thulium
thumb
thumbnail
thump
thunder
thunderclap
thunderflower
thunderous
thundershower
thunderstorm
Thurman
Thursday
thus
thwack
thwart
thy
thyme
thymine
thymus
thyratron
thyroglobulin
thyroid
thyroidal
thyronine
thyrotoxic
thyroxine
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
ticklish
tid
tidal
tidbit
tide
tideland
tidewater
tidings
tidy
tie
tied
Tientsin
tier
Tiffany
tift
tiger
tight
tighten







<


<







22104
22105
22106
22107
22108
22109
22110

22111
22112

22113
22114
22115
22116
22117
22118
22119
ticklish
tid
tidal
tidbit
tide
tideland
tidewater

tidy
tie

Tientsin
tier
Tiffany
tift
tiger
tight
tighten
22342
22343
22344
22345
22346
22347
22348

22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
timetable
timeworn
Timex
timid
Timon
timothy
tin

tincture
tinder
tine
tinfoil
tinge
tingle
tinker
tinkle
tinning
tinsel
tint
tintype
tiny
Tioga
tip
tipoff
Tipperary
tipping
tipple
tippy
tipsy
tiptoe
tirade
Tirana
tire







>








<








<







22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151

22152
22153
22154
22155
22156
22157
22158
22159

22160
22161
22162
22163
22164
22165
22166
timetable
timeworn
Timex
timid
Timon
timothy
tin
Tina
tincture
tinder
tine
tinfoil
tinge
tingle
tinker
tinkle

tinsel
tint
tintype
tiny
Tioga
tip
tipoff
Tipperary

tipple
tippy
tipsy
tiptoe
tirade
Tirana
tire
22382
22383
22384
22385
22386
22387
22388

22389
22390
22391
22392
22393
22394
22395

22396
22397
22398
22399
22400
22401

22402
22403
22404
22405
22406
22407
22408
titian
titillate
title
titmouse
titrate
titular
Titus

TNT
to
toad
toady
toast
tobacco
Tobago

toccata
today
today'll
Todd
toddle
toe

toenail
toffee
tofu
tog
together
togging
toggle







>







>






>







22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
titian
titillate
title
titmouse
titrate
titular
Titus
TN
TNT
to
toad
toady
toast
tobacco
Tobago
Toby
toccata
today
today'll
Todd
toddle
toe
TOEFL
toenail
toffee
tofu
tog
together
togging
toggle
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
tollhouse
Tolstoy
toluene
Tom
tomato
tomatoes
tomb
tomblike
tombstone
tome
Tomlinson
Tommie
tommy
tomography
tomorrow







<







22220
22221
22222
22223
22224
22225
22226

22227
22228
22229
22230
22231
22232
22233
tollhouse
Tolstoy
toluene
Tom
tomato
tomatoes
tomb

tombstone
tome
Tomlinson
Tommie
tommy
tomography
tomorrow
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
Topeka
topgallant
topic
topmost
topnotch
topocentric
topography
topology
topping
topple
topsoil
Topsy
tor
torah
torch
tore







|
|







22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
Topeka
topgallant
topic
topmost
topnotch
topocentric
topography
topologize
topology
topple
topsoil
Topsy
tor
torah
torch
tore
22558
22559
22560
22561
22562
22563
22564

22565
22566
22567
22568
22569
22570
22571
trafficking
trag
tragedian
tragedy
tragic
tragicomic
trail

trailside
train
trainee
trainman
trainmen
traipse
trait







>







22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
trafficking
trag
tragedian
tragedy
tragic
tragicomic
trail
trailhead
trailside
train
trainee
trainman
trainmen
traipse
trait
22599
22600
22601
22602
22603
22604
22605

22606
22607
22608
22609
22610
22611
22612
transfer
transferee
transference
transferor
transferral
transferred
transferring

transfix
transform
transformation
transfusable
transfuse
transfusion
transgress







>







22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
transfer
transferee
transference
transferor
transferral
transferred
transferring
transfinite
transfix
transform
transformation
transfusable
transfuse
transfusion
transgress
22647
22648
22649
22650
22651
22652
22653

22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
transpose
transposition
transship
transshipping
transversal
transverse
transvestite

trap
trapezium
trapezoid
trapezoidal
trapping
trash
trashy
Trastevere
trauma
traumatic
travail
travel







>




<







22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455

22456
22457
22458
22459
22460
22461
22462
transpose
transposition
transship
transshipping
transversal
transverse
transvestite
Transylvania
trap
trapezium
trapezoid
trapezoidal

trash
trashy
Trastevere
trauma
traumatic
travail
travel
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
treasure
treasury
treat
treatise
treaty
treble
tree
treelike
treetop
trefoil
trek
trekking
trellis
tremble
tremendous
tremor
tremulous
trench
trenchant







<



<







22479
22480
22481
22482
22483
22484
22485

22486
22487
22488

22489
22490
22491
22492
22493
22494
22495
treasure
treasury
treat
treatise
treaty
treble
tree

treetop
trefoil
trek

trellis
tremble
tremendous
tremor
tremulous
trench
trenchant
22712
22713
22714
22715
22716
22717
22718

22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732

22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
triad
trial
triangle
triangular
triangulate
Triangulum
Trianon

triatomic
tribal
tribe
tribesman
tribesmen
tribulate
tribunal
tribune
tributary
tribute
Trichinella
trichloroacetic
trichloroethane
trichrome

trick
trickery
trickle
trickster
tricky
trident
tridiagonal
tried
triennial
trifle
trifluouride
trig
trigonal
trigonometric
trigonometry
trigram
trill
trillion
trilobite
trilogy
trim
trimer
trimester
trimming
Trinidad
trinitarian
trinity
trinket
trio
triode
trioxide
trip
tripartite
tripe
triphenylphosphine
triple
triplet
Triplett
triplex
triplicate
tripod
tripoli
tripping
triptych
trisodium
Tristan
tristate
trisyllable
trite
tritium







>














>







<


|


<









<


















<







22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536

22537
22538
22539
22540
22541

22542
22543
22544
22545
22546
22547
22548
22549
22550

22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568

22569
22570
22571
22572
22573
22574
22575
triad
trial
triangle
triangular
triangulate
Triangulum
Trianon
Triassic
triatomic
tribal
tribe
tribesman
tribesmen
tribulate
tribunal
tribune
tributary
tribute
Trichinella
trichloroacetic
trichloroethane
trichrome
Triceratops
trick
trickery
trickle
trickster
tricky
trident
tridiagonal

triennial
trifle
trifluoride
trig
trigonal

trigonometry
trigram
trill
trillion
trilobite
trilogy
trim
trimer
trimester

Trinidad
trinitarian
trinity
trinket
trio
triode
trioxide
trip
tripartite
tripe
triphenylphosphine
triple
triplet
Triplett
triplex
triplicate
tripod
tripoli

triptych
trisodium
Tristan
tristate
trisyllable
trite
tritium
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
trophic
trophy
tropic
tropopause
troposphere
tropospheric
trot
trotting
trouble
troubleshoot
troublesome
trough
trounce
troupe
trouser
trout
Troutman
troy
truancy
truant
truce
truck
truculent
trudge
Trudy
true







<










<







22596
22597
22598
22599
22600
22601
22602

22603
22604
22605
22606
22607
22608
22609
22610
22611
22612

22613
22614
22615
22616
22617
22618
22619
trophic
trophy
tropic
tropopause
troposphere
tropospheric
trot

trouble
troubleshoot
troublesome
trough
trounce
troupe
trouser
trout
Troutman
troy

truant
truce
truck
truculent
trudge
Trudy
true
22842
22843
22844
22845
22846
22847
22848

22849
22850
22851
22852
22853
22854
22855
trustful
trustworthy
truth
truthful
TRW
try
trypsin

t's
tsar
tsarina
tsunami
TTL
TTY
tub







>







22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
trustful
trustworthy
truth
truthful
TRW
try
trypsin
trytophan
t's
tsar
tsarina
tsunami
TTL
TTY
tub
22887
22888
22889
22890
22891
22892
22893

22894


22895
22896
22897
22898
22899
22900
22901
tungstate
tungsten
tunic
Tunis
Tunisia
tunnel
tupelo

turban


turbinate
turbine
turbofan
turbojet
turbulent
turf
Turin







>

>
>







22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
tungstate
tungsten
tunic
Tunis
Tunisia
tunnel
tupelo
tuple
turban
turbid
turbidity
turbinate
turbine
turbofan
turbojet
turbulent
turf
Turin
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976

22977
22978
22979
22980
22981
22982
22983
twigging
twilight
twill
twin
twine
twinge
twinkle
twinning
twirl
twirly
twist
twisty
twit
twitch
twitchy
twitting
two
twofold
Twombly
twosome
TWX

Tyburn
tycoon
tying
Tyler
type
typeface
typescript







<







<





>







22751
22752
22753
22754
22755
22756
22757

22758
22759
22760
22761
22762
22763
22764

22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
twigging
twilight
twill
twin
twine
twinge
twinkle

twirl
twirly
twist
twisty
twit
twitch
twitchy

two
twofold
Twombly
twosome
TWX
TX
Tyburn
tycoon
tying
Tyler
type
typeface
typescript
22994
22995
22996
22997
22998
22999
23000

23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012

23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
typify
typo
typographer
typography
typology
tyrannic
tyrannicide

tyranny
tyrant
tyrosine
Tyson
u
ubiquitous
ubiquity
UCLA
Uganda
ugh
ugly
UK

Ukrainian
Ulan
ulcer
ulcerate
Ullman
Ulster
ulterior
ultimate
ultimatum
ultra
ultracentrifuge
ultraconservative
ultrafast
ultramarine
ultramodern
ultrashort
ultrasonic
ultrasound
ultrastructure
ultraviolet
Ulysses
umber
umbilical
umbilici
umbilicus
umbra
umbrage
umbrella
umpire
UN
unanimity
unanimous
unary
unbeknownst
unbidden
unchristian
uncle
uncouth
unction
under
underclassman
underclassmen







>












>










<
<
<
<
<
<
<
<
<
<














<







22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818










22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832

22833
22834
22835
22836
22837
22838
22839
typify
typo
typographer
typography
typology
tyrannic
tyrannicide
Tyrannosaurus
tyranny
tyrant
tyrosine
Tyson
u
ubiquitous
ubiquity
UCLA
Uganda
ugh
ugly
UK
Ukraine
Ukrainian
Ulan
ulcer
ulcerate
Ullman
Ulster
ulterior
ultimate
ultimatum
ultra










Ulysses
umber
umbilical
umbilici
umbilicus
umbra
umbrage
umbrella
umpire
UN
unanimity
unanimous
unary
unbeknownst

unchristian
uncle
uncouth
unction
under
underclassman
underclassmen
23068
23069
23070
23071
23072
23073
23074

23075
23076
23077
23078
23079
23080
23081
uniplex
unipolar
uniprocessor
unique
Uniroyal
unison
unit

unitarian
unitary
unite
unity
Univac
univalent
univariate







>







22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
uniplex
unipolar
uniprocessor
unique
Uniroyal
unison
unit
unital
unitarian
unitary
unite
unity
Univac
univalent
univariate
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
uphold
upholster
upholstery
upkeep
upland
uplift
upon
upper
upperclassman
upperclassmen
uppercut
uppermost
upraise
upright
uprise







<







22887
22888
22889
22890
22891
22892
22893

22894
22895
22896
22897
22898
22899
22900
uphold
upholster
upholstery
upkeep
upland
uplift
upon

upperclassman
upperclassmen
uppercut
uppermost
upraise
upright
uprise
23133
23134
23135
23136
23137
23138
23139

23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166

23167
23168

23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188

23189
23190
23191
23192
23193
23194
23195
23196
23197
23198

23199
23200
23201
23202

23203
23204
23205
23206
23207
23208
23209
uptake
Upton
uptown
uptrend
upturn
upward
upwind

urania
uranium
Uranus
uranyl
urban
Urbana
urbane
urbanite
urchin
urea
uremia
urethane
urethra
urge
urgency
urgent
urging
urinal
urinary
urine
Uris
urn
Ursa
Ursula
Ursuline
Uruguay
u's

us
USA

usable
USAF
usage
USC
USC&GS
USDA
use
useful
USGS
usher
USIA
USN
USPS
USSR
usual
usurer
usurious
usurp
usurpation
usury

Utah
utensil
uterine
Utica
utile
utilitarian
utility
utmost
utopia
utopian

utter
utterance
uttermost
v

vacant
vacate
vacationland
vaccinate
vaccine
vacillate
vacua







>














<

|










>


>




















>










>




>







22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939

22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
uptake
Upton
uptown
uptrend
upturn
upward
upwind
uracil
urania
uranium
Uranus
uranyl
urban
Urbana
urbane
urbanite
urchin
urea
uremia
urethane
urethra
urge

urgent
Uri
urinal
urinary
urine
Uris
urn
Ursa
Ursula
Ursuline
Uruguay
u's
U.S
us
USA
U.S.A
usable
USAF
usage
USC
USC&GS
USDA
use
useful
USGS
usher
USIA
USN
USPS
USSR
usual
usurer
usurious
usurp
usurpation
usury
UT
Utah
utensil
uterine
Utica
utile
utilitarian
utility
utmost
utopia
utopian
Utrecht
utter
utterance
uttermost
v
VA
vacant
vacate
vacationland
vaccinate
vaccine
vacillate
vacua
23232
23233
23234
23235
23236
23237
23238

23239
23240
23241
23242

23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255

23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275


23276

23277
23278
23279
23280
23281
23282
23283
Valery
valet
valeur
Valhalla
valiant
valid
validate

Valkyrie
Valletta
valley
Valois

valuate
value
valve
vamp
vampire
van
vanadium
Vance
Vancouver
vandal
Vandenberg
Vanderbilt
Vanderpoel

vanguard
vanilla
vanish
vanity
vanquish
vantage
variable
variac
Varian
variant
variate
variegate
variety
various
varistor
Varitype
varnish
vary
vascular
vase


vassal

vast
vat
Vatican
vaudeville
Vaudois
Vaughan
Vaughn







>




>













>




















>
>

>







23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
Valery
valet
valeur
Valhalla
valiant
valid
validate
valine
Valkyrie
Valletta
valley
Valois
Valparaiso
valuate
value
valve
vamp
vampire
van
vanadium
Vance
Vancouver
vandal
Vandenberg
Vanderbilt
Vanderpoel
vane
vanguard
vanilla
vanish
vanity
vanquish
vantage
variable
variac
Varian
variant
variate
variegate
variety
various
varistor
Varitype
varnish
vary
vascular
vase
vasectomy
Vasquez
vassal
Vassar
vast
vat
Vatican
vaudeville
Vaudois
Vaughan
Vaughn
23294
23295
23296
23297
23298
23299
23300

23301
23302
23303
23304
23305
23306
23307
vegetarian
vegetate
vehement
vehicle
vehicular
veil
vein

Velasquez
veldt
Vella
vellum
velocity
velours
velvet







>







23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
vegetarian
vegetate
vehement
vehicle
vehicular
veil
vein
velar
Velasquez
veldt
Vella
vellum
velocity
velours
velvet
23321
23322
23323
23324
23325
23326
23327

23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
vengeance
vengeful
venial
Venice
venison
venom
venomous

vent
ventilate
ventricle
venture
venturesome
venturi
Venus
Venusian
Vera
veracious
veracity
veranda
verandah
verb
verbal
verbatim
verbena
verbiage
verbose
verbosity
verdant
Verde
Verdi
verdict
verge
veridic
verify







>



















<







23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144

23145
23146
23147
23148
23149
23150
23151
vengeance
vengeful
venial
Venice
venison
venom
venomous
venous
vent
ventilate
ventricle
venture
venturesome
venturi
Venus
Venusian
Vera
veracious
veracity
veranda
verandah
verb
verbal
verbatim
verbena
verbiage
verbose

verdant
Verde
Verdi
verdict
verge
veridic
verify
23368
23369
23370
23371
23372
23373
23374

23375
23376
23377
23378
23379
23380
23381
Verne
vernier
Vernon
Verona
Veronica
versa
Versailles

versatile
verse
version
versus
vertebra
vertebrae
vertebral







>







23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
Verne
vernier
Vernon
Verona
Veronica
versa
Versailles
versatec
versatile
verse
version
versus
vertebra
vertebrae
vertebral
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
vestry
vet
vetch
veteran
veterinarian
veterinary
veto
vetting
vex
vexation
vexatious
vi
via
viaduct
vial
vibrant
vibrate
vibrato
viburnum
vicar
vicarious
vice
vicelike
viceroy
Vichy
vicinal
vicinity
vicious
vicissitude
Vicksburg
Vicky
victim
victor
Victoria
Victorian
victorious
victory
victrola
victual
Vida
video
videotape
vie
Vienna
Viennese
Vientiane
Viet
Vietnam
Vietnamese
view
viewpoint
vigil
vigilant
vigilante
vigilantism
vignette
vigorous
vii
viii
Viking
vile
vilify







<














<











<



















<







23195
23196
23197
23198
23199
23200
23201

23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215

23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226

23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245

23246
23247
23248
23249
23250
23251
23252
vestry
vet
vetch
veteran
veterinarian
veterinary
veto

vex
vexation
vexatious
vi
via
viaduct
vial
vibrant
vibrate
vibrato
viburnum
vicar
vicarious
vice

viceroy
Vichy
vicinal
vicinity
vicious
vicissitude
Vicksburg
Vicky
victim
victor
Victoria

victorious
victory
victrola
victual
Vida
video
videotape
vie
Vienna
Viennese
Vientiane
Viet
Vietnam
Vietnamese
view
viewpoint
vigil
vigilant
vigilante

vignette
vigorous
vii
viii
Viking
vile
vilify
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
violent
violet
violin
Virgil
virgin
virginal
Virginia
Virginian
Virgo
virgule
virile
virtual
virtue
virtuosi
virtuosity







<







23270
23271
23272
23273
23274
23275
23276

23277
23278
23279
23280
23281
23282
23283
violent
violet
violin
Virgil
virgin
virginal
Virginia

Virgo
virgule
virile
virtual
virtue
virtuosi
virtuosity
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
visceral
viscoelastic
viscometer
viscosity
viscount
viscous
vise
viselike
Vishnu
visible
Visigoth
vision
visionary
visit
visitation







<







23292
23293
23294
23295
23296
23297
23298

23299
23300
23301
23302
23303
23304
23305
visceral
viscoelastic
viscometer
viscosity
viscount
viscous
vise

Vishnu
visible
Visigoth
vision
visionary
visit
visitation
23591
23592
23593
23594
23595
23596
23597

23598
23599
23600
23601
23602
23603
23604
23605

23606
23607
23608
23609
23610
23611
23612
vouchsafe
Vought
vow
vowel
voyage
Vreeland
v's

Vulcan
vulgar
vulnerable
vulpine
vulture
vulturelike
vying
w

Waals
Wabash
WAC
wack
wacke
wacky
Waco







>





<


>







23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395

23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
vouchsafe
Vought
vow
vowel
voyage
Vreeland
v's
VT
Vulcan
vulgar
vulnerable
vulpine
vulture

vying
w
WA
Waals
Wabash
WAC
wack
wacke
wacky
Waco
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
wallboard
Waller
wallet
Wallis
wallop
wallow
wallpaper
Walls
wally
walnut
Walpole
walrus
Walsh
Walt
Walter
Walters
Waltham
Walton
waltz
wan
wand
wander
wane







<







<







23452
23453
23454
23455
23456
23457
23458

23459
23460
23461
23462
23463
23464
23465

23466
23467
23468
23469
23470
23471
23472
wallboard
Waller
wallet
Wallis
wallop
wallow
wallpaper

wally
walnut
Walpole
walrus
Walsh
Walt
Walter

Waltham
Walton
waltz
wan
wand
wander
wane
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709

23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
wardroom
ware
warehouse
warehouseman
warfare
warhead
Waring
warlike
warm
warmhearted
warmish
warmonger
warmth
warmup
warn
warp

warrant
warranty
warren
warring
warrior
Warsaw
wart
wartime
warty
Warwick
wary







<








>



<







23485
23486
23487
23488
23489
23490
23491

23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503

23504
23505
23506
23507
23508
23509
23510
wardroom
ware
warehouse
warehouseman
warfare
warhead
Waring

warm
warmhearted
warmish
warmonger
warmth
warmup
warn
warp
warplane
warrant
warranty
warren

warrior
Warsaw
wart
wartime
warty
Warwick
wary
23735
23736
23737
23738
23739
23740
23741

23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
wastage
waste
wastebasket
wasteful
wasteland
wastewater
wastrel

watch
watchband
watchdog
watchful
watchmake
watchman
watchmen
watchword
water
Waterbury
watercourse
waterfall
waterfront
Watergate
Waterhouse
waterline
Waterloo
Waterman
watermelon
waterproof
Waters
watershed
waterside
Watertown
waterway
watery
Watkins
Watson
watt
wattage
wattle
Watts
wave
waveform
wavefront
waveguide
wavelength
wavenumber
wavy







>




















<










<







23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552

23553
23554
23555
23556
23557
23558
23559
23560
23561
23562

23563
23564
23565
23566
23567
23568
23569
wastage
waste
wastebasket
wasteful
wasteland
wastewater
wastrel
Watanabe
watch
watchband
watchdog
watchful
watchmake
watchman
watchmen
watchword
water
Waterbury
watercourse
waterfall
waterfront
Watergate
Waterhouse
waterline
Waterloo
Waterman
watermelon
waterproof

watershed
waterside
Watertown
waterway
watery
Watkins
Watson
watt
wattage
wattle

wave
waveform
wavefront
waveguide
wavelength
wavenumber
wavy
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
weal
wealth
wealthy
wean
weapon
weaponry
wear
wearied
wearisome
weary
weasel
weather
weatherbeaten
weatherproof
weatherstrip
weatherstripping
weave
web
Webb
webbing
weber
Webster
WECo
we'd
wed
wedding
wedge
wedlock
Wednesday
wee
weed
weedy
week
weekday
weekend
Weeks
weep
Wehr
Wei
Weierstrass
weigh
weight
weighty







<











<





<









<







23584
23585
23586
23587
23588
23589
23590

23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601

23602
23603
23604
23605
23606

23607
23608
23609
23610
23611
23612
23613
23614
23615

23616
23617
23618
23619
23620
23621
23622
weal
wealth
wealthy
wean
weapon
weaponry
wear

wearisome
weary
weasel
weather
weatherbeaten
weatherproof
weatherstrip
weatherstripping
weave
web
Webb

weber
Webster
WECo
we'd
wed

wedge
wedlock
Wednesday
wee
weed
weedy
week
weekday
weekend

weep
Wehr
Wei
Weierstrass
weigh
weight
weighty
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
we'll
well
wellbeing
Weller
Welles
Wellesley
wellington
Wells
welsh
welt
Wendell
Wendy
went
wept
we're







<







23633
23634
23635
23636
23637
23638
23639

23640
23641
23642
23643
23644
23645
23646
we'll
well
wellbeing
Weller
Welles
Wellesley
wellington

welsh
welt
Wendell
Wendy
went
wept
we're
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
Westfield
Westinghouse
Westminster
Weston
westward
wet
wetland
wetting
we've
Weyerhauser
whack
whale
Whalen
wham
whamming
wharf
Wharton
wharves
what
what'd
whatever
Whatley







<






<







23660
23661
23662
23663
23664
23665
23666

23667
23668
23669
23670
23671
23672

23673
23674
23675
23676
23677
23678
23679
Westfield
Westinghouse
Westminster
Weston
westward
wet
wetland

we've
Weyerhauser
whack
whale
Whalen
wham

wharf
Wharton
wharves
what
what'd
whatever
Whatley
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
where're
wheresoever
whereupon
wherever
wherewith
whet
whether
whetting
which
whichever
whiff
whig
while
whim
whimper
whimsey
whimsic
whine
whinny
whip
whiplash
Whippany
whippet
whipping
Whipple
whipsaw
whir
whirl
whirligig
whirlpool
whirlwind
whirring
whisk
whisper
whistle
whistleable
whit
Whitaker
Whitcomb







<















<







<







23710
23711
23712
23713
23714
23715
23716

23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731

23732
23733
23734
23735
23736
23737
23738

23739
23740
23741
23742
23743
23744
23745
where're
wheresoever
whereupon
wherever
wherewith
whet
whether

which
whichever
whiff
whig
while
whim
whimper
whimsey
whimsic
whine
whinny
whip
whiplash
Whippany
whippet

Whipple
whipsaw
whir
whirl
whirligig
whirlpool
whirlwind

whisk
whisper
whistle
whistleable
whit
Whitaker
Whitcomb
23974
23975
23976
23977
23978
23979
23980

23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003

24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024

24025

24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040

24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078

24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
whitewash
whither
Whitlock
Whitman
Whitney
Whittaker
Whittier

whiz
whizzing
who
whoa
who'd
whoever
whole
wholehearted
wholesale
wholesome
who'll
wholly
whom
whomsoever
whoop
whoosh
whop
whopping
whore
whose
whosoever
whup
why

Wichita
wick
wicket
wide
widen
widespread
widgeon
widget
widow
widowhood
width
widthwise
wield
wiener
Wier
wife
wig
wigging
Wiggins
wiggle
wiggly

wigmake

Wilbur
Wilcox
wild
wildcat
wildcatter
wilderness
wildfire
wildlife
wile
Wiley
Wilfred
wilful
Wilhelm
Wilhelmina
Wilkes

Wilkins
Wilkinson
will
Willa
Willard
willful
William
Williams
Williamsburg
Williamson
Willie
Willis
Willoughby
willow
willowy
Wills
Wilma
Wilmington
Wilshire
Wilson
Wilsonian
wilt
wily
win
wince
winch
Winchester
wind
windbag
windbreak
windfall
windmill
window
windowpane
windowsill
windshield
Windsor
windstorm

windup
windward
windy
wine
winemake
winemaster
winery
wineskin
Winfield
wing
wingback
wingman
wingmen
wingspan
wingtip
Winifred
wink
winkle
Winnetka
Winnie
winning
Winnipeg
Winnipesaukee
winnow
wino
Winslow
winsome
Winston
winter
Winters
wintertime
Winthrop
wintry
winy
wipe
wire
wireman







>

















<





>









<











>

>















>







<







<




<

















>




















<








<







23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777

23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792

23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829

23830
23831
23832
23833
23834
23835
23836

23837
23838
23839
23840

23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878

23879
23880
23881
23882
23883
23884
23885
23886

23887
23888
23889
23890
23891
23892
23893
whitewash
whither
Whitlock
Whitman
Whitney
Whittaker
Whittier
whittle
whiz
whizzing
who
whoa
who'd
whoever
whole
wholehearted
wholesale
wholesome
who'll
wholly
whom
whomsoever
whoop
whoosh
whop

whore
whose
whosoever
whup
why
WI
Wichita
wick
wicket
wide
widen
widespread
widgeon
widget
widow

width
widthwise
wield
wiener
Wier
wife
wig
wigging
Wiggins
wiggle
wiggly
Wightman
wigmake
wigwam
Wilbur
Wilcox
wild
wildcat
wildcatter
wilderness
wildfire
wildlife
wile
Wiley
Wilfred
wilful
Wilhelm
Wilhelmina
Wilkes
Wilkie
Wilkins
Wilkinson
will
Willa
Willard
willful
William

Williamsburg
Williamson
Willie
Willis
Willoughby
willow
willowy

Wilma
Wilmington
Wilshire
Wilson

wilt
wily
win
wince
winch
Winchester
wind
windbag
windbreak
windfall
windmill
window
windowpane
windowsill
windshield
Windsor
windstorm
windsurf
windup
windward
windy
wine
winemake
winemaster
winery
wineskin
Winfield
wing
wingback
wingman
wingmen
wingspan
wingtip
Winifred
wink
winkle
Winnetka
Winnie

Winnipeg
Winnipesaukee
winnow
wino
Winslow
winsome
Winston
winter

wintertime
Winthrop
wintry
winy
wipe
wire
wireman
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
within
without
withstand
withstood
withy
witness
Witt
witting
witty
wive
wizard
wobble
woe
woebegone
woeful
wok
woke
Wolcott
wold
wolf
Wolfe
Wolff
Wolfgang
wolfish
wolve
woman
womanhood
womb
women
won
wonder
wonderful
wonderland
wondrous
Wong







<


















|
|







23922
23923
23924
23925
23926
23927
23928

23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
within
without
withstand
withstood
withy
witness
Witt

witty
wive
wizard
wobble
woe
woebegone
woeful
wok
woke
Wolcott
wold
wolf
Wolfe
Wolff
Wolfgang
wolfish
wolve
woman
womb
wombat
women
won
wonder
wonderful
wonderland
wondrous
Wong
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217

24218
24219
24220
24221
24222
24223
24224
24225

24226
24227
24228

24229
24230
24231
24232
24233
24234
24235
woodhen
woodland
Woodlawn
woodlot
woodpeck
woodrow
woodruff
Woods
woodshed
woodside
woodward
woodwind
woodwork
woody
woodyard
wool
woolen
woolgather
Woolworth
Wooster
wop
Worcester
word
Wordsworth
wordy
wore
work
workbench

workday
workhorse
workload
workman
workmanlike
workmen
workout
workpiece

worksheet
workshop
workspace

worktable
world
worldwide
worm
wormy
worn
worrisome







<








<











>




<



>



>







23967
23968
23969
23970
23971
23972
23973

23974
23975
23976
23977
23978
23979
23980
23981

23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997

23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
woodhen
woodland
Woodlawn
woodlot
woodpeck
woodrow
woodruff

woodshed
woodside
woodward
woodwind
woodwork
woody
woodyard
wool

woolgather
Woolworth
Wooster
wop
Worcester
word
Wordsworth
wordy
wore
work
workbench
workbook
workday
workhorse
workload
workman

workmen
workout
workpiece
workplace
worksheet
workshop
workspace
workstation
worktable
world
worldwide
worm
wormy
worn
worrisome
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
wove
woven
wow
wrack
wraith
wrangle
wrap
wrapping
wrapup
wrath
wrathful
wreak
wreath
wreathe
wreck







<







24027
24028
24029
24030
24031
24032
24033

24034
24035
24036
24037
24038
24039
24040
wove
woven
wow
wrack
wraith
wrangle
wrap

wrapup
wrath
wrathful
wreak
wreath
wreathe
wreck
24287
24288
24289
24290
24291
24292
24293


24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
Wronskian
wrote
wrought
wry
w's
Wu
Wuhan


Wyandotte
Wyatt
Wyeth
Wylie
Wyman
Wyner
wynn
Wyoming
x
Xavier
xenon
xenophobia
xerography
Xerox
Xerxes
xi
x's
xylem
xylene
xylophone
y







>
>













|







24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
Wronskian
wrote
wrought
wry
w's
Wu
Wuhan
WV
WY
Wyandotte
Wyatt
Wyeth
Wylie
Wyman
Wyner
wynn
Wyoming
x
Xavier
xenon
xenophobia
xerography
xerox
Xerxes
xi
x's
xylem
xylene
xylophone
y
24351
24352
24353
24354
24355
24356
24357

24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376


24377
24378
24379
24380
24381
24382
24383
yeast
yeasty
Yeats
yell
yellow
yellowish
Yellowknife

yelp
Yemen
yen
yeoman
yeomanry
yeshiva
yesterday
yesteryear
yet
Yiddish
yield
yin
yip
yipping
YMCA
yodel
Yoder
yoga
yogi


yoke
yokel
Yokohama
Yokuts
yolk
yon
yond







>



















>
>







24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
yeast
yeasty
Yeats
yell
yellow
yellowish
Yellowknife
Yellowstone
yelp
Yemen
yen
yeoman
yeomanry
yeshiva
yesterday
yesteryear
yet
Yiddish
yield
yin
yip
yipping
YMCA
yodel
Yoder
yoga
yogi
yoghurt
yogurt
yoke
yokel
Yokohama
Yokuts
yolk
yon
yond
24404
24405
24406
24407
24408
24409
24410

24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423

24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
yow
Ypsilanti
y's
ytterbium
yttrium
Yucatan
yucca

Yugoslav
Yugoslavia
yuh
Yuki
Yukon
yule
Yves
Yvette
YWCA
z
Zachary
zag
zagging

Zaire
Zambia
Zan
Zanzibar
zap
zapping
zeal
Zealand
zealot
zealous
zebra
Zeiss
Zellerbach







>













>





|







24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
yow
Ypsilanti
y's
ytterbium
yttrium
Yucatan
yucca
yuck
Yugoslav
Yugoslavia
yuh
Yuki
Yukon
yule
Yves
Yvette
YWCA
z
Zachary
zag
zagging
Zagreb
Zaire
Zambia
Zan
Zanzibar
zap
zazen
zeal
Zealand
zealot
zealous
zebra
Zeiss
Zellerbach
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470

24471
24472
24473
24474

24475

zigzag
zigzagging
zilch
Zimmerman
zinc
zing
Zion
Zionism
zip
zipping
zircon
zirconium
zloty
zodiac
zodiacal
Zoe
Zomba
zombie
zone
zoo
zoology
zoom

Zoroaster
Zoroastrian
zounds
z's

Zurich








<

<












>




>

>
24232
24233
24234
24235
24236
24237
24238

24239

24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
zigzag
zigzagging
zilch
Zimmerman
zinc
zing
Zion

zip

zircon
zirconium
zloty
zodiac
zodiacal
Zoe
Zomba
zombie
zone
zoo
zoology
zoom
Zorn
Zoroaster
Zoroastrian
zounds
z's
zucchini
Zurich
zygote

Changes to share/man/man5/passwd.5.

1
2
3
4
5
6
7
8
.\"	@(#)passwd.5	6.1 (Berkeley) 05/15/85
.\"
.TH PASSWD 5  ""
.AT 3
.SH NAME
passwd \- password file
.SH DESCRIPTION
.I Passwd
|







1
2
3
4
5
6
7
8
.\"	@(#)passwd.5	6.2 (Berkeley) 01/08/86
.\"
.TH PASSWD 5  ""
.AT 3
.SH NAME
passwd \- password file
.SH DESCRIPTION
.I Passwd
62
63
64
65
66
67
68
69
70
71
does the necessary locking.
.SH FILES
/etc/passwd
.SH "SEE ALSO"
getpwent(3), login(1), crypt(3), passwd(1), group(5), chfn(1), finger(1),
vipw(8), adduser(8)
.SH BUGS
A binary indexed file format should be available for fast access.
.PP
User information (name, office, etc.) should be stored elsewhere.







<
<

62
63
64
65
66
67
68


69
does the necessary locking.
.SH FILES
/etc/passwd
.SH "SEE ALSO"
getpwent(3), login(1), crypt(3), passwd(1), group(5), chfn(1), finger(1),
vipw(8), adduser(8)
.SH BUGS


User information (name, office, etc.) should be stored elsewhere.

Added share/man/man5/resolver.5.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.\"	@(#)resolver.5	5.2 (Berkeley) 01/07/86
.\"
.TH RESOLVER 5 "1 January 1986"
.UC 4
.SH NAME
resolver configuration file
.SH DESCRIPTION
.LP
The resolver configuration file contains information that is read
by the resolver routines the first time they are invoked in a process.
The file is designed to be human readable and contains a list of
name-value pairs which provide various types of resolver information.
.LP
The different configuration options are:
.TP
\fBnameserver\fP
followed by the Internet address (in dot notation) of a nameserver
that the resolver should query.  At least one nameserver should be
listed.  Up to MAXNS (currently 3) nameservers may be listed, in which
case the resolver library queries tries them in the order listed.
(The algorithm used is to try a nameserver, and if the query times out,
try the next, until out of nameservers, then repeat trying all the nameservers
until a maximum number of retries has been made).
.TP
\fBdomain\fP
followed by a domain name, which is
the default domain to append to names which do not have a dot in them.
This defaults to empty (the root domain).
.LP
The name value pair must appear on a single line, and the keyword
(e.g. \fBnameserver\fP) must start the line.  The value follows
the keyword, separated by whitespace.
.SH FILES
.I /etc/resolv.conf
.SH SEE ALSO
gethostent(3n), resolver(3), named(8)

Added share/me/letterhead.me.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.nr _0 \n(c.
.\" This file defines the local letterhead.  It should be changed as
.\" necessary for your organization.
.\" This version prints the U.C. letterhead, complete with seal.
.\" Unfortunately, it assumes that you have ditroff and the seal font.
.\"
.\"	@(#)letterhead.me	2.2		01/09/86
.\"	%beginstrip%
.nr xx \n(.d
.nr xy \n(.u
.nr xz \n(.f
.lp
.rs
.nr xw \n(.s
.nf
.ie "\*(.T"ip" \
.	ft R
.el \
.	ft cr
.ps 12
.vs 0.14i
.in 0
.po 0.4i
.sp |0.5i
UNIVERSITY OF CALIFORNIA, BERKELEY
.sp 0.3i-1v
.ps 7
\D't 0.013i'\D'l 4.5i 0'\h'0.83i'\D'l 1.85i 0'
.sp 0.13i-1v
\!s5
\D't 0.024i'\|BERKELEY \v'-0.035i'\D'l 0 0'\v'0.035i' DAVIS \v'-0.035i'\D'l 0 0'\v'0.035i' IRVINE \v'-0.035i'\D'l 0 0'\v'0.035i' LOS ANGELES \v'-0.035i'\D'l 0 0'\v'0.035i' RIVERSIDE \v'-0.035i'\D'l 0 0'\v'0.035i' SAN DIEGO \v'-0.035i'\D'l 0 0'\v'0.035i' SAN FRANCISCO\h'|4.9i'\u\f(slseal\fP\h'|5.475i'\dSANTA BARBARA \v'-0.035i'\D'l 0 0'\v'0.035i' SANTA CRUZ
.sp 0.07i-1v
\D't 0.013i'\D'l 4.5i 0'\h'0.83i'\D'l 1.85i 0'
.sp 0.5i-1v
\|COLLEGE OF ENGINEERING\h'|4.1i'BERKELEY, CALIFORNIA  94720
\|DEPARTMENT OF ELECTRICAL ENGINEERING
\0\0AND COMPUTER SCIENCES\D't 3u'
\|COMPUTER SCIENCE DIVISION
.ft \n(xz
.ps \n(xw
.if "\$1"d" \
\{\
.	sp 4p
\h'|4.1i'\*(td
.\}
.if \n(xy .fi
.ie \n(xx>\n(.d \
.	sp |\n(xxu
.el .sp 0.3i
.vs
.in
.po
.nr c. \n(_0

Changes to share/me/tmac.orig_me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.nr _0 \n(.c
.\"**********************************************************************
.\"*									*
.\"*	******  - M E   N R O F F / T R O F F   M A C R O S  ******	*
.\"*									*
.\"*	Produced for your edification and enjoyment by:			*
.\"*		Eric Allman						*
.\"*		Electronics Research Laboratory				*
.\"*		U.C. Berkeley.						*
.\"*	current address:						*
.\"*		Britton-Lee, Inc.					*
.\"*		1919 Addison Street Suite 304				*
.\"*		Berkeley, California  94704				*
.\"*									*
.\"*	VERSION 2.23	First Release: 11 Sept 1978			*
.\"*	See file \*(||/revisions for revision history			*
.\"*									*
.\"*	Documentation is available.					*
.\"*									*
.\"**********************************************************************
.\"
.\"	@(#)tmac.orig_me	2.23	06/23/85
.\"	%beginstrip%
.\"
.\"	Code on .de commands:
.\"		***	a user interface macro.
.\"		&&&	a user interface macro which is redefined
.\"			when used to be the real thing.
.\"		$$$	a macro which may be redefined by the user











|


|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.nr _0 \n(.c
.\"**********************************************************************
.\"*									*
.\"*	******  - M E   N R O F F / T R O F F   M A C R O S  ******	*
.\"*									*
.\"*	Produced for your edification and enjoyment by:			*
.\"*		Eric Allman						*
.\"*		Electronics Research Laboratory				*
.\"*		U.C. Berkeley.						*
.\"*	current address:						*
.\"*		Britton-Lee, Inc.					*
.\"*		1919 Addison Street Suite 105				*
.\"*		Berkeley, California  94704				*
.\"*									*
.\"*	VERSION 2.24	First Release: 11 Sept 1978			*
.\"*	See file \*(||/revisions for revision history			*
.\"*									*
.\"*	Documentation is available.					*
.\"*									*
.\"**********************************************************************
.\"
.\"	@(#)tmac.orig_me	2.24	01/07/86
.\"	%beginstrip%
.\"
.\"	Code on .de commands:
.\"		***	a user interface macro.
.\"		&&&	a user interface macro which is redefined
.\"			when used to be the real thing.
.\"		$$$	a macro which may be redefined by the user
710
711
712
713
714
715
716



717
718
719
720
721
722



723
724
725
726
727
728



729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748






















































749
750
751
752
753
754
755
.de )l			\" *** end list
.br
.ev
.sp \\n(bsu+\\n(.Lv-1v
.nr ?k 0
..
.\"		*** PREPROCESSOR SUPPORT ***



.de EQ			\" &&& begin equation
.rn EQ @T
.so \\*(||/eqn.me
.EQ \\$1 \\$2
.rm @T
..



.de TS			\" &&& begin table
.rn TS @W
.so \\*(||/tbl.me
.TS \\$1 \\$2
.rm @W
..



.de ]-			\" &&& initialize reference
.rn ]- @]
.so \\*(||/refer.me
.]-
.rm @]
..
.de ]<			\" &&& initialize reference
.rn ]< @]
.so \\*(||/refer.me
.]<
.rm @]
..
.if n .ds [. " [
.if t .ds [. \s-2\v'-.4m'\f1
.if n .ds .] ]
.if t .ds .] \v'.4m'\s+2\fP
.if n .ds <. "
.if t .ds <. .
.if n .ds >. .
.if t .ds >. "






















































.\"		*** FONT AIDS ***
.de sz			\" *** set point size and vertical spacing
.ps \\$1
.vs \\n(.su*\\n($ru		\" default vs at pointsize + 20%
.bd S B \\n(.su/3u
..
.de r			\" *** enter roman font







>
>
>






>
>
>






>
>
>




















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
.de )l			\" *** end list
.br
.ev
.sp \\n(bsu+\\n(.Lv-1v
.nr ?k 0
..
.\"		*** PREPROCESSOR SUPPORT ***
.\"
.\"	EQN
.\"
.de EQ			\" &&& begin equation
.rn EQ @T
.so \\*(||/eqn.me
.EQ \\$1 \\$2
.rm @T
..
.\"
.\"	TBL
.\"
.de TS			\" &&& begin table
.rn TS @W
.so \\*(||/tbl.me
.TS \\$1 \\$2
.rm @W
..
.\"
.\"	REFER
.\"
.de ]-			\" &&& initialize reference
.rn ]- @]
.so \\*(||/refer.me
.]-
.rm @]
..
.de ]<			\" &&& initialize reference
.rn ]< @]
.so \\*(||/refer.me
.]<
.rm @]
..
.if n .ds [. " [
.if t .ds [. \s-2\v'-.4m'\f1
.if n .ds .] ]
.if t .ds .] \v'.4m'\s+2\fP
.if n .ds <. "
.if t .ds <. .
.if n .ds >. .
.if t .ds >. "
.\"
.\"	IDEAL
.\"
.de IS			\" *** start ideal picture
.nr g7 \\n(.u
.ls 1
..
.de IF
.if \\n(g7 .fi
.ls
..
.de IE			\" *** end ideal picture
.if \\n(g7 .fi
.ls
..
.\"
.\"	PIC
.\"
.de PS			\" *** start picture: $1=height, $2=width in units
.if t \
.	sp 0.3
.in (\\n(.lu-\\$2u)/2u
.ne \\$1u
.nr g7 \\n(.u
.ls 1
..
.de PE			\" *** end picture
.ls
.in
.if \\n(g7 .fi
.if t .sp .6
..
.\"
.\"	GREMLIN
.\"
.de GS			\" *** start gremlin picture
.nr g7 (\\n(.lu-\\n(g1u)/2u
.if "\\$1"L" .nr g7 \\n(.iu
.if "\\$1"R" .nr g7 \\n(.lu-\\n(g1u
.in \\n(g7u
.nr g7 \\n(.u
.ls 1
.nf
.ne \\n(g2u
..
.de GE			\" *** end gremlin picture
.GF
.if t .sp .6
..
.de GF			\" *** finish gremlin picture; stay at top
.ls
.in
.if \\n(g7 .fi
..
.\"		*** FONT AIDS ***
.de sz			\" *** set point size and vertical spacing
.ps \\$1
.vs \\n(.su*\\n($ru		\" default vs at pointsize + 20%
.bd S B \\n(.su/3u
..
.de r			\" *** enter roman font
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
\&\\$1\l'|0\(ul'\\$2
..
.de q			\" *** enter quoted word
\&\\*(lq\\$1\\*(rq\\$2
..
.de bi			\" *** enter word in bold italics
.ft 2
.ie t \&\k~\\$1\h'|\\n~u+(\\n(.su/3u)'\\$1\fP\\$2
.el \&\\$1\fP\\$2
..
.de bx			\" *** enter boxed word
.ie \\n($T \&\f2\\$1\fP\\$2
.el \k~\(br\|\\$1\|\(br\l'|\\n~u\(rn'\l'|\\n~u\(ul'\^\\$2
..
.de sm			\" *** print in smaller font







|







847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
\&\\$1\l'|0\(ul'\\$2
..
.de q			\" *** enter quoted word
\&\\*(lq\\$1\\*(rq\\$2
..
.de bi			\" *** enter word in bold italics
.ft 2
.ie t \&\k~\\$1\h'|\\n~u+(\\w' 'u/4u)'\\$1\fP\\$2
.el \&\\$1\fP\\$2
..
.de bx			\" *** enter boxed word
.ie \\n($T \&\f2\\$1\fP\\$2
.el \k~\(br\|\\$1\|\(br\l'|\\n~u\(rn'\l'|\\n~u\(ul'\^\\$2
..
.de sm			\" *** print in smaller font
954
955
956
957
958
959
960



961
962
963
964
965
966
967
.ac "\\$1" "\\$2"
.rm @T
..
.de lo			\" *** pull in the set of local macros
.\" all these macros should be named "*X", where X is any letter
.so \\*(||/local.me
.rm lo



..
.\"		*** DATES ***
.if \n(mo=1 .ds mo January
.if \n(mo=2 .ds mo February
.if \n(mo=3 .ds mo March
.if \n(mo=4 .ds mo April
.if \n(mo=5 .ds mo May







>
>
>







1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
.ac "\\$1" "\\$2"
.rm @T
..
.de lo			\" *** pull in the set of local macros
.\" all these macros should be named "*X", where X is any letter
.so \\*(||/local.me
.rm lo
..
.de lh			\" *** letterhead
.so \\*(||/letterhead.me
..
.\"		*** DATES ***
.if \n(mo=1 .ds mo January
.if \n(mo=2 .ds mo February
.if \n(mo=3 .ds mo March
.if \n(mo=4 .ds mo April
.if \n(mo=5 .ds mo May

Changes to sys/conf/newvers.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh -
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)newvers.sh	1.6 (Berkeley) 08/29/85
#
if [ ! -r version ]
then
	echo 0 > version
fi
touch version
v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date`
( echo "char sccs[] = \"@(#)4.3 BSD #${v}: ${t} (${u}@${h}:${d})\\n\";" ;
  echo "char version[] = \"4.3 BSD UNIX #${v}: ${t}\\n    ${u}@${h}:${d}\\n\";"
) > vers.c
echo `expr ${v} + 1` > version






|



|



|
|

|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh -
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)newvers.sh	1.7 (Berkeley) 01/09/86
#
if [ ! -r version ]
then
	/bin/echo 0 > version
fi
touch version
v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date`
( /bin/echo "char sccs[] = \"@(#)4.3 BSD #${v}: ${t} (${u}@${h}:${d})\\n\";" ;
  /bin/echo "char version[] = \"4.3 BSD UNIX #${v}: ${t}\\n    ${u}@${h}:${d}\\n\";"
) > vers.c
/bin/echo `expr ${v} + 1` > version

Changes to sys/kern/uipc_domain.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)uipc_domain.c	6.8 (Berkeley) 09/16/85
 */

#include "param.h"
#include "socket.h"
#include "protosw.h"
#include "domain.h"
#include "time.h"





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)uipc_domain.c	6.9 (Berkeley) 01/08/86
 */

#include "param.h"
#include "socket.h"
#include "protosw.h"
#include "domain.h"
#include "time.h"
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
domaininit()
{
	register struct domain *dp;
	register struct protosw *pr;

#ifndef lint
	ADDDOMAIN(unix);
#if defined(INET) || defined(BBNNET)
	ADDDOMAIN(inet);
#endif
#ifdef NS
	ADDDOMAIN(ns);
#endif
#ifdef PUP
	ADDDOMAIN(pup);
#endif
#include "imp.h"
#if NIMP > 0
	ADDDOMAIN(imp);
#endif
#endif

	for (dp = domains; dp; dp = dp->dom_next) {







|





<
<
<







22
23
24
25
26
27
28
29
30
31
32
33
34



35
36
37
38
39
40
41
domaininit()
{
	register struct domain *dp;
	register struct protosw *pr;

#ifndef lint
	ADDDOMAIN(unix);
#ifdef INET
	ADDDOMAIN(inet);
#endif
#ifdef NS
	ADDDOMAIN(ns);
#endif



#include "imp.h"
#if NIMP > 0
	ADDDOMAIN(imp);
#endif
#endif

	for (dp = domains; dp; dp = dp->dom_next) {

Changes to sys/kern/uipc_socket.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)uipc_socket.c	6.19 (Berkeley) 12/19/85
 */

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "proc.h"





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)uipc_socket.c	6.20 (Berkeley) 01/09/86
 */

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "proc.h"
531
532
533
534
535
536
537

538
539

540
541
542
543
544
545
546
			panic("receive 3");
		len = uio->uio_resid;
		so->so_state &= ~SS_RCVATMARK;
		if (tomark && len > tomark)
			len = tomark;
		if (len > m->m_len - moff)
			len = m->m_len - moff;

		so->so_rcv.sb_mb = m;
		m->m_act = nextrecord;

		splx(s);
		error =
		    uiomove(mtod(m, caddr_t) + moff, (int)len, UIO_READ, uio);
		s = splnet();
		if (len == m->m_len - moff) {
			if (flags & MSG_PEEK) {
				m = m->m_next;







>
|
|
>







531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
			panic("receive 3");
		len = uio->uio_resid;
		so->so_state &= ~SS_RCVATMARK;
		if (tomark && len > tomark)
			len = tomark;
		if (len > m->m_len - moff)
			len = m->m_len - moff;
		if ((flags & MSG_PEEK) == 0) {
			so->so_rcv.sb_mb = m;
			m->m_act = nextrecord;
		}
		splx(s);
		error =
		    uiomove(mtod(m, caddr_t) + moff, (int)len, UIO_READ, uio);
		s = splnet();
		if (len == m->m_len - moff) {
			if (flags & MSG_PEEK) {
				m = m->m_next;

Changes to sys/netinet/tcp_input.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)tcp_input.c	6.17 (Berkeley) 12/19/85
 */

#include "param.h"
#include "systm.h"
#include "mbuf.h"
#include "protosw.h"
#include "socket.h"





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)tcp_input.c	6.18 (Berkeley) 01/07/86
 */

#include "param.h"
#include "systm.h"
#include "mbuf.h"
#include "protosw.h"
#include "socket.h"
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
		  bcopy(op+om->m_len, op,
		   (unsigned)(m->m_len-sizeof (struct tcpiphdr)));
		}
	}
	tiflags = ti->ti_flags;

	/*
	 * Drop TCP and IP headers.
	 */
	off += sizeof (struct ip);
	m->m_off += off;
	m->m_len -= off;

	/*
	 * Convert TCP protocol specific fields to host format.
	 */
	ti->ti_seq = ntohl(ti->ti_seq);
	ti->ti_ack = ntohl(ti->ti_ack);
	ti->ti_win = ntohs(ti->ti_win);







|

<
|
|







241
242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
257
258
		  bcopy(op+om->m_len, op,
		   (unsigned)(m->m_len-sizeof (struct tcpiphdr)));
		}
	}
	tiflags = ti->ti_flags;

	/*
	 * Drop TCP and IP headers; TCP options were dropped above.
	 */

	m->m_off += sizeof(struct tcpiphdr);
	m->m_len -= sizeof(struct tcpiphdr);

	/*
	 * Convert TCP protocol specific fields to host format.
	 */
	ti->ti_seq = ntohl(ti->ti_seq);
	ti->ti_ack = ntohl(ti->ti_ack);
	ti->ti_win = ntohs(ti->ti_win);

Changes to sys/sys/fcntl.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)fcntl.h	5.1 (Berkeley) 05/30/85
 */

/*
 * Flag values accessible to open(2) and fcntl(2)
 *  (The first three can only be set by open)
 */
#define	O_RDONLY	0
#define	O_WRONLY	1
#define	O_RDWR		2
#define	O_NDELAY	FNDELAY	/* Non-blocking I/O */

#define	O_APPEND	FAPPEND	/* append (writes guaranteed at the end) */
#define	O_CREAT		FCREAT	/* open with file create */
#define	O_TRUNC		FTRUNC	/* open with truncation */
#define	O_EXCL		FEXCL	/* error on create if file exists */

#ifndef	F_DUPFD
/* fcntl(2) requests */
#define	F_DUPFD	0	/* Duplicate fildes */
#define	F_GETFD	1	/* Get fildes flags */
#define	F_SETFD	2	/* Set fildes flags */
#define	F_GETFL	3	/* Get file flags */





|



|
|

|
|
|
|
>
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)fcntl.h	5.2 (Berkeley) 01/08/86
 */

/*
 * Flag values accessible to open(2) and fcntl(2)-- copied from
 * <sys/file.h>.  (The first three can only be set by open.)
 */
#define	O_RDONLY	000		/* open for reading */
#define	O_WRONLY	001		/* open for writing */
#define	O_RDWR		002		/* open for read & write */
#define	O_NDELAY	FNDELAY		/* non-blocking open */
					/* really non-blocking I/O for fcntl */
#define	O_APPEND	FAPPEND		/* append on each write */
#define	O_CREAT		FCREAT		/* open with file create */
#define	O_TRUNC		FTRUNC		/* open with truncation */
#define	O_EXCL		FEXCL		/* error on create if file exists */

#ifndef	F_DUPFD
/* fcntl(2) requests */
#define	F_DUPFD	0	/* Duplicate fildes */
#define	F_GETFD	1	/* Get fildes flags */
#define	F_SETFD	2	/* Set fildes flags */
#define	F_GETFL	3	/* Get file flags */

Changes to sys/sys/systm.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)systm.h	6.3 (Berkeley) 06/08/85
 */

/*
 * Random set of variables
 * used by more than one
 * routine.
 */





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)systm.h	6.4 (Berkeley) 01/05/86
 */

/*
 * Random set of variables
 * used by more than one
 * routine.
 */
82
83
84
85
86
87
88
89
90
int	selwait;

extern	char vmmap[];		/* poor name! */

/* casts to keep lint happy */
#define	insque(q,p)	_insque((caddr_t)q,(caddr_t)p)
#define	remque(q)	_remque((caddr_t)q)
#define	queue(q,p)	_queue((caddr_t)q,(caddr_t)p)
#define	dequeue(q)	_dequeue((caddr_t)q)







<
<
82
83
84
85
86
87
88


int	selwait;

extern	char vmmap[];		/* poor name! */

/* casts to keep lint happy */
#define	insque(q,p)	_insque((caddr_t)q,(caddr_t)p)
#define	remque(q)	_remque((caddr_t)q)


Changes to sys/tahoe/conf/Makefile.tahoe.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56





57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#	makefile.tahoe	1.2	85/04/22
#	makefile.tahoe	6.3	9/25/83
#
# Makefile for 4.2 BSD
#
# This makefile is constructed from a machine description:
#	config machine
# Most changes should be made in the machine description
#	/sys/conf/``machineid''
# after which you should do
#	 config machineid
# Generic makefile changes should be made in
#	/sys/conf/makefile
# after which config should be rerun for all machines.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
#
# -DTRACE	compile in kernel tracing hooks
# -DQUOTA	compile in file system quotas
# -DSWABIPS	compile in code to byte swap ip packets on 3Mb/s Ethernet
#
DESTDIR=
AS=/bin/as
CC=/bin/cc
LD=/bin/ld
INCLDIR=${DESTDIR}/usr/include
LIBDIR=${DESTDIR}/lib
ULIBDIR=${DESTDIR}/usr/lib

LCC=/bin/cc
TOUCH=	touch -c




COPTS=	${IDENT} -DKERNEL
CFLAGS=	-O ${COPTS}

%OBJS

%CFILES

%LOAD

clean:
	rm -f eddep *vmunix tags *.o locore.i [a-tv-z]*.s \
		errs linterrs makelinks

lint: /tmp
	@lint -hbxn -I. -DGENERIC ${COPTS} ../machine/Locore.c \
	  ${CFILES} ../machine/swapgeneric.c ioconf.c | \
	    grep -v 'struct/union .* never defined' | \
	    grep -v 'possible pointer alignment problem'

../machine/symbols.sort: ../machine/symbols.raw
	grep -v '^#' ../machine/symbols.raw \
	    | sed 's/^	//' | sort -u > ../machine/symbols.sort






locore.o: assym.s ../machine/scb.s ../machine/locore.s \
    ubglue.s ../machine/mtpr.h ../machine/trap.h ../machine/psl.h \
    ../machine/pte.h ../machine/cp.h ../machine/mem.h
	cat assym.s ../machine/scb.s ../machine/locore.s \
	    ubglue.s > locore.c
	${CC} -E -I. -DLOCORE ${COPTS} locore.c > locore.i
	@echo 'as -o locore.o locore.i'
	@${AS} -o locore.o locore.i
	@rm locore.i

# the following is necessary because autoconf.o depends on #if GENERIC
autoconf.o tu.o: makefile

# depend on network configuration
af.o : makefile
# depend on maxusers
assym.s: makefile

assym.s: ../h/param.h ../machine/pte.h ../h/buf.h ../h/vmparam.h \
    ../h/vmmeter.h ../h/dir.h ../h/cmap.h ../h/map.h ../vba/vbavar.h \
    ../h/proc.h ../h/msgbuf.h
	${LCC} -I/DIST/usr/include ${IDENT} ${PARAM} ../machine/genassym.c; ./a.out >assym.s; rm -f a.out

../h/param.h: ../machine/param.h ../h/signal.h ../h/types.h
	${TOUCH} ../h/param.h
../h/tty.h:  ../h/ttychars.h ../h/ttydev.h
	${TOUCH} ../h/tty.h
../h/ioctl.h: /usr/include/sgtty.h ../h/ttychars.h ../h/ttydev.h
	${TOUCH} ../h/ioctl.h
../h/user.h: ../machine/pcb.h ../h/dmap.h ../h/time.h ../h/resource.h \
    /usr/include/errno.h
	${TOUCH} ../h/user.h
../h/vm.h: ../h/vmmac.h ../h/vmmeter.h ../h/vmparam.h ../h/vmsystm.h
	${TOUCH} ../h/vm.h
../h/vmparam.h: ../machine/vmparam.h
	${TOUCH} ../h/vmparam.h

depend:

	grep '^#include' ${CFILES} | grep -v '<' | \
	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
	    -e 's/\.c/.o/' \
	    -e 's,../[a-zA-Z]*/,,' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep
	echo '$$r makedep' >>eddep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp makefile makefile.bak
	ed - makefile < eddep
	rm eddep makedep


links:
	egrep '#if' ${CFILES} | sed -f ../conf/defines | \
	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
	  sort -u | comm -23 - dontlink | \
	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
	echo 'rm -f udiv.o;ln -s ../GENERIC/udiv.o udiv.o' >> makelinks
	echo 'rm -f urem.o;ln -s ../GENERIC/urem.o urem.o' >> makelinks
	sh makelinks && rm -f dontlink

tags:
	/usr/ucb/ctags ${CFILES}

print:
	@pr -f makefile ../sys/TODO linterrs
	@/usr/ucb/ctags -x ${CFILES} | pr -f -h XREF
	@(size vmunix *.o) | pr -f -h sizes
	@ls -ls | pr -f
	@cd ../h; ls -ls | pr -f ; pr -f *.m *.h
	@echo 'once upon a time ...'
	@cd ../sys; pr -f asm.sed Locore.c scb.s locore.s

	@pr -f ${CFILES}

ioconf.o: ioconf.c ../h/param.h ../machine/pte.h ../h/buf.h ../h/map.h \
    ../h/vm.h ../vba/vbavar.h

param.c: ../conf/param.c
	rm -f param.c
	cp ../conf/param.c .

param.o: param.c makefile
	${CC} -I. -c ${CFLAGS} ${PARAM} param.c

%RULES

# DO NOT DELETE THIS LINE -- make depend uses it

|
<

|








|









<
<
|
|
<
<
<
<
<
|
>
>

>
|













|
|



|
|
|

>
>
>
>
>
|
|
|
|
|






|


|

|

|
|

|

|





|




|


|
>
|
|
|
|




<



|
|

<















|





|
>


|
|





|






1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21


22
23





24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#	@(#)Makefile.tahoe	1.2 (Berkeley) 01/05/86

#
# Makefile for 4.3 BSD
#
# This makefile is constructed from a machine description:
#	config machine
# Most changes should be made in the machine description
#	/sys/conf/``machineid''
# after which you should do
#	 config machineid
# Generic makefile changes should be made in
#	/sys/conf/Makefile
# after which config should be rerun for all machines.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
#
# -DTRACE	compile in kernel tracing hooks
# -DQUOTA	compile in file system quotas
# -DSWABIPS	compile in code to byte swap ip packets on 3Mb/s Ethernet
#


C2=	/lib/c2
LD=	/bin/ld





TOUCH=	touch -f -c
INDIR=	../tahoe/inline
INLINE=	${INDIR}/inline

INCLUDES= -I. -I../h
COPTS=	${INCLUDES} ${IDENT} -DKERNEL
CFLAGS=	-O ${COPTS}

%OBJS

%CFILES

%LOAD

clean:
	rm -f eddep *vmunix tags *.o locore.i [a-tv-z]*.s \
		errs linterrs makelinks

lint: /tmp
	@lint -hbxn -I. -DGENERIC ${COPTS} ${PARAM} ../tahoe/Locore.c \
	  ${CFILES} ../tahoe/swapgeneric.c ioconf.c param.c | \
	    grep -v 'struct/union .* never defined' | \
	    grep -v 'possible pointer alignment problem'

../tahoe/symbols.sort: ../tahoe/symbols.raw
	grep -v '^#' ../tahoe/symbols.raw \
	    | sed 's/^	//' | sort -u > ../tahoe/symbols.sort

${INLINE}: ${INDIR}/inline.h ${INDIR}/langpats.c
${INLINE}: ${INDIR}/libcpats.c ${INDIR}/machdep.c
${INLINE}: ${INDIR}/machpats.c ${INDIR}/main.c
	cd ${INDIR}; make

locore.o: assym.s ../tahoe/scb.s ../tahoe/locore.s \
    vbglue.s ../tahoe/mtpr.h ../tahoe/trap.h ../tahoe/psl.h \
    ../tahoe/pte.h ../tahoe/cp.h ../tahoe/mem.h
	cat assym.s ../tahoe/scb.s ../tahoe/locore.s \
	    vbglue.s > locore.c
	${CC} -E -I. -DLOCORE ${COPTS} locore.c > locore.i
	@echo 'as -o locore.o locore.i'
	@${AS} -o locore.o locore.i
	@rm locore.i

# the following is necessary because autoconf.o depends on #if GENERIC
autoconf.o: Makefile

# depend on network configuration
af.o : Makefile
# depend on maxusers
assym.s machdep.o: Makefile

assym.s: ../h/param.h ../tahoe/pte.h ../h/buf.h ../h/vmparam.h \
    ../h/vmmeter.h ../h/dir.h ../h/cmap.h ../h/map.h ../tahoevba/vbavar.h \
    ../h/proc.h ../h/msgbuf.h
	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} ../tahoe/genassym.c; ./a.out >assym.s; rm -f a.out

../h/param.h: ../tahoe/machparam.h ../h/signal.h ../h/types.h
	${TOUCH} ../h/param.h
../h/tty.h:  ../h/ttychars.h ../h/ttydev.h
	${TOUCH} ../h/tty.h
../h/ioctl.h: /usr/include/sgtty.h ../h/ttychars.h ../h/ttydev.h
	${TOUCH} ../h/ioctl.h
../h/user.h: ../tahoe/pcb.h ../h/dmap.h ../h/time.h ../h/resource.h \
    /usr/include/errno.h
	${TOUCH} ../h/user.h
../h/vm.h: ../h/vmmac.h ../h/vmmeter.h ../h/vmparam.h ../h/vmsystm.h
	${TOUCH} ../h/vm.h
../h/vmparam.h: ../tahoe/vmparam.h
	${TOUCH} ../h/vmparam.h

depend: 
	-if [ ! -f assym.s ]; then touch assym.s; fi
	${CC} -M ${COPTS} ${CFILES} | \
	sed -e ':loop' \
	    -e 's/\.\.\/[^ /]*\/\.\./../' \
	    -e 't loop' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep

	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ex - Makefile < eddep
	rm eddep makedep


links:
	egrep '#if' ${CFILES} | sed -f ../conf/defines | \
	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
	  sort -u | comm -23 - dontlink | \
	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
	echo 'rm -f udiv.o;ln -s ../GENERIC/udiv.o udiv.o' >> makelinks
	echo 'rm -f urem.o;ln -s ../GENERIC/urem.o urem.o' >> makelinks
	sh makelinks && rm -f dontlink

tags:
	/usr/ucb/ctags ${CFILES}

print:
	@pr -f Makefile ../sys/TODO linterrs
	@/usr/ucb/ctags -x ${CFILES} | pr -f -h XREF
	@(size vmunix *.o) | pr -f -h sizes
	@ls -ls | pr -f
	@cd ../h; ls -ls | pr -f ; pr -f *.m *.h
	@echo 'once upon a time ...'
	@cd ../tahoe; pr -f Locore.c scb.s locore.s
	@cd ${INDIR}; make print
	@pr -f ${CFILES}

ioconf.o: ioconf.c ../h/param.h ../tahoe/pte.h ../h/buf.h ../h/map.h \
    ../h/vm.h ../tahoevba/vbavar.h

param.c: ../conf/param.c
	rm -f param.c
	cp ../conf/param.c .

param.o: param.c Makefile
	${CC} -I. -c ${CFLAGS} ${PARAM} param.c

%RULES

# DO NOT DELETE THIS LINE -- make depend uses it

Changes to sys/tahoe/if/if_ace.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*	if_ace.c	1.1	85/07/21	*/

/*
 * ACC VERSAbus Ethernet controller
 */
#include "ace.h"
#if NACE > 0

#include "../machine/pte.h"

#include "../h/param.h"
#include "../h/systm.h"
#include "../h/mbuf.h"
#include "../h/buf.h"
#include "../h/protosw.h"
#include "../h/socket.h"
#include "../h/vmmac.h"
#include "../h/ioctl.h"
#include "../h/errno.h"
#include "../h/vmparam.h"

#include "../net/if.h"
#include "../net/netisr.h"
#include "../net/route.h"
#include "../netinet/in.h"
#include "../netinet/in_systm.h"

#include "../netinet/ip.h"
#include "../netinet/ip_var.h"
#include "../netinet/if_ether.h"
#include "../netpup/pup.h"

#include "../tahoe/mtpr.h"
#include "../tahoeif/if_acereg.h"
#include "../vba/vbavar.h"

#define	LONET	124

/*
 * Configuration table, for 2 units (should be defined by config)
 */
#define	ACEVECTOR	0x90
long	acestd[] = { 0x0ff0000, 0xff0100 };		/* controller */

extern	char ace0utl[], ace1utl[];			/* dpm */
char	*acemap[]= { ace0utl, ace1utl };
extern	long ACE0map[], ACE1map[];
long	*ACEmap[] = { ACE0map, ACE1map };
long	ACEmapa[] = { 0xfff80000, 0xfff90000 };

/* station address */
char	ace_station[6] = { ~0x8, ~0x0, ~0x3, ~0x0, ~0x0, ~0x1 };
/* multicast hash table initializer */
char	ace_hash[8] = { ~0xF,~0xF,~0xF,~0xF,~0xF,~0xF,~0xF,~0xF };
/* backoff table masks */
short random_mask_tbl[16] = {
|









|
|
|
|
|
|
|
|
|
|






>



<



|











|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*	if_ace.c	1.2	86/01/05	*/

/*
 * ACC VERSAbus Ethernet controller
 */
#include "ace.h"
#if NACE > 0

#include "../machine/pte.h"

#include "param.h"
#include "systm.h"
#include "mbuf.h"
#include "buf.h"
#include "protosw.h"
#include "socket.h"
#include "vmmac.h"
#include "ioctl.h"
#include "errno.h"
#include "vmparam.h"

#include "../net/if.h"
#include "../net/netisr.h"
#include "../net/route.h"
#include "../netinet/in.h"
#include "../netinet/in_systm.h"
#include "../netinet/in_var.h"
#include "../netinet/ip.h"
#include "../netinet/ip_var.h"
#include "../netinet/if_ether.h"


#include "../tahoe/mtpr.h"
#include "../tahoeif/if_acereg.h"
#include "../tahoevba/vbavar.h"

#define	LONET	124

/*
 * Configuration table, for 2 units (should be defined by config)
 */
#define	ACEVECTOR	0x90
long	acestd[] = { 0x0ff0000, 0xff0100 };		/* controller */

extern	char ace0utl[], ace1utl[];			/* dpm */
char	*acemap[]= { ace0utl, ace1utl };
extern	struct pte ACE0map[], ACE1map[];
struct	pte *ACEmap[] = { ACE0map, ACE1map };
caddr_t	ACEmapa[] = { (caddr_t)0xfff80000, (caddr_t)0xfff90000 };

/* station address */
char	ace_station[6] = { ~0x8, ~0x0, ~0x3, ~0x0, ~0x0, ~0x1 };
/* multicast hash table initializer */
char	ace_hash[8] = { ~0xF,~0xF,~0xF,~0xF,~0xF,~0xF,~0xF,~0xF };
/* backoff table masks */
short random_mask_tbl[16] = {
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
	register struct acedevice *addr = (struct acedevice *)reg;

#ifdef lint
	acerint(0); acecint(0);
#endif
	if (badaddr(reg, 2))
		return(0);
	movew((short)CSR_RESET, &addr->csr);
	DELAY(10000);
	return (sizeof (struct acedevice));
}

/*
 * Interface exists: make available by filling in network interface
 * record.  System will initialize the interface when it is ready
 * to accept packets.
 */
aceattach(ui)
	struct vba_device *ui;
{
	register short unit = ui->ui_unit;
	register struct ace_softc *is = &ace_softc[unit];
	register struct ifnet *ifp = &is->is_if;
	register struct acedevice *addr = (struct acedevice *)ui->ui_addr;
	register short *wp, i;
	struct sockaddr_in *sin;

	ifp->if_unit = unit;
	ifp->if_name = "ace";
	ifp->if_mtu = ETHERMTU;
	/*
	 * Set station's addresses, multicast
	 * hash table, and initialize dual ported memory.
	 */
	ace_station[5] = ~(unit + 1);
	acesetetaddr(unit, addr, ace_station);
	is->is_promiscuous = 0;
	wp = (short *)addr->hash;
	for (i =  0; i < 8; i++)
		movew((short)ace_hash[i], wp++); 
	movew((short)~0xffff, &addr->bcastena[0]); 
	movew((short)~0xffff, &addr->bcastena[1]);
	aceclean(unit);
	sin = (struct sockaddr_in *)&ifp->if_addr;
	sin->sin_family = AF_INET;
	ifp->if_init = aceinit;
	ifp->if_output = aceoutput;
	ifp->if_ioctl = aceioctl;
	ifp->if_reset = acereset;

	if_attach(ifp);
}

acesetetaddr(unit, addr, station_addr)
	short unit;
	struct acedevice *addr;
	char *station_addr;
{
	register short *wp, i;
	register char *cp;
	struct ace_softc *is = &ace_softc[unit];

	wp = (short *)addr->station;
	cp = station_addr;
	for (i = 0; i < 6; i++)
		movew((short)*cp++, wp++); 
	wp = (short *)addr->station;
	cp = (char *)&is->is_addr;
	for (i = 0; i < 6; i++)
		*cp++ = ~(*wp++);
}

/*
 * Reset of interface after "system" reset.
 */







|

















<













|
|
|

<
<




>















|

|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	register struct acedevice *addr = (struct acedevice *)reg;

#ifdef lint
	acerint(0); acecint(0);
#endif
	if (badaddr(reg, 2))
		return(0);
	movow(&addr->csr, CSR_RESET);
	DELAY(10000);
	return (sizeof (struct acedevice));
}

/*
 * Interface exists: make available by filling in network interface
 * record.  System will initialize the interface when it is ready
 * to accept packets.
 */
aceattach(ui)
	struct vba_device *ui;
{
	register short unit = ui->ui_unit;
	register struct ace_softc *is = &ace_softc[unit];
	register struct ifnet *ifp = &is->is_if;
	register struct acedevice *addr = (struct acedevice *)ui->ui_addr;
	register short *wp, i;


	ifp->if_unit = unit;
	ifp->if_name = "ace";
	ifp->if_mtu = ETHERMTU;
	/*
	 * Set station's addresses, multicast
	 * hash table, and initialize dual ported memory.
	 */
	ace_station[5] = ~(unit + 1);
	acesetetaddr(unit, addr, ace_station);
	is->is_promiscuous = 0;
	wp = (short *)addr->hash;
	for (i =  0; i < 8; i++)
		movow(wp++, ace_hash[i]); 
	movow(&addr->bcastena[0], ~0xffff); 
	movow(&addr->bcastena[1], ~0xffff);
	aceclean(unit);


	ifp->if_init = aceinit;
	ifp->if_output = aceoutput;
	ifp->if_ioctl = aceioctl;
	ifp->if_reset = acereset;
	ifp->if_flags = IFF_BROADCAST;
	if_attach(ifp);
}

acesetetaddr(unit, addr, station_addr)
	short unit;
	struct acedevice *addr;
	char *station_addr;
{
	register short *wp, i;
	register char *cp;
	struct ace_softc *is = &ace_softc[unit];

	wp = (short *)addr->station;
	cp = station_addr;
	for (i = 0; i < 6; i++)
		movow(wp++, *cp++); 
	wp = (short *)addr->station;
	cp = (char *)is->is_addr;
	for (i = 0; i < 6; i++)
		*cp++ = ~(*wp++);
}

/*
 * Reset of interface after "system" reset.
 */
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222

223
224

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250

251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
aceinit(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];
	register struct vba_device *ui = aceinfo[unit];
	register struct acedevice *addr;
	register struct ifnet *ifp = &is->is_if;
	register struct sockaddr_in *sin;
	register short Csr;
	register int i, s;

	sin = (struct sockaddr_in *)&ifp->if_addr;
	if (sin->sin_addr.s_addr == 0)		/* address still unknown */
		return;
	if ((ifp->if_flags & IFF_RUNNING) == 0) {
		/*
		 * Reset the controller, initialize the recieve buffers,
		 * and turn the controller on again and set board online.
		 */
		addr = (struct acedevice *)ui->ui_addr;
		s = splimp();
		movew((short)CSR_RESET, &addr->csr);
		DELAY(10000);

		/*
		 * clean up dpm since the controller might
		 * jumble dpm after reset
		 */
		aceclean(unit);
		movew((short)CSR_GO, &addr->csr);
		Csr = addr->csr;
		if (Csr & CSR_ACTIVE) {
			movew((short)(ACEVECTOR + unit*8), &addr->ivct);
			Csr |= CSR_IENA | is->is_promiscuous;

			if (ifp->if_net == LONET)
				Csr |= CSR_LOOP3;

			movew(Csr, &addr->csr);
			is->is_flags = 0;
			is->is_xcnt = 0;
			is->is_if.if_flags |= IFF_UP|IFF_RUNNING;
		}
		splx(s);
	}

	if (is->is_if.if_flags & IFF_UP) {
		if_rtinit(&is->is_if, RTF_UP);
		aceStart(unit);
	}
	arpwhohas(&is->is_ac, &sin->sin_addr);
}

/*
 * Start output on interface.
 * Get another datagram to send off of the interface queue,
 * and map it to the interface before starting the output.
 *
 */
acestart(dev)
	dev_t dev;
{
	register struct tx_segment *txs;
	register long len, x;

	int unit = ACEUNIT(dev);
	struct vba_device *ui = aceinfo[unit];
	register struct acedevice *addr = (struct acedevice *)ui->ui_addr;
	register struct ace_softc *is = &ace_softc[unit];
	struct mbuf *m;
	short retries, idx;

again:
	txs = (struct tx_segment*)(is->is_dpm + (is->is_txnext << 11));
	if (txs->tx_csr & TCS_TBFULL) {
		is->is_stats.tx_busy++;
		return;
	}
	x = splimp();
	IF_DEQUEUE(&is->is_if.if_snd, m);
	splx(x);
	if (m == 0)
		return;
	len = aceput(unit, txs->tx_data, m);
	retries = txs->tx_csr & TCS_RTC;
	if (retries > 0)
		acebakoff(is, txs, retries);








<

|

|
<








|







|


|

>


>
|


|



<
|
<

<
<












|
>

<
<


|







|

|







187
188
189
190
191
192
193

194
195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229

230

231


232
233
234
235
236
237
238
239
240
241
242
243
244
245
246


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
aceinit(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];
	register struct vba_device *ui = aceinfo[unit];
	register struct acedevice *addr;
	register struct ifnet *ifp = &is->is_if;

	register short Csr;
	register int s;

	if (ifp->if_addrlist == (struct ifaddr *)0)

		return;
	if ((ifp->if_flags & IFF_RUNNING) == 0) {
		/*
		 * Reset the controller, initialize the recieve buffers,
		 * and turn the controller on again and set board online.
		 */
		addr = (struct acedevice *)ui->ui_addr;
		s = splimp();
		movow(&addr->csr, CSR_RESET);
		DELAY(10000);

		/*
		 * clean up dpm since the controller might
		 * jumble dpm after reset
		 */
		aceclean(unit);
		movow(&addr->csr, CSR_GO);
		Csr = addr->csr;
		if (Csr & CSR_ACTIVE) {
			movow(&addr->ivct, ACEVECTOR + unit*8);
			Csr |= CSR_IENA | is->is_promiscuous;
#ifdef notdef
			if (ifp->if_net == LONET)
				Csr |= CSR_LOOP3;
#endif
			movow(&addr->csr, Csr);
			is->is_flags = 0;
			is->is_xcnt = 0;
			is->is_if.if_flags |= IFF_RUNNING;
		}
		splx(s);
	}

	if (is->is_if.if_snd.ifq_head)

		aceStart(unit);


}

/*
 * Start output on interface.
 * Get another datagram to send off of the interface queue,
 * and map it to the interface before starting the output.
 *
 */
acestart(dev)
	dev_t dev;
{
	register struct tx_segment *txs;
	register long len;
	register int s;
	int unit = ACEUNIT(dev);


	register struct ace_softc *is = &ace_softc[unit];
	struct mbuf *m;
	short retries;

again:
	txs = (struct tx_segment*)(is->is_dpm + (is->is_txnext << 11));
	if (txs->tx_csr & TCS_TBFULL) {
		is->is_stats.tx_busy++;
		return;
	}
	s = splimp();
	IF_DEQUEUE(&is->is_if.if_snd, m);
	splx(s);
	if (m == 0)
		return;
	len = aceput(unit, txs->tx_data, m);
	retries = txs->tx_csr & TCS_RTC;
	if (retries > 0)
		acebakoff(is, txs, retries);

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313

314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329

330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353


354
355
356
357
358
359
360
		len = ETHERMIN + 14;
#endif
	if (++is->is_txnext > SEG_MAX) 
		is->is_txnext = is->is_segboundry;
	is->is_if.if_opackets++;
	is->is_xcnt++;
	len = (len & 0x7fff) | TCS_TBFULL;
	movew((short)len, txs);
	goto again;
}

/*
 * Transmit done interrupt.
 */
acecint(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];
	struct vba_device *ui = aceinfo[unit];
	register struct acedevice *addr = (struct acedevice *)ui->ui_addr;
	register struct tx_segment *txseg;
	short txidx, eostat;

	if (is->is_xcnt <= 0)  {
		txidx = (addr->tseg >> 11) & 0xf;
		printf("ace%d: stray xmit interrupt, xcnt %d\n",
		    unit, is->is_xcnt);
		is->is_xcnt = 0;

		aceStart(unit);
		return;
	}
	is->is_xcnt--;
	txseg = (struct tx_segment *)((is->is_eoctr << 11) + is->is_dpm);
	eostat = txseg->tx_csr;
	if ((eostat & TCS_TBFULL) == 0) {
		is->is_stats.tx_retries += eostat & TCS_RTC;
		if (eostat & TCS_RTFAIL)  {
			is->is_stats.tx_discarded++;
			is->is_if.if_oerrors++;
		} else 
			is->is_stats.tx_datagrams++;
		if (++is->is_eoctr >= 16)
			is->is_eoctr = is->is_segboundry; 
	} 

	aceStart(unit);
}

/*
 * Ethernet interface receiver interrupt.
 * If input error just drop packet.
 * Otherwise purge input buffered data path and examine 
 * packet to determine type.  If can't determine length
 * from type, then have to drop packet.  Othewise decapsulate
 * packet based on type and pass to type specific higher-level
 * input routine.
 */
acerint(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];
	register struct ifqueue *inq;
	register struct ether_header *ace;
	register struct rx_segment *rxseg;
	struct acedevice *addr = (struct acedevice *)aceinfo[unit]->ui_addr;
	int len, s, off, resid;
	struct mbuf *m;
	short eistat;



again:
	rxseg = (struct rx_segment *)((is->is_eictr << 11) + is->is_dpm);
	eistat = rxseg->rx_csr;
	if ((eistat & RCS_RBFULL) == 0)
		return;
	is->is_if.if_ipackets++;
	if (++is->is_eictr >= is->is_segboundry) 







|










<
<

|


<



>
|















>
|


















<




>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296


297
298
299
300

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340

341
342
343
344
345
346
347
348
349
350
351
352
353
		len = ETHERMIN + 14;
#endif
	if (++is->is_txnext > SEG_MAX) 
		is->is_txnext = is->is_segboundry;
	is->is_if.if_opackets++;
	is->is_xcnt++;
	len = (len & 0x7fff) | TCS_TBFULL;
	movow(txs, len);
	goto again;
}

/*
 * Transmit done interrupt.
 */
acecint(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];


	register struct tx_segment *txseg;
	short eostat;

	if (is->is_xcnt <= 0)  {

		printf("ace%d: stray xmit interrupt, xcnt %d\n",
		    unit, is->is_xcnt);
		is->is_xcnt = 0;
		if (is->is_if.if_snd.ifq_head)
			aceStart(unit);
		return;
	}
	is->is_xcnt--;
	txseg = (struct tx_segment *)((is->is_eoctr << 11) + is->is_dpm);
	eostat = txseg->tx_csr;
	if ((eostat & TCS_TBFULL) == 0) {
		is->is_stats.tx_retries += eostat & TCS_RTC;
		if (eostat & TCS_RTFAIL)  {
			is->is_stats.tx_discarded++;
			is->is_if.if_oerrors++;
		} else 
			is->is_stats.tx_datagrams++;
		if (++is->is_eoctr >= 16)
			is->is_eoctr = is->is_segboundry; 
	} 
	if (is->is_if.if_snd.ifq_head)
		aceStart(unit);
}

/*
 * Ethernet interface receiver interrupt.
 * If input error just drop packet.
 * Otherwise purge input buffered data path and examine 
 * packet to determine type.  If can't determine length
 * from type, then have to drop packet.  Othewise decapsulate
 * packet based on type and pass to type specific higher-level
 * input routine.
 */
acerint(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];
	register struct ifqueue *inq;
	register struct ether_header *ace;
	register struct rx_segment *rxseg;

	int len, s, off, resid;
	struct mbuf *m;
	short eistat;

	if ((is->is_if.if_flags&IFF_RUNNING) == 0)
		return;
again:
	rxseg = (struct rx_segment *)((is->is_eictr << 11) + is->is_dpm);
	eistat = rxseg->rx_csr;
	if ((eistat & RCS_RBFULL) == 0)
		return;
	is->is_if.if_ipackets++;
	if (++is->is_eictr >= is->is_segboundry) 
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437







438
439
440
441
442
443
444
	ace = (struct ether_header *)rxseg->rx_data;
#ifdef notdef
	len -= sizeof (struct ether_header);
#else
	len -= 14;
#endif
	/*
	 * Deal with trailer protocol: if type is PUP trailer
	 * get true type from first 16-bit word past data.
	 * Remember that type was trailer by setting off.
	 */
	ace->ether_type = ntohs((u_short)ace->ether_type);
#ifdef notdef
#define	acedataaddr(ace, off, type) \
    ((type)(((caddr_t)(((char *)ace)+sizeof (struct ether_header))+(off))))
#else
#define	acedataaddr(ace, off, type) \
    ((type)(((caddr_t)(((char *)ace)+14)+(off))))
#endif
	if (ace->ether_type >= ETHERPUP_TRAIL &&
	    ace->ether_type < ETHERPUP_TRAIL+ETHERPUP_NTRAILER) {
		off = (ace->ether_type - ETHERPUP_TRAIL) * 512;
		if (off >= ETHERMTU)
			goto setup;		/* sanity */
		ace->ether_type = ntohs(*acedataaddr(ace, off, u_short *));
		resid = ntohs(*(acedataaddr(ace, off+2, u_short *)));
		if (off + resid > len)
			goto setup;		/* sanity */
		len = off + resid;
	} else
		off = 0;
	if (len == 0)
		goto setup;

	/*
	 * Pull packet off interface.  Off is nonzero if packet
	 * has trailing header; aceget will then force this header
	 * information to be at the front, but we still have to drop
	 * the type and length which are at the front of any trailer data.
	 */
	m = aceget(unit, rxseg->rx_data, len, off);
	if (m == 0)
		goto setup;
	if (off) {
		m->m_off += 2 * sizeof (u_short);
		m->m_len -= 2 * sizeof (u_short);
	}
	switch (ace->ether_type) {

#ifdef INET
	case ETHERPUP_IPTYPE:
		schednetisr(NETISR_IP);
		inq = &ipintrq;
		break;

	case ETHERPUP_ARPTYPE:
		arpinput(&is->is_ac, m);
		goto setup;







#endif
	default:
		m_freem(m);
		goto setup;
	}
	if (IF_QFULL(inq)) {
		IF_DROP(inq);







|











|
|
|


















|









|




|


>
>
>
>
>
>
>







373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
	ace = (struct ether_header *)rxseg->rx_data;
#ifdef notdef
	len -= sizeof (struct ether_header);
#else
	len -= 14;
#endif
	/*
	 * Deal with trailer protocol: if type is trailer
	 * get true type from first 16-bit word past data.
	 * Remember that type was trailer by setting off.
	 */
	ace->ether_type = ntohs((u_short)ace->ether_type);
#ifdef notdef
#define	acedataaddr(ace, off, type) \
    ((type)(((caddr_t)(((char *)ace)+sizeof (struct ether_header))+(off))))
#else
#define	acedataaddr(ace, off, type) \
    ((type)(((caddr_t)(((char *)ace)+14)+(off))))
#endif
	if (ace->ether_type >= ETHERTYPE_TRAIL &&
	    ace->ether_type < ETHERTYPE_TRAIL+ETHERTYPE_NTRAILER) {
		off = (ace->ether_type - ETHERTYPE_TRAIL) * 512;
		if (off >= ETHERMTU)
			goto setup;		/* sanity */
		ace->ether_type = ntohs(*acedataaddr(ace, off, u_short *));
		resid = ntohs(*(acedataaddr(ace, off+2, u_short *)));
		if (off + resid > len)
			goto setup;		/* sanity */
		len = off + resid;
	} else
		off = 0;
	if (len == 0)
		goto setup;

	/*
	 * Pull packet off interface.  Off is nonzero if packet
	 * has trailing header; aceget will then force this header
	 * information to be at the front, but we still have to drop
	 * the type and length which are at the front of any trailer data.
	 */
	m = aceget(unit, (u_char *)rxseg->rx_data, len, off);
	if (m == 0)
		goto setup;
	if (off) {
		m->m_off += 2 * sizeof (u_short);
		m->m_len -= 2 * sizeof (u_short);
	}
	switch (ace->ether_type) {

#ifdef INET
	case ETHERTYPE_IP:
		schednetisr(NETISR_IP);
		inq = &ipintrq;
		break;

	case ETHERTYPE_ARP:
		arpinput(&is->is_ac, m);
		goto setup;
#endif
#ifdef NS
	case ETHERTYPE_NS:
		schednetisr(NETISR_NS);
		inq = &nsintrq;
		break;

#endif
	default:
		m_freem(m);
		goto setup;
	}
	if (IF_QFULL(inq)) {
		IF_DROP(inq);
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482

483
484
485
486
487
488
489
490
491
492
493
494
495
496
497













498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
{
	register struct ace_softc *is = &ace_softc[ifp->if_unit];
	register struct mbuf *m = m0;
	register struct ether_header *ace;
	register int off;
	struct mbuf *mcopy = (struct mbuf *)0;
	int type, s, error;
	struct ether_addr edst;
	struct in_addr idst;

	switch (dst->sa_family) {

#ifdef INET
	case AF_INET:
		idst = ((struct sockaddr_in *)dst)->sin_addr;
		if (!arpresolve(&is->is_ac, m, &idst, &edst))
			return (0);	/* if not yet resolved */

		if (in_lnaof(idst) == INADDR_ANY)
			mcopy = m_copy(m, 0, (int)M_COPYALL);
		off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
		/* need per host negotiation */
		if ((ifp->if_flags & IFF_NOTRAILERS) == 0 && off > 0 &&
		    (off & 0x1ff) == 0 &&
		    m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
			type = ETHERPUP_TRAIL + (off>>9);
			m->m_off -= 2 * sizeof (u_short);
			m->m_len += 2 * sizeof (u_short);
			*mtod(m, u_short *) = htons((u_short)ETHERPUP_IPTYPE);
			*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
			goto gottrailertype;
		}
		type = ETHERPUP_IPTYPE;













		off = 0;
		goto gottype;
#endif

	case AF_UNSPEC:
		ace = (struct ether_header *)dst->sa_data;
#ifdef notdef
		edst = ace->ether_dhost;
#else
		bcopy((caddr_t)ace->ether_dhost, (caddr_t)&edst, 6);
#endif
		type = ace->ether_type;
		goto gottype;

	default:
		printf("ace%d: can't handle af%d\n",
		    ifp->if_unit, dst->sa_family);
		error = EAFNOSUPPORT;







|







|

>
|






|


|



|
>
>
>
>
>
>
>
>
>
>
>
>
>






<
<
<
|
<







466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517



518

519
520
521
522
523
524
525
{
	register struct ace_softc *is = &ace_softc[ifp->if_unit];
	register struct mbuf *m = m0;
	register struct ether_header *ace;
	register int off;
	struct mbuf *mcopy = (struct mbuf *)0;
	int type, s, error;
	u_char edst[6];
	struct in_addr idst;

	switch (dst->sa_family) {

#ifdef INET
	case AF_INET:
		idst = ((struct sockaddr_in *)dst)->sin_addr;
		if (!arpresolve(&is->is_ac, m, &idst, edst))
			return (0);	/* if not yet resolved */
		if (!bcmp((caddr_t)edst, (caddr_t)etherbroadcastaddr,
		    sizeof(edst)))
			mcopy = m_copy(m, 0, (int)M_COPYALL);
		off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
		/* need per host negotiation */
		if ((ifp->if_flags & IFF_NOTRAILERS) == 0 && off > 0 &&
		    (off & 0x1ff) == 0 &&
		    m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
			type = ETHERTYPE_TRAIL + (off>>9);
			m->m_off -= 2 * sizeof (u_short);
			m->m_len += 2 * sizeof (u_short);
			*mtod(m, u_short *) = htons((u_short)ETHERTYPE_IP);
			*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
			goto gottrailertype;
		}
		type = ETHERTYPE_IP;
		off = 0;
		goto gottype;
#endif
#ifdef NS
	case AF_NS:
 		bcopy((caddr_t)&(((struct sockaddr_ns *)dst)->sns_addr.x_host),
		    (caddr_t)edst, sizeof (edst));
		if (!bcmp((caddr_t)edst, (caddr_t)&ns_broadhost,sizeof(edst)))
			mcopy = m_copy(m, 0, (int)M_COPYALL);
		else if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost,
		    sizeof(edst)))
			return(looutput(&loif, m, dst));
		type = ETHERTYPE_NS;
		off = 0;
		goto gottype;
#endif

	case AF_UNSPEC:
		ace = (struct ether_header *)dst->sa_data;



		bcopy((caddr_t)ace->ether_dhost, (caddr_t)edst, sizeof (edst));

		type = ace->ether_type;
		goto gottype;

	default:
		printf("ace%d: can't handle af%d\n",
		    ifp->if_unit, dst->sa_family);
		error = EAFNOSUPPORT;
557
558
559
560
561
562
563
564
565
566
567
568
569
570

571
572
573
574
575
576
577
		m->m_len += sizeof (struct ether_header);
#else
		m->m_off -= 14;
		m->m_len += 14;
#endif
	}
	ace = mtod(m, struct ether_header *);
#ifdef notdef
	ace->ether_dhost = edst;
	ace->ether_shost = is->is_addr;
#else
	bcopy((caddr_t)&edst, (caddr_t)ace->ether_dhost, 6);
	bcopy((caddr_t)&is->is_addr, (caddr_t)ace->ether_shost, 6);
#endif

	ace->ether_type = htons((u_short)type);

	/*
	 * Queue message on interface, and start output if interface
	 * not yet active.
	 */
	s = splimp();







<
<
<
<
|
|
<
>







567
568
569
570
571
572
573




574
575

576
577
578
579
580
581
582
583
		m->m_len += sizeof (struct ether_header);
#else
		m->m_off -= 14;
		m->m_len += 14;
#endif
	}
	ace = mtod(m, struct ether_header *);




	bcopy((caddr_t)edst, (caddr_t)ace->ether_dhost, sizeof (edst));
	bcopy((caddr_t)is->is_addr, (caddr_t)ace->ether_shost,

	    sizeof (is->is_addr));
	ace->ether_type = htons((u_short)type);

	/*
	 * Queue message on interface, and start output if interface
	 * not yet active.
	 */
	s = splimp();
608
609
610
611
612
613
614

615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678

679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705

/*
 * Routine to copy from mbuf chain to transmit buffer on the VERSAbus
 * If packet size is less than the minimum legal size,
 * the buffer is expanded.  We probably should zero out the extra
 * bytes for security, but that would slow things down.
 */

aceput(unit, txbuf, m)
	int unit;			/* for statistics collection */
	u_char *txbuf;
	struct mbuf *m;
{
	register u_char *bp, *mcp;	/* known to be r12, r11 */
	register short *s1, *s2;	/* known to be r10, r9 */
	register unsigned len;
	register struct mbuf *mp;
	int total, idx;

	total = 0;
	bp = txbuf;
	for (mp = m;(mp); mp = mp->m_next) {
		len = mp->m_len;
		if (len == 0)
			continue;
		total += len;
		mcp = mtod(mp, u_char *);
		if (((int)mcp & 01) && ((int)bp & 01)) {
			/* source & destination at odd addresses */
			/* *bp++ = *mcp++; */
			asm("movob (r11),(r12)");
			bp++, mcp++;
			--len;
		}
		if (len > 1 && (((int)mcp & 01)==0) && (((int)bp & 01)==0)) {
			register int l;

			s1 = (short *)bp;
			s2 = (short *)mcp;
			l = len >> 1;		/* count # of shorts */
			while (l-- > 0) {
				/* *s1++ = *s2++; */
				asm("movow (r9),(r10)");
				s1++, s2++;
			}
			len &= 1;		/* # remaining bytes */
			bp = (u_char *)s1;
			mcp = (u_char *)s2;
		}
		while (len-- > 0) {
			/* *bp++ = *mcp++;  */
			asm("movob (r11),(r12)");
			bp++, mcp++;
		}
	}
	m_freem(m);
	return (total);
}

movew(data, to)
	short data, *to;
{

	asm("movow 6(fp),*8(fp)");
}

/*
 * Routine to copy from VERSAbus memory into mbufs.
 *
 * Warning: This makes the fairly safe assumption that
 * mbufs have even lengths.
 */

struct mbuf *
aceget(unit, rxbuf, totlen, off0)
	int unit;			/* for statistics collection */
	u_char *rxbuf;
	int totlen, off0;
{
	register u_char *cp, *mcp;	/* known to be r12, r11 */
	register int tlen;
	register struct mbuf *m;
	struct mbuf *top = 0, **mp = &top;
	int len, off = off0;

#ifdef notdef
	cp = rxbuf + sizeof (struct ether_header);
#else
	cp = rxbuf + 14;
#endif
	while (totlen > 0) {
		register int words;

		MGET(m, M_DONTWAIT, MT_DATA);
		if (m == 0)
			goto bad;
		if (off) {
			len = totlen - off;
#ifdef notdef
			cp = rxbuf + sizeof (struct ether_header) + off;







>


|




|

|


|
|







<
<
|



|




|
<
<
|
<




|
<
<
|
<





<
<
<
<
<
<
<






>


















<
<







614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642


643
644
645
646
647
648
649
650
651
652


653

654
655
656
657
658


659

660
661
662
663
664







665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689


690
691
692
693
694
695
696

/*
 * Routine to copy from mbuf chain to transmit buffer on the VERSAbus
 * If packet size is less than the minimum legal size,
 * the buffer is expanded.  We probably should zero out the extra
 * bytes for security, but that would slow things down.
 */
/*ARGSUSED*/
aceput(unit, txbuf, m)
	int unit;			/* for statistics collection */
	char *txbuf;
	struct mbuf *m;
{
	register u_char *bp, *mcp;	/* known to be r12, r11 */
	register short *s1, *s2;	/* known to be r10, r9 */
	register u_int len;
	register struct mbuf *mp;
	int total;

	total = 0;
	bp = (u_char *)txbuf;
	for (mp = m; (mp); mp = mp->m_next) {
		len = mp->m_len;
		if (len == 0)
			continue;
		total += len;
		mcp = mtod(mp, u_char *);
		if (((int)mcp & 01) && ((int)bp & 01)) {
			/* source & destination at odd addresses */


			movob(bp++, *mcp++);
			--len;
		}
		if (len > 1 && (((int)mcp & 01)==0) && (((int)bp & 01)==0)) {
			register u_int l;

			s1 = (short *)bp;
			s2 = (short *)mcp;
			l = len >> 1;		/* count # of shorts */
			while (l-- != 0)


				movow(s1++, *s2++);

			len &= 1;		/* # remaining bytes */
			bp = (u_char *)s1;
			mcp = (u_char *)s2;
		}
		while (len-- != 0)


			movob(bp++, *mcp++);

	}
	m_freem(m);
	return (total);
}








/*
 * Routine to copy from VERSAbus memory into mbufs.
 *
 * Warning: This makes the fairly safe assumption that
 * mbufs have even lengths.
 */
/*ARGSUSED*/
struct mbuf *
aceget(unit, rxbuf, totlen, off0)
	int unit;			/* for statistics collection */
	u_char *rxbuf;
	int totlen, off0;
{
	register u_char *cp, *mcp;	/* known to be r12, r11 */
	register int tlen;
	register struct mbuf *m;
	struct mbuf *top = 0, **mp = &top;
	int len, off = off0;

#ifdef notdef
	cp = rxbuf + sizeof (struct ether_header);
#else
	cp = rxbuf + 14;
#endif
	while (totlen > 0) {


		MGET(m, M_DONTWAIT, MT_DATA);
		if (m == 0)
			goto bad;
		if (off) {
			len = totlen - off;
#ifdef notdef
			cp = rxbuf + sizeof (struct ether_header) + off;
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808


809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
 * Process an ioctl request.
 */
aceioctl(ifp, cmd, data)
	register struct ifnet *ifp;
	int cmd;
	caddr_t data;
{
	register struct ifreq *ifr = (struct ifreq *)data;
	int s, error = 0;

	s = splimp();
	switch (cmd) {

	case SIOCSIFADDR:
		if (ifp->if_flags & IFF_RUNNING)
			if_rtinit(ifp, -1);	/* delete previous route */
		acesetaddr(ifp, (struct sockaddr_in *)&ifr->ifr_addr);
		aceinit(ifp->if_unit);


		break;

#ifdef notdef
	case SIOCSETETADDR: {		/* set Ethernet station address */
		struct vba_device *ui;
		struct acedevice *addr;
		struct sockaddr_in *sin;

		ifp->if_flags &= ~IFF_RUNNING | IFF_UP;
		sin = (struct sockaddr_in *)&ifr->ifr_addr;
		ui = aceinfo[ifp->if_unit];
		addr = (struct acedevice *)ui->ui_addr;
		movew((short)CSR_RESET, &addr->csr);
		DELAY(10000);
		/* set station address and copy addr to arp struct */
		acesetetaddr(ifp->if_unit, addr, &sin->sin_zero[2]);
		aceinit(ifp->if_unit);		/* Re-initialize */
		break;
	}
#endif

	default:
		error = EINVAL;
	}
	splx(s);
	return (error);
}

acesetaddr(ifp, sin)
	register struct ifnet *ifp;
	register struct sockaddr_in *sin;
{

	ifp->if_addr = *(struct sockaddr *)sin;
	ifp->if_net = in_netof(sin->sin_addr);
	ifp->if_host[0] = in_lnaof(sin->sin_addr);
	sin = (struct sockaddr_in *)&ifp->if_broadaddr;
	sin->sin_family = AF_INET;
	sin->sin_addr = if_makeaddr(ifp->if_net, INADDR_ANY);
	ifp->if_flags |= IFF_BROADCAST;
}

aceclean(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];
	register struct ifnet *ifp = &is->is_if;
	register struct vba_device *ui = aceinfo[unit];
	register struct acedevice *addr = (struct acedevice *)ui->ui_addr;
	register short i, data;
	register char *pData1;

	ioaccess(ACEmap[unit], ACEmapa[unit], ACEBPTE);
	is->is_dpm = acemap[unit];		/* init dpm */
	bzero((char *)is->is_dpm, 16384*2);

	is->is_currnd = 49123;







|
|

<



|
<
<

>
>












|















<
<
<
<
<
<
<
<
<
<
<
<
<
<




<


|







782
783
784
785
786
787
788
789
790
791

792
793
794
795


796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826














827
828
829
830

831
832
833
834
835
836
837
838
839
840
 * Process an ioctl request.
 */
aceioctl(ifp, cmd, data)
	register struct ifnet *ifp;
	int cmd;
	caddr_t data;
{
	register struct ifaddr *ifa = (struct ifaddr *)data;
	int s = splimp(), error = 0;


	switch (cmd) {

	case SIOCSIFADDR:
		ifp->if_flags |= IFF_UP;


		aceinit(ifp->if_unit);
		((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
		arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
		break;

#ifdef notdef
	case SIOCSETETADDR: {		/* set Ethernet station address */
		struct vba_device *ui;
		struct acedevice *addr;
		struct sockaddr_in *sin;

		ifp->if_flags &= ~IFF_RUNNING | IFF_UP;
		sin = (struct sockaddr_in *)&ifr->ifr_addr;
		ui = aceinfo[ifp->if_unit];
		addr = (struct acedevice *)ui->ui_addr;
		movow(&addr->csr, CSR_RESET);
		DELAY(10000);
		/* set station address and copy addr to arp struct */
		acesetetaddr(ifp->if_unit, addr, &sin->sin_zero[2]);
		aceinit(ifp->if_unit);		/* Re-initialize */
		break;
	}
#endif

	default:
		error = EINVAL;
	}
	splx(s);
	return (error);
}















aceclean(unit)
	int unit;
{
	register struct ace_softc *is = &ace_softc[unit];

	register struct vba_device *ui = aceinfo[unit];
	register struct acedevice *addr = (struct acedevice *)ui->ui_addr;
	register short i;
	register char *pData1;

	ioaccess(ACEmap[unit], ACEmapa[unit], ACEBPTE);
	is->is_dpm = acemap[unit];		/* init dpm */
	bzero((char *)is->is_dpm, 16384*2);

	is->is_currnd = 49123;

Changes to sys/tahoe/include/clock.h.

1
2
3
4
5
6
7
8
9
10
11
12
/*	clock.h	4.5	81/02/23	*/

#define	SECDAY		((unsigned)(24*60*60))		/* seconds per day */
#define	SECYR		((unsigned)(365*SECDAY))	/* per common year */

#define	YRREF		1970
#define	LEAPYEAR(year)	((year)%4==0)	/* good till time becomes negative */

/*
 * Software clock is software interrupt level 8
 */
#define	setsoftclock()	mtpr(0x8, SIRR)
|










|
1
2
3
4
5
6
7
8
9
10
11
12
/*	clock.h	1.2	86/01/05	*/

#define	SECDAY		((unsigned)(24*60*60))		/* seconds per day */
#define	SECYR		((unsigned)(365*SECDAY))	/* per common year */

#define	YRREF		1970
#define	LEAPYEAR(year)	((year)%4==0)	/* good till time becomes negative */

/*
 * Software clock is software interrupt level 8
 */
#define	setsoftclock()	mtpr(SIRR, 0x8)

Added sys/tahoe/include/frame.h.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
/*	frame.h	1.1	86/01/05	*/

/*
 * Definition of the tahoe call frame.
 */
struct frame {
	int	fr_savpc;		/* saved program counter */
	u_int	fr_mask:16,		/* register save mask */
		fr_removed:16;		/* 4*number of arguments + 4 */
	int	fr_savfp;		/* saved frame pointer */
};

Added sys/tahoe/include/mtpr.h.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*	mtpr.h	1.1	86/01/05	*/
/*	mtpr.h	4.5	82/11/05	*/

/*
 * TAHOE processor register numbers
 */

#define	SBR	0x0		/* system base register */
#define	SLR	0x1		/* system length register */
#define	P0BR	0x2		/* p0 base register */
#define	P0LR	0x3		/* p0 length register */
#define	P1BR	0x4		/* p1 base register */
#define	P1LR	0x5		/* p1 length register */
#define	P2BR	0x6		/* p2 base register */
#define	P2LR	0x7		/* p2 length register */
#define	IPL	0x8 		/* interrupt priority level */
#define	MME  	0x9		/* memory management enable */
#define	TBIA	0xa		/* translation buffer invalidate all */
#define	TBIS	0xb		/* translation buffer invalidate single */
#define DCK	0xc		/* data cache key */
#define CCK	0xd		/* code cache key */
#define	PCBB	0xe		/* process control block base */
#define	ISP	0xf		/* interrupt stack pointer */
#define	SIRR	0x10		/* software interrupt request */
#define	SISR	0x11		/* software interrupt summary */
#define	SCBB	0x12		/* system control block base */
#define	KSP	0x13		/* kernelack pointer */
#define	USP	0x14		/* user stack pointer */
#define CPMDCB	0x15		/* CP master DCM pointer */
#define PACC	0x17		/* purge all code cache */
#define P1DC	0x18		/* purge one data cache */
#define PADC	0x19		/* purge all data cache */
#define HISR	0x1a		/* hardware interrupt summery register */
#define DCR	0x1b		/* diagnostic control register */
#define PDCS	0x1c		/* purge data cache slot */

Added sys/tahoe/include/param.h.































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*	param.h	1.1	86/01/05	*/

/*
 * Machine dependent constants for TAHOE.
 */
#define	NBPG	1024		/* bytes/page */
#define	PGOFSET	(NBPG-1)	/* byte offset into page */
#define	PGSHIFT	10		/* LOG2(NBPG) */

#define	CLSIZE		1
#define	CLSIZELOG2	0

#define	SSIZE	2			/* initial stack size/NBPG */
#define	SINCR	2			/* increment of stack/NBPG */
#define	UPAGES	6			/* pages of u-area (2 stack pages) */
#define IOBASE	((caddr_t)0xfff00000)	/* base of Versabus address space */

#define	MAXCKEY	255		/* maximal allowed code key */
#define	MAXDKEY	255		/* maximal allowed data key */
#define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
#define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */

/*
 * Some macros for units conversion
 */
/* Core clicks (1024 bytes) to segments and vice versa */
#define	ctos(x)	(x)
#define	stoc(x)	(x)

/* Core clicks (1024 bytes) to disk blocks */
#define	ctod(x)	(x)
#define	dtoc(x)	(x)
#define	dtob(x)	((x)<<PGSHIFT)

/* clicks to bytes */
#define	ctob(x)	((x)<<PGSHIFT)

/* bytes to clicks */
#define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))

/*
 * Macros to decode processor status word.
 */
#define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
#define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)

#define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }

Changes to sys/tahoe/include/pcb.h.



1
2
3
4
5
6
7
8
9
10
11
12
13


/*
 * TAHOE process control block
 */

struct pcb
{
	int	pcb_ksp; 	/* kernel stack pointer */
	int	pcb_usp; 	/* user stack pointer */
	int	pcb_r0; 
	int	pcb_r1; 
	int	pcb_r2; 
	int	pcb_r3; 
	int	pcb_r4; 
>
>



<
|
<







1
2
3
4
5

6

7
8
9
10
11
12
13
/*	pcb.h	1.2	86/01/05	*/

/*
 * TAHOE process control block
 */

struct pcb {

	int	pcb_ksp; 	/* kernel stack pointer */
	int	pcb_usp; 	/* user stack pointer */
	int	pcb_r0; 
	int	pcb_r1; 
	int	pcb_r2; 
	int	pcb_r3; 
	int	pcb_r4; 
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

60
61
62
63
64
65

66
	int	pcb_p1lr; 	/* seg 1 length register and pme */
	struct  pte *pcb_p2br; 	/* seg 2 base register */
	int	pcb_p2lr; 	/* seg 2 length register and pme */
	int	pcb_ach;	/* accumulator - high order longword */
	int	pcb_acl;	/* accumulator - low order longword */
#define ACH	pcb_ach
#define ACL	pcb_acl
	int	pcb_hfs;	/* f.p. status register.	*/
/*
 * Software pcb (extension)
 */
	union {
		float 	*faddr;	/* address of single precision accumulator */
		double	*daddr; /* address of double precision accumulator */
	} pcb_savacc;
#define FSAVACC	pcb_savacc.faddr
#define DSAVACC pcb_savacc.daddr
	int	pcb_szpt; 	/* number of pages of user page table */
	int	pcb_cmap2;
	int	*pcb_sswap;
	short	pcb_ckey;	/* cache code key (proc index if NPROC<255) */
	short	pcb_dkey;	/* cache data key */
	int	pcb_sigc[4];
};

extern long	*user_psl;

#define	aston() \
	{ \
		u.u_pcb.pcb_psl |= PSL_SFE; \
		if ((int)user_psl != 0) *user_psl |= PSL_SFE; \

	}

#define	astoff() \
	{ \
		u.u_pcb.pcb_psl &= ~ PSL_SFE; \
		if ((int)user_psl != 0) *user_psl &= ~PSL_SFE; \

	}







|












<
<
|




|
<
|
|
>
|

|
<
|
|
>
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48


49
50
51
52
53
54

55
56
57
58
59
60

61
62
63
64
	int	pcb_p1lr; 	/* seg 1 length register and pme */
	struct  pte *pcb_p2br; 	/* seg 2 base register */
	int	pcb_p2lr; 	/* seg 2 length register and pme */
	int	pcb_ach;	/* accumulator - high order longword */
	int	pcb_acl;	/* accumulator - low order longword */
#define ACH	pcb_ach
#define ACL	pcb_acl
	int	pcb_hfs;	/* fp status register */
/*
 * Software pcb (extension)
 */
	union {
		float 	*faddr;	/* address of single precision accumulator */
		double	*daddr; /* address of double precision accumulator */
	} pcb_savacc;
#define FSAVACC	pcb_savacc.faddr
#define DSAVACC pcb_savacc.daddr
	int	pcb_szpt; 	/* number of pages of user page table */
	int	pcb_cmap2;
	int	*pcb_sswap;


	long	pcb_sigc[5];	/* sigcode actually 19 bytes */
};

extern long	*user_psl;

#define	aston() { \

	u.u_pcb.pcb_psl |= PSL_SFE; \
	if ((int)user_psl != 0) \
		*user_psl |= PSL_SFE; \
}

#define	astoff() { \

	u.u_pcb.pcb_psl &= ~ PSL_SFE; \
	if ((int)user_psl != 0) \
		*user_psl &= ~PSL_SFE; \
}

Changes to sys/tahoe/include/psl.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26

/*	psl.h	4.4	84/01/31	*/

/*
 * TAHOE program status longword
 */

#define	PSL_C		0x00000001	/* carry bit */
#define	PSL_V		0x00000002	/* overflow bit */
#define	PSL_Z		0x00000004	/* zero bit */
#define	PSL_N		0x00000008	/* negative bit */
#define	PSL_ALLCC	0x0000000f	/* all cc bits - unlikely */
#define	PSL_T		0x00000010	/* trace enable bit */
#define	PSL_IV		0x00000020	/* integer overflow enable bit */
#define	PSL_FU		0x00000040	/* float underflow enable 	*/
#define PSL_DBL		0x00000080	/* f.p. prescision indicator	*/
#define	PSL_SFE		0x00000100	/* system-forced-exception */
#define	PSL_IPL		0x001f0000	/* interrupt priority level */

#define	PSL_CURMOD	0x01000000	/* current mode (all on is user) */
#define	PSL_IS		0x04000000	/* interrupt stack */
#define	PSL_TP		0x40000000	/* trace pending */

#define	PSL_MBZ		0xbae0ffc0	/* must be zero bits */

#define	PSL_USERSET	(PSL_CURMOD)
#define	PSL_USERCLR	(PSL_IS|PSL_IPL|PSL_MBZ)
<
|


|

<











>




|


|

1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

/*	psl.h	1.2	86/01/05	*/

/*
 * TAHOE processor status longword.
 */

#define	PSL_C		0x00000001	/* carry bit */
#define	PSL_V		0x00000002	/* overflow bit */
#define	PSL_Z		0x00000004	/* zero bit */
#define	PSL_N		0x00000008	/* negative bit */
#define	PSL_ALLCC	0x0000000f	/* all cc bits - unlikely */
#define	PSL_T		0x00000010	/* trace enable bit */
#define	PSL_IV		0x00000020	/* integer overflow enable bit */
#define	PSL_FU		0x00000040	/* float underflow enable 	*/
#define PSL_DBL		0x00000080	/* f.p. prescision indicator	*/
#define	PSL_SFE		0x00000100	/* system-forced-exception */
#define	PSL_IPL		0x001f0000	/* interrupt priority level */
#define	PSL_PRVMOD	0x00000000	/* previous mode (kernel mode) */
#define	PSL_CURMOD	0x01000000	/* current mode (all on is user) */
#define	PSL_IS		0x04000000	/* interrupt stack */
#define	PSL_TP		0x40000000	/* trace pending */

#define	PSL_MBZ		0xbae0fe00	/* must be zero bits */

#define	PSL_USERSET	(PSL_CURMOD)
#define	PSL_USERCLR	(PSL_IS|PSL_IPL|PSL_MBZ|PSL_SFE|PSL_DBL|PSL_FU)

Changes to sys/tahoe/include/pte.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
/*	pte.h	1.1	85/07/21	*/
/*	Tahoe version, November 1982	*/

/*
 * Tahoe page table entry
 *
 * There are two major kinds of pte's: those which have ever existed (and are
 * thus either now in core or on the swap device), and those which have
 * never existed, but which will be filled on demand at first reference.
 * There is a structure describing each.  There is also an ancillary
 * structure used in page clustering.
 */

#ifndef LOCORE
struct pte
{
unsigned int	
		pg_v:1,			/* valid bit */
		pg_prot:4,		/* access control */
		pg_fod:1,		/* is fill on demand (=0) */
		pg_swapm:1,		/* must write back to swap */
		pg_nc:1,		/* 'uncacheable page' bit */
		pg_m:1,			/* hardware maintained modified bit */
	/*	pg_u:1,			/* hardware maintained 'used' bit */
					/* Not implemented in this version */
		pg_vreadm:1,		/* modified since vread (ored with _m)*/
		pg_pfnum:22;		/* core page frame number or 0 */
};
struct hpte
{
unsigned int	
		pg_high:10,		/* special for clustering */
		pg_pfnum:22;
};
struct fpte
{
unsigned int	
		pg_v:1,
		pg_prot:4,
		pg_fod:1,		/* is fill on demand (=1) */
		:1,
		pg_fileno:5,		/* file mapped from or TEXT or ZERO */
		pg_blkno:20;		/* file system block number */
};
#endif

#define	PG_V		0x80000000
#define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
#define	PG_FOD		0x04000000
#define	PG_SWAPM	0x02000000
#define PG_N		0x01000000 /* Non-cacheable */
#define	PG_M		0x00800000
/*  #define PG_U	0x00400000 /* NOT implemented now !!! */
#define PG_VREADM	0x00400000 /* Uses 'U' bit location !!! */
#define	PG_PFNUM	0x003fffff

#define	PG_FZERO	(NOFILE)
#define	PG_FTEXT	(NOFILE+1)
#define	PG_FMAX		(PG_FTEXT)

#define	PG_NOACC	0
#define	PG_KR		0x40000000
#define	PG_KW		0x60000000
#define	PG_URKR		0x50000000
#define	PG_URKW		0x70000000
#define	PG_UW		0x78000000

/*
 * Pte related macros
 */
#define	dirty(pte)	((pte)->pg_fod == 0 && (pte)->pg_pfnum && \
			    ((pte)->pg_m || (pte)->pg_swapm))

#ifndef LOCORE
#ifdef KERNEL
struct	pte *vtopte();

/* utilities defined in locore.s */
extern	struct pte Sysmap[];
extern	struct pte Usrptmap[];
extern	struct pte usrpt[];
extern	struct pte Swapmap[];
extern	struct pte Forkmap[];
extern	struct pte Xswapmap[];
extern	struct pte Xswap2map[];
extern	struct pte Pushmap[];
extern	struct pte Vfmap[];
/*
extern	struct pte IOmap[];
*/
extern	struct pte VD0map[];
extern	struct pte VD1map[];
extern	struct pte VD2map[];
extern	struct pte VD3map[];
extern	struct pte UDmap[];
extern	struct pte CYmap[];

extern	struct pte XYmap[];
extern	struct pte mmap[];
extern	struct pte msgbufmap[];
extern	struct pte camap[];
#endif
#endif
|
<


















|


|
<
<















|
|









|
<


|
|












|
<



<
<










<
<
<





|
>






1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69
70


71
72
73
74
75
76
77
78
79
80



81
82
83
84
85
86
87
88
89
90
91
92
93
/*	pte.h	1.2	86/01/05	*/


/*
 * Tahoe page table entry
 *
 * There are two major kinds of pte's: those which have ever existed (and are
 * thus either now in core or on the swap device), and those which have
 * never existed, but which will be filled on demand at first reference.
 * There is a structure describing each.  There is also an ancillary
 * structure used in page clustering.
 */

#ifndef LOCORE
struct pte
{
unsigned int	
		pg_v:1,			/* valid bit */
		pg_prot:4,		/* access control */
		pg_fod:1,		/* is fill on demand (=0) */
		:1,			/* must write back to swap (unused) */
		pg_nc:1,		/* 'uncacheable page' bit */
		pg_m:1,			/* hardware maintained modified bit */
		pg_u:1,			/* hardware maintained 'used' bit */


		pg_pfnum:22;		/* core page frame number or 0 */
};
struct hpte
{
unsigned int	
		pg_high:10,		/* special for clustering */
		pg_pfnum:22;
};
struct fpte
{
unsigned int	
		pg_v:1,
		pg_prot:4,
		pg_fod:1,		/* is fill on demand (=1) */
		:1,
		pg_fileno:1,		/* file mapped from or TEXT or ZERO */
		pg_blkno:24;		/* file system block number */
};
#endif

#define	PG_V		0x80000000
#define	PG_PROT		0x78000000 /* all protection bits  (dorit). */
#define	PG_FOD		0x04000000
#define	PG_SWAPM	0x02000000
#define PG_N		0x01000000 /* Non-cacheable */
#define	PG_M		0x00800000
#define PG_U		0x00400000 /* not currently used */

#define	PG_PFNUM	0x003fffff

#define	PG_FZERO	0
#define	PG_FTEXT	1
#define	PG_FMAX		(PG_FTEXT)

#define	PG_NOACC	0
#define	PG_KR		0x40000000
#define	PG_KW		0x60000000
#define	PG_URKR		0x50000000
#define	PG_URKW		0x70000000
#define	PG_UW		0x78000000

/*
 * Pte related macros
 */
#define	dirty(pte)	((pte)->pg_fod == 0 && (pte)->pg_pfnum && (pte)->pg_m)


#ifndef LOCORE
#ifdef KERNEL


/* utilities defined in locore.s */
extern	struct pte Sysmap[];
extern	struct pte Usrptmap[];
extern	struct pte usrpt[];
extern	struct pte Swapmap[];
extern	struct pte Forkmap[];
extern	struct pte Xswapmap[];
extern	struct pte Xswap2map[];
extern	struct pte Pushmap[];
extern	struct pte Vfmap[];



extern	struct pte VD0map[];
extern	struct pte VD1map[];
extern	struct pte VD2map[];
extern	struct pte VD3map[];
extern	struct pte UDmap[];
extern	struct pte CY0map[];
extern	struct pte CY1map[];
extern	struct pte XYmap[];
extern	struct pte mmap[];
extern	struct pte msgbufmap[];
extern	struct pte camap[];
#endif
#endif

Added sys/tahoe/include/reg.h.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*	reg.h	1.1	86/01/05	*/
/*	reg.h	4.2	81/02/19	*/
/*
 * Location of the users' stored
 * registers relative to PSL of 'trap' and 'syscall'.
 * Usage is u.u_ar0[XX].
 */

#define	PS	(-1)
#define	PC	(-2)
/*		(-3)	*/
/*		(-4)	*/
#define	RACL	(-5)
#define	RACH	(-6)
/*		(-7)	*/
/*		(-8)	*/
#define	SP	(-9)
#define	R13	(-10)
#define	FP	(-10)
#define	R12	(-13)
#define	R11	(-14)
#define	R10	(-15)
#define	R9	(-16)
#define	R8	(-17)
#define	R7	(-18)
#define	R6	(-19)
#define	R5	(-20)
#define	R4	(-21)
#define	R3	(-22)
#define	R2	(-23)
#define	R1	(-24)
#define	R0	(-25)

Added sys/tahoe/include/trap.h.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*	trap.h	1.1	86/01/05	*/

/*	first 3 constants known in system C files - don't change */
#define	T_RESADFLT	0	/* reserved addressing */
#define	T_PRIVINFLT	1	/* privileged instruction */
#define	T_RESOPFLT	2	/* reserved operand */
/*	those constants shouldn't change 	*/
#define	T_BPTFLT	3	/* breakpoint instruction */
#define	T_SYSCALL	5	/* system call (kcall) */
#define	T_ARITHTRAP	6	/* arithmetic trap */
#define	T_ASTFLT	7	/* system forced exception */
#define	T_SEGFLT	8	/* segmentation (limit) fault */
#define	T_PROTFLT	9	/* protection fault */
#define	T_TRCTRAP	10	/* trace trap */
#define	T_PAGEFLT	12	/* page fault */
#define	T_TABLEFLT	13	/* page table fault */
#define	T_ALIGNFLT	14	/* alignment fault */
#define	T_KSPNOTVAL	15	/* kernel stack pointer not valid */
#define	T_BUSERR	16	/* bus error */

Changes to sys/tahoe/include/vmparam.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25

26


27





28










29
30
31
32
33

34
35




36
37
38
39
40
41
42
/*	vmparam.h	1.3	5/25/85	*/
/*	vmparam.h	6.1	83/07/29	*/

/*
 * Machine dependent constants for TAHOE
 */
/*
 * USRTEXT is the start of the user text/data space, while USRSTACK
 * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
 * the number of pages from the beginning of the P0 region to the
 * beginning of the text and from the beginning of the P2 region to the
 * beginning of the stack respectively.
 */
					/* number of ptes per page */
#define	USRTEXT		0
#define	USRSTACK	(0xC0000000-UPAGES*NBPG)
					/* Start of user stack */

#define	P2PAGES		0x100000	/* number of pages in P2 region */
#define	LOWPAGES	0
#define	HIGHPAGES	UPAGES

/*
 * Virtual memory related constants
 */
#define	SLOP	32

#define	MAXTSIZ		(6*1024-SLOP)		/* max text size (clicks) */


#define	MAXDSIZ		(19*2048-32-SLOP)	/* max data size (clicks) */





#define	MAXSSIZ		(19*2048-32-SLOP)	/* max stack size (clicks) */











/*
 * Sizes of the system and user portions of the system page table.
 */
/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */

#define	SYSPTSIZE	((30+MAXUSERS)*NPTEPG/4)
#define	USRPTSIZE 	(2*NPTEPG)





/*
 * The size of the clock loop.
 */
#define	LOOPPAGES	(maxfree - firstfree)

/*
|
<











<

<
|
>





|

|
>
|
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>





>
|
|
>
>
>
>







1

2
3
4
5
6
7
8
9
10
11
12

13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*	vmparam.h	1.2	86/01/05	*/


/*
 * Machine dependent constants for TAHOE
 */
/*
 * USRTEXT is the start of the user text/data space, while USRSTACK
 * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
 * the number of pages from the beginning of the P0 region to the
 * beginning of the text and from the beginning of the P2 region to the
 * beginning of the stack respectively.
 */

#define	USRTEXT		0

#define	USRSTACK	(0xc0000000-UPAGES*NBPG) /* Start of user stack */
#define	BTOPUSRSTACK	(0x300000 - UPAGES)	 /* btop(USRSTACK) */
#define	P2PAGES		0x100000	/* number of pages in P2 region */
#define	LOWPAGES	0
#define	HIGHPAGES	UPAGES

/*
 * Virtual memory related constants, all in clicks
 */
#define	MAXTSIZ		(6*CLSIZE*1024)		/* max text size */
#ifndef DFLDSIZ
#define	DFLDSIZ		(6*1024*1024/NBPG)	/* initial data size limit */
#endif
#ifndef MAXDSIZ
#define	MAXDSIZ		(19*1024*1024/NBPG)	/* max data size */
#endif
#ifndef	DFLSSIZ
#define	DFLSSIZ		(512*1024/NBPG)		/* initial stack size limit */
#endif
#ifndef	MAXSSIZ
#define	MAXSSIZ		MAXDSIZ			/* max stack size */
#endif

/*
 * Default sizes of swap allocation chunks (see dmap.h).
 * The actual values may be changed in vminit() based on MAXDSIZ.
 * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
 */
#define	DMMIN	32			/* smallest swap allocation */
#define	DMMAX	4096			/* largest potential swap allocation */
#define	DMTEXT	1024			/* swap allocation for text */

/*
 * Sizes of the system and user portions of the system page table.
 */
/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
#ifdef notdef
#define	SYSPTSIZE	((20+MAXUSERS)*NPTEPG)
#define	USRPTSIZE 	(32*NPTEPG)
#else
#define	SYSPTSIZE	((128*NPTEPG/2)+(MAXUSERS*NPTEPG/16))
#define	USRPTSIZE 	(4*NPTEPG)
#endif

/*
 * The size of the clock loop.
 */
#define	LOOPPAGES	(maxfree - firstfree)

/*
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
 * number just means a swapped in process is given around 25k bytes.
 * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
 * so we loan each swapped in process memory worth 100$, or just admit
 * that we don't consider it worthwhile and swap it out to disk which costs
 * $30/mb or about $0.75.
 */
#define	SAFERSS		16		/* nominal ``small'' resident set size
					   protected against replacement */

/*
 * DISKRPM is used to estimate the number of paging i/o operations
 * which one can expect from a single disk controller.
 */
#define	DISKRPM		60







|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
 * number just means a swapped in process is given around 25k bytes.
 * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
 * so we loan each swapped in process memory worth 100$, or just admit
 * that we don't consider it worthwhile and swap it out to disk which costs
 * $30/mb or about $0.75.
 */
#define	SAFERSS		32		/* nominal ``small'' resident set size
					   protected against replacement */

/*
 * DISKRPM is used to estimate the number of paging i/o operations
 * which one can expect from a single disk controller.
 */
#define	DISKRPM		60
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109














110
111
112
113
114
115
116
117
118
119
120







121
122
123
124
125
126
127
128
129
130
131
132
133
134
 * KLSDIST is the advance or retard of the fifo reclaim for sequential
 * processes data space.
 */
#define	KLSDIST	3		/* klusters advance/retard for seq. fifo */

/*
 * Paging thresholds (see vm_sched.c).
 * Strategy of 4/22/81:
 *	lotsfree is 1/4 of memory free.
 *	desfree is 200k bytes, but at most 1/8 of memory
 *	minfree is 64k bytes, but at most 1/2 of desfree
 */

#define	LOTSFREEFRACT	4
#define	DESFREE		(200 * 1024)
#define	DESFREEFRACT	8
#define	MINFREE		(64 * 1024)
#define	MINFREEFRACT	2















/*
 * Believed threshold (in megabytes) for which interleaved
 * swapping area is desirable.
 */
#define	LOTSOFMEM	2

/*
 * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1
 */
#define	mapin(pte, v, pfnum, count, prot) \
	(*(int *)(pte) = (pfnum) | (prot), mtpr(ptob(v), TBIS))








/* 
 * The following constant is used to initialize the map of the
 * system page table i/o entries.
 * It's value should be the highest i/o address used by all the 
 * controllers handled in the system as specified in ubminit 
 * structure in ioconf.c.
*/
#define MAXIOADDR 0xffffee45	/* highest physical io address */

/* Number of entries in the system page pable for i/o space */
#define IOSIZE	(( (MAXIOADDR - IOBASE+ NBPG -1) >> PGSHIFT )+1)
#define TBUFSIZ	10		/* maximum tape buffer size */
#define	ACEBPTE	32		/* ACC Ethernet (ACE) I/O window	*/







|
|



>






>
>
>
>
>
>
>
>
>
>
>
>
>
>










|
>
>
>
>
>
>
>







|
|
<
|
|
|
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

173
174
175
176
 * KLSDIST is the advance or retard of the fifo reclaim for sequential
 * processes data space.
 */
#define	KLSDIST	3		/* klusters advance/retard for seq. fifo */

/*
 * Paging thresholds (see vm_sched.c).
 * Strategy of 1/19/85:
 *	lotsfree is 512k bytes, but at most 1/4 of memory
 *	desfree is 200k bytes, but at most 1/8 of memory
 *	minfree is 64k bytes, but at most 1/2 of desfree
 */
#define	LOTSFREE	(512 * 1024)
#define	LOTSFREEFRACT	4
#define	DESFREE		(200 * 1024)
#define	DESFREEFRACT	8
#define	MINFREE		(64 * 1024)
#define	MINFREEFRACT	2

/*
 * There are two clock hands, initially separated by HANDSPREAD bytes
 * (but at most all of user memory).  The amount of time to reclaim
 * a page once the pageout process examines it increases with this
 * distance and decreases as the scan rate rises.
 */
#define	HANDSPREAD	(2 * 1024 * 1024)

/*
 * The number of times per second to recompute the desired paging rate
 * and poke the pagedaemon.
 */
#define	RATETOSCHEDPAGING	4

/*
 * Believed threshold (in megabytes) for which interleaved
 * swapping area is desirable.
 */
#define	LOTSOFMEM	2

/*
 * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1
 */
#define	mapin(pte, v, pfnum, count, prot) \
	(*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, ptob(v)))

/*
 * Invalidate a cluster (optimized here for standard CLSIZE).
 */
#if CLSIZE == 1
#define	tbiscl(v)	mtpr(TBIS, ptob(v))
#endif

/* 
 * The following constant is used to initialize the map of the
 * system page table i/o entries.
 * It's value should be the highest i/o address used by all the 
 * controllers handled in the system as specified in ubminit 
 * structure in ioconf.c.
 */
#define MAXIOADDR	0xffffee45

/* number of entries in the system page pable for i/o space */
#define IOSIZE		(((MAXIOADDR - (int)IOBASE+ NBPG-1) >> PGSHIFT)+1)
#define TBUFSIZ		32		/* maximum tape buffer size */
#define	ACEBPTE		32		/* ACC Ethernet (ACE) I/O window */

Changes to sys/tahoe/inline/langpats.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)langpats.c	2.9 (Berkeley) 6/8/85";
#endif not lint

#include "inline.h"

/*
 * Pattern table for kernel specific routines.
 * These patterns are based on the old asm.sed script.
 */
struct pats language_ptab[] = {

#ifdef vax
	{ "0,_spl0\n",
"	mfpr	$18,r0\n\
	mtpr	$0,$18\n" },

	{ "0,_spl1\n",
"	mfpr	$18,r0\n\
	mtpr	$1,$18\n" },







|
|









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)langpats.c	1.2 (Berkeley) 01/05/86";
#endif

#include "inline.h"

/*
 * Pattern table for kernel specific routines.
 * These patterns are based on the old asm.sed script.
 */
struct pats language_ptab[] = {

#if defined(vax)
	{ "0,_spl0\n",
"	mfpr	$18,r0\n\
	mtpr	$0,$18\n" },

	{ "0,_spl1\n",
"	mfpr	$18,r0\n\
	mtpr	$1,$18\n" },
243
244
245
246
247
248
249
250
251































































252
























































































253
254
255
256
257
	{ "2,_max\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r5\n\
	cmpl	r0,r5\n\
	bgequ	1f\n\
	movl	r5,r0\n\
1:\n" },
#endif vax
































































#ifdef mc68000
























































































/* someday... */
#endif mc68000

	{ "", "" }
};







|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
	{ "2,_max\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r5\n\
	cmpl	r0,r5\n\
	bgequ	1f\n\
	movl	r5,r0\n\
1:\n" },
#endif

#if defined(tahoe)
	{ "4,_spl0\n",
"	mfpr	$8,r0\n\
	mtpr	$0,$8\n" },

	{ "4,_spl1\n",
"	mfpr	$8,r0\n\
	mtpr	$0x11,$8\n" },

	{ "4,_spl3\n",
"	mfpr	$8,r0\n\
	mtpr	$0x13,$8\n" },

	{ "4,_spl7\n",
"	mfpr	$8,r0\n\
	mtpr	$0x17,$8\n" },

	{ "4,_spl8\n",
"	mfpr	$8,r0\n\
	mtpr	$0x18,$8\n" },

	{ "4,_splimp\n",
"	mfpr	$8,r0\n\
	mtpr	$0x18,$8\n" },

	{ "4,_splsoftclock\n",
"	mfpr	$18,r0\n\
	mtpr	$0x8,$8\n" },

	{ "4,_splnet\n",
"	mfpr	$8,r0\n\
	mtpr	$0xc,$8\n" },

	{ "4,_splbio\n",
"	mfpr	$8,r0\n\
	mtpr	$0x18,$8\n" },

	{ "4,_spltty\n",
"	mfpr	$8,r0\n\
	mtpr	$0x18,$8\n" },

	{ "4,_splclock\n",
"	mfpr	$8,r0\n\
	mtpr	$0x18,$8\n" },

	{ "4,_splhigh\n",
"	mfpr	$8,r0\n\
	mtpr	$0x18,$8\n" },

	{ "8,_splx\n",
"	movl	(sp)+,r1\n\
	mfpr	$8,r0\n\
	mtpr	r1,$8\n" },

	{ "8,_mfpr\n",
"	movl	(sp)+,r1\n\
	mfpr	r1,r0\n" },

	{ "12,_mtpr\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r0\n\
	mtpr	r0,r1\n" },

#ifdef notdef
	{ "8,_uncache\n",
"	movl	(sp)+,r1\n\
	mtpr	r1,$0x1c\n" },
#endif

	{ "4,_setsoftclock\n",
"	mtpr	$0x8,$0x10\n" },

	{ "8,_fuibyte\n",
"	callf	$8,_fubyte\n" },

	{ "8,_fuiword\n",
"	callf	$8,_fuword\n" },

	{ "12,_suibyte\n",
"	callf	$12,_subyte\n" },

	{ "12,_suiword\n",
"	callf	$12,_suword\n" },

	{ "8,_setjmp\n",
"	movl	(sp)+,r1\n\
	clrl	r0\n\
	movab	(fp),(r1)\n\
	addl2	$4,r1\n\
	movab	1(pc),(r1)\n" },

	{ "8,_ffs\n",
"	movl	(sp)+,r1\n\
	ffs	r1,r0\n\
	bgeq	1f\n\
	mnegl	$1,r0\n\
1:\n\
	incl	r0\n" },

	{ "12,__insque\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	insque	(r0),(r1)\n" },

	{ "8,__remque\n",
"	movl	(sp)+,r1\n\
	remque	(r1)\n" },

	{ "12,_imin\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	cmpl	r0,r1\n\
	bleq	1f\n\
	movl	r1,r0\n\
1:\n" },

	{ "12,_imax\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	cmpl	r0,r1\n\
	bgeq	1f\n\
	movl	r1,r0\n\
1:\n" },

	{ "12,_min\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	cmpl	r0,r1\n\
	blequ	1f\n\
	movl	r1,r0\n\
1:\n" },

	{ "12,_max\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	cmpl	r0,r1\n\
	bgequ	1f\n\
	movl	r1,r0\n\
1:\n" },

	{ "12,__movow\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r0\n\
	movow	r0,(r1)\n" },

	{ "12,__movob\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r0\n\
	movob	r0,(r1)\n" },
#endif

#if defined(mc68000)
/* someday... */
#endif

	{ "", "" }
};

Changes to sys/tahoe/inline/libcpats.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)libcpats.c	1.3 (Berkeley) 6/8/85";
#endif not lint

#include "inline.h"

/*
 * Pattern table for the C library.
 */
struct pats libc_ptab[] = {

#ifdef vax
	{ "1,_fgetc\n",
"	sobgeq	*(sp),1f\n\
	calls	$1,__filbuf\n\
	jbr     2f\n\
1:\n\
	addl3	$4,(sp)+,r1\n\
	movzbl	*(r1),r0\n\







|
|








|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)libcpats.c	1.2 (Berkeley) 01/05/86";
#endif

#include "inline.h"

/*
 * Pattern table for the C library.
 */
struct pats libc_ptab[] = {

#if defined(vax)
	{ "1,_fgetc\n",
"	sobgeq	*(sp),1f\n\
	calls	$1,__filbuf\n\
	jbr     2f\n\
1:\n\
	addl3	$4,(sp)+,r1\n\
	movzbl	*(r1),r0\n\
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	{ "1,_strlen\n",
"	movl	(sp)+,r5\n\
	movl	r5,r1\n\
1:\n\
	locc	$0,$65535,(r1)\n\
	jeql	1b\n\
	subl3	r5,r1,r0\n" },
#endif vax

#ifdef mc68000
/* someday... */
#endif mc68000

	{ "", "" }
};







|

|

|



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	{ "1,_strlen\n",
"	movl	(sp)+,r5\n\
	movl	r5,r1\n\
1:\n\
	locc	$0,$65535,(r1)\n\
	jeql	1b\n\
	subl3	r5,r1,r0\n" },
#endif

#if defined(mc68000)
/* someday... */
#endif

	{ "", "" }
};

Changes to sys/tahoe/inline/machdep.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)machdep.c	1.6 (Berkeley) 6/8/85";
#endif not lint

#include <stdio.h>
#include <ctype.h>
#include "inline.h"

/*
 * The routines and tables in this file must be rewritten
 * for each new machine that this program is ported to.
 */

#ifdef vax
/*
 * Instruction stop table.
 * All instructions that implicitly modify any of the temporary
 * registers, change control flow, or implicitly loop must be
 * listed in this table. It is used to find the end of a basic
 * block when scanning backwards through the instruction stream
 * trying to merge the inline expansion.







|
|










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)machdep.c	1.2 (Berkeley) 01/05/86";
#endif

#include <stdio.h>
#include <ctype.h>
#include "inline.h"

/*
 * The routines and tables in this file must be rewritten
 * for each new machine that this program is ported to.
 */

#if defined(vax)
/*
 * Instruction stop table.
 * All instructions that implicitly modify any of the temporary
 * registers, change control flow, or implicitly loop must be
 * listed in this table. It is used to find the end of a basic
 * block when scanning backwards through the instruction stream
 * trying to merge the inline expansion.
67
68
69
70
71
72
73

74




















































75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
	char *cp;
{

	if (bcmp(cp, "calls\t$", 7) == 0)
		return (cp + 7);
	return (0);
}






















































/*
 * Find the next argument to the function being expanded.
 */
nextarg(argc, argv)
	int argc;
	char *argv[];
{
	register char *lastarg = argv[2];

	if (argc == 3 &&
	    bcmp(argv[0], "mov", 3) == 0 &&
	    bcmp(argv[1], "(sp)+", 6) == 0 &&
	    lastarg[0] == 'r' && isdigit(lastarg[1]) && lastarg[2] == '\0')
		return (lastarg[1] - '0');
	return (-1);
}

/*
 * Determine whether the current line pushes an argument.
 */
 ispusharg(argc, argv)
	int argc;
	char *argv[];
{

	if (argc < 2)
		return (0);
	if (argc == 2 && bcmp(argv[0], "push", 4) == 0)







>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




















|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
	char *cp;
{

	if (bcmp(cp, "calls\t$", 7) == 0)
		return (cp + 7);
	return (0);
}
#endif

#if defined(tahoe)
/*
 * Instruction stop table.
 * All instructions that implicitly modify any of the temporary
 * registers, change control flow, or implicitly loop must be
 * listed in this table. It is used to find the end of a basic
 * block when scanning backwards through the instruction stream
 * trying to merge the inline expansion.
 */
struct inststoptbl inststoptable[] = {
/* control */
	{ "bbssi" }, { "bcc" }, { "bcs" }, { "beql" }, { "beqlu" },
	{ "bgeq" }, { "bgequ" }, { "bgtr" }, { "bgtru" }, { "bleq" },
	{ "blequ" }, { "blss" }, { "blssu" }, { "bneq" }, { "bnequ" },
	{ "brb" }, { "brw" }, { "bvc" }, { "bvs" }, { "jmp" },
/* jump versions of control */
	{ "jbc" }, { "jbs" }, { "jeql" }, { "jeqlu" },
	{ "jgeq" }, { "jgequ" }, { "jgtr" }, { "jgtru" }, { "jleq" },
	{ "jlequ" }, { "jlss" }, { "jlssu" }, { "jneq" }, { "jnequ" },
	{ "jcc" }, { "jcs" }, { "jvc" }, { "jvs" }, { "jbr" },
/* multiple registers */
	{ "loadr" },
/* bit field */
	{ "bbc" }, { "bbs" },
/* character string and block move */
	{ "cmps2" }, { "cmps3" }, { "movblk" }, { "movs2" }, { "movs3" },
/* procedure call */
	{ "callf" }, { "calls" }, { "ret" },
/* loop control */
	{ "aobleq" }, { "aoblss" }, { "casel" },
/* privileged and miscellaneous */
	{ "bpt" }, { "halt" }, { "kcall" }, { "ldpctx" }, { "rei" },
	{ "svpctx" },
	{ "" }
};

/*
 * Check to see if a line is a candidate for replacement.
 * Return pointer to name to be looked up in pattern table.
 */
char *
doreplaceon(cp)
	char *cp;
{

	if (bcmp(cp, "callf\t$", 7) == 0)
		return (cp + 7);
	return (0);
}
#endif

#if defined(vax) || defined(tahoe)
/*
 * Find the next argument to the function being expanded.
 */
nextarg(argc, argv)
	int argc;
	char *argv[];
{
	register char *lastarg = argv[2];

	if (argc == 3 &&
	    bcmp(argv[0], "mov", 3) == 0 &&
	    bcmp(argv[1], "(sp)+", 6) == 0 &&
	    lastarg[0] == 'r' && isdigit(lastarg[1]) && lastarg[2] == '\0')
		return (lastarg[1] - '0');
	return (-1);
}

/*
 * Determine whether the current line pushes an argument.
 */
ispusharg(argc, argv)
	int argc;
	char *argv[];
{

	if (argc < 2)
		return (0);
	if (argc == 2 && bcmp(argv[0], "push", 4) == 0)
110
111
112
113
114
115
116


117
118
119
120
121
122
123
124
125
126
127
128
 * Determine which (if any) registers are modified
 * Return register number that is modified, -1 if none are modified.
 */
modifies(argc, argv)
	int argc;
	char *argv[];
{


	/*
	 * For the VAX all we care about are r0 to r5
	 */
	register char *lastarg = argv[argc - 1];

	if (lastarg[0] == 'r' && isdigit(lastarg[1]) && lastarg[2] == '\0')
		return (lastarg[1] - '0');
	return (-1);
}

/*
 * Rewrite the instruction in (argc, argv) to store its







>
>

|

<
<







163
164
165
166
167
168
169
170
171
172
173
174


175
176
177
178
179
180
181
 * Determine which (if any) registers are modified
 * Return register number that is modified, -1 if none are modified.
 */
modifies(argc, argv)
	int argc;
	char *argv[];
{
	register char *lastarg = argv[argc - 1];

	/*
	 * For the VAX or TAHOE all we care about are r0 to r5
	 */


	if (lastarg[0] == 'r' && isdigit(lastarg[1]) && lastarg[2] == '\0')
		return (lastarg[1] - '0');
	return (-1);
}

/*
 * Rewrite the instruction in (argc, argv) to store its
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 */
cleanup(numargs)
	int numargs;
{

	return;
}
#endif vax

#ifdef mc68000
/*
 * Instruction stop table.
 * All instructions that implicitly modify any of the temporary
 * registers, change control flow, or implicitly loop must be
 * listed in this table. It is used to find the end of a basic
 * block when scanning backwards through the instruction stream
 * trying to merge the inline expansion.







|

|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
 */
cleanup(numargs)
	int numargs;
{

	return;
}
#endif

#if defined(mc68000)
/*
 * Instruction stop table.
 * All instructions that implicitly modify any of the temporary
 * registers, change control flow, or implicitly loop must be
 * listed in this table. It is used to find the end of a basic
 * block when scanning backwards through the instruction stream
 * trying to merge the inline expansion.
352
353
354
355
356
357
358
359
	 * delete instruction to pop arguments.
	 * TODO:
	 *	CHECK FOR LABEL
	 *	CHECK THAT INSTRUCTION IS A POP
	 */
	fgets(line[bufhead], MAXLINELEN, stdin);
}
#endif mc68000







|
405
406
407
408
409
410
411
412
	 * delete instruction to pop arguments.
	 * TODO:
	 *	CHECK FOR LABEL
	 *	CHECK THAT INSTRUCTION IS A POP
	 */
	fgets(line[bufhead], MAXLINELEN, stdin);
}
#endif

Changes to sys/tahoe/inline/machpats.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)machpats.c	1.4 (Berkeley) 6/8/85";
#endif not lint

#include "inline.h"

/*
 * Pattern table for special VAX instructions.
 */
struct pats machine_ptab[] = {

#ifdef vax
	{ "3,_blkcpy\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r3\n\
	jbr	2f\n\
1:\n\
	subl2	r0,(sp)\n\
	movc3	r0,(r1),(r3)\n\







|
|




|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)machpats.c	1.2 (Berkeley) 01/05/86";
#endif

#include "inline.h"

/*
 * Pattern table for special instructions.
 */
struct pats machine_ptab[] = {

#if defined(vax)
	{ "3,_blkcpy\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r3\n\
	jbr	2f\n\
1:\n\
	subl2	r0,(sp)\n\
	movc3	r0,(r1),(r3)\n\
122
123
124
125
126
127
128
129
130
































131
132
133
134
135
136
"	movl	(sp)+,r4\n\
	movl	(sp)+,r5\n\
	insque	(r4),(r5)\n" },

	{ "1,_remque\n",
"	movl	(sp)+,r5\n\
	remque	(r5),r0\n" },
#endif vax

































#ifdef mc68000
/* someday... */
#endif mc68000

	{ "", "" }
};







|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

|



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
"	movl	(sp)+,r4\n\
	movl	(sp)+,r5\n\
	insque	(r4),(r5)\n" },

	{ "1,_remque\n",
"	movl	(sp)+,r5\n\
	remque	(r5),r0\n" },
#endif

#if defined(tahoe)
	{ "16,_blkcpy\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	movl	(sp)+,r2\n\
	movblk\n" },

	{ "16,_bcopy\n",
"	movl	(sp)+,r0\n\
	movl	(sp)+,r1\n\
	movl	(sp)+,r2\n\
	movblk\n" },

	{ "12,_bzero\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r2\n\
	movab	1f,r0\n\
	movs3\n\
	.data\n\
1:	.byte	0\n\
	.text\n" },

	{ "12,_blkclr\n",
"	movl	(sp)+,r1\n\
	movl	(sp)+,r2\n\
	movab	1f,r0\n\
	movs3\n\
	.data\n\
1:	.byte	0\n\
	.text\n" },
#endif

#if defined(mc68000)
/* someday... */
#endif

	{ "", "" }
};

Changes to sys/tahoe/inline/main.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1984 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	1.8 (Berkeley) 6/8/85";
#endif not lint

#include <stdio.h>
#include <ctype.h>
#include "inline.h"

/*
 * These are the pattern tables to be loaded










|


|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 1984 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1984 Regents of the University of California.\n\
 All rights reserved.\n";
#endif

#ifndef lint
static char sccsid[] = "@(#)main.c	1.2 (Berkeley) 01/05/86";
#endif

#include <stdio.h>
#include <ctype.h>
#include "inline.h"

/*
 * These are the pattern tables to be loaded

Changes to sys/tahoe/math/Kaddd.s.

1
2
3
4
5
6
7
8
9
10
11
/*	Kaddd.s	1.2	86/01/03	*/

#include "fp.h"
#include "SYS.h"

/*
 * _Kaddd(acc_most,acc_least,op_most,op_least,hfs)
 */

ENTRY(Kaddd, R10|R9|R8|R7|R6|R5|R4|R3|R2)
/*
|

|
|







1
2
3
4
5
6
7
8
9
10
11
/*	Kaddd.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoe/SYS.h"

/*
 * _Kaddd(acc_most,acc_least,op_most,op_least,hfs)
 */

ENTRY(Kaddd, R10|R9|R8|R7|R6|R5|R4|R3|R2)
/*

Changes to sys/tahoe/math/Kaddf.s.

1
2
3
4
5
6
7
8
9
10
11
/*	Kaddf.s	1.2	86/01/03	*/

#include "fp.h"
#include "SYS.h"

/*
 * _Kaddf(acc_most,acc_least,op_most,op_least,hfs)
 */
	.text
ENTRY(Kaddf, R10|R9|R8|R7|R6|R5|R4|R3|R2)
/*
|

|
|







1
2
3
4
5
6
7
8
9
10
11
/*	Kaddf.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoe/SYS.h"

/*
 * _Kaddf(acc_most,acc_least,op_most,op_least,hfs)
 */
	.text
ENTRY(Kaddf, R10|R9|R8|R7|R6|R5|R4|R3|R2)
/*

Changes to sys/tahoe/math/Katanf.s.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*	Katanf.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Katanf, 0)
	tstl	4(fp)			# if (arg > 0)
	jleq	1f
	pushl	20(fp)			# hfs
	pushl	8(fp)
	pushl	4(fp)
	callf	$16,satan
	ret				# return(satan(arg));
1:					# else
	pushl	20(fp)			# hfs
	lnd	4(fp)
	pushd
	callf	$16,satan
	lnf	r0
	stf	r0
	ret				# return(-satan(-arg));

	.align	1
satan: .word	R3|R2
	subl3	$60,fp,sp
	cmpd2	4(fp),_sq2m1		# if (arg < sq2m1)
	jgeq	1f
	pushl	12(fp)			# hfs
	pushl	8(fp)
	pushl	4(fp)
	callf	$16,xatan
|

|



















<
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
/*	Katanf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Katanf, 0)
	tstl	4(fp)			# if (arg > 0)
	jleq	1f
	pushl	20(fp)			# hfs
	pushl	8(fp)
	pushl	4(fp)
	callf	$16,satan
	ret				# return(satan(arg));
1:					# else
	pushl	20(fp)			# hfs
	lnd	4(fp)
	pushd
	callf	$16,satan
	lnf	r0
	stf	r0
	ret				# return(-satan(-arg));


ASENTRY(satan, R2|R3)
	subl3	$60,fp,sp
	cmpd2	4(fp),_sq2m1		# if (arg < sq2m1)
	jgeq	1f
	pushl	12(fp)			# hfs
	pushl	8(fp)
	pushl	4(fp)
	callf	$16,xatan
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	pushl	12(fp)			# hfs
	ldd	r0; pushd
	ldd	_pio2; pushd
	callf	$24,_Ksubd
	ldd	r0; cvdf; stf r0
	ret

	.align	1
xatan: .word	0
	subl3	$68,fp,sp
	pushl	12(fp)			# hfs
	ldd	4(fp); pushd; pushd
	callf	$24,_Kmuld		# argsq = arg*arg;
	ldd	r0
	std	-60(fp)			# argsq
	pushl	12(fp)			# hfs







<
|







71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
	pushl	12(fp)			# hfs
	ldd	r0; pushd
	ldd	_pio2; pushd
	callf	$24,_Ksubd
	ldd	r0; cvdf; stf r0
	ret


ASENTRY(xatan, 0)
	subl3	$68,fp,sp
	pushl	12(fp)			# hfs
	ldd	4(fp); pushd; pushd
	callf	$24,_Kmuld		# argsq = arg*arg;
	ldd	r0
	std	-60(fp)			# argsq
	pushl	12(fp)			# hfs

Changes to sys/tahoe/math/Kcmpd.s.

1
2
3
4
5
6
7
8
9
10
/*	Kcmpd.s	1.2	86/01/03	*/

#include "SYS.h"

/*
 * cmpd(hi1, lo1, hi2, lo2)
 *	register hi1, hi2;
 *	register unsigned lo1, lo2;
 *{
 *	if(hi1 < 0) {
|

|







1
2
3
4
5
6
7
8
9
10
/*	Kcmpd.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

/*
 * cmpd(hi1, lo1, hi2, lo2)
 *	register hi1, hi2;
 *	register unsigned lo1, lo2;
 *{
 *	if(hi1 < 0) {

Changes to sys/tahoe/math/Kcmpf.s.

1
2
3
4
5
6
7
8
9
10
/*	Kcmpf.s	1.2	86/01/03	*/

#include "SYS.h"

/*
 * cmpf(o1, o2)
 *	register o1, o2;
 *{
 *	if(o1 < 0) {
 *		o1 ^= 0x80000000;
|

|







1
2
3
4
5
6
7
8
9
10
/*	Kcmpf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

/*
 * cmpf(o1, o2)
 *	register o1, o2;
 *{
 *	if(o1 < 0) {
 *		o1 ^= 0x80000000;

Changes to sys/tahoe/math/Kcvtdl.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kcvtdl.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

 
	.text
	.globl	_Kcvtdl
	.globl	_Kcvtdu
_Kcvtdu:
_Kcvtdl:
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kcvtdl.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

 
	.text
	.globl	_Kcvtdl
	.globl	_Kcvtdu
_Kcvtdu:
_Kcvtdl:

Changes to sys/tahoe/math/Kcvtfl.s.

1
2
3
4
5
6
7
8
9
10
11
/*	Kcvtfl.s	1.2	86/01/03	*/

#include "fp.h"
#include "SYS.h"

	.text
ENTRY(Kcvtfl, R5|R4|R3|R2)
	clrl	r1
	clrl	r4		# r4 - negative flag.
	clrl	r2		# r2 - exponent.
	movl	4(fp),r0	# fetch operand.
|

|
|







1
2
3
4
5
6
7
8
9
10
11
/*	Kcvtfl.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoe/SYS.h"

	.text
ENTRY(Kcvtfl, R5|R4|R3|R2)
	clrl	r1
	clrl	r4		# r4 - negative flag.
	clrl	r2		# r2 - exponent.
	movl	4(fp),r0	# fetch operand.

Changes to sys/tahoe/math/Kcvtld.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kcvtld.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

	.text
ENTRY(Kcvtld, R5|R4|R3|R2)
	clrl	r4		# r4 - negative flag.
	clrl	r2		# r2 - exponent.
	movl	12(fp),r0	# fetch operand.
	movl	r0,r5		# need another copy.
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kcvtld.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

	.text
ENTRY(Kcvtld, R5|R4|R3|R2)
	clrl	r4		# r4 - negative flag.
	clrl	r2		# r2 - exponent.
	movl	12(fp),r0	# fetch operand.
	movl	r0,r5		# need another copy.

Changes to sys/tahoe/math/Kcvtlf.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kcvtlf.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

	.text
ENTRY(Kcvtlf, R5|R4|R3|R2)
	clrl	r1
	clrl	r4		# r4 - negative flag.
	clrl	r2		# r2 - exponent.
	movl	12(fp),r0	# fetch operand.
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kcvtlf.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

	.text
ENTRY(Kcvtlf, R5|R4|R3|R2)
	clrl	r1
	clrl	r4		# r4 - negative flag.
	clrl	r2		# r2 - exponent.
	movl	12(fp),r0	# fetch operand.

Changes to sys/tahoe/math/Kdivd.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kdivd.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

#define	HIDDEN	23		# here we count from 0 not from 1 as in fp.h

	.text
ENTRY(Kdivd, R9|R8|R7|R6|R5|R4|R3|R2)
	clrl	r3		# r3 - sign: 0 for positive,1 for negative.
	movl	4(fp),r0
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kdivd.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

#define	HIDDEN	23		# here we count from 0 not from 1 as in fp.h

	.text
ENTRY(Kdivd, R9|R8|R7|R6|R5|R4|R3|R2)
	clrl	r3		# r3 - sign: 0 for positive,1 for negative.
	movl	4(fp),r0

Changes to sys/tahoe/math/Kdivf.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kdivf.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

#define	HIDDEN	23	 	# here we count from 0 not from 1 as in fp.h

	.text
ENTRY(Kdivf, R9|R8|R7|R6|R5|R4|R3|R2)
	clrl	r1
	clrl	r3		# r3 - sign: 0 for positive,1 for negative.
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kdivf.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

#define	HIDDEN	23	 	# here we count from 0 not from 1 as in fp.h

	.text
ENTRY(Kdivf, R9|R8|R7|R6|R5|R4|R3|R2)
	clrl	r1
	clrl	r3		# r3 - sign: 0 for positive,1 for negative.

Changes to sys/tahoe/math/Kexpf.s.

1
2
3
4
5
6
7
8
9
10
/*	Kexpf.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Kexpf, R4|R3)
	subl3	$88,fp,sp
	tstl	4(fp)
	jneq	1f
	movl	one,r0
|

|







1
2
3
4
5
6
7
8
9
10
/*	Kexpf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Kexpf, R4|R3)
	subl3	$88,fp,sp
	tstl	4(fp)
	jneq	1f
	movl	one,r0

Changes to sys/tahoe/math/Kfnorm.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kfnorm.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

	.text
ENTRY(Kfnorm, R6|R5|R4|R3|R2)
				# clrl	r1
	movl	r0,r4		# copy to temporary.
	jneq	inr0
	movl	r1,r5
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kfnorm.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

	.text
ENTRY(Kfnorm, R6|R5|R4|R3|R2)
				# clrl	r1
	movl	r0,r4		# copy to temporary.
	jneq	inr0
	movl	r1,r5

Changes to sys/tahoe/math/Kfp_exp.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kfp_exp.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

ENTRY(Kfpover, 0)
	movl	$HUGE0,r0
	movl	$HUGE1,r1
	ret

ENTRY(Kfpunder, 0)
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kfp_exp.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

ENTRY(Kfpover, 0)
	movl	$HUGE0,r0
	movl	$HUGE1,r1
	ret

ENTRY(Kfpunder, 0)

Changes to sys/tahoe/math/Kfp_mvtoacc.s.

1
2
3
4
5
6
7
8
9
10
11
/*	Kfp_mvtoacc.s	1.2	86/01/03	*/

#include "fp.h"
#include "SYS.h"

/*
 * mvtofacc(value, acc_addr)
 *
 * move value to floating point accumulator
 */
ENTRY(mvtofacc, 0)
|

|
|







1
2
3
4
5
6
7
8
9
10
11
/*	Kfp_mvtoacc.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoe/SYS.h"

/*
 * mvtofacc(value, acc_addr)
 *
 * move value to floating point accumulator
 */
ENTRY(mvtofacc, 0)

Changes to sys/tahoe/math/Kfrexpd.s.

1
2
3
4
5
6
7
8
9
10
/*	Kfrexpd.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Kfrexpd, 0)
	subl3	$60,fp,sp
	clrl	-60(fp)
	clrl	-56(fp)
	tstl	4(fp)
|

|







1
2
3
4
5
6
7
8
9
10
/*	Kfrexpd.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Kfrexpd, 0)
	subl3	$60,fp,sp
	clrl	-60(fp)
	clrl	-56(fp)
	tstl	4(fp)

Changes to sys/tahoe/math/Kfrexpf.s.

1
2
3
4
5
6
7
8
9
10
/*	Kfrexpf.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Kfrexpf, 0)
	subl3	$60,fp,sp
	clrl	-60(fp)		# j=0;
	clrl	-56(fp)		# neg=0;
	tstl	4(fp)		# if(x<0){
|

|







1
2
3
4
5
6
7
8
9
10
/*	Kfrexpf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Kfrexpf, 0)
	subl3	$60,fp,sp
	clrl	-60(fp)		# j=0;
	clrl	-56(fp)		# neg=0;
	tstl	4(fp)		# if(x<0){

Changes to sys/tahoe/math/Kldexpf.s.

1
2
3


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*	Kldexpf.s	1.2	86/01/03	*/

#include "SYS.h"



/* @(*)Kldexpf.s	4.2 (Berkeley) 12/21/80
 *	Tahoe 		2/2/83
 *
 * float Kldexpf (op_most, op_least, exp, hfs)
 *
 * Ldexp returns value*2**exp, if that result is in range.
 * If underflow occurs, it returns zero.  If overflow occurs,
 * it returns a value of appropriate sign and largest
 * possible magnitude.  In case of either overflow or underflow,
 * the external int "errno" is set to ERANGE.  Note that errno is
 * not modified if no error occurs, so if you intend to test it
 * after you use Kldexpf, you had better set it to something
 * other than ERANGE first (zero is a reasonable value to use).
 */

#include "fp.h"
#include "Kfp.h"

	.text
ENTRY(Kldexpf, R2)
	movl	4(fp),r0	/* Fetch "value" */
	movl	8(fp),r1

	andl3	$EXPMASK,r0,r2	/* r2 := shifted biased exponent */
	jeql	ld1		/* If it's zero, we're done */
|

|
>
>
















<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21



22
23
24
25
26
27
28
/*	Kldexpf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"
#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"

/* @(*)Kldexpf.s	4.2 (Berkeley) 12/21/80
 *	Tahoe 		2/2/83
 *
 * float Kldexpf (op_most, op_least, exp, hfs)
 *
 * Ldexp returns value*2**exp, if that result is in range.
 * If underflow occurs, it returns zero.  If overflow occurs,
 * it returns a value of appropriate sign and largest
 * possible magnitude.  In case of either overflow or underflow,
 * the external int "errno" is set to ERANGE.  Note that errno is
 * not modified if no error occurs, so if you intend to test it
 * after you use Kldexpf, you had better set it to something
 * other than ERANGE first (zero is a reasonable value to use).
 */




	.text
ENTRY(Kldexpf, R2)
	movl	4(fp),r0	/* Fetch "value" */
	movl	8(fp),r1

	andl3	$EXPMASK,r0,r2	/* r2 := shifted biased exponent */
	jeql	ld1		/* If it's zero, we're done */

Changes to sys/tahoe/math/Klogf.s.

1
2
3
4
5
6
7
8
9
10
/*	Klogf.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Klogf, R5|R4|R3|R2)
	subl3	$88,fp,sp
	clrl	8(fp)
	tstl	4(fp)
	jgtr	L53
|

|







1
2
3
4
5
6
7
8
9
10
/*	Klogf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Klogf, R5|R4|R3|R2)
	subl3	$88,fp,sp
	clrl	8(fp)
	tstl	4(fp)
	jgtr	L53

Changes to sys/tahoe/math/Kmodf.s.

1
2
3
4
5
6
7
8
9
10
11
/*	Kmodf.s	1.2	86/01/03	*/

#include "SYS.h"
#include "fp.h"

/* 
 *  float Kmodf (value, iptr, hfs)
 *  float value, *iptr;
 *  int hfs;
 * 
 *  Modf returns the fractional part of "value",
|

|
|







1
2
3
4
5
6
7
8
9
10
11
/*	Kmodf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"
#include "../tahoemath/fp.h"

/* 
 *  float Kmodf (value, iptr, hfs)
 *  float value, *iptr;
 *  int hfs;
 * 
 *  Modf returns the fractional part of "value",

Changes to sys/tahoe/math/Kmuld.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kmuld.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

#define	HIDDEN	23	/* here we count from 0 not from 1 as in fp.h */

/*
 * _Kmuld(acc_most,acc_least,op_most,op_least,hfs)
 */
	.text
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kmuld.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

#define	HIDDEN	23	/* here we count from 0 not from 1 as in fp.h */

/*
 * _Kmuld(acc_most,acc_least,op_most,op_least,hfs)
 */
	.text

Changes to sys/tahoe/math/Kmulf.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Kmulf.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

#define	HIDDEN	23	/* here we count from 0 not from 1 as in fp.h */

/* 
 * _Kmulf(acc_most,acc_least,op_most,op_least,hfs)
 */
	.text
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Kmulf.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

#define	HIDDEN	23	/* here we count from 0 not from 1 as in fp.h */

/* 
 * _Kmulf(acc_most,acc_least,op_most,op_least,hfs)
 */
	.text

Changes to sys/tahoe/math/Knegd.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Knegd.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

	.text
ENTRY(Knegd, 0)
	andl3	$EXPMASK,4(fp),r0	/* check for reserved operand,zero. */
	beql	retzero
	movl	4(fp),r0		/* fetch operand. */
	movl	8(fp),r1
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Knegd.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

	.text
ENTRY(Knegd, 0)
	andl3	$EXPMASK,4(fp),r0	/* check for reserved operand,zero. */
	beql	retzero
	movl	4(fp),r0		/* fetch operand. */
	movl	8(fp),r1

Changes to sys/tahoe/math/Knegf.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Knegf.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

	.text
ENTRY(Knegf, 0)
	clrl	r1
	andl3	$EXPMASK,4(fp),r0	/* check for reserved operand,zero. */
	beql	retzero
	movl	4(fp),r0		/* fetch operand. */
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Knegf.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

	.text
ENTRY(Knegf, 0)
	clrl	r1
	andl3	$EXPMASK,4(fp),r0	/* check for reserved operand,zero. */
	beql	retzero
	movl	4(fp),r0		/* fetch operand. */

Changes to sys/tahoe/math/Ksfnorm.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Ksfnorm.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

/*
 * Ksfnorm(hfs)
 */
	.text
ENTRY(Ksfnorm, R6|R5|R4|R3|R2)
	clrl	r1
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Ksfnorm.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

/*
 * Ksfnorm(hfs)
 */
	.text
ENTRY(Ksfnorm, R6|R5|R4|R3|R2)
	clrl	r1

Changes to sys/tahoe/math/Ksfp_exp.s.

1
2
3
4
5
6
7
8
9
10
11
12
/*	Ksfp_exp.s	1.2	86/01/03	*/

#include "fp.h"
#include "Kfp.h"
#include "SYS.h"

ENTRY(Ksfpover, 0)
	movl	$HUGE0,r0
	movl	$HUGE1,r1
	ret

ENTRY(Ksfpunder, 0)
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
/*	Ksfp_exp.s	1.3	86/01/05	*/

#include "../tahoemath/fp.h"
#include "../tahoemath/Kfp.h"
#include "../tahoe/SYS.h"

ENTRY(Ksfpover, 0)
	movl	$HUGE0,r0
	movl	$HUGE1,r1
	ret

ENTRY(Ksfpunder, 0)

Changes to sys/tahoe/math/Ksinfcosf.s.

1
2
3
4
5
6
7
8
9
10
/*	Ksinfcosf.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Kcosf, 0)
	tstl	4(fp)		# if (arg < 0)
	jgeq	L23
	lnd	4(fp)
	std	4(fp)		# arg = -arg;
|

|







1
2
3
4
5
6
7
8
9
10
/*	Ksinfcosf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Kcosf, 0)
	tstl	4(fp)		# if (arg < 0)
	jgeq	L23
	lnd	4(fp)
	std	4(fp)		# arg = -arg;

Changes to sys/tahoe/math/Ksqrtf.s.

1
2
3
4
5
6
7
8
9
10
/*	Ksqrtf.s	1.2	86/01/03	*/

#include "SYS.h"

	.text
ENTRY(Ksqrtf, 0)
	subl3	$76,fp,sp
	tstl	4(fp)			# if (arg <= 0.) {
	jgtr	L18
	jgeq	L19			# if (arg < 0.)
|

|







1
2
3
4
5
6
7
8
9
10
/*	Ksqrtf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

	.text
ENTRY(Ksqrtf, 0)
	subl3	$76,fp,sp
	tstl	4(fp)			# if (arg <= 0.) {
	jgtr	L18
	jgeq	L19			# if (arg < 0.)

Changes to sys/tahoe/math/Ksubd.s.

1
2
3
4
5
6
7
8
9
10
/*	Ksubd.s	1.2	86/01/03	*/

#include "SYS.h"

/*
 * double 
 * Ksubd(d1,d2)
 * double d1,d2;
 * {
 * 	return(d1+(-d2));
|

|







1
2
3
4
5
6
7
8
9
10
/*	Ksubd.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

/*
 * double 
 * Ksubd(d1,d2)
 * double d1,d2;
 * {
 * 	return(d1+(-d2));

Changes to sys/tahoe/math/Ksubf.s.

1
2
3
4
5
6
7
8
9
10
/*	Ksubf.s	1.2	86/01/03	*/

#include "SYS.h"

/*
 * _Ksubf(acc_most,acc_least,op_most,op_least,hfs)
 *
 * subf(d1,d2)
 * {
 * 	return(d1+(-d2));
|

|







1
2
3
4
5
6
7
8
9
10
/*	Ksubf.s	1.3	86/01/05	*/

#include "../tahoe/SYS.h"

/*
 * _Ksubf(acc_most,acc_least,op_most,op_least,hfs)
 *
 * subf(d1,d2)
 * {
 * 	return(d1+(-d2));

Added sys/tahoe/math/fpe.c.







































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*	fpe.c	1.1	86/01/03	*/

#include "../tahoe/psl.h"
#include "../tahoe/reg.h"
#include "../tahoe/pte.h"
#include "../tahoe/mtpr.h"
#include "../tahoemath/Kfp.h"

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "proc.h"
#include "seg.h"
#include "acct.h"
#include "kernel.h"

/*
 * Floating point emulation support.
 */
extern	float Kcvtlf(), Kaddf(), Ksubf(), Kmulf(), Kdivf();
extern	double Kcvtld(), Kaddd(), Ksubd(), Kmuld(), Kdivd();
extern	float Ksinf(), Kcosf(), Katanf(), Klogf(), Ksqrtf(), Kexpf();

#define	OP(dop)		((dop) &~ 01)	/* precision-less version of opcode */
#define	isdouble(op)	((op) & 01)	/* is opcode double or float */

struct	fpetab {
	int	fpe_op;		/* base opcode emulating */
	float	(*fpe_ffunc)();	/* float version of op */
	double	(*fpe_dfunc)();	/* double version of op */
} fpetab[] = {
	{ OP(CVLD),	Kcvtlf,	Kcvtld },
	{ OP(ADDD),	Kaddf,	Kaddd },
	{ OP(SUBD),	Ksubf,	Ksubd },
	{ OP(MULD),	Kmulf,	Kmuld },
	{ OP(DIVD),	Kdivf,	Kdivd },
	{ SINF,		Ksinf,	0 },
	{ COSF,		Kcosf,	0 },
	{ ATANF,	Katanf,	0 },
	{ LOGF,		Klogf,	0 },
	{ SQRTF,	Ksqrtf,	0 },
	{ EXPF,		Kexpf,	0 },
};
#define	NFPETAB	(sizeof (fpetab) / sizeof (fpetab[0]))

/*
 * Emulate the FP opcode. Update psl as necessary.
 * If OK, set opcode to 0, else to the FP exception #.
 * Not all parameter longwords are relevant, depends on opcode.
 *
 * The entry mask is set by locore.s so ALL registers are saved.
 * This enables FP opcodes to change user registers on return.
 */
/* WARNING!!!! THIS CODE MUST NOT PRODUCE ANY FLOATING POINT EXCEPTIONS */
/*ARGSUSED*/
fpemulate(hfsreg, acc_most, acc_least, dbl, op_most, op_least, opcode, pc, psl)
{
	int r0, r1;			/* must reserve space */
	register int *locr0 = ((int *)&psl)-PS;
	register struct fpetab *fp;
	int hfs = 0; 			/* returned data about exceptions */
	int type;			/* opcode type, FLOAT or DOUBLE */
	union { float ff; int fi; } f_res;
	union { double dd; int di[2]; } d_res;

#ifdef lint
	r0 = 0; r0 = r0; r1 = 0; r1 = r1;
#endif
	type = isdouble(opcode) ? DOUBLE : FLOAT;
	for (fp = fpetab; fp < &fpetab[NFPETAB]; fp++)
		if ((opcode & 0xfe) == fp->fpe_op)
			break;
	if (type == DOUBLE) {
		if (fp->fpe_dfunc == 0)
			fp = &fpetab[NFPETAB];
		else
			locr0[PS] &= ~PSL_DBL;
	}
	if (fp >= &fpetab[NFPETAB]) {
		opcode = DIV0_EXC;	/* generate SIGILL - XXX */
		return;
	}
	switch (type) {

	case DOUBLE:
		d_res.dd = (*fp->fpe_dfunc)(acc_most, acc_least, op_most,
		    op_least, &hfs);
		if (d_res.di[0] == 0 && d_res.di[1] == 0)
			locr0[PS] |= PSL_Z;
		if (d_res.di[0] < 0)
			locr0[PS] |= PSL_N;
		break;

	case FLOAT:
		f_res.ff = (*fp->fpe_ffunc)(acc_most, acc_least, op_most,
		    op_least, &hfs);
		if (f_res.fi == 0)
			locr0[PS] |= PSL_Z;
		if (f_res.fi ==  0)
			locr0[PS] |= PSL_N;
		break;
	}
	if (hfs & HFS_OVF) {
		locr0[PS] |= PSL_V;	/* turn on overflow bit */
#ifdef notdef
		if (locr0[PS] & PSL_IV)   {  /* overflow enabled? */
#endif
			opcode = OVF_EXC;
			u.u_error = (hfs & HFS_DOM) ? EDOM : ERANGE;
			return;
#ifdef notdef
		}
#endif
	} else if (hfs & HFS_UNDF) {
		if (locr0[PS] &  PSL_FU) {  /* underflow enabled? */
			opcode = UNDF_EXC;
			u.u_error = (hfs & HFS_DOM) ? EDOM : ERANGE;
			return;
		} 
	} else if (hfs & HFS_DIVZ) {
		opcode = DIV0_EXC;
		return;
	} else if (hfs & HFS_DOM)
		u.u_error = EDOM;
	else if (hfs & HFS_RANGE)
		u.u_error = ERANGE;
	switch (type) {

	case DOUBLE:
		if (hfs & (HFS_OVF|HFS_UNDF)) {
			d_res.dd = 0.0;
			locr0[PS] |= PSL_Z;
		}
		mvtodacc(d_res.di[0], d_res.di[1], &acc_most);
		break;

	case FLOAT:
		if (hfs & (HFS_OVF|HFS_UNDF)) {
			f_res.ff = 0.0;
			locr0[PS] |= PSL_Z;
		}
		mvtofacc(f_res.ff, &acc_most);
		break;
	}
	opcode = 0;
}

Changes to sys/tahoe/stand/udc.h.

1
2
3
4
5
6
7
8
/*	udc.h	1.1	85/07/21	*/

struct UDPAC {		/* UDC command packet */
	char _stx  ;
	char _pkid ;
	char _pksiz ;	/* 21  bytes */
	char _pkdev ;	/* device # */	
	char _pkcmd ;	/* Command type */
|







1
2
3
4
5
6
7
8
/*	udc.h	1.2	86/01/05	*/

struct UDPAC {		/* UDC command packet */
	char _stx  ;
	char _pkid ;
	char _pksiz ;	/* 21  bytes */
	char _pkdev ;	/* device # */	
	char _pkcmd ;	/* Command type */
85
86
87
88
89
90
91
92
93
94
95
96
#define	IN3	0xffffb004
#define	IN4	0xffffb00c
#define	IN5	0xffffb02c

int dummy;
extern char vmem[][16*NBPG];

#define	IOaddr(off)	(char *)((int)vmem + ((off) & 0x0fffff))

int	iospace_mapped;
#define	scope_out(x)	if(iospace_mapped) movob (0, IOaddr(OUT/**/x))
#define	scope_in(x)	if(iospace_mapped) dummy =  *IOaddr(IN/**/x)







|


|

85
86
87
88
89
90
91
92
93
94
95
96
#define	IN3	0xffffb004
#define	IN4	0xffffb00c
#define	IN5	0xffffb02c

int dummy;
extern char vmem[][16*NBPG];

#define	IOaddr(off)	(caddr_t)((int)vmem + ((off) & 0x0fffff))

int	iospace_mapped;
#define	scope_out(x)	if(iospace_mapped) movob(IOaddr(OUT/**/x),0)
#define	scope_in(x)	if(iospace_mapped) dummy =  *IOaddr(IN/**/x)

Changes to sys/tahoe/tahoe/Locore.c.

1
2
3

4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40








41
42
43
44
45
46
47
48
49
50

51



52
53
54
55
56
57
58
59
60
61
62






63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78




79



80
81
82
83
84
85
86
87
88
89
90
91

92

93
94
95
96

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
124
125
126
127

128
129


130
131

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160



















161
162










163
164
165
166
167
168
169
170
171
172
173
174
175
176


177
178
179
180
181
182
183
184





185
186



187
188


189
190
191
192



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282

283






284


285






























/*	Locore.c	1.1	85/07/21	*/

#include "dz.h"

#include "mba.h"
#include "uba.h"

#include "../machine/pte.h"


#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/vm.h"
#include "../h/tty.h"
#include "../h/proc.h"
#include "../h/buf.h"
#include "../h/msgbuf.h"
#include "../h/mbuf.h"
#include "../h/protosw.h"
#include "../h/domain.h"

#include "../vax/nexus.h"
#include "../vaxuba/ubavar.h"
#include "../vaxuba/ubareg.h"

/*
 * Pseudo file for lint to show what is used/defined in locore.s.
 */

struct	scb scb;
int	(*UNIvec[128])();
#if NUBA > 1
int	(*UNI1vec[128])();
#endif
struct	rpb rpb;

int	intstack[3*128];

int	masterpaddr;		/* p_addr of current process on master cpu */

struct	user u;









doadump() { dumpsys(); }

Xmba3int() { }
Xmba2int() { }
Xmba1int() { }
Xmba0int() { }

lowinit()
{

	extern int dumpmag;



	extern struct domain unixdomain;
#ifdef PUP
	extern struct domain pupdomain;
#endif
#ifdef INET
	extern struct domain inetdomain;
#endif
#include "imp.h"
#if NIMP > 0
	extern struct domain impdomain;
#endif







	/* cpp messes these up for lint so put them here */
	unixdomain.dom_next = domains;
	domains = &unixdomain;
#ifdef PUP
	pupdomain.dom_next = domains;
	domains = &pupdomain;
#endif
#ifdef INET
	inetdomain.dom_next = domains;
	domains = &inetdomain;
#endif
#if NIMP > 0
	impdomain.dom_next = domains;
	domains = &impdomain;
#endif




	dumpmag = 0;			/* used only by savecore */




	/*
	 * Pseudo-uses of globals.
	 */
	lowinit();
	intstack[0] = intstack[1];
	rpb = rpb;
	scb = scb;
	maxmem = physmem = freemem = 0;
	u = u;
	fixctlrmask();
	main(0);

	Xustray();


	/*
	 * Routines called from interrupt vectors.
	 */

	panic("Machine check");
	printf("Write timeout");
	(*UNIvec[0])();
#if NUBA > 1
	(*UNI1vec[0])();
#endif
	ubaerror(0, (struct uba_hd *)0, 0, 0, (struct uba_regs *)0);
	cnrint(0);
	cnxint(0);
	consdin();
	consdout();
#if NDZ > 0
	dzdma();
#endif
#if NMBA > 0
	mbintr(0);
#endif
	hardclock((caddr_t)0, 0);
	softclock((caddr_t)0, 0);

	trap(0, 0, (unsigned)0, 0, 0);
	syscall(0, 0, (unsigned)0, 0, 0);
	ipintr();
	rawintr();

	if (vmemall((struct pte *)0, 0, (struct proc *)0, 0))
		return;		/* use value */
	machinecheck((caddr_t)0);
	memerr();
	boothowto = 0;
}


consdin() { }
consdout() { }


#if NDZ > 0
dzdma() { dzxint((struct tty *)0); }

#endif

int	catcher[256];
int	cold = 1;

Xustray() { }

struct	pte Sysmap[6*NPTEPG];
char	Sysbase[6*NPTEPG*NBPG];
int	umbabeg;
struct	pte Nexmap[16][16];
struct	nexus nexus[MAXNNEXUS];
struct	pte UMEMmap[MAXNUBA][512];
char	umem[MAXNUBA][512*NBPG];
int	umbaend;
struct	pte Usrptmap[USRPTSIZE];
struct	pte usrpt[USRPTSIZE*NPTEPG];
struct	pte Forkmap[UPAGES];
struct	user forkutl;
struct	pte Xswapmap[UPAGES];
struct	user xswaputl;
struct	pte Xswap2map[UPAGES];
struct	user xswap2utl;
struct	pte Swapmap[UPAGES];
struct	user swaputl;
struct	pte Pushmap[UPAGES];
struct	user pushutl;
struct	pte Vfmap[UPAGES];
struct	user vfutl;



















struct	pte CMAP1;
char	CADDR1[NBPG];










struct	pte CMAP2;
char	CADDR2[NBPG];
struct	pte mmap[1];
char	vmmap[NBPG];
struct	pte Mbmap[NMBCLUSTERS/CLSIZE];
struct	mbuf mbutl[NMBCLUSTERS*CLBYTES/sizeof (struct mbuf)];
struct	pte msgbufmap[CLSIZE];
struct	msgbuf msgbuf;
struct	pte camap[32];
int	cabase;
#ifdef unneeded
char	caspace[32*NBPG];
#endif
int	calimit;



/*ARGSUSED*/
badaddr(addr, len) caddr_t addr; int len; { return (0); }

/*ARGSUSED*/
copyin(udaddr, kaddr, n) caddr_t udaddr, kaddr; unsigned n; { return (0); }

/*ARGSUSED*/





copyout(kaddr, udaddr, n) caddr_t kaddr, udaddr; unsigned n; { return (0); }




/*ARGSUSED*/
setjmp(lp) label_t *lp; { return (0); }



/*ARGSUSED*/
longjmp(lp) label_t *lp; { /*NOTREACHED*/ }




/*ARGSUSED*/
setrq(p) struct proc *p; { }

/*ARGSUSED*/
remrq(p) struct proc *p; { }

swtch() { if (whichqs) whichqs = 0; if (masterpaddr) masterpaddr = 0; }

/*ARGSUSED*/
resume(pcbpf) unsigned pcbpf; { }

/*ARGSUSED*/
fubyte(base) caddr_t base; { return (0); }

/*ARGSUSED*/
subyte(base, i) caddr_t base; { return (0); }

/*ARGSUSED*/
suibyte(base, i) caddr_t base; { return (0); }

/*ARGSUSED*/
fuword(base) caddr_t base; { return (0); }

/*ARGSUSED*/
fuiword(base) caddr_t base; { return (0); }

/*ARGSUSED*/
suword(base, i) caddr_t base; { return (0); }

/*ARGSUSED*/
suiword(base, i) caddr_t base; { return (0); }

/*ARGSUSED*/
copyseg(udaddr, pf) caddr_t udaddr; unsigned pf; {
    CMAP1 = CMAP1; CADDR1[0] = CADDR1[0];
}

/*ARGSUSED*/
clearseg(pf) unsigned pf; { CMAP2 = CMAP2; CADDR2[0] = CADDR2[0]; }

/*ARGSUSED*/
useracc(udaddr, bcnt, rw) caddr_t udaddr; unsigned bcnt; { return (0); }

/*ARGSUSED*/
kernacc(addr, bcnt, rw) caddr_t addr; unsigned bcnt; { return (0); }

/*
 * Routines handled by asm.sed script.
 */

/*VARARGS1*/
/*ARGSUSED*/
mtpr(reg, value) int reg, value; { }

/*ARGSUSED*/
mfpr(reg) int reg; { return (0); }


spl0() { }
spl4() { return (0); }
spl5() { return (0); }
spl6() { return (0); }
spl7() { return (0); }

/*ARGSUSED*/
splx(s) int s; { }

/*ARGSUSED*/
bcopy(from, to, count) caddr_t from, to; unsigned count; { ; }

/*ARGSUSED*/
bzero(base, count) caddr_t base; unsigned count; { ; }

/*ARGSUSED*/
bcmp(s1, s2, count) caddr_t s1, s2; unsigned count; { return (0); }

/*ARGSUSED*/
scanc(size, cp, table, mask)
unsigned size; caddr_t cp, table; int mask; { return (0); }

/*ARGSUSED*/
ffs(i) { return (0); }

ntohs(s) u_short s; { return ((int)s); }

htons(s) u_short s; { return ((int)s); }

/*
 * Variables declared for savecore, or
 * implicitly, such as by config or the loader.

 */






char	version[] = "4.2 BSD UNIX ....";


char	etext;






























|

|
>
|
|
|
|
>

|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
<






<
<
<
<

>
|
<

<

>
>
>
>
>
>
>
>



<
<
<
<
<


>

>
>
>











>
>
>
>
>
>
















>
>
>
>

>
>
>










<

>
|
>




>


|
|
|

<
<
<
<
<
|
|

<
|
|


>
|
|
<
<



|
|

<
|
>
|
|
>
>
|
<
>

|
<
<

<
<

|
<
|
<
<
<
|














>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
|
|

|
<
<
|

|
|
<
<
<
<
>
>



|

|
|

>
>
>
>
>
|
|
>
>
>

|
>
>




>
>
>













<


<

<
<
<

<
<
<
<




<
|
<
|
|
|
<

|







<
<
<
<
<

|


<
|
|
<
|
<
<
<


<
|
<
<

<
<
|

<
|
<
<
<
|
<
<

<
<
<
<

<
<
>

>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24

25
26
27
28
29
30




31
32
33

34

35
36
37
38
39
40
41
42
43
44
45
46





47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119





120
121
122

123
124
125
126
127
128
129


130
131
132
133
134
135

136
137
138
139
140
141
142

143
144
145


146


147
148

149



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199


200
201
202
203




204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

248
249

250



251




252
253
254
255

256

257
258
259

260
261
262
263
264
265
266
267
268





269
270
271
272

273
274

275



276
277

278


279


280
281

282



283


284




285


286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*	Locore.c	1.2	86/01/05	*/

#include "../tahoe/mtpr.h"
#include "../tahoe/trap.h"
#include "../tahoe/psl.h"
#include "../tahoe/pte.h"
#include "../tahoe/cp.h"
#include "../tahoe/mem.h"
#include "../tahoemath/fp.h"

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "vm.h"
#include "ioctl.h"
#include "tty.h"
#include "proc.h"
#include "buf.h"
#include "msgbuf.h"
#include "mbuf.h"
#include "protosw.h"

#include "domain.h"
#include "map.h"


/*
 * Pseudo file for lint to show what is used/defined in locore.s.
 */

struct	scb scb;




struct	rpb rpb;
int	dumpflag;
int	intstack[3*NBPG];

int	masterpaddr;		/* p_addr of current process on master cpu */

struct	user u;
int	icode[8];
int	szicode = sizeof (icode);
/*
 * Variables declared for savecore, or
 * implicitly, such as by config or the loader.
 */
char	version[] = "4.2 BSD UNIX ....";
int	etext;

doadump() { dumpsys(); }






lowinit()
{
	caddr_t cp;
	extern int dumpmag;
	extern int rthashsize;
	extern int arptab_size;
	extern int dk_ndrive;
	extern struct domain unixdomain;
#ifdef PUP
	extern struct domain pupdomain;
#endif
#ifdef INET
	extern struct domain inetdomain;
#endif
#include "imp.h"
#if NIMP > 0
	extern struct domain impdomain;
#endif
#ifdef NS
	extern struct domain nsdomain;
#endif
	extern int nport;
	extern short *swsize;
	extern int *swpf;

	/* cpp messes these up for lint so put them here */
	unixdomain.dom_next = domains;
	domains = &unixdomain;
#ifdef PUP
	pupdomain.dom_next = domains;
	domains = &pupdomain;
#endif
#ifdef INET
	inetdomain.dom_next = domains;
	domains = &inetdomain;
#endif
#if NIMP > 0
	impdomain.dom_next = domains;
	domains = &impdomain;
#endif
#ifdef NS
	nsdomain.dom_next = domains;
	domains = &nsdomain;
#endif
	dumpmag = 0;			/* used only by savecore */
	rthashsize = rthashsize;	/* used by netstat, etc. */
	arptab_size = arptab_size;	/* used by arp command */
	dk_ndrive = dk_ndrive;		/* used by vmstat, iostat, etc. */

	/*
	 * Pseudo-uses of globals.
	 */
	lowinit();
	intstack[0] = intstack[1];
	rpb = rpb;
	scb = scb;
	maxmem = physmem = freemem = 0;
	u = u;

	main(0);
	swsize = swsize;		/* XXX */
	swpf = swpf;			/* XXX */
	nport = nport;			/* XXX */

	/*
	 * Routines called from interrupt vectors.
	 */
	buserror((caddr_t)0);
	panic("Machine check");
	printf("Write timeout");
	rawintr();
#ifdef INET
	ipintr();
#endif





#ifdef NS
	nsintr();
#endif

	cnrint(0);
	cnxint(0);
	hardclock((caddr_t)0, 0);
	softclock((caddr_t)0, 0);
	fpemulate(0, 0, 0, 0, 0, 0, 0, 0, 0);
	trap(0, 0, 0, 0, 0, 0, (unsigned)0, 0, 0);
	syscall(0, 0, 0, 0, 0, 0, (unsigned)0, 0, 0);



	if (vmemall((struct pte *)0, 0, (struct proc *)0, 0))
		return;		/* use value */
	if (zmemall((int (*)())0, 0) == (caddr_t)0)
		return;		/* use value */
	boothowto = 0;

/* the following are not currently used but will soon */
	if (rmget((struct map *)0, 0, 0) == 0)
		return;
	cp = calloc(0); cfreemem(cp, 0);
/* end not currently used */
	dumpflag = 0; dumpflag = dumpflag;
#if !defined(GPROF)

	cp = (caddr_t)&etext;
#endif
}





struct	pte Sysmap[6*NPTEPG];
caddr_t	Sysbase;

struct	pte VMEMmap[1];



int	vmembeg, vmemend;
struct	pte Usrptmap[USRPTSIZE];
struct	pte usrpt[USRPTSIZE*NPTEPG];
struct	pte Forkmap[UPAGES];
struct	user forkutl;
struct	pte Xswapmap[UPAGES];
struct	user xswaputl;
struct	pte Xswap2map[UPAGES];
struct	user xswap2utl;
struct	pte Swapmap[UPAGES];
struct	user swaputl;
struct	pte Pushmap[UPAGES];
struct	user pushutl;
struct	pte Vfmap[UPAGES];
struct	user vfutl;
#include "fsd.h"
#if NVD > 0
struct	pte VD0map[MAXBPTE+1];
char	vd0utl[1];
#endif
#if NVD > 1
struct	pte VD1map[MAXBPTE+1];
char	vd1utl[1];
#endif
#if NVD > 2
struct	pte VD2map[MAXBPTE+1];
char	vd2utl[1];
#endif
#if NVD > 3
struct	pte VD3map[MAXBPTE+1];
char	vd3utl[1];
#endif
#include "cy.h"
#if NCY > 0
struct	pte CY0map[TBUFSIZ+1];
char	cy0utl[1];
#endif
#if NCY > 1
struct	pte CY1map[TBUFSIZ+1];
char	cy1utl[1];
#endif
#include "ace.h"
#if NACE > 0
struct	pte ACE0map[1], ACE1map[1];
char	ace0utl[1], ace1utl[1];
#endif
struct	pte CMAP1[1], CMAP2[1];
caddr_t	CADDR1, CADDR2;
struct	pte mmap[1];
char	vmmap[1];


struct	pte msgbufmap[3*NBPG];
struct	msgbuf msgbuf;
struct	pte camap[16];
int	cabase, calimit;




struct	pte Mbmap[NMBCLUSTERS/CLSIZE];
struct	mbuf mbutl[NMBCLUSTERS*CLBYTES/sizeof (struct mbuf)];

/*ARGSUSED*/
badaddr(addr, len) caddr_t addr; int len; { return (0); }
#if NCY > 0
/*ARGSUSED*/
badcyaddr(addr) caddr_t addr; { return (0); }
#endif
/*ARGSUSED*/
ovbcopy(from, to, len) caddr_t from, to; unsigned len; { }
copyinstr(udaddr, kaddr, maxlength, lencopied)
    caddr_t udaddr, kaddr; u_int maxlength, *lencopied;
{ *kaddr = *udaddr; *lencopied = maxlength; return (0); }
copyoutstr(kaddr, udaddr, maxlength, lencopied)
    caddr_t kaddr, udaddr; u_int maxlength, *lencopied;
{ *kaddr = *udaddr; *lencopied = maxlength; return (0); }
copystr(kfaddr, kdaddr, maxlength, lencopied)
    caddr_t kfaddr, kdaddr; u_int maxlength, *lencopied;
{ *kdaddr = *kfaddr; *lencopied = maxlength; return (0); }
/*ARGSUSED*/
copyin(udaddr, kaddr, n) caddr_t udaddr, kaddr; u_int n; { return (0); }
/*ARGSUSED*/
copyout(kaddr, udaddr, n) caddr_t kaddr, udaddr; u_int n; { return (0); }

/*ARGSUSED*/
longjmp(lp) label_t *lp; { /*NOTREACHED*/ }

/*ARGSUSED*/
savectx(lp) label_t *lp; { return (0); }

/*ARGSUSED*/
setrq(p) struct proc *p; { }

/*ARGSUSED*/
remrq(p) struct proc *p; { }

swtch() { if (whichqs) whichqs = 0; if (masterpaddr) masterpaddr = 0; }

/*ARGSUSED*/
resume(pcbpf) unsigned pcbpf; { }

/*ARGSUSED*/
fubyte(base) caddr_t base; { return (0); }

/*ARGSUSED*/
subyte(base, i) caddr_t base; { return (0); }

/*ARGSUSED*/



fuword(base) caddr_t base; { return (0); }




/*ARGSUSED*/
suword(base, i) caddr_t base; { return (0); }

/*ARGSUSED*/

copyseg(udaddr, pf)

    caddr_t udaddr; unsigned pf;
{ CMAP1[0] = CMAP1[0]; CADDR1[0] = CADDR1[0]; }


/*ARGSUSED*/
clearseg(pf) unsigned pf; { CMAP2[0] = CMAP2[0]; CADDR2[0] = CADDR2[0]; }

/*ARGSUSED*/
useracc(udaddr, bcnt, rw) caddr_t udaddr; unsigned bcnt; { return (0); }

/*ARGSUSED*/
kernacc(addr, bcnt, rw) caddr_t addr; unsigned bcnt; { return (0); }






/*ARGSUSED*/
addupc(pc, prof, counts) int pc; struct uprof *prof; int counts; { }

/*ARGSUSED*/

scanc(size, cp, table, mask)
    unsigned size; char *cp, table[]; int mask;

{ return (0); }




/*ARGSUSED*/

skpc(mask, size, cp) int mask; char *cp; unsigned size; { return (0); }





#ifdef notdef
/*ARGSUSED*/

locc(mask, size, cp) int mask; char *cp; unsigned size; { return (0); }



#endif







/*


 * Routines expanded by inline.
 */
#ifdef notdef
fuibyte(base) caddr_t base; { return (fubyte(base)); }
#endif
fuiword(base) caddr_t base; { return (fuword(base)); }
suibyte(base, i) caddr_t base; { return (subyte(base, i)); }
suiword(base, i) caddr_t base; { return (suword(base, i)); }

/*ARGSUSED*/
setjmp(lp) label_t *lp; { return (0); }

/*ARGSUSED*/
_insque(p, q) caddr_t p, q; { }
/*ARGSUSED*/
_remque(p) caddr_t p; { }

/*ARGSUSED*/
bcopy(from, to, len) caddr_t from, to; unsigned len; { }
/*ARGSUSED*/
bzero(base, count) caddr_t base; unsigned count; { }
/*ARGSUSED*/
blkclr(base, count) caddr_t base; unsigned count; { }

/*ARGSUSED*/
/*VARARGS1*/
mtpr(reg, v) int reg; { }
/*ARGSUSED*/
mfpr(reg) int reg; { return (0); }

/*ARGSUSED*/
_movow(dst, v) u_short *dst, v; { }
/*ARGSUSED*/
_movob(dst, v) u_char *dst, v; { }

/*ARGSUSED*/
ffs(v) long v; { return (0); }

imin(a, b) int a, b; { return (a < b ? a : b); }
imax(a, b) int a, b; { return (a > b ? a : b); }
unsigned min(a, b) u_int a, b; { return (a < b ? a : b); }
unsigned max(a, b) u_int a, b; { return (a > b ? a : b); }

Added sys/tahoe/tahoe/SYS.h.





























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*	SYS.h	1.1	86/01/05	*/

/*
 * Macros used to define entry points
 * in assembly language routines.
 */
#if defined(GPROF) || defined(PROF)
#define	ENTRY(name, regs) \
	.globl _/**/name; .align 2; _/**/name: .word regs; callf $0,mcount
#define	ASENTRY(name, regs) \
	.globl name; .align 2; name: .word regs; callf $0,mcount
#else
#define	ENTRY(name, regs) \
	.globl _/**/name; .align 2; _/**/name: .word regs
#define	ASENTRY(name, regs) \
	.globl name; .align 2; name: .word regs
#endif
#define R0	0x0001
#define R1	0x0002
#define R2	0x0004
#define R3	0x0008
#define R4	0x0010
#define R5	0x0020
#define R6	0x0040
#define	R7	0x0080
#define	R8	0x0100
#define	R9	0x0200
#define	R10	0x0400
#define	R11	0x0800
#define	R12	0x1000

Changes to sys/tahoe/tahoe/autoconf.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*	autoconf.c	1.1	85/07/21	*/

/*
 * Setup the system to run on the current machine.
 *
 * Configure() is called at boot time and initializes the vba 
 * device tables and the memory controller monitoring.  Available
 * devices are determined (from possibilities mentioned in ioconf.c),
 * and the drivers are initialized.
 *
 */

#include "../machine/pte.h"
#include "../h/param.h"
#include "../h/systm.h"

#include "../h/map.h"
#include "../h/buf.h"
#include "../h/dk.h"
#include "../h/vm.h"
#include "../h/conf.h"
#include "../h/dmap.h"
#include "../machine/mem.h"
#include "../machine/mtpr.h"

#include "../vba/vbavar.h"

/*
 * The following several variables are related to
 * the configuration process, and are used in initializing
 * the machine.
 */
int	dkn;		/* number of iostat dk numbers assigned so far */

/*
 * Determine mass storage configuration for a machine.
 */
configure()
{
	register int *ip;
	extern char Sysbase[];

	printf("vba%d at 0x%x\n", numvba, IOBASE);
	vbafind((char *)vmem,(struct pte *)VMEMmap);
	/*
	 * Write protect the scb.  It is strange
	 * that this code is here, but this is as soon
	 * as we are done mucking with it, and the
	 * write-enable was done in assembly language
	 * to which we will never return.
	 */
	ip = (int *)&Sysmap[2]; *ip &= ~PG_PROT; *ip |= PG_KR;
	mtpr(Sysbase+0x800, TBIS);
#if GENERIC
	setconf();
#endif
	swapconf();
}


/*
 * Make the controllers accessible at physical address phys
 * by mapping kernel ptes starting at pte.
 */

ioaccess(pte,iobase,iosize)
	register struct pte *pte;
	register caddr_t iobase;
	register int	iosize;
{
	register int i = iosize;	/* number of ptes to map */
	register unsigned v = btop(iobase);
	
	do
		*(int *)pte++ = PG_V|PG_KW|v++;
	while (--i > 0);
	mtpr(0, TBIA);
}


/*
 * Find devices on the BUS.
 * Uses per-driver routine to see who is on the bus
 * and then fills in the tables, with help from a per-driver
 * slave initialization routine.
 */

int	iospace_mapped = 0;

vbafind(vumem, memmap)

	char *vumem;
	struct pte *memmap;
{
	register struct vba_device *ui;
	register struct vba_ctlr *um;
	u_short *reg;
	long  addr;
	struct vba_driver *udp;
	int i;

	/*
	 * Make the controllers accessible at physical address phys
	 * by mapping kernel ptes starting at pte.
	 */
	ioaccess(memmap,IOBASE,IOSIZE);
	iospace_mapped = 1;
#define	vbaddr(off)	(u_short *)((int)vumem + ((off) & 0x0fffff))


	/*
	 * Check each VERSAbus mass storage controller.
	 * For each one which is potentially on this vba,
	 * see if it is really there, and if it is record it and
	 * then go looking for slaves.
	 */
	for (um = vbminit; udp = um->um_driver; um++) {
		if (um->um_vbanum != numvba && um->um_vbanum != '?')
			continue;
		addr = (long)um->um_addr;
		reg = vbaddr(addr);
		i = (*udp->ud_probe)(reg);
		if (i == 0)
			continue;
		printf("%s%d at csr 0x%x\n",
		    udp->ud_mname, um->um_ctlr, addr);
		um->um_alive = 1;
		um->um_vbanum = numvba;
		um->um_addr = (caddr_t)reg;
		udp->ud_minfo[um->um_ctlr] = um;
		for (ui = vbdinit; ui->ui_driver; ui++) {
			if (ui->ui_driver != udp || ui->ui_alive ||
			    ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?' ||
			    ui->ui_vbanum != numvba && ui->ui_vbanum != '?')
				continue;
			if ((*udp->ud_slave)(ui, reg)) {
				ui->ui_alive = 1;
				ui->ui_ctlr = um->um_ctlr;
				ui->ui_vbanum = numvba;
				ui->ui_addr = (caddr_t)reg;
				ui->ui_physaddr = (caddr_t)IOBASE + (addr&0x0fffff);
				if (ui->ui_dk && dkn < DK_NDRIVE)
					ui->ui_dk = dkn++;
				else
					ui->ui_dk = -1;
				ui->ui_mi = um;
|










<
|
|
|
>
|
|
|
|
|
|
|
|
>
|














|

|
|








|











<
|

|
|

<




|
|












|
>














|


<








|






|
|

|





|




|







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*	autoconf.c	1.2	86/01/05	*/

/*
 * Setup the system to run on the current machine.
 *
 * Configure() is called at boot time and initializes the vba 
 * device tables and the memory controller monitoring.  Available
 * devices are determined (from possibilities mentioned in ioconf.c),
 * and the drivers are initialized.
 *
 */

#include "../tahoe/pte.h"
#include "../tahoe/mem.h"
#include "../tahoe/mtpr.h"

#include "param.h"
#include "systm.h"
#include "map.h"
#include "buf.h"
#include "dk.h"
#include "vm.h"
#include "conf.h"
#include "dmap.h"

#include "../tahoevba/vbavar.h"

/*
 * The following several variables are related to
 * the configuration process, and are used in initializing
 * the machine.
 */
int	dkn;		/* number of iostat dk numbers assigned so far */

/*
 * Determine mass storage configuration for a machine.
 */
configure()
{
	register int *ip;
	extern caddr_t Sysbase;

	printf("vba%d at %x\n", numvba-1, IOBASE);
	vbafind(numvba-1, (char *)vmem,(struct pte *)VMEMmap);
	/*
	 * Write protect the scb.  It is strange
	 * that this code is here, but this is as soon
	 * as we are done mucking with it, and the
	 * write-enable was done in assembly language
	 * to which we will never return.
	 */
	ip = (int *)&Sysmap[2]; *ip &= ~PG_PROT; *ip |= PG_KR;
	mtpr(TBIS, Sysbase+2*NBPG);
#if GENERIC
	setconf();
#endif
	swapconf();
}


/*
 * Make the controllers accessible at physical address phys
 * by mapping kernel ptes starting at pte.
 */

ioaccess(pte, iobase, n)
	register struct pte *pte;
	caddr_t iobase;
	register int n;
{

	register unsigned v = btop(iobase);
	
	do
		*(int *)pte++ = PG_V|PG_KW|v++;
	while (--n > 0);
	mtpr(TBIA, 0);
}


/*
 * Find devices on the BUS.
 * Uses per-driver routine to see who is on the bus
 * and then fills in the tables, with help from a per-driver
 * slave initialization routine.
 */

int	iospace_mapped = 0;

vbafind(vban, vumem, memmap)
	int vban;
	char *vumem;
	struct pte *memmap;
{
	register struct vba_device *ui;
	register struct vba_ctlr *um;
	u_short *reg;
	long  addr;
	struct vba_driver *udp;
	int i;

	/*
	 * Make the controllers accessible at physical address phys
	 * by mapping kernel ptes starting at pte.
	 */
	ioaccess(memmap, IOBASE, (int)IOSIZE);
	iospace_mapped = 1;
#define	vbaddr(off)	(u_short *)((int)vumem + ((off) & 0x0fffff))


	/*
	 * Check each VERSAbus mass storage controller.
	 * For each one which is potentially on this vba,
	 * see if it is really there, and if it is record it and
	 * then go looking for slaves.
	 */
	for (um = vbminit; udp = um->um_driver; um++) {
		if (um->um_vbanum != vban && um->um_vbanum != '?')
			continue;
		addr = (long)um->um_addr;
		reg = vbaddr(addr);
		i = (*udp->ud_probe)(reg);
		if (i == 0)
			continue;
		printf("%s%d at vba%d csr %x\n",
		    udp->ud_mname, um->um_ctlr, vban, addr);
		um->um_alive = 1;
		um->um_vbanum = vban;
		um->um_addr = (caddr_t)reg;
		udp->ud_minfo[um->um_ctlr] = um;
		for (ui = vbdinit; ui->ui_driver; ui++) {
			if (ui->ui_driver != udp || ui->ui_alive ||
			    ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?' ||
			    ui->ui_vbanum != vban && ui->ui_vbanum != '?')
				continue;
			if ((*udp->ud_slave)(ui, reg)) {
				ui->ui_alive = 1;
				ui->ui_ctlr = um->um_ctlr;
				ui->ui_vbanum = vban;
				ui->ui_addr = (caddr_t)reg;
				ui->ui_physaddr = (caddr_t)IOBASE + (addr&0x0fffff);
				if (ui->ui_dk && dkn < DK_NDRIVE)
					ui->ui_dk = dkn++;
				else
					ui->ui_dk = -1;
				ui->ui_mi = um;
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
			}
		}
	}
	/*
	 * Now look for non-mass storage peripherals.
	 */
	for (ui = vbdinit; udp = ui->ui_driver; ui++) {
		if (ui->ui_vbanum != numvba && ui->ui_vbanum != '?' ||
		    ui->ui_alive || ui->ui_slave != -1)
			continue;
		addr = (long)ui->ui_addr;
		reg = vbaddr(addr);
		if (badaddr((caddr_t)reg, 2))
			continue;
		i = (*udp->ud_probe)(reg);
		if (i == 0)
			continue;
		printf("%s%d at csr 0x%x\n",
		    ui->ui_driver->ud_dname, ui->ui_unit, addr);
		ui->ui_alive = 1;
		ui->ui_vbanum = numvba;
		ui->ui_addr = (caddr_t)reg;
		ui->ui_physaddr = (caddr_t)IOBASE + (addr&0x0fffff);
		ui->ui_dk = -1;
		/* ui_type comes from driver */
		udp->ud_dinfo[ui->ui_unit] = ui;
		(*udp->ud_attach)(ui);
	}
}


#define	DMMIN	32
#define	DMMAX	1024
#define	DMTEXT	1024
#define	MAXDUMP	(10*2048)
/*
 * Configure swap space and related parameters.
 */
swapconf()
{
	register struct swdevt *swp;
	register int nblks;

	for (swp = swdevt; swp->sw_dev; swp++) {
		if (bdevsw[major(swp->sw_dev)].d_psize)
			nblks =
			  (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
		if (swp->sw_nblks == 0 || swp->sw_nblks > nblks)
			swp->sw_nblks = nblks;
	}
	if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
		dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) - MAXDUMP;
	if (dumplo < 0)
		dumplo = 0;
	if (dmmin == 0)
		dmmin = DMMIN;
	if (dmmax == 0)
		dmmax = DMMAX;
	if (dmtext == 0)
		dmtext = DMTEXT;
	if (dmtext > dmmax)
		dmtext = dmmax;
}







|









|
|

|










<
<
<
|



















<
<
<
<
<
<
<
<

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200








201
			}
		}
	}
	/*
	 * Now look for non-mass storage peripherals.
	 */
	for (ui = vbdinit; udp = ui->ui_driver; ui++) {
		if (ui->ui_vbanum != vban && ui->ui_vbanum != '?' ||
		    ui->ui_alive || ui->ui_slave != -1)
			continue;
		addr = (long)ui->ui_addr;
		reg = vbaddr(addr);
		if (badaddr((caddr_t)reg, 2))
			continue;
		i = (*udp->ud_probe)(reg);
		if (i == 0)
			continue;
		printf("%s%d at vba%d csr %x\n",
		    ui->ui_driver->ud_dname, ui->ui_unit, vban, addr);
		ui->ui_alive = 1;
		ui->ui_vbanum = vban;
		ui->ui_addr = (caddr_t)reg;
		ui->ui_physaddr = (caddr_t)IOBASE + (addr&0x0fffff);
		ui->ui_dk = -1;
		/* ui_type comes from driver */
		udp->ud_dinfo[ui->ui_unit] = ui;
		(*udp->ud_attach)(ui);
	}
}





#define	MAXDUMP	(8*1024)
/*
 * Configure swap space and related parameters.
 */
swapconf()
{
	register struct swdevt *swp;
	register int nblks;

	for (swp = swdevt; swp->sw_dev; swp++) {
		if (bdevsw[major(swp->sw_dev)].d_psize)
			nblks =
			  (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
		if (swp->sw_nblks == 0 || swp->sw_nblks > nblks)
			swp->sw_nblks = nblks;
	}
	if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
		dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) - MAXDUMP;
	if (dumplo < 0)
		dumplo = 0;








}

Changes to sys/tahoe/tahoe/clock.c.

1
2
3
4
5
6
7
8
/*	clock.c	1.1	85/07/22	*/

#include "../h/param.h"
#include "../h/time.h"
#include "../h/kernel.h"
#include "../tahoe/clock.h"

/*
|







1
2
3
4
5
6
7
8
/*	clock.c	1.2	86/01/05	*/

#include "../h/param.h"
#include "../h/time.h"
#include "../h/kernel.h"
#include "../tahoe/clock.h"

/*

Changes to sys/tahoe/tahoe/conf.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*	conf.c	1.3	85/04/25	*/
/*	conf.c	6.1	83/07/29	*/

#include "../h/param.h"
#include "../h/systm.h"
#include "../h/buf.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/conf.h"

int	nulldev();
int	nodev();

/*   #include "ud.h" */
#if NUD > 0
int	udopen(),udstrategy(),udread(),udwrite(),uddump(),udioctl(),udsize();
|
<

|
|
|
|
|
|







1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*	conf.c	1.2	86/01/05	*/


#include "param.h"
#include "systm.h"
#include "buf.h"
#include "ioctl.h"
#include "tty.h"
#include "conf.h"

int	nulldev();
int	nodev();

/*   #include "ud.h" */
#if NUD > 0
int	udopen(),udstrategy(),udread(),udwrite(),uddump(),udioctl(),udsize();
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	  0,		B_TAPE },
	{ nodev,	nodev,		swstrategy,	nodev,		/*4*/
	  0,		0 },
};
int	nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);

int	cnopen(),cnclose(),cnread(),cnwrite(),cnioctl();
struct tty cons[];

#include "vx.h"
#if NVX == 0
#define	vxopen	nodev
#define	vxclose	nodev
#define	vxread	nodev
#define	vxwrite	nodev







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	  0,		B_TAPE },
	{ nodev,	nodev,		swstrategy,	nodev,		/*4*/
	  0,		0 },
};
int	nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);

int	cnopen(),cnclose(),cnread(),cnwrite(),cnioctl();
extern	struct tty cons;

#include "vx.h"
#if NVX == 0
#define	vxopen	nodev
#define	vxclose	nodev
#define	vxread	nodev
#define	vxwrite	nodev
176
177
178
179
180
181
182


183
184
185
186
187
188
189
190
191
192
193
194
195
#define efsfgen nodev
#define efsread nodev
#define efswrite nodev
#define efsioctl nodev
#define efsreset nodev
#endif



int	ttselect(), seltrue();

struct cdevsw	cdevsw[] =
{
	cnopen,		cnclose,	cnread,		cnwrite,	/*0*/
	cnioctl,	nulldev,	nulldev,	cons,
	ttselect,	nodev,
	vxopen,		vxclose,	vxread,		vxwrite,	/*1*/
	vxioctl,	vxstop,		vxreset,	vx_tty,
	ttselect,	nodev,
	syopen,		nulldev,	syread,		sywrite,	/*2*/
	syioctl,	nulldev,	nulldev,	0,
	syselect,	nodev,







>
>





|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#define efsfgen nodev
#define efsread nodev
#define efswrite nodev
#define efsioctl nodev
#define efsreset nodev
#endif

int	logopen(),logclose(),logread(),logioctl(),logselect();

int	ttselect(), seltrue();

struct cdevsw	cdevsw[] =
{
	cnopen,		cnclose,	cnread,		cnwrite,	/*0*/
	cnioctl,	nulldev,	nulldev,	&cons,
	ttselect,	nodev,
	vxopen,		vxclose,	vxread,		vxwrite,	/*1*/
	vxioctl,	vxstop,		vxreset,	vx_tty,
	ttselect,	nodev,
	syopen,		nulldev,	syread,		sywrite,	/*2*/
	syioctl,	nulldev,	nulldev,	0,
	syselect,	nodev,
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
	nodev,		nodev,
	bstopen,	bstclose,	bstread,	nodev,		/*13*/
	bstioctl,	nodev,		nulldev,	0,
	nodev,		nodev,
	iiopen,		iiclose,	nulldev,	nulldev,	/*14*/
	iiioctl,	nulldev,	nulldev,	0,
	seltrue,	nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*15*/
	nodev,		nodev,		nulldev,	0,
	nodev,		nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*16*/
	nodev,		nodev,		nulldev,	0,
	nodev,		nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*17*/
	nodev,		nodev,		nulldev,	0,
	nodev,		nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*18*/







|
|
|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
	nodev,		nodev,
	bstopen,	bstclose,	bstread,	nodev,		/*13*/
	bstioctl,	nodev,		nulldev,	0,
	nodev,		nodev,
	iiopen,		iiclose,	nulldev,	nulldev,	/*14*/
	iiioctl,	nulldev,	nulldev,	0,
	seltrue,	nodev,
	logopen,	logclose,	logread,	nodev,		/*15*/
	logioctl,	nodev,		nulldev,	0,
	logselect,	nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*16*/
	nodev,		nodev,		nulldev,	0,
	nodev,		nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*17*/
	nodev,		nodev,		nulldev,	0,
	nodev,		nodev,
	nodev,		nodev,		nulldev,	nulldev,	/*18*/

Changes to sys/tahoe/tahoe/cons.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72
73
74
75
76


77
78
79
80
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

137
138


139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244









245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317

318

319
320
321

322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
/*	cons.c	1.1	85/07/21	*/
/*	Minor device 0 is the CP itself.
/*	  No real read/writes can be done to him.
/*	Minor 1 is the console terminal.
/*	Minor 2 is the remote line trminal.
/**/

/*
 * Tahoe console processor driver
 *
 */
#include "../h/param.h"
#include "../h/conf.h"
#include "../h/dir.h"
#include "../h/ioctl.h"
#include "../h/user.h"
#include "../h/tty.h"
#include "../h/uio.h"
#include "../h/callout.h"
#include "../h/systm.h"
#include "../machine/cp.h"
#include "../machine/mtpr.h"

#define FALSE 0
#define TRUE  1

int	cnrestart() ;
int	timeout() ;

struct	tty cons[3];	/* One for each unit on CP */



struct	cons_info {
	char	last_one;	/* Last char sent - possibly repeat
				 * If zero, timeout has nothing to do
				 */
	int	active_timeout;	/* There is an active timeout for this line
				 * Set by 'cnputc' when a timeout is initiated.
				 * Reset by the routine  called at timeout.
			 	 */
	int	try_later;	/* If true, timeout has nothing to do.
				 * Set by 'cnputc' every time a char is sent.
				 * Reset by the timeout arrival. If next time
				 * the timeout comes it's zero, then it may
				 * have something to do.
				 */
	} cons_info[3];
struct	cpdcb_o consout[3] = { 
			/* 	unit,		cmd,count, buf */
			{(char)(CPTAKE | CPDONE),0,   0 },
			{(char)(CPTAKE | CPDONE),0,   0 },
			{(char)(CPTAKE | CPDONE),0,   0 }
			};
struct	cpdcb_i consin[3] = {
			/* 	unit,		cmd,count, buf */
			{(char)(CPTAKE | CPDONE),0,   0 },
			{(char)(CPTAKE | CPDONE),0,   0 },
			{(char)(CPTAKE | CPDONE),0,   0 }
			};
struct	cphdr *lasthdr;

int	cnstart();
int	ttrstrt();
char	partab[];


cnopen(dev, flag)
dev_t dev;
{
	register struct cpdcb_i *cin;
	register struct tty *tp;
	register int timo;

	if (minor(dev) > CPREMOT) 
		return EEXIST;
	tp = &cons[minor(dev)];
	if (tp->t_state&TS_XCLUDE && u.u_uid != 0)
		return EBUSY;
	if (lasthdr != (struct cphdr *)0) {


		timo = 10000;
		uncache((char *)&lasthdr->cp_unit);
		while ((lasthdr->cp_unit & CPTAKE)==0 && --timo )
			uncache((char *)&lasthdr->cp_unit);
	}	/* Here we give up waiting */

	cin = &consin[minor(dev)];
	cin->cp_hdr.cp_unit = (char)(minor(dev));
	cin->cp_hdr.cp_comm = (char)CPREAD;
	cin->cp_hdr.cp_count = 1;	/* Get ready for input */
	mtpr (cin, CPMDCB);
	lasthdr = (struct cphdr *)cin;
	tp->t_oproc = cnstart;
	tp->t_dev = dev;
	if ((tp->t_state&TS_ISOPEN) == 0) {
		ttychars(tp);
		tp->t_state = TS_ISOPEN|TS_CARR_ON;
		tp->t_flags = EVENP|ECHO|XTABS|CRMOD;
	}
	(*linesw[tp->t_line].l_open)(dev, tp);
}

cnclose(dev)
dev_t dev;
{
	register struct tty *tp = &cons[minor(dev)];

	(*linesw[tp->t_line].l_close)(tp);
	ttyclose(tp);
}

/*ARGSUSED*/
cnread(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	register struct tty *tp = &cons[minor(dev)];

	return ((*linesw[tp->t_line].l_read)(tp, uio));
}

/*ARGSUSED*/
cnwrite(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	register struct tty *tp = &cons[minor(dev)];

	return ((*linesw[tp->t_line].l_write)(tp, uio));
}

/*
 * Got a console receive interrupt -
 * the console processor wants to give us a character.
 * Catch the character, and see who it goes to.
 */
cnrint(dev)
dev_t dev;
{
	register int c, timo;
	register struct tty *tp;


	if (intenable == 0) return;


	/* make sure we dont take it from cache */
	uncache((char *)&consin[minor(dev)].cpi_buf[0]);
	c = consin[minor(dev)].cpi_buf[0];
/*
/* Wait about 5 milli for last CPMDCB to be read by CP,
/* otherwise give up
/**/
	timo = 10000;
	uncache((char *)&lasthdr->cp_unit);
	while ((lasthdr->cp_unit & CPTAKE)==0  && --timo  )
		uncache((char *)&lasthdr->cp_unit);
	uncache((char *)&lasthdr->cp_unit);
	if (lasthdr->cp_unit & CPTAKE)
	{
		consin[minor(dev)].cp_hdr.cp_unit = (char)(minor(dev));
			/* This resets status bits */
		mtpr (&consin[minor(dev)], CPMDCB); /* Ready for new character */
		lasthdr = (struct cphdr *)&consin[minor(dev)];
		tp = &cons[minor(dev)];
		(*linesw[tp->t_line].l_rint)(c, tp);
	}
}

cnioctl(dev, cmd, addr, flag)
dev_t dev;
caddr_t addr;
{
	register struct tty *tp = &cons[minor(dev)];
	register error;
 
	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr);
	if (error >= 0)
		return error;
	if ((error = ttioctl(tp, cmd, addr, flag)) < 0)
		error = ENOTTY;
	else if(cmd==TIOCSETP || cmd==TIOCSETN)
		cnparams(tp);
	return error;
}

int	consintr = 1;
/*
 * Got a console transmission interrupt -
 * the console processor wants another character.
 */
cnxint(dev)
dev_t dev;
{
	register struct tty *tp;
	register int line_no;

	if (intenable == 0 || consintr == 0) return;
#ifdef	CPPERF
	if (minor(dev)==CPCONS) scope_in(1);

	else scope_in(2);
#endif
	line_no = minor(dev);
	tp = &cons[line_no];
	tp->t_state &= ~TS_BUSY;
	cons_info[line_no].last_one = (char)0;
	if (tp->t_line)
		(*linesw[tp->t_line].l_start)(tp);
	else
		cnstart(tp);
}

cnstart(tp)
register struct tty *tp;
{
	register c;
	register s;

#ifdef	CPPERF
	if (minor(tp->t_dev)==CPCONS) scope_in(3);
	else scope_in(4);
#endif
	s = spl8();
	if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
		goto out;
	if (tp->t_outq.c_cc <= TTLOWAT(tp)) {
		if (tp->t_state&TS_ASLEEP) {
			tp->t_state &= ~TS_ASLEEP;
			wakeup((caddr_t)&tp->t_outq);
		}
		if (tp->t_wsel) {
			selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL);
			tp->t_wsel = 0;
			tp->t_state &= ~TS_WCOLL;
		}
	}
	if (tp->t_outq.c_cc == 0)
		goto out;
	c = getc(&tp->t_outq) & 0xff;
	if (tp->t_flags&(RAW|LITOUT))
		cnputc(c,tp);
	else if (c<=0177)
		cnputc ((c | (partab[c]&0200))&0xff,tp);
	else {
		timeout(ttrstrt, (caddr_t)tp, (c&0177));
		tp->t_state |= TS_TIMEOUT;
		goto out;
	}
	tp->t_state |= TS_BUSY;
    out:
	splx(s);
}










/*
 * Print a character on console.
 */
cnputc(c,tp)
register char c;
register struct tty *tp;
{
	register timo , line_no, s;
	register struct cpdcb_o *current;

	/* tp == 0 only in system error messages */
	if (tp == 0) {
		current = &consout[CPCONS];
		line_no = CPCONS;
		if(lasthdr == 0)	/* not done anythig yet */
			lasthdr = (struct cphdr *)current;
		c |= partab[c&0177]&0200;
	}
	else {
		current = &consout[minor(tp->t_dev)];
		line_no = minor(tp->t_dev);
	}
	timo = 30000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 * make sure we dont test this bit in cache!
	 */
	uncache((char *)&current->cp_hdr.cp_unit);
	while ((current->cp_hdr.cp_unit & CPDONE) == 0 && --timo )
		uncache((char *)&current->cp_hdr.cp_unit);
	current->cp_hdr.cp_comm = (char)CPWRITE;
	current->cp_hdr.cp_count = 1;
	current->cp_buf[0] = (char)(c & 0xff);
	timo = 10000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 */
	uncache((char *)&lasthdr->cp_unit);
	while ((lasthdr->cp_unit & CPTAKE)==0 && --timo )
		uncache((char *)&lasthdr->cp_unit);
	/* Reset done bit */
	current->cp_hdr.cp_unit = (char)line_no; 
	lasthdr = (struct cphdr *)current;
#ifdef	CPPERF
	if (intenable != 0) scope_in(5);

#endif
	cons_info[line_no].last_one = c;
	if ( !cons_info[line_no].active_timeout && clk_enable) {
		cons_info[line_no].active_timeout = TRUE;
		timeout (cnrestart, (caddr_t)tp, 10);
	}
	cons_info[line_no].try_later = TRUE; /* For timeout-means wait some more */
	mtpr (current, CPMDCB);
}

/*
 * Restart (if necessary) transfer to CP line.
 * This way, lost 'transmit' interrupts don't break the chain.
 */
cnrestart (tp)
struct tty *tp;
{
	register line_no, s;

	if (tp == 0) {
		line_no = CPCONS;
	} else
		line_no = minor(tp->t_dev);
	if (cons_info[line_no].try_later) {
		cons_info[line_no].try_later = FALSE;

		timeout (cnrestart, (caddr_t)tp, 10);

	}
	else {
		cons_info[line_no].active_timeout = FALSE;

		if (cons_info[line_no].last_one != (char)0)
			cnputc (cons_info[line_no].last_one, tp);
	}
}

/*
 * Set line parameters
 */
cnparams(tp)
register struct tty *tp;
{
	register timo ;
	register struct cpdcb_o *current;
	register struct cpdcb_i *cin;

	current = &consout[minor(tp->t_dev)];
	timo = 30000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 * make sure we dont test this bit in cache!
	 */
	uncache((char *)&current->cp_hdr.cp_unit);
	while ((current->cp_hdr.cp_unit & CPDONE) == 0 && --timo )
		uncache((char *)&current->cp_hdr.cp_unit);
	current->cp_hdr.cp_comm = (char)CPSTTY;
	current->cp_hdr.cp_count = 4;
	current->cp_buf[0] = tp->t_ispeed;
	/* the rest are defaults */
	current->cp_buf[1] = 0;	/* no parity */
	current->cp_buf[2] = 0; /* stop bits */
	current->cp_buf[3] = 8; /* data bits */
	timo = 10000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 */
	uncache((char *)&lasthdr->cp_unit);
	while ((lasthdr->cp_unit & CPTAKE)==0 && --timo )
		uncache((char *)&lasthdr->cp_unit);
	/* Reset done bit */
	current->cp_hdr.cp_unit = (char)minor(tp->t_dev); 
	lasthdr = (struct cphdr *)current;
	mtpr (current, CPMDCB);

	timo = 10000;
	uncache((char *)&lasthdr->cp_unit);
	while ((lasthdr->cp_unit & CPTAKE)==0 && --timo )
		uncache((char *)&lasthdr->cp_unit);
	cin = &consin[minor(tp->t_dev)];
	cin->cp_hdr.cp_unit = (char)(minor(tp->t_dev));
	cin->cp_hdr.cp_comm = (char)CPREAD;
	cin->cp_hdr.cp_count = 1;	/* Get ready for input */
	mtpr (cin, CPMDCB);
	lasthdr = (struct cphdr *)cin;

}
|










|
|
|
|
|
|
|
|
|
|
<

|
|

|
|

|
>
>
>
|
|
<
<
|
|
|
<
<
<
<
<
<
<
|

|
|
|
|
|

|
|
|
|
|






>

|



|

|
|
|

|

>
>

|
|
|
<
>
|
|
|

|








|



|

|










|









|










|



>

|
>
>

|
|





|
|
|
|
|
<
|

|
|
|





|
|

|







|

|








|


|

|
|
|
>
|

<
|

|







|

|
<


|
<



















|
|
|






|


>
>
>
>
>
>
>
>
>




|
|
|

|





|
|


<
|

|







|
|
|
|

|





|
|
|

|


|
>

|
|
|
|

|
|






|
|

|

<
<
<
|
|
<
>
|
>

<
<
>
|
|
<






|

|










|
|
|
|




|
|





|
|
|



|


|
|
|

|
|

|

|
<
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
33
34


35
36
37







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

194
195
196
197
198
199
200
201
202
203
204
205
206

207
208
209

210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267

268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316



317
318

319
320
321
322


323
324
325

326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

/*	cons.c	1.2	86/01/05	*/
/*	Minor device 0 is the CP itself.
/*	  No real read/writes can be done to him.
/*	Minor 1 is the console terminal.
/*	Minor 2 is the remote line trminal.
/**/

/*
 * Tahoe console processor driver
 *
 */
#include "param.h"
#include "conf.h"
#include "dir.h"
#include "ioctl.h"
#include "user.h"
#include "proc.h"
#include "tty.h"
#include "uio.h"
#include "callout.h"
#include "systm.h"


#include "../tahoe/cp.h"
#include "../tahoe/mtpr.h"

int	cnrestart();
int	timeout();

struct	tty cons;
struct	tty CPtty;
struct	tty RLtty;
struct	tty *constty[3] = { &CPtty, &cons, &RLtty };
struct	consoftc {
	char	cs_lastc;	/* last char sent */


	int	cs_flags;
#define	CSF_ACTIVE	0x1	/* timeout active */
#define	CSF_RETRY	0x2	/* try again at a later time */







} consoftc[3];
struct	cpdcb_o consout[3] = { 
	/* 	unit,		cmd,count, buf */
	{ (char)(CPTAKE | CPDONE),0,   0 },
	{ (char)(CPTAKE | CPDONE),0,   0 },
	{ (char)(CPTAKE | CPDONE),0,   0 }
};
struct	cpdcb_i consin[3] = {
	/* 	unit,		cmd,count, buf */
	{ (char)(CPTAKE | CPDONE),0,   0 },
	{ (char)(CPTAKE | CPDONE),0,   0 },
	{ (char)(CPTAKE | CPDONE),0,   0 }
};
struct	cphdr *lasthdr;

int	cnstart();
int	ttrstrt();
char	partab[];

/*ARGSUSED*/
cnopen(dev, flag)
	dev_t dev;
{
	register struct cpdcb_i *cin;
	register struct tty *tp;
	int unit = minor(dev);

	if (unit > CPREMOT) 
		return (EEXIST);
	tp = constty[unit];
	if (tp->t_state&TS_XCLUDE && u.u_uid != 0)
		return (EBUSY);
	if (lasthdr != (struct cphdr *)0) {
		register int timo;

		timo = 10000;
		uncache(&lasthdr->cp_unit);
		while ((lasthdr->cp_unit&CPTAKE) == 0 && --timo)
			uncache(&lasthdr->cp_unit);

	}
	cin = &consin[unit];
	cin->cp_hdr.cp_unit = unit;
	cin->cp_hdr.cp_comm = CPREAD;
	cin->cp_hdr.cp_count = 1;	/* Get ready for input */
	mtpr(CPMDCB, cin);
	lasthdr = (struct cphdr *)cin;
	tp->t_oproc = cnstart;
	tp->t_dev = dev;
	if ((tp->t_state&TS_ISOPEN) == 0) {
		ttychars(tp);
		tp->t_state = TS_ISOPEN|TS_CARR_ON;
		tp->t_flags = EVENP|ECHO|XTABS|CRMOD;
	}
	return ((*linesw[tp->t_line].l_open)(dev, tp));
}

cnclose(dev)
	dev_t dev;
{
	register struct tty *tp = constty[minor(dev)];

	(*linesw[tp->t_line].l_close)(tp);
	ttyclose(tp);
}

/*ARGSUSED*/
cnread(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	struct tty *tp = constty[minor(dev)];

	return ((*linesw[tp->t_line].l_read)(tp, uio));
}

/*ARGSUSED*/
cnwrite(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	struct tty *tp = constty[minor(dev)];

	return ((*linesw[tp->t_line].l_write)(tp, uio));
}

/*
 * Got a console receive interrupt -
 * the console processor wants to give us a character.
 * Catch the character, and see who it goes to.
 */
cnrint(dev)
	dev_t dev;
{
	register int c, timo;
	register struct tty *tp;
	int unit;

	if (intenable == 0)
		return;
	unit = minor(dev);
	/* make sure we dont take it from cache */
	uncache(&consin[unit].cpi_buf[0]);
	c = consin[unit].cpi_buf[0];
/*
/* Wait about 5 milli for last CPMDCB to be read by CP,
/* otherwise give up
/**/
	timo = 10000;
	uncache(&lasthdr->cp_unit);
	while ((lasthdr->cp_unit&CPTAKE) == 0  && --timo)
		uncache(&lasthdr->cp_unit);
	uncache(&lasthdr->cp_unit);
	if (lasthdr->cp_unit&CPTAKE) {

		consin[unit].cp_hdr.cp_unit = unit;
			/* This resets status bits */
		mtpr(CPMDCB, &consin[unit]); /* Ready for new character */
		lasthdr = (struct cphdr *)&consin[unit];
		tp = constty[unit];
		(*linesw[tp->t_line].l_rint)(c, tp);
	}
}

cnioctl(dev, cmd, addr, flag)
	dev_t dev;
	caddr_t addr;
{
	register struct tty *tp = constty[minor(dev)];
	register error;
 
	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr);
	if (error >= 0)
		return error;
	if ((error = ttioctl(tp, cmd, addr, flag)) < 0)
		error = ENOTTY;
	else if (cmd == TIOCSETP || cmd == TIOCSETN)
		cnparams(tp);
	return (error);
}

int	consintr = 1;
/*
 * Got a console transmission interrupt -
 * the console processor wants another character.
 */
cnxint(dev)
	dev_t dev;
{
	register struct tty *tp;
	register int unit;

	if (intenable == 0 || consintr == 0)
		return;
	unit = minor(dev);
#ifdef CPPERF
	scope_in(unit == CPCONS ? 1 : 2);
#endif

	tp = constty[unit];
	tp->t_state &= ~TS_BUSY;
	consoftc[unit].cs_lastc = (char)0;
	if (tp->t_line)
		(*linesw[tp->t_line].l_start)(tp);
	else
		cnstart(tp);
}

cnstart(tp)
	register struct tty *tp;
{
	register c, s;


#ifdef	CPPERF
	scope_in(minor(tp->t_dev) == CPCONS ? 3 : 4);

#endif
	s = spl8();
	if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
		goto out;
	if (tp->t_outq.c_cc <= TTLOWAT(tp)) {
		if (tp->t_state&TS_ASLEEP) {
			tp->t_state &= ~TS_ASLEEP;
			wakeup((caddr_t)&tp->t_outq);
		}
		if (tp->t_wsel) {
			selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL);
			tp->t_wsel = 0;
			tp->t_state &= ~TS_WCOLL;
		}
	}
	if (tp->t_outq.c_cc == 0)
		goto out;
	c = getc(&tp->t_outq) & 0xff;
	if (tp->t_flags&(RAW|LITOUT))
		cnputchar(c, tp);
	else if (c <= 0177)
		cnputchar((c | (partab[c]&0200))&0xff, tp);
	else {
		timeout(ttrstrt, (caddr_t)tp, (c&0177));
		tp->t_state |= TS_TIMEOUT;
		goto out;
	}
	tp->t_state |= TS_BUSY;
out:
	splx(s);
}

cnputc(c)
	char c;
{

	if (c == '\n')
		cnputchar('\r', (struct tty *)0);
	cnputchar(c, (struct tty *)0);
}

/*
 * Print a character on console.
 */
cnputchar(c,tp)
	register char c;
	register struct tty *tp;
{
	register timo, unit;
	register struct cpdcb_o *current;

	/* tp == 0 only in system error messages */
	if (tp == 0) {
		current = &consout[CPCONS];
		unit = CPCONS;
		if (lasthdr == 0)	/* not done anythig yet */
			lasthdr = (struct cphdr *)current;
		c |= partab[c&0177]&0200;

	} else {
		current = &consout[minor(tp->t_dev)];
		unit = minor(tp->t_dev);
	}
	timo = 30000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 * make sure we dont test this bit in cache!
	 */
	uncache(&current->cp_hdr.cp_unit);
	while ((current->cp_hdr.cp_unit&CPDONE) == 0 && --timo)
		uncache(&current->cp_hdr.cp_unit);
	current->cp_hdr.cp_comm = CPWRITE;
	current->cp_hdr.cp_count = 1;
	current->cp_buf[0] = c & 0xff;
	timo = 10000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 */
	uncache(&lasthdr->cp_unit);
	while ((lasthdr->cp_unit&CPTAKE) == 0 && --timo)
		uncache(&lasthdr->cp_unit);
	/* Reset done bit */
	current->cp_hdr.cp_unit = (char)unit;
	lasthdr = (struct cphdr *)current;
#ifdef	CPPERF
	if (intenable != 0)
		scope_in(5);
#endif
	consoftc[unit].cs_lastc = c;
	if ((consoftc[unit].cs_flags&CSF_ACTIVE) == 0 && clk_enable) {
		consoftc[unit].cs_flags |= CSF_ACTIVE;
		timeout(cnrestart, (caddr_t)tp, 10);
	}
	consoftc[unit].cs_flags |= CSF_RETRY;	/* wait some more */
	mtpr(CPMDCB, current);
}

/*
 * Restart (if necessary) transfer to CP line.
 * This way, lost 'transmit' interrupts don't break the chain.
 */
cnrestart(tp)
	struct tty *tp;
{
	register struct consoftc *cs;




	cs = &consoftc[tp == 0 ? CPCONS : minor(tp->t_dev)];
	if (cs->cs_flags&CSF_RETRY) {

		cs->cs_flags &= ~CSF_RETRY;
		timeout(cnrestart, (caddr_t)tp, 10);
		return;
	}


	cs->cs_flags &= ~CSF_ACTIVE;
	if (cs->cs_lastc != (char)0)
		cnputchar(cs->cs_lastc, tp);

}

/*
 * Set line parameters
 */
cnparams(tp)
	register struct tty *tp;
{
	register timo;
	register struct cpdcb_o *current;
	register struct cpdcb_i *cin;

	current = &consout[minor(tp->t_dev)];
	timo = 30000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 * make sure we dont test this bit in cache!
	 */
	uncache(&current->cp_hdr.cp_unit);
	while ((current->cp_hdr.cp_unit&CPDONE) == 0 && --timo)
		uncache(&current->cp_hdr.cp_unit);
	current->cp_hdr.cp_comm = CPSTTY;
	current->cp_hdr.cp_count = 4;
	current->cp_buf[0] = tp->t_ispeed;
	/* the rest are defaults */
	current->cp_buf[1] = 0;	/* no parity */
	current->cp_buf[2] = 0;	/* stop bits */
	current->cp_buf[3] = 8;	/* data bits */
	timo = 10000;
	/*
	 * Try waiting for the console tty to come ready,
	 * otherwise give up after a reasonable time.
	 */
	uncache(&lasthdr->cp_unit);
	while ((lasthdr->cp_unit&CPTAKE) == 0 && --timo)
		uncache(&lasthdr->cp_unit);
	/* Reset done bit */
	current->cp_hdr.cp_unit = (char)minor(tp->t_dev); 
	lasthdr = (struct cphdr *)current;
	mtpr(CPMDCB, current);

	timo = 10000;
	uncache(&lasthdr->cp_unit);
	while ((lasthdr->cp_unit&CPTAKE) == 0 && --timo)
		uncache(&lasthdr->cp_unit);
	cin = &consin[minor(tp->t_dev)];
	cin->cp_hdr.cp_unit = minor(tp->t_dev);
	cin->cp_hdr.cp_comm = CPREAD;
	cin->cp_hdr.cp_count = 1;	/* Get ready for input */
	mtpr(CPMDCB, cin);
	lasthdr = (struct cphdr *)cin;
}

Added sys/tahoe/tahoe/cp.h.































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*	cp.h	1.1	86/01/05	*/
/*	Console Processor Interface 	*/
/*	Tahoe version, Nov. 1982	*/

/****************************************/
/*					*/
/*	Reduced DCB layout for byte	*/
/*	communication.			*/
/*					*/
/****************************************/

#define	CPBUFLEN 200		/* Output buffer length */
#ifndef	LOCORE
struct	cphdr
{
	char	cp_unit;	/* Done bit & unit # */
	char	cp_comm;	/* Command */
	short	cp_count;	/* Counter (when relevant) */
};

struct	cpdcb_o			/* Output structure */
{
	struct	cphdr	cp_hdr;
	char	cp_buf[CPBUFLEN]; /* Buffer for output or 'stty' */
};

struct	cpdcb_i			/* Structure for input */
{
	struct	cphdr	cp_hdr;
	char	cpi_buf[4]; 	/* Buffer for input */
};
#endif

#define	CPDONE	0x80		/* 'Done' bit in cp_unit */
#define	CPTAKE	0x40		/* CP 'ack' to this cpdcb */

		/* Values for 'unit' */
#define	CPUNIT	0		/* The CP itself */
#define	CPCONS	1		/* Console line */
#define	CPREMOT	2		/* Remote line */

		/* Values for 'command' */
#define	CPRESET 0
#define	CPWRITE 1
#define	CPREAD	2
#define	CPSTTY	3
#define	CPBOOT	4

Added sys/tahoe/tahoe/genassym.c.

































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef lint
static char sccsid[] = "@(#)genassym.c	1.2 (Berkeley) 01/05/86";
#endif

#include "../tahoe/pte.h"

#include "param.h"
#include "vmmeter.h"
#include "vmparam.h"
#include "buf.h"
#include "dir.h"
#include "user.h"
#include "cmap.h"
#include "map.h"
#include "proc.h"
#include "text.h"
#include "mbuf.h"
#include "msgbuf.h"

main()
{
	register struct user *u = (struct user *)0;
	register struct proc *p = (struct proc *)0;
	register struct vmmeter *vm = (struct vmmeter *)0;
	register struct pcb *pcb = (struct pcb *)0;

	printf("#ifdef LOCORE\n");
	printf("#define\tU_PROCP %d\n", &u->u_procp);
	printf("#define\tP_LINK %d\n", &p->p_link);
	printf("#define\tP_RLINK %d\n", &p->p_rlink);
	printf("#define\tP_XLINK %d\n", &p->p_xlink);
	printf("#define\tP_ADDR %d\n", &p->p_addr);
	printf("#define\tP_PRI %d\n", &p->p_pri);
	printf("#define\tP_STAT %d\n", &p->p_stat);
	printf("#define\tP_WCHAN %d\n", &p->p_wchan);
	printf("#define\tP_TSIZE %d\n", &p->p_tsize);
	printf("#define\tP_SSIZE %d\n", &p->p_ssize);
	printf("#define\tP_P0BR %d\n", &p->p_p0br);
	printf("#define\tP_SZPT %d\n", &p->p_szpt);
	printf("#define\tP_TEXTP %d\n", &p->p_textp);
	printf("#define\tP_FLAG %d\n", &p->p_flag);
	printf("#define\tP_DKEY %d\n", &p->p_dkey);
	printf("#define\tP_CKEY %d\n", &p->p_ckey);
	printf("#define\tSSLEEP %d\n", SSLEEP);
	printf("#define\tSRUN %d\n", SRUN);
	printf("#define\tV_SWTCH %d\n", &vm->v_swtch);
	printf("#define\tV_TRAP %d\n", &vm->v_trap);
	printf("#define\tV_SYSCALL %d\n", &vm->v_syscall);
	printf("#define\tV_INTR %d\n", &vm->v_intr);
	printf("#define\tNBPG %d\n", NBPG);
	printf("#define\tPGSHIFT %d\n", PGSHIFT);
	printf("#define\tUPAGES %d\n", UPAGES);
	printf("#define\tCLSIZE %d\n", CLSIZE);
	printf("#define\tSYSPTSIZE %d\n", SYSPTSIZE);
	printf("#define\tUSRPTSIZE %d\n", USRPTSIZE);
	printf("#define\tIOSIZE %d\n", IOSIZE);
	printf("#define\tMAXBPTE %d\n", MAXBPTE);
	printf("#define\tTBUFSIZ %d\n", TBUFSIZ);
	printf("#define\tACEBPTE %d\n", ACEBPTE);
	printf("#define\tMSGBUFPTECNT %d\n", btoc(sizeof (struct msgbuf)));
	printf("#define\tNMBCLUSTERS %d\n", NMBCLUSTERS);
	printf("#define\tPCB_KSP %d\n", &pcb->pcb_ksp);
	printf("#define\tPCB_USP %d\n", &pcb->pcb_usp);
	printf("#define\tPCB_R0 %d\n", &pcb->pcb_r0);
	printf("#define\tPCB_R1 %d\n", &pcb->pcb_r1);
	printf("#define\tPCB_R2 %d\n", &pcb->pcb_r2);
	printf("#define\tPCB_R3 %d\n", &pcb->pcb_r3);
	printf("#define\tPCB_R4 %d\n", &pcb->pcb_r4);
	printf("#define\tPCB_R5 %d\n", &pcb->pcb_r5);
	printf("#define\tPCB_R6 %d\n", &pcb->pcb_r6);
	printf("#define\tPCB_R7 %d\n", &pcb->pcb_r7);
	printf("#define\tPCB_R8 %d\n", &pcb->pcb_r8);
	printf("#define\tPCB_R9 %d\n", &pcb->pcb_r9);
	printf("#define\tPCB_R10 %d\n", &pcb->pcb_r10);
	printf("#define\tPCB_R11 %d\n", &pcb->pcb_r11);
	printf("#define\tPCB_R12 %d\n", &pcb->pcb_r12);
	printf("#define\tPCB_R13 %d\n", &pcb->pcb_r13);
	printf("#define\tPCB_FP %d\n", &pcb->pcb_fp);
	printf("#define\tPCB_PC %d\n", &pcb->pcb_pc);
	printf("#define\tPCB_PSL %d\n", &pcb->pcb_psl);
	printf("#define\tPCB_P0BR %d\n", &pcb->pcb_p0br);
	printf("#define\tPCB_P0LR %d\n", &pcb->pcb_p0lr);
	printf("#define\tPCB_P1BR %d\n", &pcb->pcb_p1br);
	printf("#define\tPCB_P1LR %d\n", &pcb->pcb_p1lr);
	printf("#define\tPCB_P2BR %d\n", &pcb->pcb_p2br);
	printf("#define\tPCB_P2LR %d\n", &pcb->pcb_p2lr);
	printf("#define\tPCB_ACH %d\n", &pcb->pcb_ach);
	printf("#define\tPCB_ACL %d\n", &pcb->pcb_acl);
	printf("#define\tPCB_HFS %d\n", &pcb->pcb_hfs);
	printf("#define\tPCB_SAVACC %d\n", &pcb->pcb_savacc);
	printf("#define\tPCB_SZPT %d\n", &pcb->pcb_szpt);
	printf("#define\tPCB_CMAP2 %d\n", &pcb->pcb_cmap2);
	printf("#define\tPCB_SSWAP %d\n", &pcb->pcb_sswap);
	printf("#define\tPCB_SIGC %d\n", pcb->pcb_sigc);
	printf("#endif\n");
}

Changes to sys/tahoe/tahoe/in_cksum.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*	in_cksum.c	6.1	83/07/29	*/

#include "../h/types.h"
#include "../h/mbuf.h"
#include "../netinet/in.h"
#include "../netinet/in_systm.h"

#if defined(tahoe)
/*
 * Checksum routine for Internet Protocol family headers.
 *
 * This routine is very heavily used in the network
 * code and should be modified for each CPU to be as fast as possible.
 * 
 * This implementation is TAHOE version.
|






<







1
2
3
4
5
6
7

8
9
10
11
12
13
14
/*	in_cksum.c	1.2	86/01/05	*/

#include "../h/types.h"
#include "../h/mbuf.h"
#include "../netinet/in.h"
#include "../netinet/in_systm.h"


/*
 * Checksum routine for Internet Protocol family headers.
 *
 * This routine is very heavily used in the network
 * code and should be modified for each CPU to be as fast as possible.
 * 
 * This implementation is TAHOE version.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
		u_short	s;
	} u;
	register u_short *w;
	register int sum = 0;
	register int mlen = 0;

	for (;m && len; m = m->m_next) {

		if (m->m_len == 0) {
			continue;
		}

		w = mtod(m, u_short *);
		if (mlen == -1) {
			/*
			 * The first byte of this mbuf is the continuation
			 * of a word spanning between this mbuf and the
			 * last mbuf.
			 */

			/* u.c[0] is already saved when scanning previous 
			 * mbuf.
			 */
			u.c[1] = *(u_char *)w;
			sum += u.s;
			ADDCARRY(sum);

			w = (u_short *)((char *)w + 1);
			mlen = m->m_len - 1;
			len--;
		} else
			mlen = m->m_len;

		if (len < mlen)
			mlen = len;
		len -= mlen;

		/*
		 * add by words.
		 */
		while ((mlen -= 2) >= 0) {
			
			if ((int)w & 0x1) {
				/* word is not aligned */
				u.c[0] = *(char *)w;
				u.c[1] = *((char *)w+1);
				sum += u.s;
				w++;
			}
			else {
				sum += *w++;
			}
			ADDCARRY(sum);
		}
		if (mlen == -1) {
			/*
			 * This mbuf has odd number of bytes. 
			 * There could be a word split betwen
			 * this mbuf and the next mbuf.
			 * Save the last byte (to prepend to next mbuf).
			 */
			u.c[0] = *(u_char *)w;
		}
	}
	if (len)
		printf("cksum: out of data\n");
	if (mlen == -1) {
		/* The last mbuf has odd # of bytes. Follow the
		   standard (the odd byte is shifted left by 8 bits) */
		u.c[1] = 0;
		sum += u.s;
		ADDCARRY(sum);
	}
done:
	return (~sum & 0xffff);
}
#endif

#if defined(vax)

/*
 * Checksum routine for Internet Protocol family headers (VAX Version).
 *
 * This routine is very heavily used in the network
 * code and should be modified for each CPU to be as fast as possible.
 */

in_cksum(m, len)
	register struct mbuf *m;
	register int len;
{
	register u_short *w;		/* on Tahoe, known to be r10 */
	register int sum = 0;		/* on Tahoe, known to be r9 */
	register int mlen = 0;

	for (;;) {
		/*
		 * Each trip around loop adds in
		 * word from one mbuf segment.
		 */
		w = mtod(m, u_short *);
		if (mlen == -1) {
			/*
			 * There is a byte left from the last segment;
			 * add it into the checksum.  Don't have to worry
			 * about a carry-out here because we make sure
			 * that high part of (32 bit) sum is small below.
			 */
			sum += *(u_char *)w << 8;
			w = (u_short *)((char *)w + 1);
			mlen = m->m_len - 1;
			len--;
		} else
			mlen = m->m_len;
		m = m->m_next;
		if (len < mlen)
			mlen = len;
		len -= mlen;
		/*
		 * Force to long boundary so we do longword aligned
		 * memory operations.  
		 */
		if (((int)w&0x1) && mlen >= 1) {
			sum += *(u_char *)w++;
			mlen -= 1;
		}
		if (((int)w&0x2) && mlen >= 2) {
			sum += *w++;
			mlen -= 2;
		}
		/*
		 * Do as much of the checksum as possible 32 bits at at time.
		 * In fact, this loop is unrolled to make overhead from
		 * branches &c small.
		 *
		 * We can do a 16 bit ones complement sum 32 bits at a time
		 * because the 32 bit register is acting as two 16 bit
		 * registers for adding, with carries from the low added
		 * into the high (by normal carry-chaining) and carries
		 * from the high carried into the low on the next word
		 * by use of the adwc instruction.  This lets us run
		 * this loop at almost memory speed.
		 *
		 * Here there is the danger of high order carry out, and
		 * we carefully use adwc.
		 */
		while ((mlen -= 32) >= 0) {
#undef ADD
			asm("clrl r0");		/* clears carry */
#define ADD		asm("adwc (r10),r9;addl2 $4,r10; ");
			ADD; ADD; ADD; ADD; ADD; ADD; ADD; ADD;
			asm("adwc $0,r9");
		}
		mlen += 32;
		while ((mlen -= 8) >= 0) {
			asm("clrl r0");
			ADD; ADD;
			asm("adwc $0,r9");
		}
		mlen += 8;
		/*
		 * Now eliminate the possibility of carry-out's by
		 * folding back to a 16 bit number (adding high and
		 * low parts together.)  Then mop up trailing words
		 * and maybe an odd byte.
		 */
		{ asm("shal $-16,r9,r0; addw2 r0,r9");
		  asm("adwc $0,r9; movzwl r9,r9"); }
		while ((mlen -= 2) >= 0) {
			asm("movzwl (r10),r0;addl2 $4,r10;  addl2 r0,r9");
		}
		if (mlen == -1) {
			sum += *(u_char *)w;
		}
		if (len == 0)
			break;
		/*
		 * Locate the next block with some data.
		 * If there is a word split across a boundary we
		 * will wrap to the top with mlen == -1 and
		 * then add it in shifted appropriately.
		 */
		for (;;) {
			if (m == 0) {
				printf("cksum: out of data\n");
				goto done;
			}
			if (m->m_len)
				break;
			m = m->m_next;
		}
	}
done:
	/*
	 * Add together high and low parts of sum
	 * and carry to get cksum.
	 * Have to be careful to not drop the last
	 * carry here.
	 */
	{ asm("shal $-16,r9,r0; addw2 r0,r9; adwc $0,r9");
	  asm("mcoml r9,r9; movzwl r9,r9"); }
	return (sum);
}
#endif







<
|

<
<














<














<






<
|

<


|







<










<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
30
31
32
33
34
35
36

37
38


39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72

73
74

75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94

95
96
































































































































		u_short	s;
	} u;
	register u_short *w;
	register int sum = 0;
	register int mlen = 0;

	for (;m && len; m = m->m_next) {

		if (m->m_len == 0)
			continue;


		w = mtod(m, u_short *);
		if (mlen == -1) {
			/*
			 * The first byte of this mbuf is the continuation
			 * of a word spanning between this mbuf and the
			 * last mbuf.
			 */

			/* u.c[0] is already saved when scanning previous 
			 * mbuf.
			 */
			u.c[1] = *(u_char *)w;
			sum += u.s;
			ADDCARRY(sum);

			w = (u_short *)((char *)w + 1);
			mlen = m->m_len - 1;
			len--;
		} else
			mlen = m->m_len;

		if (len < mlen)
			mlen = len;
		len -= mlen;

		/*
		 * add by words.
		 */
		while ((mlen -= 2) >= 0) {

			if ((int)w & 0x1) {
				/* word is not aligned */
				u.c[0] = *(char *)w;
				u.c[1] = *((char *)w+1);
				sum += u.s;
				w++;

			} else
				sum += *w++;

			ADDCARRY(sum);
		}
		if (mlen == -1)
			/*
			 * This mbuf has odd number of bytes. 
			 * There could be a word split betwen
			 * this mbuf and the next mbuf.
			 * Save the last byte (to prepend to next mbuf).
			 */
			u.c[0] = *(u_char *)w;

	}
	if (len)
		printf("cksum: out of data\n");
	if (mlen == -1) {
		/* The last mbuf has odd # of bytes. Follow the
		   standard (the odd byte is shifted left by 8 bits) */
		u.c[1] = 0;
		sum += u.s;
		ADDCARRY(sum);
	}

	return (~sum & 0xffff);
}
































































































































Changes to sys/tahoe/tahoe/locore.s.

1
2
3
4
5
6
7
8
9

10
11


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

62
63
64
65

66
67
68
69
70
71







72
73
74


















75



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94


95
96








97

98
99
100
101
102
103
104
105
106
107
108
109
110
111


112







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182








183



184
185
186









187
188

189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
221
222
223
224
225
226
227
228


229

230
231
232
233

234
235
236
237
238
239
240
241














242


243

244
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/*	locore.s	1.7	85/05/15	*/

#include "../tahoe/mtpr.h"
#include "../tahoe/trap.h"
#include "../tahoe/psl.h"
#include "../tahoe/pte.h"
#include "../tahoe/cp.h"
#include "../tahoe/mem.h"
#include "../tahoe/fp.h"


#include "../h/errno.h"



	.set	HIGH,0x1f	# mask for total disable
	.set	BERVEC,0x80	# offset into scb of the bus error vector 
	.set	RESTVEC,0x8	# offset into scb of the restart vector 
	.set	MAXPHYSMEM,8*1024*1024-1 # max physical memory 
					# while we work on CMD/32M !
					# look at vmsched.c to see why.
	.set	MEMUNIT,64*1024 # minimum memory increment

	.set	NISP,3		# number of interrupt stack pages
	.set	SYSTEM,0xC0000000 # virtual address of system start
	.set	PPAGES,0x100000  # Number of possible pages in P0,P1, etc.

/* ACBL for non-negative '_add' */
#define ACBL(_limit,_add,_index,_displ) \
	addl2	_add,_index; \
	cmpl	_index,_limit; \
	bleq	_displ

/* _ACBL for negative '_add' */
#define _ACBL(_limit,_add,_index,_displ) \
	addl2	_add,_index; \
	cmpl	_index,_limit; \
	bgeq	_displ

#define	MOVC3(_len,_srcaddr,_dstaddr) \
	movl	_srcaddr,r0; \
	movl	_dstaddr,r1; \
	movl	_len,r2; \
	movblk

/* Keep address of psl if coming from user mode */
#define CHECK_SFE(_delta) \
	bitl	$PSL_CURMOD,_delta(sp); \
	jeql	1f; \
	moval	_delta(sp),_user_psl; \
1:

/*
 * User structure is UPAGES at top of user space.
 */
	.globl	_u
	.set	_u,SYSTEM - UPAGES*NBPG

/*
 * Restart stack. Used on power recovery or panic.
 * Takes a core-dump and then halts.
 */ 
	.globl	_rsstk


_rsstk: 	.space	1024-8
	.globl	pwfl_stk	
pwfl_stk:	.space  4
dumpflag:	.space	4


	.globl	_intstack
_intstack:
	.space	NISP*NBPG
eintstack:








	.data
	.globl	pwfl_r0
pwfl_r0:	.space	14*4		# Enough for r0 - r13


















	.globl	pwfl_sp



pwfl_sp:	.long	0x12345678	# r14
	.globl	pwfl_SCBB
pwfl_SCBB:	.long	0x12345678
	.globl	pwfl_SBR
pwfl_SBR:	.long	0x12345678
	.globl	pwfl_SLR
pwfl_SLR:	.long	0x12345678
	.globl	pwfl_P0BR
pwfl_P0BR:	.long	0x12345678
	.globl	pwfl_P0LR
pwfl_P0LR:	.long	0x12345678
	.globl	pwfl_P1BR
pwfl_P1BR:	.long	0x12345678
	.globl	pwfl_P1LR
pwfl_P1LR:	.long	0x12345678
	.globl	pwfl_P2BR
pwfl_P2BR:	.long	0x12345678
	.globl	pwfl_P2LR
pwfl_P2LR:	.long	0x12345678


	.globl	pwfl_IPL
pwfl_IPL:	.long	0x12345678








	.globl	pwfl_DCK

pwfl_DCK:	.long	0x12345678
	.globl	pwfl_CCK
pwfl_CCK:	.long	0x12345678
	.globl	pwfl_PCBB
pwfl_PCBB:	.long	0x12345678
	.globl	pwfl_ISP
pwfl_ISP:	.long	0x12345678
	.globl	pwfl_KSP
pwfl_KSP:	.long	0x12345678
	.globl	pwfl_USP
pwfl_USP:	.long	0x12345678
	.globl	pwfl_MME
pwfl_MME:	.long	0x12345678
	.globl	pwfl_PSL


pwfl_PSL:	.long	0x12345678








/*
 * Do a dump.
 * Called by auto-restart.
 * May be called manually.
 */
	.align	2
	.text
	.globl	_Xdoadump
	.globl	_doadump
_Xdoadump:			# CP brings Tahoe here on power recovery
	loadr	$0x3fff,pwfl_r0	# Restore r0 - r13
	movl	pwfl_sp,sp	# Restore sp ( = r14 )
	mtpr	pwfl_SCBB,$SCBB
	mtpr	pwfl_SBR,$SBR	# Restore all re_loadable registers
	mtpr	pwfl_SLR,$SLR
	mtpr	pwfl_P0BR,$P0BR
	mtpr	pwfl_P0LR,$P0LR
	mtpr	pwfl_P1BR,$P1BR
	mtpr	pwfl_P1LR,$P1LR
	mtpr	pwfl_P2BR,$P2BR
	mtpr	pwfl_P2LR,$P2LR
	mtpr	pwfl_IPL,$IPL
	mtpr	pwfl_DCK,$DCK
	mtpr	pwfl_CCK,$CCK
	mtpr	pwfl_PCBB,$PCBB
	mtpr	pwfl_ISP,$ISP
	mtpr	pwfl_KSP,$KSP
	mtpr	pwfl_USP,$USP

	bicpsw	$0xff		# Restore PSW.
	bispsw	pwfl_PSL+2	# Set original bits back (just in case..)
/* now go to mapped mode */
/* Have to change PC to system addresses */
	mtpr	$1,$PACC	# Thoroughly clean up caches.
	mtpr	$1,$PADC
	mtpr	$1,$TBIA
	mtpr	pwfl_MME,$MME  	# Restore MME. Last thing to be done.
	jmp 	*$0f
_doadump:
	.word 0
#define	_rsstkmap	_Sysmap+12			
			# Tahoe storage, scb, rsstk, interrupt stack
0:
	mtpr	$HIGH,$IPL

	andl2	$0!PG_PROT,_rsstkmap
	orl2	$PG_KW,_rsstkmap		# Make dump stack r/w
	tstl	dumpflag			# dump only once!
	bneq	1f
	movl	$1,dumpflag
	mtpr	$0,$TBIA
	movab	dumpflag,sp
	callf	$4,_dumpsys
1:
	halt

/*
 * Interrupt vector routines
 */ 
	.globl	_waittime

#define	SCBVEC(name) \
	.align 2; \
	.globl _X/**/name; \
_X/**/name
#define	PANIC(msg)	clrl _waittime; pushab 1f; \
			callf $8,_panic; 1: .asciz msg

#define	PRINTF(n,msg)	pushab 1f; callf $(n+2)*4,_printf; MSG(msg)
#define	MSG(msg)	.data; 1: .asciz msg; .text









			# these registers are not restored by the C-compiler.



#define	PUSHR		pushl r0; pushl r1;
#define	POPR		movl (sp)+, r1; movl (sp)+, r0;
			# mask for error code on stack.










#define SAVE_FPSTAT(_delta)	bitl	$PSL_DBL,_delta(sp); \

				beql	1f; \
				pushl	$1; \
				pushd; \
				jmp	2f; \
			1:	pushl	$0; \
				pushl	$0; \
				stf	-(sp); \
			2:	tstl	_u+PCB_SAVACC; \
				bneq	3f; \
				moval	0(sp),_u+PCB_SAVACC; \
				orl2	$2,8(sp);\
			3:	pushl	$0;

#define REST_FPSTAT		tstl	(sp)+; \

				bitl	$2,8(sp);\
				beql	1f;\
				movl	$0,_u+PCB_SAVACC; \
			1:	bitl	$1,8(sp); \
				beql	2f; \
				ldd	(sp); \
				jmp	3f; \
			2:	ldf	(sp); \
			3:	moval	12(sp),sp;

#define REST_ACC		tstl	_u+PCB_SAVACC; \

				beql	2f; \
				movl	_u+PCB_SAVACC,r1; \
				andl3	$(EXPMASK|SIGNBIT),(r1),-(sp); \
				cmpl	$0x80000000,(sp)+; \
				bneq	3f; \
				clrl	(r1); \
			3:	bitl	$1,8(r1); \
				beql	1f; \
				ldd	(r1); \
				jmp	2f; \
			1:	ldf	(r1); \
			2:	;

#define PUSHBPAR	pushab	6*4(sp) /* Push address of buserr paramters */
#define BPAR1		28		/* Offset to first hardware parameter */




SCBVEC(buserr):
	CHECK_SFE(12)
	SAVE_FPSTAT(12);
	PUSHR

	andl3	BPAR1(sp),$ERRCD,r0
	jeql	go_on
	cmpl	r0,$APE
	jneq	1f
	halt		# Address parity error !!!
1:	cmpl	r0,$VBE
	jneq	go_on
	halt		# Versabus error !!!














go_on:


	PUSHBPAR	# Pointer to parameters

	callf	$8,_buserror
	POPR

	REST_FPSTAT;
	movab	8(sp),sp	# Remove hardware parameters
	rei

SCBVEC(powfail):		# We should be on interrupt stack now.
	movpsl	pwfl_PSL	# Keeps all flags, etc.
	storer	$0x3fff,pwfl_r0	# Saves r0 - r13
	moval	0(sp),pwfl_sp	# Saves sp ( = r14 )
	mfpr	$SBR,pwfl_SBR	# Save all re_loadable registers
	mfpr	$SLR,pwfl_SLR
	mfpr	$P0BR,pwfl_P0BR
	mfpr	$P0LR,pwfl_P0LR
	mfpr	$P1BR,pwfl_P1BR
	mfpr	$P1LR,pwfl_P1LR
	mfpr	$P2BR,pwfl_P2BR
	mfpr	$P2LR,pwfl_P2LR
	mfpr	$IPL,pwfl_IPL
	mfpr	$MME,pwfl_MME  
	mfpr	$DCK,pwfl_DCK
	mfpr	$CCK,pwfl_CCK
	mfpr	$PCBB,pwfl_PCBB
	mfpr	$ISP,pwfl_ISP
	mfpr	$SCBB,pwfl_SCBB
	mfpr	$KSP,pwfl_KSP
	mfpr	$USP,pwfl_USP
	moval	_Xdoadump-SYSTEM,_scb+RESTVEC
	halt

SCBVEC(stray):
	PUSHR; PRINTF(0, "******* Undefined interrupt *******\n"); POPR;
	rei

#include "../net/netisr.h"
	.globl	_netisr
SCBVEC(netintr):
	CHECK_SFE(4)
	SAVE_FPSTAT(4)
	PUSHR

	bbc	$NETISR_RAW,_netisr,1f
	andl2	$(0!(1<<NETISR_RAW)),_netisr	
	callf	$4,_rawintr	
1:
#ifdef INET
#include "../netinet/in_systm.h"
	bbc	$NETISR_IP,_netisr,1f	
	andl2	$(0!(1<<NETISR_IP)),_netisr
	callf	$4,_ipintr	
1:
#endif
#ifdef NS
	bbc	$NETISR_NS,_netisr,1f	
	andl2	$(0!(1<<NETISR_NS)),_netisr
	callf	$4,_nsintr	
1:
#endif
	POPR; 
	REST_FPSTAT
	rei
SCBVEC(soft15):
|







|
>

|
>
>




<
<
<
<

















|





|

















|
>
|
|
|
|
>






>
>
>
>
>
>
>

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
|
>
>
>
>
>
>
>
>
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
>
>
>
>
>
>
>










|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<


<
<
<
|
>
|














<




|
|
>
|
|
|
>
>
>
>
>
>
>
>
|
>
>
>
|
|
|
>
>
>
>
>
>
>
>
>

|
>
|
|
|
|
|
|
|
|
|
|
|
|

|
>
|
|
|
|
|
|
|
|
|

|
>
|
|
|
|
|
|
|
|
|
|
|
|

<
<
>
>

>


|
<
>
|
<
|

|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
>


>
|
|


|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




|








<

|





|





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18




19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171


















172









173
174



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268


269
270
271
272
273
274
275

276
277

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310




311















312
313
314
315
316
317
318
319
320
321
322
323
324

325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
/*	locore.s	1.2	86/01/05	*/

#include "../tahoe/mtpr.h"
#include "../tahoe/trap.h"
#include "../tahoe/psl.h"
#include "../tahoe/pte.h"
#include "../tahoe/cp.h"
#include "../tahoe/mem.h"
#include "../tahoe/SYS.h"
#include "../tahoemath/fp.h"

#include "errno.h"
#include "syscall.h"
#include "cmap.h"

	.set	HIGH,0x1f	# mask for total disable
	.set	BERVEC,0x80	# offset into scb of the bus error vector 
	.set	RESTVEC,0x8	# offset into scb of the restart vector 





	.set	NISP,3		# number of interrupt stack pages
	.set	SYSTEM,0xC0000000 # virtual address of system start
	.set	PPAGES,0x100000  # Number of possible pages in P0,P1, etc.

/* ACBL for non-negative '_add' */
#define ACBL(_limit,_add,_index,_displ) \
	addl2	_add,_index; \
	cmpl	_index,_limit; \
	bleq	_displ

/* _ACBL for negative '_add' */
#define _ACBL(_limit,_add,_index,_displ) \
	addl2	_add,_index; \
	cmpl	_index,_limit; \
	bgeq	_displ

#define	MOVC3(_srcaddr,_dstaddr,_len) \
	movl	_srcaddr,r0; \
	movl	_dstaddr,r1; \
	movl	_len,r2; \
	movblk

/* keep address of psl if coming from user mode */
#define CHECK_SFE(_delta) \
	bitl	$PSL_CURMOD,_delta(sp); \
	jeql	1f; \
	moval	_delta(sp),_user_psl; \
1:

/*
 * User structure is UPAGES at top of user space.
 */
	.globl	_u
	.set	_u,SYSTEM - UPAGES*NBPG

/*
 * Restart stack. Used on power recovery or panic.
 * Takes a core-dump and then halts.
 */ 
	.globl	_rsstk
	.globl	pwfl_stk	
_rsstk:
	.space	1024-8
pwfl_stk:
	.space	4
dumpflag:
	.space	4

	.globl	_intstack
_intstack:
	.space	NISP*NBPG
eintstack:

/*
 * Power failure storage block and
 * macros for saving and restoring.
 */
#define	POWERFAIL(id,longs) \
	.globl	pwfl_/**/id \
pwfl_/**/id: .space longs*4
	.data
	POWERFAIL(r0,	14)		# r0-r13
	POWERFAIL(sp,	1)		# r14
	POWERFAIL(SCBB,	1)		# system control block base
	POWERFAIL(SBR,	1)		# system pte base
	POWERFAIL(SLR,	1)		# system pte length
	POWERFAIL(P0BR,	1)		# p0 pte base
	POWERFAIL(P0LR,	1)		# p0 pte length
	POWERFAIL(P1BR,	1)		# p1 pte base
	POWERFAIL(P1LR,	1)		# p1 pte length
	POWERFAIL(P2BR,	1)		# p2 pte base
	POWERFAIL(P2LR,	1)		# p2 pte length
	POWERFAIL(IPL,	1)		# interrupt priority level
	POWERFAIL(DCK,	1)		# data cache key
	POWERFAIL(CCK,	1)		# code cache key
	POWERFAIL(PCBB,	1)		# process control block base
	POWERFAIL(ISP,	1)		# interrupt stack pointer
	POWERFAIL(KSP,	1)		# kernel mode stack pointer
	POWERFAIL(USP,	1)		# user mode stack pointer
	POWERFAIL(MME,	1)		# memory management enable
	POWERFAIL(PSL,	1)		# processor status longword

/*
 * Save current state in power fail storage block.
 */
#define	SAVEpwfl() \
	movpsl	pwfl_PSL	# Keeps all flags, etc. \
	storer	$0x3fff,pwfl_r0	# Saves r0-r13 \
	moval	0(sp),pwfl_sp	# Saves sp (=r14) \
	mfpr	$SBR,pwfl_SBR	# Save all re_loadable registers \
	mfpr	$SLR,pwfl_SLR \

	mfpr	$P0BR,pwfl_P0BR \
	mfpr	$P0LR,pwfl_P0LR \
	mfpr	$P1BR,pwfl_P1BR \
	mfpr	$P1LR,pwfl_P1LR \
	mfpr	$P2BR,pwfl_P2BR \
	mfpr	$P2LR,pwfl_P2LR \
	mfpr	$IPL,pwfl_IPL \
	mfpr	$MME,pwfl_MME \
	mfpr	$DCK,pwfl_DCK \
	mfpr	$CCK,pwfl_CCK \
	mfpr	$PCBB,pwfl_PCBB \
	mfpr	$ISP,pwfl_ISP \
	mfpr	$SCBB,pwfl_SCBB \
	mfpr	$KSP,pwfl_KSP \
	mfpr	$USP,pwfl_USP

/*
 * Restore state saved in power fail block and
 * jmp to location specified after (possibly)
 * enabling memory management.
 */
#define	RESTOREpwfl(loc) \
	loadr	$0x3fff,pwfl_r0	# Restore r0-r13 \
	movl	pwfl_sp,sp	# Restore sp (=r14) \
	mtpr	pwfl_SCBB,$SCBB \
	mtpr	pwfl_SBR,$SBR	# Restore all re_loadable registers \
	mtpr	pwfl_SLR,$SLR \
	mtpr	pwfl_P0BR,$P0BR \
	mtpr	pwfl_P0LR,$P0LR \
	mtpr	pwfl_P1BR,$P1BR \
	mtpr	pwfl_P1LR,$P1LR \
	mtpr	pwfl_P2BR,$P2BR \
	mtpr	pwfl_P2LR,$P2LR \
	mtpr	pwfl_IPL,$IPL \
	mtpr	pwfl_DCK,$DCK \
	mtpr	pwfl_CCK,$CCK \
	mtpr	pwfl_PCBB,$PCBB \
	mtpr	pwfl_ISP,$ISP \
	mtpr	pwfl_KSP,$KSP \
	mtpr	pwfl_USP,$USP \
\
	bicpsw	$0xff		# Restore PSW. \
	bispsw	pwfl_PSL+2	# Set original bits back (just in case..) \
# now go to mapped mode \
# Have to change PC to system addresses \
	mtpr	$1,$PACC	# Thoroughly clean up caches. \
	mtpr	$1,$PADC \
	mtpr	$1,$TBIA \
	mtpr	pwfl_MME,$MME  	# Restore MME. Last thing to be done. \
	jmp 	loc

/*
 * Do a dump.
 * Called by auto-restart.
 * May be called manually.
 */
	.align	2
	.text
	.globl	_Xdoadump
	.globl	_doadump
_Xdoadump:					# CP comes here after power fail


















	RESTOREpwfl(*0f)			# restore state









_doadump:
	.word 0



0:	mtpr	$HIGH,$IPL
#define	_rsstkmap _Sysmap+12	# powerfail storage, scb, rsstk, int stack
	andl2	$~PG_PROT,_rsstkmap
	orl2	$PG_KW,_rsstkmap		# Make dump stack r/w
	tstl	dumpflag			# dump only once!
	bneq	1f
	movl	$1,dumpflag
	mtpr	$0,$TBIA
	movab	dumpflag,sp
	callf	$4,_dumpsys
1:
	halt

/*
 * Interrupt vector routines
 */ 
	.globl	_waittime

#define	SCBVEC(name) \
	.align 2; \
	.globl _X/**/name; \
_X/**/name
#define	PANIC(msg) \
	clrl _waittime; pushab 1f; callf $8,_panic; 1: .asciz msg
#define	PRINTF(n,msg) \
	pushab 1f; callf $(n+2)*4,_printf; MSG(msg)
#define	MSG(msg) .data; 1: .asciz msg; .text
/*
 * r0-r2 are saved across all faults and interrupts.
 * Routines below and those hidden in ubglue.s (device
 * interrupts) invoke the PUSHR/POPR macros to execute
 * this.  Also, certain stack frame offset calculations
 * (such as in hardclock) understand this, using the
 * REGSPC definition (and FPSPC defined below).
 * Finally, many routines, including those expanded
 * inline depend on this!  Should probably save all
 * live C compiler temp registers to eliminate potentially
 * grievous problems caused by incorrect register save masks.
 */
#define	REGSPC	(3*4)
#define	PUSHR	pushl r0; pushl r1; pushl r2;
#define	POPR	movl (sp)+,r2; movl (sp)+,r1; movl (sp)+,r0;

/*
 * Floating point state is saved across faults and
 * interrupts.  The state occupies 4 longwords on
 * the stack:
 *	precision indicator (single = 0/double = 1)
 *	double representation of accumulator
 *	save accumulator status flag (pcb_savacc)
 */
#define	FPSPC	(4*4)

#define SAVE_FPSTAT(_delta) \
	bitl	$PSL_DBL,_delta(sp); \
	beql	1f; \
	pushl	$1; \
	pushd; \
	jmp	2f; \
1:	pushl	$0; \
	pushl	$0; \
	stf	-(sp); \
2:	tstl	_u+PCB_SAVACC; \
	bneq	3f; \
	moval	0(sp),_u+PCB_SAVACC; \
	orl2	$2,8(sp);\
3:	pushl	$0;

#define REST_FPSTAT \
	tstl	(sp)+; \
	bitl	$2,8(sp);\
	beql	1f;\
	movl	$0,_u+PCB_SAVACC; \
1:	bitl	$1,8(sp); \
	beql	2f; \
	ldd	(sp); \
	jmp	3f; \
2:	ldf	(sp); \
3:	moval	12(sp),sp;

#define REST_ACC \
	tstl	_u+PCB_SAVACC; \
	beql	2f; \
	movl	_u+PCB_SAVACC,r1; \
	andl3	$(EXPMASK|SIGNBIT),(r1),-(sp); \
	cmpl	$0x80000000,(sp)+; \
	bneq	3f; \
	clrl	(r1); \
3:	bitl	$1,8(r1); \
	beql	1f; \
	ldd	(r1); \
	jmp	2f; \
1:	ldf	(r1); \
2:	;



	.data
nofault: .space	4			# bus error non-local goto label

	.text
SCBVEC(buserr):
	CHECK_SFE(12)
	SAVE_FPSTAT(12)

	pushl	r0			# must save
	andl3	24(sp),$ERRCD,r0	# grab pushed MER value

	cmpl	r0,$APE			# address parity error?
	jneq	1f
	halt	
1:	cmpl	r0,$VBE			# versabus error?
	jneq	2f
	halt
2:
	movl	(sp)+,r0		# restore r0 and...
	bitl	$PSL_CURMOD,4*4+3*4(sp)	# check if happened in user mode?
	jeql	3f			# yes, then shift stack up for trap...
	movl	12(sp),16(sp)		# sorry, no space for which-buss...
	movl	8(sp),12(sp)
	movl	4(sp),8(sp)
	movl	0(sp),4(sp)
	movl	$T_BUSERR,0(sp)		# push trap type code and...
	jbr	alltraps		# ...merge with all other traps
3:					# kernel mode, check to see if...
	tstl	nofault			# ...doing peek/poke?
	jeql	4f			# nofault set? if so, jump to it...
	movl	nofault,4*4+2*4(sp)	# ...setup for non-local goto
	clrl	nofault
	jbr	5f
4:
	PUSHR
	pushab	7*4(sp)			# address of bus error parameters
	callf	$8,_buserror
	POPR
5:
	REST_FPSTAT
	movab	8(sp),sp		# remove bus error parameters
	rei

SCBVEC(powfail):			# We should be on interrupt stack now.




	SAVEpwfl()			# save machine state















	moval	_Xdoadump-SYSTEM,_scb+RESTVEC
	halt

SCBVEC(stray):
	PUSHR; PRINTF(0, "stray interrupt\n"); POPR;
	rei

#include "../net/netisr.h"
	.globl	_netisr
SCBVEC(netintr):
	CHECK_SFE(4)
	SAVE_FPSTAT(4)
	PUSHR

	bbc	$NETISR_RAW,_netisr,1f
	andl2	$~(1<<NETISR_RAW),_netisr	
	callf	$4,_rawintr	
1:
#ifdef INET
#include "../netinet/in_systm.h"
	bbc	$NETISR_IP,_netisr,1f	
	andl2	$~(1<<NETISR_IP),_netisr
	callf	$4,_ipintr	
1:
#endif
#ifdef NS
	bbc	$NETISR_NS,_netisr,1f	
	andl2	$~(1<<NETISR_NS),_netisr
	callf	$4,_nsintr	
1:
#endif
	POPR; 
	REST_FPSTAT
	rei
SCBVEC(soft15):
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334

335
336
337
338
339
340
341

342
343
344
345
346

347
348
349
350
351

352
353
354
355
356
357
358
359




360
361
362
363
364
365
366
367

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
SCBVEC(soft5):
SCBVEC(soft4):
#ifndef SIMIO
SCBVEC(soft3):
SCBVEC(soft2):
SCBVEC(soft1):
#endif
	PUSHR
	PRINTF(0, "******* Undefined software interrupt *******\n")
	POPR;
	rei

#ifdef SIMIO
SCBVEC(soft2):
#endif
SCBVEC(cnrint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4);PUSHR; 
	pushl $CPCONS; callf $8,_cnrint; POPR; incl _cnt+V_INTR;
	REST_FPSTAT; rei

#ifdef SIMIO
SCBVEC(soft3):
#endif
SCBVEC(cnxint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4);PUSHR; 
	pushl $CPCONS; callf $8,_cnxint; POPR; REST_FPSTAT;

	incl _cnt+V_INTR; rei
SCBVEC(rmtrint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR; 
	pushl $CPREMOT; callf $8,_cnrint; POPR; REST_FPSTAT;

	incl _cnt+V_INTR; rei
SCBVEC(rmtxint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR; 
	pushl $CPREMOT; callf $8,_cnxint; POPR; REST_FPSTAT;

	incl _cnt+V_INTR; rei
#ifdef SIMIO
SCBVEC(soft9):
#endif

#define PUSHPCPSL	pushl 5*4+2*4(sp); pushl 5*4+2*4(sp);

SCBVEC(hardclock):




	CHECK_SFE(4)
	SAVE_FPSTAT(4)
	PUSHR
	PUSHPCPSL				# push pc and psl
	callf $12,_hardclock			# hardclock(pc,psl)
	POPR;
	REST_FPSTAT
	incl	_cnt+V_INTR		## temp so not to break vmstat -= HZ

	rei
SCBVEC(softclock):
	CHECK_SFE(4)
	SAVE_FPSTAT(4)
	PUSHR
	PUSHPCPSL				# push pc and psl
	callf $12,_softclock			# softclock(pc,psl)
	POPR; 
	REST_FPSTAT
	rei

/*
 * Trap and fault vector routines
 */ 
#define	TRAP(a)	pushl $T_/**/a; jbr alltraps

/*
 * Ast delivery (profiling and/or reschedule)
 */
/*
 * When we want to reschedule we will force a memory fault by setting the m.s.b

 *  of P0LR. Then , on memory fault if m.s.b of P0LR is on we will clear it and
 *  TRAP(astflt).
 *
 */
 
					# if this bit is on it is an ast.
#define 	ASTBIT	0x00100000  	
#define		P0MASK	0xc0000000

SCBVEC(kspnotval):
	CHECK_SFE(4)
	pushl $0;
	SAVE_FPSTAT(8)
	TRAP(KSPNOTVAL)
SCBVEC(privinflt):







<
|
<







|
|
|
>





|
|
>
|



|
>
|



|
>
|




|


>
>
>
>

|
<
|
|
<
<

>



|
<

|
<
|











|
>
|
|
<

<
<
|
|







355
356
357
358
359
360
361

362

363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407

408
409


410
411
412
413
414
415

416
417

418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433

434


435
436
437
438
439
440
441
442
443
SCBVEC(soft5):
SCBVEC(soft4):
#ifndef SIMIO
SCBVEC(soft3):
SCBVEC(soft2):
SCBVEC(soft1):
#endif

	PUSHR; PRINTF(0, "stray software interrupt\n"); POPR;

	rei

#ifdef SIMIO
SCBVEC(soft2):
#endif
SCBVEC(cnrint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR; 
	pushl $CPCONS; callf $8,_cnrint; incl _cnt+V_INTR
	POPR; REST_FPSTAT;
	rei
#ifdef SIMIO
SCBVEC(soft3):
#endif
SCBVEC(cnxint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR; 
	pushl $CPCONS; callf $8,_cnxint; incl _cnt+V_INTR
	POPR; REST_FPSTAT;
	rei
SCBVEC(rmtrint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR; 
	pushl $CPREMOT; callf $8,_cnrint; incl _cnt+V_INTR
	POPR; REST_FPSTAT;
	rei
SCBVEC(rmtxint):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR; 
	pushl $CPREMOT; callf $8,_cnxint; incl _cnt+V_INTR
	POPR; REST_FPSTAT;
	rei
#ifdef SIMIO
SCBVEC(soft9):
#endif

#define PUSHPCPSL	pushl 4+FPSPC+REGSPC(sp); pushl 4+FPSPC+REGSPC(sp);

SCBVEC(hardclock):
	tstl	_clk_enable
	bneq	1f
	rei
1:
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR

	PUSHPCPSL			# push pc and psl
	callf	$12,_hardclock		# hardclock(pc,psl)


	incl	_cnt+V_INTR		## temp so not to break vmstat -= HZ
	POPR; REST_FPSTAT
	rei
SCBVEC(softclock):
	CHECK_SFE(4)
	SAVE_FPSTAT(4); PUSHR;

	PUSHPCPSL				# push pc and psl
	callf	$12,_softclock			# softclock(pc,psl)

	POPR; REST_FPSTAT
	rei

/*
 * Trap and fault vector routines
 */ 
#define	TRAP(a)	pushl $T_/**/a; jbr alltraps

/*
 * Ast delivery (profiling and/or reschedule)
 */
/*
 * When we want to reschedule we will force a
 * memory fault by setting the ASTBIT of P0LR.
 * Then, on memory fault if the ASTBIT of the
 * p0lr is set we will clear it and TRAP(astflt).

 */


#define ASTBIT	0x00100000  	
#define	P0MASK	0xc0000000

SCBVEC(kspnotval):
	CHECK_SFE(4)
	pushl $0;
	SAVE_FPSTAT(8)
	TRAP(KSPNOTVAL)
SCBVEC(privinflt):
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
	jneq	segflt
	SAVE_FPSTAT(8)
	TRAP(PROTFLT)
segflt:
	SAVE_FPSTAT(8)
	TRAP(SEGFLT)

SCBVEC(fpm):			# Floating Point eMulation
	.globl	_fpemulate
	CHECK_SFE(16)
	SAVE_FPSTAT(16)
	callf	$4,_fpemulate
	REST_FPSTAT
	moval	8(sp),sp	# Pop operand
	tstl	(sp)		# Stack= PSL, PC, return_code
	jneq	_Xarithtrap	# If not OK, emulate F.P. exception







|
<







481
482
483
484
485
486
487
488

489
490
491
492
493
494
495
	jneq	segflt
	SAVE_FPSTAT(8)
	TRAP(PROTFLT)
segflt:
	SAVE_FPSTAT(8)
	TRAP(SEGFLT)

SCBVEC(fpm):			# Floating Point Emulation

	CHECK_SFE(16)
	SAVE_FPSTAT(16)
	callf	$4,_fpemulate
	REST_FPSTAT
	moval	8(sp),sp	# Pop operand
	tstl	(sp)		# Stack= PSL, PC, return_code
	jneq	_Xarithtrap	# If not OK, emulate F.P. exception
474
475
476
477
478
479
480

481
482
483
484
485
486
487
488
489
490
491


492
493
494
495
496
497
498
499
500
	SAVE_FPSTAT(8)
	TRAP(TABLEFLT)

#define REST_STACK	movab 4(sp), sp; REST_FPSTAT; movab 4(sp), sp

alltraps:
	mfpr	$USP,-(sp); 

	callf $4,_trap; mtpr (sp)+,$USP
	incl	_cnt+V_TRAP
	REST_STACK			# pop type, code, an fp stuff
	mtpr	$HIGH,$IPL		## dont go to a higher IPL (GROT)
	rei

SCBVEC(syscall):
	CHECK_SFE(8)
	SAVE_FPSTAT(8)
	pushl	$T_SYSCALL
	mfpr	$USP,-(sp); callf $4,_syscall; mtpr (sp)+,$USP


	incl	_cnt+V_SYSCALL
	REST_STACK			# pop type, code, an fp stuff
	mtpr	$HIGH,$IPL		## dont go to a higher IPL (GROT)
	rei

/*
 * System page table
 */ 
#define	vaddr(x)	((((x)-_Sysmap)/4)*NBPG+SYSTEM)







>
|

|







|
>
>

|







513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
	SAVE_FPSTAT(8)
	TRAP(TABLEFLT)

#define REST_STACK	movab 4(sp), sp; REST_FPSTAT; movab 4(sp), sp

alltraps:
	mfpr	$USP,-(sp); 
	callf	$4,_trap;
	mtpr	(sp)+,$USP
	incl	_cnt+V_TRAP
	REST_STACK			# pop type, code, and fp stuff
	mtpr	$HIGH,$IPL		## dont go to a higher IPL (GROT)
	rei

SCBVEC(syscall):
	CHECK_SFE(8)
	SAVE_FPSTAT(8)
	pushl	$T_SYSCALL
	mfpr	$USP,-(sp);
	callf	$4,_syscall;
	mtpr	(sp)+,$USP
	incl	_cnt+V_SYSCALL
	REST_STACK			# pop type, code, and fp stuff
	mtpr	$HIGH,$IPL		## dont go to a higher IPL (GROT)
	rei

/*
 * System page table
 */ 
#define	vaddr(x)	((((x)-_Sysmap)/4)*NBPG+SYSTEM)
519
520
521
522
523
524
525
526

527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732

733
734
735
736
737
738
739
740
741

742


743
744
745



746
747
748
749
750
751
752
753
754
755

756
757
758
759
760
761

762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829

830

831
832
833
834

835
836


837

838
839




840
841

842


843
844

845
846
847
848
849
850
851
852
853
854
855

856




857
858






859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
	SYSMAP(Swapmap	,swaputl	,UPAGES		)
	SYSMAP(Pushmap	,pushutl	,UPAGES		)
	SYSMAP(Vfmap	,vfutl		,UPAGES		)
	SYSMAP(VD0map	,vd0utl		,(MAXBPTE+1)	)
	SYSMAP(VD1map	,vd1utl		,(MAXBPTE+1)	)
	SYSMAP(VD2map	,vd2utl		,(MAXBPTE+1)	)
	SYSMAP(VD3map	,vd3utl		,(MAXBPTE+1)	)
	SYSMAP(CYmap	,cyutl		,(TBUFSIZ+1)	)

	SYSMAP(CMAP1	,CADDR1		,1		)
	SYSMAP(CMAP2	,CADDR2		,1		)
	SYSMAP(mmap	,vmmap		,1		)
	SYSMAP(msgbufmap,msgbuf		,MSGBUFPTECNT	)
	SYSMAP(camap	,cabase		,16*CLSIZE	)
	SYSMAP(ecamap	,calimit	,0		)
	SYSMAP(Mbmap	,mbutl		,NMBCLUSTERS*CLSIZE)
eSysmap:
	.globl	_Syssize
	.set	_Syssize,(eSysmap-_Sysmap)/4

	.text
/*
 * Initialization
 *
 * IPL 0x1f; MME 0; scbb, pcbb, sbr, slr, isp, ksp not set
 *
 */

	.align	2
	.globl	start
start:
	.word	0

/* set system control block base and system page table params */

	mtpr	$_scb-SYSTEM,$SCBB
	mtpr	$_Sysmap-SYSTEM,$SBR
	mtpr	$_Syssize,$SLR

/* double map the kernel into the virtual user addresses of phys mem */
/* (to be on the safe side.This is supposed to run in system sace. )  */
	mtpr	$_Sysmap,$P0BR
	mtpr	$_Syssize,$P0LR

	mtpr	$_Sysmap,$P1BR		# Against Murphy
	mtpr	$_Syssize,$P1LR

/* set ISP */
	movl	$_intstack-SYSTEM+NISP*NBPG,sp	# Still physical !
	mtpr	$_intstack+NISP*NBPG,$ISP

/* count up memory */

	clrl	r7
1:	pushl	$1; pushl r7; callf $12,_badaddr; tstl r0; bneq 9f
	addl2	$MEMUNIT,r7
	cmpl	r7,$MAXPHYSMEM
	bleq	1b
9:
/* clear memory from kernel bss and pages for proc 0 u. and page table */
	movab	_edata,r6
	movab	_end,r5
	andl2	$0!SYSTEM,r6
	andl2	$0!SYSTEM,r5
	addl2	$(UPAGES*NBPG)+NBPG+NBPG,r5
1:	clrl	(r6); ACBL( r5,$4,r6,1b)

/* trap() and syscall() save r0-r13 in the entry mask (per ../h/reg.h) */
/* For floating point emulation, we do same for 'fpemulate' */
	orw2	$0x01fff,_trap
	orw2	$0x01fff,_syscall
	orw2	$0x01fff,_fpemulate

/* initialize system page table: scb and int stack writeable */
	clrl	r2
	movab	eintstack,r1 
	andl2	$0!SYSTEM,r1
	shrl 	$PGSHIFT,r1,r1		# r1-page number of eintstack.

/* Start by making the processor storage read/only */

	orl3	$PG_V|PG_KR,r2,_Sysmap[r2]; incl r2;
	orl3	$PG_V|PG_KR,r2,_Sysmap[r2]; incl r2;

/* Other parts of the system are read/write for kernel */

1:	orl3	$PG_V|PG_KW,r2,_Sysmap[r2]; # data:kernel write + phys=virtual
	aoblss r1,r2,1b

/* make rsstk read-only as red zone for interrupt stack */
	andl2	$0!PG_PROT,_rsstkmap
	orl2	$PG_V|PG_KR,_rsstkmap		# Make dump stack r/w

/* make kernel text space read-only */
/*
 * HAVE TO CHECK ALL THE MAGIC CONSTANTS USED HERE : $xxxxxx */

	movab	_etext+NBPG-1,r1
	andl2	$0!SYSTEM,r1
	shrl 	$PGSHIFT,r1,r1
1:	orl3	$PG_V|PG_KR,r2,_Sysmap[r2]
	aoblss r1,r2,1b

/* make kernel data, bss, read-write */
	movab	_end+NBPG-1,r1
	andl2	$0!SYSTEM,r1
	shrl 	$PGSHIFT,r1,r1
1:	orl3	$PG_V|PG_KW,r2,_Sysmap[r2]
	aoblss r1,r2,1b

/* now go to mapped mode */
/* Have to change both PC and SP to system addresses */
	mtpr	$1,$TBIA
	mtpr	$1,$PADC	/* needed by HW parity & ECC logic */
	mtpr	$1,$PACC	/* just in case */
	mtpr 	$1,$MME
	movab	SYSTEM(sp),sp
	.globl	go_virt
go_virt:	
	jmp 	*$0f
0:

/* disable any interrupts */
	movl	$0,_intenable
/* init mem sizes */
	shrl	$PGSHIFT,r7,_maxmem
	movl	_maxmem,_physmem
	movl	_maxmem,_freemem

/* setup context for proc[0] == Scheduler */
	movab	_end-SYSTEM+NBPG-1,r6
	andl2	$0!(NBPG-1),r6		# make page boundary

/* setup page table for proc[0] */
	shrl	$PGSHIFT,r6,r3			# r3 = btoc(r6)
	orl3	$PG_V|PG_KW,r3,_Usrptmap	# init first upt entry
	incl	r3				# r3 - next page
	movab	_usrpt,r0			# r0 - first user page
	mtpr	r0,$TBIS

/* init p0br, p0lr */
	mtpr	r0,$P0BR	# No P0 for proc[0]
	mtpr	$0,$P0LR

	mtpr	r0,$P1BR	# No P1 either
	mtpr	$0,$P1LR


/* init p2br, p2lr */
	movab	NBPG(r0),r0
	movl	$PPAGES-UPAGES,r1
	mtpr	r1,$P2LR
	moval	-4*PPAGES(r0),r2
	mtpr	r2,$P2BR

/* setup mapping for UPAGES of _u */
	clrl	r2; 
	movl 	$SYSTEM,r1
	addl2 	$UPAGES,r3
	jbr 2f
1:	decl	r3
	moval	-NBPG(r1),r1;	# r1 = virtual add of next (downward) _u page
	subl2	$4,r0		# r0 = pte address
	orl3	$PG_V|PG_URKW,r3,(r0)
	mtpr	r1,$TBIS
2:	aobleq	$UPAGES,r2,1b

/* initialize (slightly) the pcb */
	movab	UPAGES*NBPG(r1),PCB_KSP(r1)	# KSP starts at end of _u
	movl	r1,PCB_USP(r1)			# USP starts just below _u
	mfpr	$P0BR,PCB_P0BR(r1)
	mfpr	$P0LR,PCB_P0LR(r1)
	mfpr	$P1BR,PCB_P1BR(r1)
	mfpr	$P1LR,PCB_P1LR(r1)
	mfpr	$P2BR,PCB_P2BR(r1)
	mfpr	$P2LR,PCB_P2LR(r1)
	movl	$CLSIZE,PCB_SZPT(r1)		# init u.u_pcb.pcb_szpt
	movl	r11,PCB_R11(r1)			# r11 obtained from CP on boot
	movab	1f,PCB_PC(r1)			# initial pc
	clrl	PCB_PSL(r1)			# kernel mode, ipl=0
	movw	$0xff,PCB_CKEY(r1)	# give him a code key
	movw	$0xff,PCB_DKEY(r1)	# give him a data key
	shll	$PGSHIFT,r3,r3
	mtpr	r3,$PCBB			# first pcbb (physical ! )

/* Go to a 'normal' process mode (kernel) */

	ldpctx
	rei		# Actually 'returns' to the next instruction:

/* put signal trampoline code in u. area */
1:	movab	_u,r0
	movl	sigcode+0,PCB_SIGC+0(r0)
	movl	sigcode+4,PCB_SIGC+4(r0)
	movl	sigcode+8,PCB_SIGC+8(r0)
	movl	sigcode+12,PCB_SIGC+12(r0)

/* save reboot flags in global _boothowto */
	movl	r11,_boothowto

/* calculate firstaddr, and call main() */
	movab	_end-SYSTEM+NBPG-1,r0
	shrl	$PGSHIFT,r0,-(sp)
	addl2	$UPAGES+1,(sp)		# First physical unused page number
	callf 	$8,_main

/* proc[1] == /etc/init now running here in kernel mode; run icode */
	pushl	$PSL_CURMOD		# User mode PSL
	pushl $0			# PC = 0 (virtual now)
	rei

/* signal trampoline code: it is known that this code takes up to 16    */
/* bytes in pcb.h and in the code above 				*/
/*  The following user stack layout was set up by machdep.c/sendsig 	*/
/*	routine:							*/

/*									*/
/*	+---------------+						*/
/*	|  Last PSL	|\						*/
/*	+---------------+ > for rei					*/
/*  :-->|  Last PC	|/						*/
/*  |	+---------------+						*/
/*  :___|__*   SP	|\						*/
/*	+---------------+ |						*/
/*	|  sigmask	| |						*/

/*	+---------------+  > cleaned by kcall $139 (sigcleanup)		*/


/*  :-->|  u.u_onstack	| |						*/
/*  |	+---------------+ |						*/
/*  :___|_* copy of SCP	|/						*/



/*  |	+---------------+						*/
/*  |	|  Process' r0	| 						*/
/*  |	+---------------+						*/
/*  |	|  Process' r1	|						*/
/*  |	+---------------+						*/
/*  |	| Handler addr. |\						*/
/*  |	+---------------+ |						*/
/*  :___|_*   SCP	| |						*/
/*	+---------------+  > cleaned by ret from calls			*/
/*	|  u.u_code	| |						*/

/*	+---------------+ |						*/
/*	|  signal number|/						*/
/*	+---------------+						*/
/*									*/
/*   * Stack when entering sigcode; setup by sendsig();			*/
/*									*/

	.align	2
sigcode:			# When the process executes this code
				#  (located in its u. structure), it
				#  is in user mode !
	calls	$4*4+4,*12(sp)	# 4 words popped from stack when this call returns
	movl	(sp)+,r1
	movl	(sp)+,r0
	kcall	$139		# Signal cleanup
	rei			# From user mode to user mode !

/*
 * Primitives
 */ 

/*
 * badaddr(addr, len)
 *	see if access addr with a len type instruction causes a machine check
 *	len is length of access (1=byte, 2=short, 4=long)
 *	r0 = 0 means good(exists); r0 =1 means does not exist.
 */
	.globl	_badaddr
_badaddr:
	.word	0x1c	# Keep r4,r3,r2
	mfpr	$IPL,r1
	mtpr	$HIGH,$IPL
	movl	_scb+BERVEC,r2
	movl	4(fp),r3
	movl	8(fp),r4
	movab	9f,_scb+BERVEC
	bbc	$0,r4,1f; tstb	(r3)
1:	bbc	$1,r4,1f; tstw	(r3)
1:	bbc	$2,r4,1f; tstl	(r3)
1:	clrl	r0			# made it w/o machine checks
2:	movl	r2,_scb+BERVEC
	mtpr	r1,$IPL
	ret

	.align	2
9:			# Here we catch buss error (if it comes)
	andl3	4(sp),$ERRCD,r0
	cmpl	r0,$APE
	jneq	1f
	halt			# Address parity error !!!
1:	cmpl	r0,$VBE
	jneq	1f
	halt			# Versabus error
1:
	movl	$1,r0		# Anything else = bad address
	movab	8(sp),sp	# discard buss error trash
	movab	2b,(sp)		# new program counter on stack.
	rei


/*
 * badcyaddr(addr)
 *	see if access tape master controller addr causes a bus error
 *	r0 = 0: no error; r0 = 1: timeout error.
 */
	.globl	_badcyaddr
_badcyaddr:
	.word	0x0c	# Keep r3,r2
	mfpr	$IPL,r1
	mtpr	$HIGH,$IPL
	movl	_scb+BERVEC,r2
	clrl	r3
	movab	9f,_scb+BERVEC
	movob	$-1, *4(fp)
1:	aobleq	$1000, r3, 1b

	clrl	r0			# made it w/o machine checks

2:	movl	r2,_scb+BERVEC
	mtpr	r1,$IPL
	ret


	.align	2
9:			# Here we catch buss error (if it comes)


	andl3	4(sp),$ERRCD,r0

	cmpl	r0,$APE
	jneq	1f




	halt			# Address parity error !!!
1:	cmpl	r0,$VBE

	jneq	1f


	halt			# Versabus error
1:

	movl	$1,r0		# Anything else = timeout
	movab	8(sp),sp	# discard buss error trash
	movab	2b,(sp)		# new program counter on stack.
	rei

_bcopy:	.globl	_bcopy
	.word	0x4		# save r2
				# Called by ovbcopy(from,dst,len)
	movl	4(fp),r0
	movl	8(fp),r1
	movl	12(fp),r2

	movblk




	ret







_ovbcopy:	.globl	_ovbcopy
	.word	0x001c
	movl	4(fp),r0
	movl	8(fp),r1
	movl	12(fp),r2
	cmpl	r0,r1
	bgtru	1f		# normal forward case
	beql	2f		# equal, nothing to do
	addl2	r2,r0		# may be overlapping
	cmpl	r0,r1
	bgtru	3f
	subl2	r2,r0		# normal forward case
1:
	movblk
2:
	ret
3:
	addl2	r2,r1		# overlapping, must do backwards
	subl3	r0,r1,r3
	movl	r2,r4
	jbr	5f
4:
	subl2	r3,r0
	subl2	r3,r1
	movl	r3,r2







|
>
















<

<




<

<



<

<


<
|

<

|

<

<


<
|
<




|
|

|
|
<
<



|



|
|
<
|
<


<
|
<
|

<

|
|
<

<
<
<

|



<


|



<
|
<

|
|


<
<


<






<
|

|
<






<

|

<
|

<
<






<

|




|




<













<
<

|
|
<
<

|
<

|
|
|
<
<
|


<



|

<

|
|


|
|
|
|
>
|
<
|
|
|
<
<
<
|
>
|
>
>
|
|
|
>
>
>
|
|
<
|
<
<
|
|
<
|
>
|
|
|
|
|
|
>

|
|
|
|
|
|
<
|











<
|
<









|





|



|









<





<
|
<


<
|
|

|
>
|
>
|
|


>
|
|
>
>
|
>
|
|
>
>
>
>
|
|
>
|
>
>
|
<
>
|
<
<
|
|
<
<
<
|
|
|
>
|
>
>
>
>


>
>
>
>
>
>
|
<




|
|
|


|





|







561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585

586

587
588
589
590

591

592
593
594

595

596
597

598
599

600
601
602

603

604
605

606

607
608
609
610
611
612
613
614
615


616
617
618
619
620
621
622
623
624

625

626
627

628

629
630

631
632
633

634



635
636
637
638
639

640
641
642
643
644
645

646

647
648
649
650
651


652
653

654
655
656
657
658
659

660
661
662

663
664
665
666
667
668

669
670
671

672
673


674
675
676
677
678
679

680
681
682
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
698
699
700
701
702
703


704
705
706


707
708

709
710
711
712


713
714
715

716
717
718
719
720

721
722
723
724
725
726
727
728
729
730
731

732
733
734



735
736
737
738
739
740
741
742
743
744
745
746
747

748


749
750

751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766

767
768
769
770
771
772
773
774
775
776
777
778

779

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808

809
810
811
812
813

814

815
816

817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847

848
849


850
851



852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869

870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
	SYSMAP(Swapmap	,swaputl	,UPAGES		)
	SYSMAP(Pushmap	,pushutl	,UPAGES		)
	SYSMAP(Vfmap	,vfutl		,UPAGES		)
	SYSMAP(VD0map	,vd0utl		,(MAXBPTE+1)	)
	SYSMAP(VD1map	,vd1utl		,(MAXBPTE+1)	)
	SYSMAP(VD2map	,vd2utl		,(MAXBPTE+1)	)
	SYSMAP(VD3map	,vd3utl		,(MAXBPTE+1)	)
	SYSMAP(CY0map	,cy0utl		,(TBUFSIZ+1)	)
	SYSMAP(CY1map	,cy1utl		,(TBUFSIZ+1)	)
	SYSMAP(CMAP1	,CADDR1		,1		)
	SYSMAP(CMAP2	,CADDR2		,1		)
	SYSMAP(mmap	,vmmap		,1		)
	SYSMAP(msgbufmap,msgbuf		,MSGBUFPTECNT	)
	SYSMAP(camap	,cabase		,16*CLSIZE	)
	SYSMAP(ecamap	,calimit	,0		)
	SYSMAP(Mbmap	,mbutl		,NMBCLUSTERS*CLSIZE)
eSysmap:
	.globl	_Syssize
	.set	_Syssize,(eSysmap-_Sysmap)/4

	.text
/*
 * Initialization
 *
 * IPL 0x1f; MME 0; scbb, pcbb, sbr, slr, isp, ksp not set

 */

	.align	2
	.globl	start
start:
	.word	0

/* set system control block base and system page table params */

	mtpr	$_scb-SYSTEM,$SCBB
	mtpr	$_Sysmap-SYSTEM,$SBR
	mtpr	$_Syssize,$SLR

/* double map the kernel into the virtual user addresses of phys mem */

	mtpr	$_Sysmap,$P0BR
	mtpr	$_Syssize,$P0LR

	mtpr	$_Sysmap,$P1BR			# against Murphy
	mtpr	$_Syssize,$P1LR

/* set ISP */
	movl	$_intstack-SYSTEM+NISP*NBPG,sp	# still physical
	mtpr	$_intstack+NISP*NBPG,$ISP

/* count up memory */

	clrl	r7
1:	pushl	$1; pushl r7; callf $12,_badaddr; tstl r0; bneq 9f

	ACBL($MAXMEM*1024-1,$64*1024,r7,1b)

9:
/* clear memory from kernel bss and pages for proc 0 u. and page table */
	movab	_edata,r6
	movab	_end,r5
	andl2	$~SYSTEM,r6
	andl2	$~SYSTEM,r5
	addl2	$(UPAGES*NBPG)+NBPG+NBPG,r5
1:	clrl	(r6); ACBL(r5,$4,r6,1b)
/* trap(), syscall(), and fpemulate() save r0-r12 in the entry mask */


	orw2	$0x01fff,_trap
	orw2	$0x01fff,_syscall
	orw2	$0x01fff,_fpemulate
	orw2	$0x01ffc,_panic			# for debugging (no r0|r1)
/* initialize system page table: scb and int stack writeable */
	clrl	r2
	movab	eintstack,r1 
	andl2	$~SYSTEM,r1
	shrl 	$PGSHIFT,r1,r1			# r1-page number of eintstack

/* make processor storage read/only */

	orl3	$PG_V|PG_KR,r2,_Sysmap[r2]; incl r2;
	orl3	$PG_V|PG_KR,r2,_Sysmap[r2]; incl r2;

/* other parts of the system are read/write for kernel */

1:	orl3	$PG_V|PG_KW,r2,_Sysmap[r2];	# data:kernel write+phys=virtual
	aoblss r1,r2,1b

/* make rsstk read-only as red zone for interrupt stack */
	andl2	$~PG_PROT,_rsstkmap
	orl2	$PG_V|PG_KR,_rsstkmap

/* make kernel text space read-only */



	movab	_etext+NBPG-1,r1
	andl2	$~SYSTEM,r1
	shrl 	$PGSHIFT,r1,r1
1:	orl3	$PG_V|PG_KR,r2,_Sysmap[r2]
	aoblss r1,r2,1b

/* make kernel data, bss, read-write */
	movab	_end+NBPG-1,r1
	andl2	$~SYSTEM,r1
	shrl 	$PGSHIFT,r1,r1
1:	orl3	$PG_V|PG_KW,r2,_Sysmap[r2]
	aoblss r1,r2,1b

/* go to mapped mode, have to change both pc and sp to system addresses */

	mtpr	$1,$TBIA
	mtpr	$1,$PADC			# needed by HW parity&ECC logic
	mtpr	$1,$PACC			# just in case
	mtpr 	$1,$MME
	movab	SYSTEM(sp),sp


	jmp 	*$0f
0:

/* disable any interrupts */
	movl	$0,_intenable
/* init mem sizes */
	shrl	$PGSHIFT,r7,_maxmem
	movl	_maxmem,_physmem
	movl	_maxmem,_freemem

/* setup context for proc[0] == scheduler */
	movab	_end-SYSTEM+NBPG-1,r6
	andl2	$~(NBPG-1),r6			# make page boundary

/* setup page table for proc[0] */
	shrl	$PGSHIFT,r6,r3			# r3 = btoc(r6)
	orl3	$PG_V|PG_KW,r3,_Usrptmap	# init first upt entry
	incl	r3				# r3 - next page
	movab	_usrpt,r0			# r0 - first user page
	mtpr	r0,$TBIS

/* init p0br, p0lr */
	mtpr	r0,$P0BR			# no p0 for proc[0]
	mtpr	$0,$P0LR

	mtpr	r0,$P1BR			# no p1 either
	mtpr	$0,$P1LR


/* init p2br, p2lr */
	movab	NBPG(r0),r0
	movl	$PPAGES-UPAGES,r1
	mtpr	r1,$P2LR
	moval	-4*PPAGES(r0),r2
	mtpr	r2,$P2BR

/* setup mapping for UPAGES of _u */
	clrl	r2
	movl 	$SYSTEM,r1
	addl2 	$UPAGES,r3
	jbr 2f
1:	decl	r3
	moval	-NBPG(r1),r1	# r1 = virtual add of next (downward) _u page
	subl2	$4,r0		# r0 = pte address
	orl3	$PG_V|PG_URKW,r3,(r0)
	mtpr	r1,$TBIS
2:	aobleq	$UPAGES,r2,1b

/* initialize (slightly) the pcb */
	movab	UPAGES*NBPG(r1),PCB_KSP(r1)	# KSP starts at end of _u
	movl	r1,PCB_USP(r1)			# USP starts just below _u
	mfpr	$P0BR,PCB_P0BR(r1)
	mfpr	$P0LR,PCB_P0LR(r1)
	mfpr	$P1BR,PCB_P1BR(r1)
	mfpr	$P1LR,PCB_P1LR(r1)
	mfpr	$P2BR,PCB_P2BR(r1)
	mfpr	$P2LR,PCB_P2LR(r1)
	movl	$CLSIZE,PCB_SZPT(r1)		# init u.u_pcb.pcb_szpt
	movl	r11,PCB_R11(r1)			# r11 obtained from CP on boot
	movab	1f,PCB_PC(r1)			# initial pc
	clrl	PCB_PSL(r1)			# kernel mode, ipl=0


	shll	$PGSHIFT,r3,r3
	mtpr	r3,$PCBB			# first pcbb (physical)
/* go to kernel mode */


	ldpctx
	rei					# Actually next instruction:

/* put signal trampoline code in u. area */
1:	movab	sigcode,r0
	movab	_u+PCB_SIGC,r1
	movl	$19,r2


	movblk
/* save reboot flags in global _boothowto */
	movl	r11,_boothowto

/* calculate firstaddr, and call main() */
	movab	_end-SYSTEM+NBPG-1,r0
	shrl	$PGSHIFT,r0,-(sp)
	addl2	$UPAGES+1,(sp)			# first physical unused page
	callf 	$8,_main

/* proc[1] == /etc/init now running here in kernel mode; run icode */
	pushl	$PSL_CURMOD			# User mode PSL
	pushl $0				# PC = 0 (virtual now)
	rei

/*
 * Mask for saving/restoring registers on entry to
 * a user signal handler.  Space for the registers
 * is reserved in sendsig, so beware if you want
 * to change the mask.
 */

#define	SIGREGS	(R0|R1|R2|R3|R4|R5)
	.align	2
	.globl	sigcode



sigcode:
	storer	$SIGREGS,16(sp)	# save volatile registers
	calls	$4*3+4,*12(sp)	# params pushed by sendsig for handler
	loadr	$SIGREGS,4(sp)	# restore volatile registers
	movab	24(sp),fp	# use parameter list set up in sendsig
	kcall	$SYS_sigreturn	# cleanup mask and onsigstack
	halt			# sigreturn does not return!

	.globl	_icode
	.globl	_initflags
	.globl	_szicode
/*
 * Icode is copied out to process 1 to exec /etc/init.

 * If the exec fails, process 1 exits.


 */
	.align	2

_icode:
	pushab	b`argv-l0(pc)
l0:	pushab	b`init-l1(pc)
l1:	pushl	$2
	movab	(sp),fp
	kcall	$SYS_execv
	kcall	$SYS_exit

init:	.asciz	"/etc/init"
	.align	2
_initflags:
	.long	0
argv:	.long	init+5-_icode
	.long	_initflags-_icode
	.long	0
_szicode:

	.long	_szicode-_icode

/*
 * Primitives
 */ 

/*
 * badaddr(addr, len)
 *	see if access addr with a len type instruction causes a machine check
 *	len is length of access (1=byte, 2=short, 4=long)
 *	r0 = 0 means good(exists); r0 =1 means does not exist.
 */

ENTRY(badaddr, R3|R4)

	mfpr	$IPL,r1
	mtpr	$HIGH,$IPL
	movl	_scb+BERVEC,r2
	movl	4(fp),r3
	movl	8(fp),r4
	movab	9f,_scb+BERVEC
	bbc	$0,r4,1f; tstb	(r3)
1:	bbc	$1,r4,1f; tstw	(r3)
1:	bbc	$2,r4,1f; tstl	(r3)
1:	clrl	r0
2:	movl	r2,_scb+BERVEC
	mtpr	r1,$IPL
	ret

	.align	2
9:				# catch buss error (if it comes)
	andl3	4(sp),$ERRCD,r0
	cmpl	r0,$APE
	jneq	1f
	halt			# address parity error
1:	cmpl	r0,$VBE
	jneq	1f
	halt			# Versabus error
1:
	movl	$1,r0		# Anything else = bad address
	movab	8(sp),sp	# discard buss error trash
	movab	2b,(sp)		# new program counter on stack.
	rei


/*
 * badcyaddr(addr)
 *	see if access tape master controller addr causes a bus error
 *	r0 = 0: no error; r0 = 1: timeout error.
 */

ENTRY(badcyaddr, 0)

	mfpr	$IPL,r1
	mtpr	$HIGH,$IPL

	clrl	r2
	movab	2f,nofault
	movob	$-1, *4(fp)
1:	aobleq	$1000, r2, 1b
	clrl	nofault			# made it w/o bus error
	clrl	r0
	jbr	3f
2:	movl	$1,r0
3:	mtpr	r1,$IPL
	ret

/*
 * peek(addr)
 *	fetch word and catch any bus error
 */
ENTRY(peek, 0)
	mfpr	$IPL,r1
	mtpr	$0x18,$IPL	# not reentrant
	movl	4(fp),r2
	movab	1f,nofault
	movw	(r2),r0
	clrl	nofault
	andl2	$0xffff,r0
	jbr	2f
1:	movl	$-1,r0		# bus error
2:	mtpr	r1,$IPL
	ret

/*
 * poke(addr, val)
 *	write word and catch any bus error

 */
ENTRY(poke, R3)


	mfpr	$IPL,r1
	mtpr	$0x18,$IPL	# not reentrant



	movl	4(fp),r2
	movl	8(fp),r3
	clrl	r0
	movab	1f,nofault
	movw	r3,(r2)
	clrl	nofault
	jbr	2f
1:	movl	$-1,r0		# bus error
2:	mtpr	r1,$IPL
	ret

/*
 * Copy a potentially overlapping block of memory.
 *
 * ovbcopy(src, dst, count)
 *	caddr_t src, dst; unsigned count;
 */
ENTRY(ovbcopy, R3|R4)

	movl	4(fp),r0
	movl	8(fp),r1
	movl	12(fp),r2
	cmpl	r0,r1
	bgtru	1f			# normal forward case
	beql	2f			# equal, nothing to do
	addl2	r2,r0			# may be overlapping
	cmpl	r0,r1
	bgtru	3f
	subl2	r2,r0			# normal forward case
1:
	movblk
2:
	ret
3:
	addl2	r2,r1			# overlapping, must do backwards
	subl3	r0,r1,r3
	movl	r2,r4
	jbr	5f
4:
	subl2	r3,r0
	subl2	r3,r1
	movl	r3,r2
891
892
893
894
895
896
897
898
899


900
901
902
903
904

905



906



907





















908






































































909








910





911



912
913

914
915
916
917
918
919
920
921

922
923
924
925
926

927
928
929
930
931
932
933
934
935
936




937

938
939
940
941
942
943
944
945

946
947
948
949
950

951
952
953
954
955
956
957
958
959








960
















961



962
963







964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
	movl	r4,r2
	subl2	r2,r0
	subl2	r2,r1
	movblk
	ret

/*
 * bzero (base, count)
 * zero out a block starting at 'base', size 'count'.


 */
_bzero:	
	.globl	_bzero
	.word	0x4
	movl	$1f,r0				# r0 = null source string

	movl	4(fp),r1			# r1 = destination address



	movl	8(fp),r2			# r2 = count



	movs3





















	ret






































































1:








	.byte 0










_copyin:	.globl	_copyin		# the _Copyin subroutine in VAX

					# became _copyin procedure for TAHOE
	.word	0x0004
	movl	12(fp),r0		# copy length
	blss	ersb
	movl	4(fp),r1		# copy user address
	cmpl	$NBPG,r0		# probing one page or less ?
	bgeq	cishort			# yes
ciloop:

	prober	$1,(r1),$NBPG		# bytes accessible ?
	beql	ersb			# no
	addl2	$NBPG,r1		# incr user address ptr
	_ACBL	($NBPG+1,$-NBPG,r0,ciloop)	# reduce count and loop
cishort:

	prober	$1,(r1),r0		# bytes accessible ?
	beql	ersb			# no
	MOVC3	(12(fp),4(fp),8(fp))
	clrl	r0
	ret

ersb:
	movl	$EFAULT,r0
	ret





_copyout:	.globl	_copyout	# the _Copyout subroutine in VAX

					# became _copyout procedure for TAHOE
	.word	0x04
	movl	12(fp),r0		# get count
	blss	ersb
	movl	8(fp),r1		# get user address
	cmpl	$NBPG,r0		# can do in one probew?
	bgeq	coshort			# yes
coloop:

	probew	$1,(r1),$NBPG		# bytes accessible?
	beql	ersb			# no 
	addl2	$NBPG,r1		# increment user address
	_ACBL	($NBPG+1,$-NBPG,r0,coloop)	# reduce count and loop
coshort:

	probew	$1,(r1),r0		# bytes accessible?
	beql	ersb			# no
	MOVC3	(12(fp),4(fp),8(fp))
	clrl	r0
	ret

/*
 * non-local goto's
 */








	.globl	_setjmp			# the _Setjmp subroutine in VAX
















					# became _setjmp procedure for TAHOE



_setjmp:
	.word	0x0







	movl	4(fp),r2
	storer	$0x1ff8,(r2)
	addl2	$40,r2
	movl	(fp),(r2)
	addl2	$4,r2
	movab	8(fp),(r2)
	addl2	$4,r2
	movl	-8(fp),(r2)
	clrl	r0
	ret

	.globl	_longjmp		# the _Longjmp subroutine in VAX
					# became _longjmp procedure for TAHOE
_longjmp:
	.word	0x0000
	movl	4(fp),r2
_Longjmp:			# called from swtch
	loadr	$0x3ff8,(r2)
	addl2	$44,r2
	movl	(r2),r1
	addl2	$4,r2
	movab	(sp),r0
	cmpl	r1,r0				# must be a pop
	bgequ	lj2
	pushab	lj1
	callf	$8,_panic
lj2:
	movl	r1,sp
	jmp	*(r2)

lj1:	.asciz	"longjmp"


	.globl	_whichqs
	.globl	_qs
	.globl	_cnt

	.globl	_noproc
	.comm	_noproc,4
	.globl	_runrun
	.comm	_runrun,4

/*
 * The following primitives use the fancy TAHOE instructions.
 * _whichqs tells which of the 32 queues _qs
 * have processes in them.  setrq puts processes into queues, remrq
 * removes them from queues.  The running process is on no queue,
 * other processes are on a queue related to p->p_pri, divided by 4
 * actually to shrink the 0-127 range of priorities into the 32 available
 * queues.
 */

/*
 * setrq(p), using fancy TAHOE instructions.
 *
 * Call should be made at spl8(), and p->p_stat should be SRUN
 */
	.globl	_setrq
_setrq:
	.word	0x4
	movl	4(fp),r0
	tstl	P_RLINK(r0)		## firewall: p->p_rlink must be 0
	beql	set1			##
	pushab	set3			##
	callf	$8,_panic		##
set1:
	movzbl	P_PRI(r0),r1		# put on queue which is p->p_pri / 4







|
|
>
>

<
<
|
|
>
|
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
|
>
>
>
>
>

>
>
>
|
|
>
|
<

|

|
|
<
>
|
|
|
|
<
>

|
|


|
<



>
>
>
>
|
>
|
<

|

|
|
<
>
|
|
|
|
<
>

|
|






>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
|
>
>
>
>
>
>
>

|
<
|
<
|
<
|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<









<















<
|
<







900
901
902
903
904
905
906
907
908
909
910
911


912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038

1039
1040
1041
1042
1043

1044
1045
1046
1047
1048

1049
1050
1051
1052
1053
1054
1055

1056
1057
1058
1059
1060
1061
1062
1063
1064
1065

1066
1067
1068
1069
1070

1071
1072
1073
1074
1075

1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125

1126

1127

1128
1129
1130






















1131
1132
1133
1134
1135
1136
1137
1138
1139

1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154

1155

1156
1157
1158
1159
1160
1161
1162
	movl	r4,r2
	subl2	r2,r0
	subl2	r2,r1
	movblk
	ret

/*
 * Copy a null terminated string from the user address space into
 * the kernel address space.
 *
 * copyinstr(fromaddr, toaddr, maxlength, &lencopied)
 */


ENTRY(copyinstr, R3|R4|R5)
	movl	12(fp),r5		# r5 = max length
	jlss	8f
	movl	4(fp),r0		# r0 = user address
	movl	r0,r3			# r3 = copy of src for null byte test
	andl3	$(NBPG*CLSIZE-1),r0,r2	# r2 = bytes on first page
	subl3	r2,$(NBPG*CLSIZE),r2
	movl	8(fp),r1		# r1 = kernel address
1:
	cmpl	r5,r2			# r2 = min(bytes on page, length left);
	jgeq	2f
	movl	r5,r2
2:
	prober	$1,(r0),r2		# bytes accessible?
	jeql	8f
	subl2	r2,r5			# update bytes left count
	addl2	r2,r3			# calculate src+count
	movs3				# copy in next piece
	subl3	r0,r3,r2		# null byte found?
	jneq	3f
	movl	$(NBPG*CLSIZE),r2	# check next page
	tstl	r5			# run out of space?
	jneq	1b
	movl	$ENOENT,r0		# set error code and return
	jbr	9f
3:
	tstl	16(fp)			# return length?
	beql	4f
	subl3	r5,12(fp),r5		# actual len = maxlen - unused pages
	subl2	r2,r5			#	- unused on this page
	addl3	$1,r5,*16(fp)		#	+ the null byte
4:
	clrl	r0
	ret
8:
	movl	$EFAULT,r0
9:
	tstl	16(fp)
	beql	1f
	subl3	r5,12(fp),*16(fp)
1:
	ret

/*
 * Copy a null terminated string from the kernel
 * address space to the user address space.
 *
 * copyoutstr(fromaddr, toaddr, maxlength, &lencopied)
 */
ENTRY(copyoutstr, R3|R4|R5)
	movl	12(fp),r5		# r5 = max length
	jlss	8b
	movl	4(fp),r0		# r0 = kernel address
	movl	r0,r3			# r3 = copy of src for null byte test
	movl	8(fp),r1		# r1 = user address
	andl3	$(NBPG*CLSIZE-1),r1,r2	# r2 = bytes on first page
	subl3	r2,$(NBPG*CLSIZE),r2
1:
	cmpl	r5,r2			# r2 = min(bytes on page, length left);
	jgeq	2f
	movl	r5,r2
2:
	probew	$1,(r1),r2		# bytes accessible?
	jeql	8b
	subl2	r2,r5			# update bytes left count
	addl2	r2,r3			# calculate src+count
#ifdef notdef
	movs3				# copy out next piece
#else
	tstl	r2
	beql	6f
4:
	movb	(r0),(r1)
	beql	5f
	incl	r0
	incl	r1
	decl	r2
	bneq	4b
	jbr	6f
5:
	incl	r1
	decl	r2
6:
#endif
	subl3	r0,r3,r2		# null byte found?
	jneq	3b
	movl	$(NBPG*CLSIZE),r2	# check next page
	tstl	r5			# run out of space?
	jneq	1b
	movl	$ENOENT,r0		# set error code and return
	jbr	9b

/*
 * Copy a null terminated string from one point to another in
 * the kernel address space.
 *
 * copystr(fromaddr, toaddr, maxlength, &lencopied)
 */
ENTRY(copystr, R3|R4|R5)
	movl	12(fp),r5		# r5 = max length
	jlss	8b
	movl	4(fp),r0		# r0 = src address
	movl	r0,r3			# r3 = copy of src for null byte test
	movl	8(fp),r1		# r1 = dest address
1:
	movzwl	$65535,r2		# r2 = bytes in first chunk
	cmpl	r5,r2			# r2 = min(bytes in chunk, length left);
	jgeq	2f
	movl	r5,r2
2:
	subl2	r2,r5			# update bytes left count
	addl2	r2,r3			# calculate src+count
	movs3				# copy next piece
	subl3	r0,r3,r2		# null byte found?
	jneq	3b
	tstl	r5			# run out of space?
	jneq	1b
	movl	$ENOENT,r0		# set error code and return
	jbr	9b

/*
 * Copy a block of data from the user address space into
 * the kernel address space.
 *
 * copyin(fromaddr, toaddr, count)
 */
ENTRY(copyin, 0)

	movl	12(fp),r0		# copy length
	blss	9f
	movl	4(fp),r1		# copy user address
	cmpl	$(CLSIZE*NBPG),r0	# probing one page or less ?
	bgeq	2f			# yes

1:
	prober	$1,(r1),$(CLSIZE*NBPG)	# bytes accessible ?
	beql	9f			# no
	addl2	$(CLSIZE*NBPG),r1	# incr user address ptr
	_ACBL($(CLSIZE*NBPG+1),$(-CLSIZE*NBPG),r0,1b)	# reduce count and loop

2:
	prober	$1,(r1),r0		# bytes accessible ?
	beql	9f			# no
	MOVC3(4(fp),8(fp),12(fp))
	clrl	r0
	ret
9:

	movl	$EFAULT,r0
	ret

/*
 * Copy a block of data from the kernel 
 * address space to the user address space.
 *
 * copyout(fromaddr, toaddr, count)
 */
ENTRY(copyout, 0)

	movl	12(fp),r0		# get count
	blss	9b
	movl	8(fp),r1		# get user address
	cmpl	$(CLSIZE*NBPG),r0	# can do in one probew?
	bgeq	2f			# yes

1:
	probew	$1,(r1),$(CLSIZE*NBPG)	# bytes accessible?
	beql	9b			# no 
	addl2	$(CLSIZE*NBPG),r1	# increment user address
	_ACBL($(CLSIZE*NBPG+1),$(-CLSIZE*NBPG),r0,1b)	# reduce count and loop

2:
	probew	$1,(r1),r0		# bytes accessible?
	beql	9b			# no
	MOVC3(4(fp),8(fp),12(fp))
	clrl	r0
	ret

/*
 * non-local goto's
 */
#ifdef notdef
ENTRY(setjmp, 0)
	movl	4(fp),r0
	movl	(fp),(r0); addl2 $4,r0		# save fp
	movl	-8(fp),(r0)			# save pc
	clrl	r0
	ret
#endif

ENTRY(longjmp, 0)
	movl	4(fp),r0
	movl	(r0),newfp; addl2 $4,r0		# must save parameters in memory
	movl	(r0),newpc			# as all regs may be clobbered.
1:
	cmpl	fp,newfp			# are we there yet?
	bgequ	2f				# yes
	moval	1b,-8(fp)			# redirect return pc to us!
	ret					# pop next frame
2:
	beql	3f				# did we miss our frame?
	pushab	4f				# yep ?!?
	callf	$8,_panic
3:
	movl	newpc,r0			# all done, just return
	jmp	(r0)				# to setjmp `ret'

	.data
newpc:	.space	4
newfp:	.space	4
4:	.asciz	"longjmp"

/*
 * setjmp that saves all registers as the call frame may not
 * be available to recover them in the usual manner by longjmp.
 * Called before swapping out the u. area, restored by resume()
 * below.
 */
ENTRY(savectx, 0)
	movl	4(fp),r2
	storer	$0x1ff8,(r2); addl2 $40,r2	# r3-r12

	movl	(fp),(r2); addl2 $4,r2		# fp

	movab	8(fp),(r2); addl2 $4,r2		# sp

	movl	-8(fp),(r2)			# pc
	clrl	r0
	ret























	.globl	_whichqs
	.globl	_qs
	.globl	_cnt

	.globl	_noproc
	.comm	_noproc,4
	.globl	_runrun
	.comm	_runrun,4

/*
 * The following primitives use the fancy TAHOE instructions.
 * _whichqs tells which of the 32 queues _qs
 * have processes in them.  setrq puts processes into queues, remrq
 * removes them from queues.  The running process is on no queue,
 * other processes are on a queue related to p->p_pri, divided by 4
 * actually to shrink the 0-127 range of priorities into the 32 available
 * queues.
 */

/*
 * setrq(p), using fancy TAHOE instructions.
 *
 * Call should be made at spl8(), and p->p_stat should be SRUN
 */

ENTRY(setrq, 0)

	movl	4(fp),r0
	tstl	P_RLINK(r0)		## firewall: p->p_rlink must be 0
	beql	set1			##
	pushab	set3			##
	callf	$8,_panic		##
set1:
	movzbl	P_PRI(r0),r1		# put on queue which is p->p_pri / 4
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
set3:	.asciz	"setrq"

/*
 * remrq(p), using fancy TAHOE instructions
 *
 * Call should be made at spl8().
 */
	.globl	_remrq
_remrq:
	.word	0x0
	movl	4(fp),r0
	movzbl	P_PRI(r0),r1
	shar	$2,r1,r1
	bbs	r1,_whichqs,rem1
	pushab	rem3			# it wasn't recorded to be on its q
	callf	$8,_panic
rem1:
	remque	(r0)
	bneq	rem2			# q not empty yet
	shal	r1,$1,r1
	mcoml	r1,r1
	andl2	r1,_whichqs		# mark queue empty
rem2:
	clrl	P_RLINK(r0)		## for firewall checking
	ret

rem3:	.asciz	"remrq"

	.globl __insque
__insque:
	.word 0
	insque	*4(fp), *8(fp)
	ret


	.globl __remque
__remque:
	.word 0
	remque	*4(fp)
	ret

/*
 * Masterpaddr is the p->p_addr of the running process on the master
 * processor.  When a multiprocessor system, the slave processors will have
 * an array of slavepaddr's.
 */
	.globl	_masterpaddr
	.data
_masterpaddr:
	.long	0

	.text
sw0:	.asciz	"swtch"
/*
 * swtch(), using fancy TAHOE instructions
 */
	.globl	_swtch
_swtch:
	.word	0x0
	movl	(fp),fp			# prepare for rei
	movl	(sp),4(sp)		# saved pc
	tstl	(sp)+
	movpsl	4(sp)
	movl	$1,_noproc
	clrl	_runrun
mtpr0:	mtpr	$0,$IPL			# must allow interrupts here







<
|
<


















<
<
<
<
<
<
<
<
<
<
<
<
<







|
<




|

<
|
<







1171
1172
1173
1174
1175
1176
1177

1178

1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196













1197
1198
1199
1200
1201
1202
1203
1204

1205
1206
1207
1208
1209
1210

1211

1212
1213
1214
1215
1216
1217
1218
set3:	.asciz	"setrq"

/*
 * remrq(p), using fancy TAHOE instructions
 *
 * Call should be made at spl8().
 */

ENTRY(remrq, 0)

	movl	4(fp),r0
	movzbl	P_PRI(r0),r1
	shar	$2,r1,r1
	bbs	r1,_whichqs,rem1
	pushab	rem3			# it wasn't recorded to be on its q
	callf	$8,_panic
rem1:
	remque	(r0)
	bneq	rem2			# q not empty yet
	shal	r1,$1,r1
	mcoml	r1,r1
	andl2	r1,_whichqs		# mark queue empty
rem2:
	clrl	P_RLINK(r0)		## for firewall checking
	ret

rem3:	.asciz	"remrq"














/*
 * Masterpaddr is the p->p_addr of the running process on the master
 * processor.  When a multiprocessor system, the slave processors will have
 * an array of slavepaddr's.
 */
	.globl	_masterpaddr
	.data
_masterpaddr: .long	0


	.text
sw0:	.asciz	"swtch"
/*
 * swtch(), using fancy tahoe instructions
 */

ENTRY(swtch, 0)

	movl	(fp),fp			# prepare for rei
	movl	(sp),4(sp)		# saved pc
	tstl	(sp)+
	movpsl	4(sp)
	movl	$1,_noproc
	clrl	_runrun
mtpr0:	mtpr	$0,$IPL			# must allow interrupts here
1125
1126
1127
1128
1129
1130
1131

1132
1133
1134

1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
















1173
1174


1175
1176


1177




1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195

1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
	movzbl	P_STAT(r2),r3		##
	cmpl	$SRUN,r3		##
	bneq	sw1b			##
	clrl	P_RLINK(r2)		##
	movl	*P_ADDR(r2),r0
	movl	r0,_masterpaddr
	shal	$PGSHIFT,r0,r0		# r0 = pcbb(p)

/*	mfpr	$PCBB,r1		# resume of current proc is easy
 *	cmpl	r0,r1
 */	beql	res0

	incl	_cnt+V_SWTCH
	brb	swresume
/* fall into... */

/*
 * global cache key used if cant use proc index as key
 * (e.g. NPROC>=255)
 * otherwise used for temporary storage of key
 */
	.data
	.globl	_globkey
_globkey:
	.long	0
	.globl	_prevpcb
_prevpcb:
	.long	0
	.text
/*
 * resume(pf)
 */
	.globl	_resume
_resume:
	.word	0x0
	shal	$PGSHIFT,4(fp),r0	# r0 = pcbb(p)
	movl	(fp),fp			# prepare for rei
	movl	(sp)+,4(sp)		# saved pc
	tstl	(sp)+
	movpsl	4(sp)
swresume:
	mtpr	$0x18,$IPL			# no interrupts, please
	movl	_CMAP2,_u+PCB_CMAP2	# yech
	REST_ACC			# restore original accumulator
	svpctx
	mtpr	r0,$PCBB
	ldpctx
	movl	_u+PCB_CMAP2,_CMAP2	# yech
	mtpr	$_CADDR2,$TBIS
res0:
















	tstl	_u+PCB_SSWAP
	beql	res1


	movl	_u+PCB_SSWAP,r2
	clrl	_u+PCB_SSWAP


	movab	_Longjmp,(sp)




	clrl	4(sp)			# PSL = kernel mode, IPL=0
res1:
#ifdef GLOBKEY
	aoblss	$256,_globkey,res2	# define new cache key
	mtpr	$0,$PACC		# out of keys, purge all
	mtpr	$0,$PADC
	movl	$1,_globkey
res2:
	mtpr	_globkey,$CCK
#else
res3:
	movzwl	_u+PCB_CKEY,_globkey
	mtpr	_globkey,$CCK
res4:
	movzwl	_u+PCB_DKEY,_globkey
#endif
	mtpr	_globkey,$DCK
	rei


/*
 * {fu,su},{byte,word}
 */
	.globl	_fuiword
	.globl	_fuword
_fuiword:
_fuword:
	.word	0x0
	movl	4(fp), r1
	prober	$1,(r1),$4		# check access
	beql	fserr			# page unreadable
	bitl	$1,r1			# check byte alignment
	bneq	2f			# odd, do byte-word-byte
	bitl	$2,r1			# check word alignment
	bneq	1f			# odd, do in 2 words







>
|
|
|
>


|

<
<
<
<
<
<
<
<
<

|
<




<
|
<
|





|








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
>
>


>
>
|
>
>
>
>
|
|
<
<
|
<
|
<
<
<
<
<
<
<
<
<
<

>




<
<
<
|
<







1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254









1255
1256

1257
1258
1259
1260

1261

1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307


1308

1309










1310
1311
1312
1313
1314
1315



1316

1317
1318
1319
1320
1321
1322
1323
	movzbl	P_STAT(r2),r3		##
	cmpl	$SRUN,r3		##
	bneq	sw1b			##
	clrl	P_RLINK(r2)		##
	movl	*P_ADDR(r2),r0
	movl	r0,_masterpaddr
	shal	$PGSHIFT,r0,r0		# r0 = pcbb(p)
#ifdef notdef
	mfpr	$PCBB,r1		# resume of current proc is easy
	cmpl	r0,r1
	beql	res0
#endif
	incl	_cnt+V_SWTCH
	brb	swresume
	/* fall into... */










	.globl	_prevpcb
_prevpcb: .long	0

	.text
/*
 * resume(pf)
 */

ENTRY(resume, 0)

	shal	$PGSHIFT,4(fp),r0	# r0 = pcbb(pf)
	movl	(fp),fp			# prepare for rei
	movl	(sp)+,4(sp)		# saved pc
	tstl	(sp)+
	movpsl	4(sp)
swresume:
	mtpr	$0x18,$IPL		# no interrupts, please
	movl	_CMAP2,_u+PCB_CMAP2	# yech
	REST_ACC			# restore original accumulator
	svpctx
	mtpr	r0,$PCBB
	ldpctx
	movl	_u+PCB_CMAP2,_CMAP2	# yech
	mtpr	$_CADDR2,$TBIS
res0:
	PUSHR;
	movl	_u+U_PROCP,r2		# r2 = u.u_procp
	tstl	P_CKEY(r2)		# does proc have code key?
	bneq	1f
	callf	$4,_getcodekey		# no, give him one
	movl	r0,P_CKEY(r2)
1:
	movl	_u+U_PROCP,r2		# r2 = u.u_procp
	tstl	P_DKEY(r2)		# does proc have data key?
	bneq	1f
	callf	$4,_getdatakey		# no, give him one
	movl	r0,P_DKEY(r2)
1:
	mtpr	P_CKEY(r2),$CCK		# set code cache key
	mtpr	P_DKEY(r2),$DCK		# set data cache key
	POPR
	tstl	_u+PCB_SSWAP
	bneq	res1
	rei
res1:					# longjmp to saved context
	movl	_u+PCB_SSWAP,r2
	clrl	_u+PCB_SSWAP
	loadr	$0x3ff8,(r2); addl2 $44,r2	# restore r3-r13 (r13=fp)
	movl	(r2),r1; addl2 $4,r2	# fetch previous sp ...
	movab	(sp),r0			# ... and current sp and
	cmpl	r1,r0			# check for credibility,
	bgequ	1f			# if further up stack ...
	pushab 2f; callf $8,_panic	# ... panic
	/*NOTREACHED*/
1:					# sp ok, complete return
	movl	r1,sp			# restore sp


	movl	(r2),(sp)		# return address

	movl	$PSL_PRVMOD,4(sp)	# kernel mode, ipl 0










	rei
2:	.asciz	"ldctx"

/*
 * {fu,su},{byte,word}
 */



ENTRY(fuword, 0)

	movl	4(fp), r1
	prober	$1,(r1),$4		# check access
	beql	fserr			# page unreadable
	bitl	$1,r1			# check byte alignment
	bneq	2f			# odd, do byte-word-byte
	bitl	$2,r1			# check word alignment
	bneq	1f			# odd, do in 2 words
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
	orl2	r2,r1
	orl2	r1,r0
	ret
fserr:
	mnegl	$1,r0
	ret

	.globl	_fuibyte
	.globl	_fubyte
_fuibyte:
_fubyte:
	.word	0x0
	prober	$1,*4(fp),$1
	beql	fserr
	movzbl	*4(fp),r0
	ret

	.globl	_suiword
	.globl	_suword
_suiword:
_suword:
	.word	0x0
	movl	4(fp), r0
	probew	$1,(r0),$4		# check access
	beql	fserr			# page unwritable
	bitl	$1,r0			# check byte alignment
	bneq	1f			# odd byte boundary
	bitl	$2,r0			# check word alignment
	beql	2f			# longword aligned







<
<
<
|
<





<
<
<
|
<







1338
1339
1340
1341
1342
1343
1344



1345

1346
1347
1348
1349
1350



1351

1352
1353
1354
1355
1356
1357
1358
	orl2	r2,r1
	orl2	r1,r0
	ret
fserr:
	mnegl	$1,r0
	ret




ENTRY(fubyte, 0)

	prober	$1,*4(fp),$1
	beql	fserr
	movzbl	*4(fp),r0
	ret




ENTRY(suword, 0)

	movl	4(fp), r0
	probew	$1,(r0),$4		# check access
	beql	fserr			# page unwritable
	bitl	$1,r0			# check byte alignment
	bneq	1f			# odd byte boundary
	bitl	$2,r0			# check word alignment
	beql	2f			# longword aligned
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310


1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356


1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402




















































	jbr	3f
2:
	movl	8(fp),(r0)
3:
	clrl	r0
	ret

	.globl	_suibyte
	.globl	_subyte
_suibyte:
_subyte:
	.word	0x0
	probew	$1,*4(fp),$1
	beql	fserr
	movb	11(fp),*4(fp)
	clrl	r0
	ret

/*
 * Copy 1 relocation unit (NBPG bytes)
 * from user virtual address to physical address
 */
_copyseg: 	.globl	_copyseg
	.word	0x4
	orl3	$PG_V|PG_KW,8(fp),_CMAP2
	mtpr	$_CADDR2,$TBIS	# invalidate entry for copy 
	MOVC3	($NBPG,4(fp),$_CADDR2)
	ret

/*
 * clearseg(physical_page_number);
 *
 * zero out physical memory
 * specified in relocation units (NBPG bytes)
 * This routine was optimized for speed on Tahoe.
 */
_clearseg: 	.globl	_clearseg
	.word	0
	orl3	$PG_V|PG_KW,4(fp),_CMAP1	# Maps to virtual addr CADDR1
	mtpr	$_CADDR1,$TBIS
	movl	$255,r0				# r0 = limit
	clrl	r1				# r1 = index of cleared long
1:
	clrl	_CADDR1[r1]
	aobleq	r0,r1,1b
	ret

/*


 * if ( useracc(address, count, mode) ) ....
 * Check address.
 * Given virtual address, byte count, and rw flag
 * returns 0 on no access.
 * Note : it is assumed that on all calls to this routine,
 *  mode=0 means write access, mode=1 means read access.
 */
_useracc:	.globl	_useracc
	.word	0x4
	movl	$1,r2			# r2 = 'user mode' for probew/probew
probes:
	movl	4(fp),r0		# get va
	movl	8(fp),r1		# count
	tstl	12(fp)			# test for read access ?
	bneq	userar			# yes
	cmpl	$NBPG,r1			# can we do it in one probe ?
	bgeq	uaw2			# yes
uaw1:
	probew	r2,(r0),$NBPG
	beql	uaerr			# no access
	addl2	$NBPG,r0
	_ACBL($NBPG+1,$-NBPG,r1,uaw1)
uaw2:
	probew	r2,(r0),r1
	beql	uaerr
	movl	$1,r0
	ret

userar:
	cmpl	$NBPG,r1
	bgeq	uar2
uar1:
	prober	r2,(r0),$NBPG
	beql	uaerr
	addl2	$NBPG,r0
	_ACBL($NBPG+1,$-NBPG,r1,uar1)
uar2:
	prober	r2,(r0),r1
	beql	uaerr
	movl	$1,r0
	ret
uaerr:
	clrl	r0
	ret

/*


 * if ( kernacc(address, count, mode) ) ....
 * Check address.
 * Given virtual address, byte count, and rw flag
 * returns 0 on no access.
 * Same as useracc routine but checks for kernel access rights.
 */

_kernacc:	.globl	_kernacc
	.word	0x4
	clrl	r2		# r2 = 0 means kernel mode probe.
	jbr	probes		# Dijkstra would get gastric distress here.

/*
 * addupc - increment some histogram counter
 *	in the profiling buffer
 *
 * addupc(pc, prof, counts)
 * long	pc , counts;	Only least significant word of 'counts' is added.
 * struct	uprof *prof;
 * 
 * struct uprof {		# profile arguments 
 * 	short	*r_base;	# buffer base 
 * 	unsigned pr_size;	# buffer size 
 * 	unsigned pr_off;	# pc offset 
 * 	unsigned pr_scale;	# pc scaling 
 * }
 */
	.globl	_addupc
_addupc:
	.word	4
	movl	8(fp),r2	# r2 points to structure
	subl3	8(r2),4(fp),r0	# r0 = PC - lowpc
	jlss	9f		# PC < lowpc , out of range !
	shrl	$1,r0,r0	# the unit is words
	shrl	$1,12(r2),r1	# ditto for scale
	emul	r1,r0,$0,r0
	shrq	$14,r0,r0
	tstl	r0		# too big
	jneq	9f
	cmpl	r1,4(r2)	# Check buffer overflow
	jgequ	9f
	probew	$1,*0(r2)[r1],$2	# counter accessible?
	jeql	9f
	shrl	$1,r1,r1	# make r1 word index
	addw2	14(fp),*0(r2)[r1]
9:	ret



























































<
<
<
|
<










|
<


|



|

|
<
<

|
<










>
>
|
|
<
|
<
|

|
<






|


|

|
|





<

|


|

|
|










>
>
|
|
<
|
|

|
<
<







|
<
|








<
|
<
|
|
|
|
|


|

|



|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1367
1368
1369
1370
1371
1372
1373



1374

1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385

1386
1387
1388
1389
1390
1391
1392
1393
1394


1395
1396

1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410

1411

1412
1413
1414

1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432

1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454

1455
1456
1457
1458


1459
1460
1461
1462
1463
1464
1465
1466

1467
1468
1469
1470
1471
1472
1473
1474
1475

1476

1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
	jbr	3f
2:
	movl	8(fp),(r0)
3:
	clrl	r0
	ret




ENTRY(subyte, 0)

	probew	$1,*4(fp),$1
	beql	fserr
	movb	11(fp),*4(fp)
	clrl	r0
	ret

/*
 * Copy 1 relocation unit (NBPG bytes)
 * from user virtual address to physical address
 */
ENTRY(copyseg, 0)

	orl3	$PG_V|PG_KW,8(fp),_CMAP2
	mtpr	$_CADDR2,$TBIS	# invalidate entry for copy 
	MOVC3(4(fp),$_CADDR2,$NBPG)
	ret

/*
 * Clear a page of memory.  The page frame is specified.
 *
 * clearseg(pf);


 */
ENTRY(clearseg, 0)

	orl3	$PG_V|PG_KW,4(fp),_CMAP1	# Maps to virtual addr CADDR1
	mtpr	$_CADDR1,$TBIS
	movl	$255,r0				# r0 = limit
	clrl	r1				# r1 = index of cleared long
1:
	clrl	_CADDR1[r1]
	aobleq	r0,r1,1b
	ret

/*
 * Check user mode read/write access.
 *
 * useracc(addr, count, mode)
 *	caddr_t addr; int count, mode;

 * mode = 0	write access

 * mode = 1	read access
 */
ENTRY(useracc, 0)

	movl	$1,r2			# r2 = 'user mode' for probew/probew
probes:
	movl	4(fp),r0		# get va
	movl	8(fp),r1		# count
	tstl	12(fp)			# test for read access ?
	bneq	userar			# yes
	cmpl	$(CLSIZE*NBPG),r1	# can we do it in one probe ?
	bgeq	uaw2			# yes
uaw1:
	probew	r2,(r0),$(CLSIZE*NBPG)
	beql	uaerr			# no access
	addl2	$(CLSIZE*NBPG),r0
	_ACBL($(CLSIZE*NBPG+1),$(-CLSIZE*NBPG),r1,uaw1)
uaw2:
	probew	r2,(r0),r1
	beql	uaerr
	movl	$1,r0
	ret

userar:
	cmpl	$(CLSIZE*NBPG),r1
	bgeq	uar2
uar1:
	prober	r2,(r0),$(CLSIZE*NBPG)
	beql	uaerr
	addl2	$(CLSIZE*NBPG),r0
	_ACBL($(CLSIZE*NBPG+1),$(-CLSIZE*NBPG),r1,uar1)
uar2:
	prober	r2,(r0),r1
	beql	uaerr
	movl	$1,r0
	ret
uaerr:
	clrl	r0
	ret

/*
 * Check kernel mode read/write access.
 *
 * kernacc(addr, count, mode)
 *	caddr_t addr; int count, mode;

 * mode = 0	write access
 * mode = 1	read access
 */
ENTRY(kernacc, 0)


	clrl	r2		# r2 = 0 means kernel mode probe.
	jbr	probes		# Dijkstra would get gastric distress here.

/*
 * addupc - increment some histogram counter
 *	in the profiling buffer
 *
 * addupc(pc, prof, delta)

 *	long pc; short delta; struct uprof *prof;
 * 
 * struct uprof {		# profile arguments 
 * 	short	*r_base;	# buffer base 
 * 	unsigned pr_size;	# buffer size 
 * 	unsigned pr_off;	# pc offset 
 * 	unsigned pr_scale;	# pc scaling 
 * }
 */

ENTRY(addupc, 0)

	movl	8(fp),r2		# r2 points to structure
	subl3	8(r2),4(fp),r0		# r0 = PC - lowpc
	jlss	9f			# PC < lowpc , out of range !
	shrl	$1,r0,r0		# the unit is words
	shrl	$1,12(r2),r1		# ditto for scale
	emul	r1,r0,$0,r0
	shrq	$14,r0,r0
	tstl	r0			# too big
	jneq	9f
	cmpl	r1,4(r2)		# Check buffer overflow
	jgequ	9f
	probew	$1,*0(r2)[r1],$2	# counter accessible?
	jeql	9f
	shrl	$1,r1,r1		# make r1 word index
	addw2	14(fp),*0(r2)[r1]
9:	ret

/*
 * scanc(size, cp, table, mask)
 */
ENTRY(scanc, R3|R4)
	movl	8(fp),r0		# r0 = cp
	addl3	4(fp),r0,r2		# end = &cp[size]
	movl	12(fp),r1		# r1 = table
	movb	19(fp),r4		# r4 = mask
	decl	r0			# --cp
	jbr	0f			# just like Fortran...
1:					# do {
	movzbl	(r0),r3	
	bitb	r4,(r1)[r3]		#	if (table[*cp] & mask)
	jneq	2f			#		break;
0:	aoblss	r2,r0,1b		# } while (++cp < end);
2:
	subl3	r0,r2,r0; ret		# return (end - cp);

/*
 * skpc(mask, size, cp)
 */
ENTRY(skpc, 0)
	movl	12(fp),r0		# r0 = cp
	addl3	8(fp),r0,r1		# r1 = end = &cp[size];
	movb	7(fp),r2		# r2 = mask
	decl	r0			# --cp;
	jbr	0f
1:					# do
	cmpb	(r0),r2			#	if (*cp != mask)
	jneq	2f			#		break;
0:	aoblss	r1,r0,1b		# while (++cp < end);
2:
	subl3	r0,r1,r0; ret		# return (end - cp);

#ifdef notdef
/*
 * locc(mask, size, cp)
 */
ENTRY(locc, 0)
	movl	12(fp),r0		# r0 = cp
	addl3	8(fp),r0,r1		# r1 = end = &cp[size]
	movb	7(fp),r2		# r2 = mask
	decl	r0			# --cp;
	jbr	0f
1:					# do
	cmpb	(r0),r2			#	if (*cp == mask)
	jeql	2f			#		break;
0:	aoblss	r1,r0,1b		# while (++cp < end);
2:
	subl3	r0,r1,r0; ret		# return (end - cp);
#endif

Changes to sys/tahoe/tahoe/machdep.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49


50

51




52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83































84
85

86
87
88
89
90



91

92
93
94
95
96
97
98
99
100
101
102
103
104
105

106
107



















108

109


110





111


112







113


114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*	machdep.c	1.4	85/05/15	*/

#include "../machine/reg.h"
#include "../machine/pte.h"
#include "../machine/psl.h"

#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/nami.h"
#include "../h/kernel.h"
#include "../h/map.h"
#include "../h/vm.h"
#include "../h/proc.h"
#include "../h/buf.h"
#include "../h/reboot.h"
#include "../h/conf.h"
#include "../h/inode.h"
#include "../h/file.h"
#include "../h/text.h"
#include "../h/clist.h"
#include "../h/callout.h"
#include "../h/cmap.h"
#include "../h/mbuf.h"
#include "../h/msgbuf.h"
#include "../h/quota.h"
#include "../tahoe/mem.h"
#include "../tahoe/mtpr.h"
#include "../tahoe/cp.h"
#include "../vba/vbavar.h"

int	icode[] = {
	0xf9af19f9,	/*	pushab	argp */
	0xaf09dd02,	/*	pushab	file */
	0xe96e5dcf,	/*	pushl	$2 */
	0x0b11fe2f,	/*	movab	(sp),fp */
	0x6574632f,	/*	kcall	$exec */
	0x696e6974,	/* here:brb	here */
	0x00000000,	/*.file:.ascii	"/etc/" */
	0x00000014,	/* args:.ascii	"init\0" */
	0x00000000,	/*	.align	2 */
			/* argp:.long	args, 0 */
};
int	szicode = sizeof(icode);
 
/*
 * Declare these as initialized data so we can patch them.
 */


int	nbuf = 0;

int	nswbuf = 0;




int	bufpages = 0;


/*
 * Machine-dependent startup code
 */
startup(firstaddr)
	int firstaddr;
{
	register int unixsize;
	register unsigned i;
	register struct pte *pte;
	register int mapaddr, j;
	register caddr_t v;
	register int maxbufs, base, residual;
	extern char etext;

	/*
	 * Initialize error message buffer (at end of core).
	 */
	maxmem -= btoc(sizeof (struct msgbuf));
	pte = msgbufmap;
	for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
		*(int *)pte++ = PG_V | PG_KW | (maxmem + i);
	mtpr(1,TBIA);

	/*
	 * Good {morning,afternoon,evening,night}.
	 */
	printf(version);
	printf("real mem  = %d\n", ctob(maxmem));
	
	/*































	 * Determine how many buffers to allocate.
	 * Use 10% of memory, with min of 16.

	 * We allocate 1/2 as many swap buffer headers as file i/o buffers.
	 */
	maxbufs = ((SYSPTSIZE * NBPG) - (5 * (int)(&etext - 0xc0000000))) /
	    MAXBSIZE;
	if (bufpages == 0)



		bufpages = (physmem * NBPG) / 10 / CLBYTES;

	if (nbuf == 0) {
		nbuf = bufpages / 2;
		if (nbuf < 16)
			nbuf = 16;
		if (nbuf > maxbufs)
			nbuf = maxbufs;
	}
	if (bufpages > nbuf * (MAXBSIZE / CLBYTES))
		bufpages = nbuf * (MAXBSIZE / CLBYTES);
	if (nswbuf == 0) {
		nswbuf = (nbuf / 2) &~ 1;	/* force even */
		if (nswbuf > 256)
			nswbuf = 256;		/* sanity */
	}


	/*



















	 * Allocate space for system data structures.

	 * The first available real memory address is in "firstaddr".


	 * As pages of memory are allocated, "firstaddr" is incremented.





	 * The first available kernel virtual address is in "v".


	 * As pages of kernel virtual memory are allocated, "v" is incremented.







	 * An index into the kernel page table corresponding to the


	 * virtual memory address maintained in "v" is kept in "mapaddr".
	 */
	mapaddr = firstaddr;
	v = (caddr_t)(0xc0000000 | (firstaddr * NBPG));
#define	valloc(name, type, num) \
	    (name) = (type *)(v); (v) = (caddr_t)((name)+(num))
#define	valloclim(name, type, num, lim) \
	    (name) = (type *)(v); (v) = (caddr_t)((lim) = ((name)+(num)))
	valloc(buffers, char, MAXBSIZE * nbuf);
	base = bufpages / nbuf;
	residual = bufpages % nbuf;

	for (i = 0; i < residual; i++) {
		for (j = 0; j < (base + 1) * CLSIZE; j++) {
			*(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
			clearseg((unsigned)firstaddr);
			firstaddr++;
		}
		mapaddr += MAXBSIZE / NBPG;
	}
	for (i = residual; i < nbuf; i++) {
		for (j = 0; j < base * CLSIZE; j++) {
			*(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
			clearseg((unsigned)firstaddr);
			firstaddr++;
		}
		mapaddr += MAXBSIZE / NBPG;
	}
	valloc(buf, struct buf, nbuf);
	valloc(swbuf, struct buf, nswbuf);
	valloclim(inode, struct inode, ninode, inodeNINODE);
	valloclim(file, struct file, nfile, fileNFILE);
	valloclim(proc, struct proc, nproc, procNPROC);
	valloclim(text, struct text, ntext, textNTEXT);
	valloc(cfree, struct cblock, nclist);
	valloc(callout, struct callout, ncallout);
	valloc(swapmap, struct map, nswapmap = nproc * 2);
	valloc(argmap, struct map, ARGMAPSIZE);
	valloc(kernelmap, struct map, nproc);
	valloc(mbmap, struct map, nmbclusters/4);
	valloc(nch, struct nch, nchsize);
#ifdef QUOTA
	valloclim(quota, struct quota, nquota, quotaNQUOTA);
	valloclim(dquot, struct dquot, ndquot, dquotNDQUOT);
#endif
	/*
	 * Now allocate space for core map
	 * Allow space for all of phsical memory minus the amount 
	 * dedicated to the system. The amount of physical memory
	 * dedicated to the system is the total virtual memory of
	 * the system minus the space in the buffers which is not
	 * allocated real memory.
	 */
	ncmap = (physmem*NBPG - ((int)v &~ 0xc0000000) +
		(nbuf * MAXBSIZE - bufpages * CLBYTES)) /
		    (NBPG*CLSIZE + sizeof (struct cmap));
	valloclim(cmap, struct cmap, ncmap, ecmap);
	if ((((int)(ecmap+1))&~0xc0000000) > SYSPTSIZE*NBPG)
		panic("sys pt too small");

	/*
	 * Clear allocated space, and make r/w entries
	 * for the space in the kernel map.
	 */
	unixsize = btoc((int)(ecmap+1) &~ 0xc0000000);
	for (i = mapaddr; i < unixsize; i++) {
		*(int *)(&Sysmap[i]) = PG_V | PG_KW | firstaddr;
		clearseg((unsigned)firstaddr);
		firstaddr++;
	}
	if (firstaddr >= physmem - 8*UPAGES)
		panic("no memory");
	mtpr(1,TBIA);

	/*
	 * Initialize callouts
	 */
	callfree = callout;
	for (i = 1; i < ncallout; i++)
		callout[i-1].c_next = &callout[i];
|

|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|



|

<
<
<
<
<
<
<
<
<
<
<
<
<
<



>
>
|
>
|
>
>
>
>

>










|

|









|





|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
>


<
<

>
>
>
|
>




<
<

<
<





>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
|
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
|
>
>
|

<
|
<
<
<
<



>
















<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
|
<
<
<
<
<


|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32














33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113


114
115
116
117
118
119
120
121
122
123


124


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

179




180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199































200




201





202
203
204
205
206
207
208
209
210
211
/*	machdep.c	1.2	86/01/05	*/

#include "../tahoe/reg.h"
#include "../tahoe/pte.h"
#include "../tahoe/psl.h"

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "kernel.h"
#include "map.h"
#include "vm.h"
#include "proc.h"
#include "buf.h"
#include "reboot.h"
#include "conf.h"
#include "inode.h"
#include "file.h"
#include "text.h"
#include "clist.h"
#include "callout.h"
#include "cmap.h"
#include "mbuf.h"
#include "msgbuf.h"
#include "quota.h"

#include "../tahoe/mem.h"
#include "../tahoe/mtpr.h"
#include "../tahoe/cp.h"
#include "../tahoevba/vbavar.h"















/*
 * Declare these as initialized data so we can patch them.
 */
int	nswbuf = 0;
#ifdef	NBUF
int	nbuf = NBUF;
#else
int	nbuf = 0;
#endif
#ifdef	BUFPAGES
int	bufpages = BUFPAGES;
#else
int	bufpages = 0;
#endif

/*
 * Machine-dependent startup code
 */
startup(firstaddr)
	int firstaddr;
{
	register int unixsize;
	register unsigned i;
	register struct pte *pte;
	int mapaddr, j;
	register caddr_t v;
	int maxbufs, base, residual;
	extern char etext;

	/*
	 * Initialize error message buffer (at end of core).
	 */
	maxmem -= btoc(sizeof (struct msgbuf));
	pte = msgbufmap;
	for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
		*(int *)pte++ = PG_V | PG_KW | (maxmem + i);
	mtpr(TBIA, 1);

	/*
	 * Good {morning,afternoon,evening,night}.
	 */
	printf(version);
	printf("real mem  = %d\n", ctob(physmem));

	/*
	 * Allocate space for system data structures.
	 * The first available real memory address is in "firstaddr".
	 * The first available kernel virtual address is in "v".
	 * As pages of kernel virtual memory are allocated, "v" is incremented.
	 * As pages of memory are allocated and cleared,
	 * "firstaddr" is incremented.
	 * An index into the kernel page table corresponding to the
	 * virtual memory address maintained in "v" is kept in "mapaddr".
	 */
	v = (caddr_t)(0xc0000000 | (firstaddr * NBPG));
#define	valloc(name, type, num) \
	    (name) = (type *)v; v = (caddr_t)((name)+(num))
#define	valloclim(name, type, num, lim) \
	    (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
	valloclim(inode, struct inode, ninode, inodeNINODE);
	valloclim(file, struct file, nfile, fileNFILE);
	valloclim(proc, struct proc, nproc, procNPROC);
	valloclim(text, struct text, ntext, textNTEXT);
	valloc(cfree, struct cblock, nclist);
	valloc(callout, struct callout, ncallout);
	valloc(swapmap, struct map, nswapmap = nproc * 2);
	valloc(argmap, struct map, ARGMAPSIZE);
	valloc(kernelmap, struct map, nproc);
	valloc(mbmap, struct map, nmbclusters/4);
	valloc(nch, struct nch, nchsize);
#ifdef QUOTA
	valloclim(quota, struct quota, nquota, quotaNQUOTA);
	valloclim(dquot, struct dquot, ndquot, dquotNDQUOT);
#endif
	
	/*
	 * Determine how many buffers to allocate.
	 * Use 10% of memory for the first 2 Meg, 5% of the remaining
	 * memory. Insure a minimum of 16 buffers.
	 * We allocate 1/2 as many swap buffer headers as file i/o buffers.
	 */


	if (bufpages == 0)
		if (physmem < (2 * 1024 * 1024))
			bufpages = physmem / 10 / CLSIZE;
		else
			bufpages =
			    ((2 * 1024 * 1024) / 5 + physmem / 5) / CLSIZE;
	if (nbuf == 0) {
		nbuf = bufpages / 2;
		if (nbuf < 16)
			nbuf = 16;


	}


	if (nswbuf == 0) {
		nswbuf = (nbuf / 2) &~ 1;	/* force even */
		if (nswbuf > 256)
			nswbuf = 256;		/* sanity */
	}
	valloc(swbuf, struct buf, nswbuf);

	/*
	 * Now the amount of virtual memory remaining for buffers
	 * can be calculated, estimating needs for the cmap.
	 */
	ncmap = (maxmem*NBPG - ((int)v &~ 0xc0000000)) /
		(CLBYTES + sizeof(struct cmap)) + 2;
	maxbufs = ((SYSPTSIZE * NBPG) -
	    ((int)(v + ncmap * sizeof(struct cmap)) - 0xc0000000)) /
		(MAXBSIZE + sizeof(struct buf));
	if (maxbufs < 16)
		panic("sys pt too small");
	if (nbuf > maxbufs) {
		printf("SYSPTSIZE limits number of buffers to %d\n", maxbufs);
		nbuf = maxbufs;
	}
	if (bufpages > nbuf * (MAXBSIZE / CLBYTES))
		bufpages = nbuf * (MAXBSIZE / CLBYTES);
	valloc(buf, struct buf, nbuf);

	/*
	 * Allocate space for core map.
	 * Allow space for all of phsical memory minus the amount 
	 * dedicated to the system. The amount of physical memory
	 * dedicated to the system is the total virtual memory of
	 * the system thus far, plus core map, buffer pages,
	 * and buffer headers not yet allocated.
	 * Add 2: 1 because the 0th entry is unused, 1 for rounding.
	 */
	ncmap = (maxmem*NBPG - ((int)(v + bufpages*CLBYTES) &~ 0xc0000000)) /
		(CLBYTES + sizeof(struct cmap)) + 2;
	valloclim(cmap, struct cmap, ncmap, ecmap);

	/*
	 * Clear space allocated thus far, and make r/w entries
	 * for the space in the kernel map.
	 */
	unixsize = btoc((int)v &~ 0xc0000000);
	while (firstaddr < unixsize) {
		*(int *)(&Sysmap[firstaddr]) = PG_V | PG_KW | firstaddr;
		clearseg((unsigned)firstaddr);
		firstaddr++;
	}

	/*
	 * Now allocate buffers proper.  They are different than the above
	 * in that they usually occupy more virtual memory than physical.
	 */

	v = (caddr_t) ((int)(v + PGOFSET) &~ PGOFSET);




	valloc(buffers, char, MAXBSIZE * nbuf);
	base = bufpages / nbuf;
	residual = bufpages % nbuf;
	mapaddr = firstaddr;
	for (i = 0; i < residual; i++) {
		for (j = 0; j < (base + 1) * CLSIZE; j++) {
			*(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
			clearseg((unsigned)firstaddr);
			firstaddr++;
		}
		mapaddr += MAXBSIZE / NBPG;
	}
	for (i = residual; i < nbuf; i++) {
		for (j = 0; j < base * CLSIZE; j++) {
			*(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
			clearseg((unsigned)firstaddr);
			firstaddr++;
		}
		mapaddr += MAXBSIZE / NBPG;
	}




































	unixsize = btoc((int)v &~ 0xc0000000);





	if (firstaddr >= physmem - 8*UPAGES)
		panic("no memory");
	mtpr(TBIA, 1);			/* After we just cleared it all! */

	/*
	 * Initialize callouts
	 */
	callfree = callout;
	for (i = 1; i < ncallout; i++)
		callout[i-1].c_next = &callout[i];
204
205
206
207
208
209
210

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

226
227
228

229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260


261




262
263
264
265

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282


283
284

285
286

287
288
289
290
291
292
293
294




295
296
297
298
299
300
301
302
303
304
305
306
307
308

309
310

311

312
313
314
315

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339













340



















341



342
343
344
345

346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363

364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403

404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465

466
467
468
469
470
471
472
473
474
475
476
477
478
479
480

481
482
483
484
485
486
487
	printf("using %d buffers containing %d bytes of memory\n",
		nbuf, bufpages * CLBYTES);
	rminit(kernelmap, (long)USRPTSIZE, (long)1,
	    "usrpt", nproc);
	rminit(mbmap, (long)((nmbclusters - 1) * CLSIZE), (long)CLSIZE,
	    "mbclusters", nmbclusters/4);
	intenable = 1;		/* Enable interrupts from now on */

	/*
	 * Configure the system.
	 */
	configure();
}

#ifdef PGINPROF
/*
 * Return the difference (in microseconds)
 * between the  current time and a previous
 * time as represented  by the arguments.
 * If there is a pending clock interrupt
 * which has not been serviced due to high
 * ipl, return error code.
 */

vmtime(otime, olbolt, oicr)
	register int otime, olbolt, oicr;
{

	return(((time.tv_sec-otime)*60 + lbolt-olbolt)*16667);
}
#endif

/*
 * Send an interrupt to process.
 *
 * Stack is set up to allow sigcode stored
 * in u. to call routine, followed by chmk
 * to sigcleanup routine below.  After sigcleanup
 * resets the signal mask and the stack, it
 * returns to user who then unwinds with the
 * rei at the bottom of sigcode.
 */
sendsig(p, sig, mask)
	int (*p)(), sig, mask;
{
	register struct sigcontext *scp;	/* know to be r12 */
	register int *regs;
	register struct sigframe {
		int	sf_signum;
		int	sf_code;
		struct	sigcontext *sf_scp;
		int	(*sf_handler)();
		int	r1;
		int 	r0;
		struct	sigcontext *sf_scpcopy;
	} *fp;					/* known to be r10 */
	int oonstack;

	regs = u.u_ar0;
	oonstack = u.u_onstack;


	scp = (struct sigcontext *)regs[SP] - 1;




	if (!u.u_onstack && (u.u_sigonstack & sigmask(sig))) {
		fp = (struct sigframe *)u.u_sigsp - 1;
		u.u_onstack = 1;
	} else

		fp = (struct sigframe *)scp - 1;
	/*
	 * Must build signal handler context on stack to be returned to
	 * so that rei instruction in sigcode will pop ps and pc
	 * off correct stack.  The remainder of the signal state
	 * used in calling the handler must be placed on the stack
	 * on which the handler is to operate so that the calls
	 * in sigcode will save the registers and such correctly.
	 */
	if (!oonstack && (int)fp <= USRSTACK - ctob(u.u_ssize)) 
		grow((unsigned)fp);
	;
#ifndef lint
	asm("probew $1,(r10),$7*4");
	asm("jeql bad");
#else
	if (useracc((caddr_t)fp, sizeof (struct sigframe), 1))


		goto bad;
#endif

	if (!u.u_onstack && (int)scp <= USRSTACK - ctob(u.u_ssize))
		grow((unsigned)scp);

	;			/* Avoid asm() label botch */
#ifndef lint
	asm("probew $1,(r12),$5*4");
	asm("beql bad");
#else
	if (useracc((caddr_t)scp, sizeof (struct sigcontext), 1))
		goto bad;
#endif




	fp->sf_signum = sig;
	if (sig == SIGILL || sig == SIGFPE) {
		fp->sf_code = u.u_code;
		u.u_code = 0;
	} else
		fp->sf_code = 0;
	fp->sf_scp = scp;
	fp->sf_handler = p;
	fp->r1 = regs[R1];	/* These are not saved by the C compiler */
	fp->r0 = regs[R0];
	/*
	 * Duplicate the pointer to the sigcontext structure.
	 * This one doesn't get popped by the ret, and is used 
	 * by sigcleanup to reset the signal state on inward return.

	 */
	fp->sf_scpcopy = scp;

	/* sigcontext goes on previous stack */

	scp->sc_onstack = oonstack;
	scp->sc_mask = mask;
	/* setup rei */
	scp->sc_sp = (int)&scp->sc_pc;

	scp->sc_pc = regs[PC];
	scp->sc_ps = regs[PS];
	regs[SP] = (int)fp;
	regs[PC] = (int)u.u_pcb.pcb_sigc;
	return;

asm("bad:");
bad:
	/*
	 * Process has trashed its stack; give it an illegal
	 * instruction to halt it in its tracks.
	 */
	u.u_signal[SIGILL] = SIG_DFL;
	sig = sigmask(SIGILL);
	u.u_procp->p_sigignore &= ~sig;
	u.u_procp->p_sigcatch &= ~sig;
	u.u_procp->p_sigmask &= ~sig;
	psignal(u.u_procp, SIGILL);
}

/*
 * Routine to cleanup state after a signal
 * has been taken.  Reset signal mask and
 * stack state from context left by sendsig (above).













 * Pop these values in preparation for rei which



















 * follows return from this routine.



 */
sigcleanup()
{
	register struct sigcontext *scp;	/* known as R12 */


	scp = (struct sigcontext *)fuword((caddr_t)u.u_ar0[SP]);
	if ((int)scp == -1)
		return;
#ifndef lint
	;			/* Avoid asm() label botch */
	/* only probe 12 here because that's all we need */
	asm("prober $1,(r12),$12");
	asm("bnequ 1f; ret; 1:");
#else
	if (useracc((caddr_t)scp, sizeof (*scp), 0))
		return;
#endif
	u.u_onstack = scp->sc_onstack & 01;
	u.u_procp->p_sigmask =
	   scp->sc_mask &~ (sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
	u.u_ar0[SP] = scp->sc_sp;
}


int	waittime = -1;

boot(paniced, arghowto)
	int paniced, arghowto;
{
	register long dummy;
	register int howto;		/* r11 == how to boot */
	register int devtype;		/* r10 == major of root dev */

#ifdef lint
	howto = 0; devtype = 0;
	printf("howto %d, devtype %d\n", arghowto, devtype);
#endif
	(void) spl1();
	howto = arghowto;
	if ((howto&RB_NOSYNC)==0 && waittime < 0 && bfreelist[0].b_forw) {
		waittime = 0;
		update();
		printf("syncing disks... ");
#ifdef notdef
		DELAY(10000000);
#else
		{ register struct buf *bp;
		  int iter, nbusy, oldnbusy;

		  printf ("\tBlocks to sync : ");
		  oldnbusy = 0;
		  for (iter = 0; /* iter < 20 */; iter++) {
			DELAY(1000);
			nbusy = 0;
			for (bp = &buf[nbuf]; --bp >= buf; )
				if ((bp->b_flags & (B_BUSY|B_INVAL)) == B_BUSY)
					nbusy++;
			if (nbusy == 0)
				break;
			if (nbusy != oldnbusy) {
				printf("%d ", nbusy);
				oldnbusy = nbusy;
			}

			if (iter >= 100) {
				printf (" - disk I/O stopped (?), giving up\n");
				DELAY(10000);
				break;
			}
		  }
		}
#endif
		printf("done\n\n");
	}
	splx(0x1f);			/* extreme priority */
	devtype = major(rootdev);
	if (howto&RB_HALT) {
		printf("halting (in tight loop); hit ~h\n\n");
		mtpr(0x1f,IPL);
		for (;;)
			;
	} else {
		if (paniced == RB_PANIC) {
			doadump();		/* TXDB_BOOT's itsself */
			/*NOTREACHED*/
		}
		tocons(CPBOOT);
	}
	for (;;)
		asm("halt");
	/*NOTREACHED*/
}




/*
 * Send the given comand ('c') to the console processor.
 * Assumed to be one of the last things the OS does before
 *  halting or rebooting.
 */

struct cphdr *lasthdr;	/* Available in "dev/cons.c" */

struct	cpdcb_o cpcontrol;

tocons(command)
int command;
{

	int timeout;

	cpcontrol.cp_hdr.cp_unit = CPUNIT;
	cpcontrol.cp_hdr.cp_comm =  (char) command;
	if (command != CPBOOT) 
		cpcontrol.cp_hdr.cp_count = 1;	/* Just for sanity */
	else {
		cpcontrol.cp_hdr.cp_count = 4;
		*(int *)cpcontrol.cp_buf = 0;	/* r11 value for reboot */
	}
	timeout = 100000;				/* Delay loop */
	while (timeout-- && !(lasthdr->cp_unit & CPDONE))
		uncache(&lasthdr->cp_unit);
					/* Give up, force it to listen */
	mtpr ( vtoph(0, &cpcontrol), CPMDCB);
}


/*
 * Invalidate single all pte's in a cluster
 */
tbiscl(v)
	unsigned v;
{
	register caddr_t addr;		/* must be first reg var */
	register int i;

	addr = ptob(v);
	for (i = 0; i < CLSIZE; i++) {
		mtpr(addr, TBIS);
		addr += NBPG;
	}
}


int	dumpmag = 0x8fca0101;	/* magic number for savecore */
int	dumpsize = 0;		/* also for savecore */
/*
 * Doadump comes here after turning off memory management and
 * getting on the dump stack, either when called above, or by
 * the auto-restart code.







>















>



>
|







|
|
|
|
|




|






|
<

|




>
>
|
>
>
>
>

|


>
|
<
<
<
<
<
<
<
<
|

<
<
<
<
<
|
>
>
|
<
>
|
|
>
|
<
|
<
<
|
<
|
>
>
>
>








<
<

<
<
<
>


>
|
>


<
|
>




<
<
<
<
<
<
<
<
<
<
<
<
<
<



|


>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>

|

|
>

|


<
<
<
<
<
<
|

<

|
|
|

>






|




|




|



<
<
<



<

|











>
|
|
<
<
|
<
<
<
|

|



|














|
>






<
<
<
<
<
|
<

<



|
|






|

|
|


>











|



>







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294








295
296





297
298
299
300

301
302
303
304
305

306


307

308
309
310
311
312
313
314
315
316
317
318
319
320


321



322
323
324
325
326
327
328
329

330
331
332
333
334
335














336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387






388
389

390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415



416
417
418

419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434


435



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464





465

466

467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
	printf("using %d buffers containing %d bytes of memory\n",
		nbuf, bufpages * CLBYTES);
	rminit(kernelmap, (long)USRPTSIZE, (long)1,
	    "usrpt", nproc);
	rminit(mbmap, (long)((nmbclusters - 1) * CLSIZE), (long)CLSIZE,
	    "mbclusters", nmbclusters/4);
	intenable = 1;		/* Enable interrupts from now on */

	/*
	 * Configure the system.
	 */
	configure();
}

#ifdef PGINPROF
/*
 * Return the difference (in microseconds)
 * between the  current time and a previous
 * time as represented  by the arguments.
 * If there is a pending clock interrupt
 * which has not been serviced due to high
 * ipl, return error code.
 */
/*ARGSUSED*/
vmtime(otime, olbolt, oicr)
	register int otime, olbolt, oicr;
{

	return (((time.tv_sec-otime)*60 + lbolt-olbolt)*16667);
}
#endif

/*
 * Send an interrupt to process.
 *
 * Stack is set up to allow sigcode stored
 * in u. to call routine, followed by kcall
 * to sigreturn routine below.  After sigreturn
 * resets the signal mask, the stack, and the
 * frame pointer, it returns to the user
 * specified pc, psl.
 */
sendsig(p, sig, mask)
	int (*p)(), sig, mask;
{
	register struct sigcontext *scp;
	register int *regs;
	register struct sigframe {
		int	sf_signum;
		int	sf_code;
		struct	sigcontext *sf_scp;
		int	(*sf_handler)();
		int	sf_regs[6];		/* r0-r5 */

		struct	sigcontext *sf_scpcopy;
	} *fp;
	int oonstack;

	regs = u.u_ar0;
	oonstack = u.u_onstack;
	/*
	 * Allocate and validate space for the signal handler
	 * context. Note that if the stack is in P0 space, the
	 * call to grow() is a nop, and the useracc() check
	 * will fail if the process has not already allocated
	 * the space with a `brk'.
	 */
	if (!u.u_onstack && (u.u_sigonstack & sigmask(sig))) {
		scp = (struct sigcontext *)u.u_sigsp - 1;
		u.u_onstack = 1;
	} else
		scp = (struct sigcontext *)regs[SP] - 1;
	fp = (struct sigframe *)scp - 1;








	if ((int)fp <= USRSTACK - ctob(u.u_ssize)) 
		grow((unsigned)fp);





	if (useracc((caddr_t)fp, sizeof (*fp) + sizeof (*scp), 1) == 0) {
		/*
		 * Process has trashed its stack; give it an illegal
		 * instruction to halt it in its tracks.

		 */
		u.u_signal[SIGILL] = SIG_DFL;
		sig = sigmask(SIGILL);
		u.u_procp->p_sigignore &= ~sig;
		u.u_procp->p_sigcatch &= ~sig;

		u.u_procp->p_sigmask &= ~sig;


		psignal(u.u_procp, SIGILL);

		return;
	}
	/* 
	 * Build the argument list for the signal handler.
	 */
	fp->sf_signum = sig;
	if (sig == SIGILL || sig == SIGFPE) {
		fp->sf_code = u.u_code;
		u.u_code = 0;
	} else
		fp->sf_code = 0;
	fp->sf_scp = scp;
	fp->sf_handler = p;


	/*



	 * Build the callf argument frame to be used to call sigreturn.
	 */
	fp->sf_scpcopy = scp;
	/*
	 * Build the signal context to be used by sigreturn.
	 */
	scp->sc_onstack = oonstack;
	scp->sc_mask = mask;

	scp->sc_sp = regs[SP];
	scp->sc_fp = regs[FP];
	scp->sc_pc = regs[PC];
	scp->sc_ps = regs[PS];
	regs[SP] = (int)fp;
	regs[PC] = (int)u.u_pcb.pcb_sigc;














}

/*
 * System call to cleanup state after a signal
 * has been taken.  Reset signal mask and
 * stack state from context left by sendsig (above).
 * Return to previous pc and psl as specified by
 * context left by sendsig. Check carefully to
 * make sure that the user has not modified the
 * psl to gain improper priviledges or to cause
 * a machine fault.
 */
sigreturn()
{
	struct a {
		struct sigcontext *sigcntxp;
	};
	register struct sigcontext *scp;
	register int *regs = u.u_ar0;

	scp = ((struct a *)(u.u_ap))->sigcntxp;
	if (useracc((caddr_t)scp, sizeof (*scp), 0) == 0) {
		u.u_error = EINVAL;
		return;
	}
	if ((scp->sc_ps & (PSL_MBZ|PSL_IPL|PSL_IS)) != 0 ||
	    (scp->sc_ps & (PSL_PRVMOD|PSL_CURMOD)) != (PSL_PRVMOD|PSL_CURMOD)) {
		u.u_error = EINVAL;
		return;
	}
	u.u_eosys = JUSTRETURN;
	u.u_onstack = scp->sc_onstack & 01;
	u.u_procp->p_sigmask = scp->sc_mask &~
	    (sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
	regs[FP] = scp->sc_fp;
	regs[SP] = scp->sc_sp;
	regs[PC] = scp->sc_pc;
	regs[PS] = scp->sc_ps;
}

/* XXX - BEGIN 4.2 COMPATIBILITY */
/*
 * Compatibility with 4.2 kcall $139 used by longjmp()
 */
osigcleanup()
{
	register struct sigcontext *scp;
	register int *regs = u.u_ar0;

	scp = (struct sigcontext *)fuword((caddr_t)regs[SP]);
	if ((int)scp == -1)
		return;






	if (useracc((caddr_t)scp, 3 * sizeof (int), 0) == 0)
		return;

	u.u_onstack = scp->sc_onstack & 01;
	u.u_procp->p_sigmask = scp->sc_mask &~
	    (sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
	regs[SP] = scp->sc_sp;
}
/* XXX - END 4.2 COMPATIBILITY */

int	waittime = -1;

boot(paniced, arghowto)
	int paniced, arghowto;
{
	register long dummy;		/* r12 is reserved */
	register int howto;		/* r11 == how to boot */
	register int devtype;		/* r10 == major of root dev */

#ifdef lint
	howto = 0; devtype = 0; dummy = 0; dummy = dummy;
	printf("howto %d, devtype %d\n", arghowto, devtype);
#endif
	(void) spl1();
	howto = arghowto;
	if ((howto&RB_NOSYNC) == 0 && waittime < 0 && bfreelist[0].b_forw) {
		waittime = 0;
		update();
		printf("syncing disks... ");



		{ register struct buf *bp;
		  int iter, nbusy, oldnbusy;


		  oldnbusy = 0;
		  for (iter = 0; iter < 1000; iter++) {
			DELAY(1000);
			nbusy = 0;
			for (bp = &buf[nbuf]; --bp >= buf; )
				if ((bp->b_flags & (B_BUSY|B_INVAL)) == B_BUSY)
					nbusy++;
			if (nbusy == 0)
				break;
			if (nbusy != oldnbusy) {
				printf("%d ", nbusy);
				oldnbusy = nbusy;
			}
		  }
		  if (iter >= 1000 && nbusy)
			printf("- i/o timeout, giving up...");


		}



		printf("done\n");
	}
	mtpr(IPL, 0x1f);			/* extreme priority */
	devtype = major(rootdev);
	if (howto&RB_HALT) {
		printf("halting (in tight loop); hit ~h\n\n");
		mtpr(IPL, 0x1f);
		for (;;)
			;
	} else {
		if (paniced == RB_PANIC) {
			doadump();		/* TXDB_BOOT's itsself */
			/*NOTREACHED*/
		}
		tocons(CPBOOT);
	}
	for (;;)
		asm("halt");
	/*NOTREACHED*/
}

struct	cphdr *lasthdr;		/* defined in cons.c */
struct	cpdcb_o cpcontrol;

/*
 * Send the given comand ('c') to the console processor.
 * Assumed to be one of the last things the OS does before
 *  halting or rebooting.
 */





tocons(c)

{

	int timeout;

	cpcontrol.cp_hdr.cp_unit = CPUNIT;
	cpcontrol.cp_hdr.cp_comm =  (char)c;
	if (c != CPBOOT) 
		cpcontrol.cp_hdr.cp_count = 1;	/* Just for sanity */
	else {
		cpcontrol.cp_hdr.cp_count = 4;
		*(int *)cpcontrol.cp_buf = 0;	/* r11 value for reboot */
	}
	timeout = 100000;				/* Delay loop */
	while (timeout-- && (lasthdr->cp_unit&CPDONE) == 0)
		uncache(&lasthdr->cp_unit);
	/* give up, force it to listen */
	mtpr(CPMDCB, vtoph((struct proc *)0, (unsigned)&cpcontrol));
}

#if CLSIZE != 1
/*
 * Invalidate single all pte's in a cluster
 */
tbiscl(v)
	unsigned v;
{
	register caddr_t addr;		/* must be first reg var */
	register int i;

	addr = ptob(v);
	for (i = 0; i < CLSIZE; i++) {
		mtpr(TBIS, addr);
		addr += NBPG;
	}
}
#endif

int	dumpmag = 0x8fca0101;	/* magic number for savecore */
int	dumpsize = 0;		/* also for savecore */
/*
 * Doadump comes here after turning off memory management and
 * getting on the dump stack, either when called above, or by
 * the auto-restart code.
514
515
516
517
518
519
520
521

522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542











543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566

567
568

569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603

604
605
606
607
608
609
610
611
612
613
614
615


616
617


618
619
		printf("i/o error\n");
		break;

	default:
		printf("succeeded\n");
		break;
	}
	printf("Rebooting the system ...\n\n");

	tocons(CPBOOT);
}


/*
 * Bus error 'recovery' code.
 * Print out the buss frame and then give up.
 * (More information from special registers can be printed here.)
 * 
 */

/*
 * Frame for bus error
 */
struct buserframe {
	int	which_bus;		/* primary or secondary */
	int	memerreg;		/* memory error register */
	int	trp_pc;			/* trapped pc */
	int	trp_psl;		/* trapped psl */
};












buserror(busef)
	caddr_t busef;
{
	register struct buserframe *frameptr;
	register long 	hardreg;


	frameptr = (struct buserframe *)busef;
	printf("bus error at address %x, psl = %x\n",
		frameptr->trp_pc,frameptr->trp_psl);
	hardreg =  frameptr->memerreg;
	printf("\tMEAR = %x\n",((hardreg&MEAR)>>16)&0xffff);
	switch (hardreg & ERRCD){
		case (APE): 	printf("\tAdress parity error.Should not reach this point!! \n");
				break;
		case (DPE): 	printf("\tData parity error.\n");
				break;
		case (DCE):	printf("\tData check error.\n");
				break;
		case (VTO):	printf("\tVersabus timeout.\n");
				break;
		case (VBE):	printf("\tVersabus error.Should not reach this point!! \n");
				break;
		case (NEM):	printf("\tNon existent memory.\n");

				break;
		default:	printf("\tUnknown error code: %x\n",

					hardreg&ERRCD);
	}
	if (hardreg&AXE) printf("\tAdapter external error\n");
	printf ("\tError master : ");
	if (hardreg&ERM) printf("Versabus\n");
	else printf ("Tahoe\n");
	if (hardreg&IVV)
		printf("\tIllegal interrupt vector, from ipl %d\n",
		    (hardreg >> 2) & 7);

	hardreg = frameptr->which_bus;
	printf("\tMCBR = %x\n", ((hardreg&MCBR)>>16)&0xffff);
	printf("\tVersabus type : %x\n", hardreg&0xffc3);
	if (frameptr->memerreg&IVV) return;
	panic("buserror");
}


physstrat(bp, strat, prio)
	struct buf *bp;
	int (*strat)(), prio;
{
	int s;

	(*strat)(bp);
	/* pageout daemon doesn't wait for pushed pages */
	if (bp->b_flags & B_DIRTY)
		return;
	s = spl8();
	while ((bp->b_flags & B_DONE) == 0)
		sleep((caddr_t)bp, prio);
	splx(s);
}



/*ARGSUSED*/
mtpr (value, regno)
{
	asm("mtpr 4(fp), 8(fp)");
}

/*ARGSUSED*/
int
mfpr (regno)
{
	asm("mfpr 4(fp),r0");
#ifdef lint


	return(0);
#endif


}








|
>


<





<












>
>
>
>
>
>
>
>
>
>
>
|
|

|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
>
|
|
>
|
<
|
|
<
<
|
|
|
|
<
|
<
|
|

<

















|
>
|
|
<
|
<
|
<
<
<
|
<
|
>
>
|

>
>

<
534
535
536
537
538
539
540
541
542
543
544

545
546
547
548
549

550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
















578

579
580
581
582
583
584

585
586


587
588
589
590

591

592
593
594

595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615

616

617



618

619
620
621
622
623
624
625
626

		printf("i/o error\n");
		break;

	default:
		printf("succeeded\n");
		break;
	}
	printf("\n\n");
	DELAY(1000);
	tocons(CPBOOT);
}


/*
 * Bus error 'recovery' code.
 * Print out the buss frame and then give up.
 * (More information from special registers can be printed here.)

 */

/*
 * Frame for bus error
 */
struct buserframe {
	int	which_bus;		/* primary or secondary */
	int	memerreg;		/* memory error register */
	int	trp_pc;			/* trapped pc */
	int	trp_psl;		/* trapped psl */
};

char	*mem_errcd[8] = {
	"Unknown error code 0",
	"Address parity error",		/* APE */
	"Data parity error",		/* DPE */
	"Data check error",		/* DCE */
	"Versabus timeout",		/* VTO */
	"Versabus error",		/* VBE */
	"Non-existent memory",		/* NEM */
	"Unknown error code 7",
};

buserror(v)
	caddr_t v;
{
	register struct buserframe *busef = (struct buserframe *)v;
	register long reg;


















	printf("bus error, address %x, psl %x\n",
	    busef->trp_pc, busef->trp_psl);
	reg =  busef->memerreg;
	printf("mear %x %s\n",
	    ((reg&MEAR)>>16)&0xffff, mem_errcd[reg & ERRCD]);
	if (reg&AXE)

		printf("adapter external error\n");
	printf("error master: %s\n", reg&ERM ? "versabus" : "tahoe");


	if (reg&IVV)
		printf("illegal interrupt vector from ipl %d\n", (reg>>2)&7);
	reg = busef->which_bus;
	printf("mcbr %x versabus type %x\n",

	    ((reg&MCBR)>>16)&0xffff, reg & 0xffc3);

	if ((busef->memerreg&IVV) == 0)
		panic("buserror");
}


physstrat(bp, strat, prio)
	struct buf *bp;
	int (*strat)(), prio;
{
	int s;

	(*strat)(bp);
	/* pageout daemon doesn't wait for pushed pages */
	if (bp->b_flags & B_DIRTY)
		return;
	s = spl8();
	while ((bp->b_flags & B_DONE) == 0)
		sleep((caddr_t)bp, prio);
	splx(s);
}

/*
 * Clear registers on exec
 */
setregs(entry)

	u_long entry;

{





#ifdef notdef
	/* should pass args to init on the stack */
	for (rp = &u.u_ar0[0]; rp < &u.u_ar0[16];)
		*rp++ = 0;
#endif
	u.u_ar0[FP] = 0;	/* bottom of the fp chain */
	u.u_ar0[PC] = entry + 2;
}

Changes to sys/tahoe/tahoe/mem.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*	mem.c	1.1	85/07/21	*/

/*
 * Memory special file
 */

#include "../machine/pte.h"

#include "../h/param.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/conf.h"
#include "../h/buf.h"
#include "../h/systm.h"
#include "../h/vm.h"
#include "../h/cmap.h"
#include "../h/uio.h"

#include "../machine/mtpr.h"

mmread(dev, uio)
	dev_t dev;
	struct uio *uio;
{

	return (mmrw(dev, uio, UIO_READ));
|

















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*	mem.c	1.2	86/01/05	*/

/*
 * Memory special file
 */

#include "../machine/pte.h"

#include "../h/param.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/conf.h"
#include "../h/buf.h"
#include "../h/systm.h"
#include "../h/vm.h"
#include "../h/cmap.h"
#include "../h/uio.h"

#include "../tahoe/mtpr.h"

mmread(dev, uio)
	dev_t dev;
	struct uio *uio;
{

	return (mmrw(dev, uio, UIO_READ));
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* minor device 0 is physical memory */
		case 0:
			v = btop(uio->uio_offset);
			if (v >= physmem)
				goto fault;
			*(int *)mmap = v | PG_V |
				(rw == UIO_READ ? PG_KR : PG_KW);
			mtpr(vmmap, TBIS);
			o = (int)uio->uio_offset & PGOFSET;
			c = min((u_int)(NBPG - o), (u_int)iov->iov_len);
			c = min(c, (u_int)(NBPG - ((int)iov->iov_base&PGOFSET)));
			error = uiomove((caddr_t)&vmmap[o], (int)c, rw, uio);
			continue;

/* minor device 1 is kernel memory */







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* minor device 0 is physical memory */
		case 0:
			v = btop(uio->uio_offset);
			if (v >= physmem)
				goto fault;
			*(int *)mmap = v | PG_V |
				(rw == UIO_READ ? PG_KR : PG_KW);
			mtpr(TBIS, vmmap);
			o = (int)uio->uio_offset & PGOFSET;
			c = min((u_int)(NBPG - o), (u_int)iov->iov_len);
			c = min(c, (u_int)(NBPG - ((int)iov->iov_base&PGOFSET)));
			error = uiomove((caddr_t)&vmmap[o], (int)c, rw, uio);
			continue;

/* minor device 1 is kernel memory */

Added sys/tahoe/tahoe/mem.h.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*	mem.h	1.1	86/01/05	*/

/*
 * Memory controller registers
 *
 */


/*
 * Some bits definition for MCR
 */

#define	EED	0x01		/* Enable error detection */
#define	EEC	0x02		/* Enable error correction */
#define	WMD	0x04		/* Write memory diagnostic */
#define	RMD	0x08		/* Read memory diagnostic */
#define	INT	0x20		/* Init = power on bit */
#define	CEC	0x40		/* Clear error count */
#define	CME	0x80		/* Clear memory error */
#define	CMEC	0xff00		/* Corrected memory error count (mask) */

/* shifts to get the values of MCR fields. */
 
#define	EECSHFT		0x01		/* Enable error correction */
#define	WMDSHFT		0x02		/* Write memory diagnostic */
#define	RMDSHFT		0x03		/* Read memory diagnostic */
#define	INTSHFT		0x05		/* Init = power on bit */
#define	CECSHFT		0x06		/* Clear error count */
#define	CMESHFT		0x07		/* Clear memory error */
#define	CMECSHFT	0x08		/* Corrected memory error count (mask) */
/*
 * MER bits
 */

#define	ERRCD	0x07		/* Error code (mask) */
#define    APE	1	/* Address parity error */
#define    DPE	2	/* Data parity error */
#define    DCE	3	/* Data check error */
#define    VTO	4	/* Versabus timeout */
#define    VBE	5	/* Versabus error */
#define    NEM	6	/* Non-existent memory */

#define	AXE	0x08		/* Adapter external error */
#define	ERM	0x10		/* Error master (0=CPU, 1=Versabus) */
#define	IVV	0x100		/* Illegal Versabus vector */

/*
 * MCBR bits
 */

#define	MCBR	0xffff0000
#define	MEAR	0xffff0000

Added sys/tahoe/tahoe/rpb.h.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*	rpb.h	1.1	86/01/05	*/

/*
 * The restart parameter block, which is a page in (very) low
 * core which runs after a crash.  Currently, the restart
 * procedure takes a dump.
 */
struct rpb {
	struct	rpb *rp_selfref;	/* self-reference */
	int	(*rp_dumprout)();	/* routine to be called */
	long	rp_checksum;		/* checksum of 31 words of dumprout */
	long	rp_flag;		/* set to 1 when dumprout runs */
/* the dump stack grows from the end of the rpb page not to reach here */
};
#ifdef KERNEL
extern	struct rpb rpb;
#endif

Added sys/tahoe/tahoe/scb.h.





















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*	scb.h	1.1	86/01/05	*/

/*
 * System control block.
 */
struct	scb {
	int	(*scb_vec0)();		/* 000: reserved */
	int	(*scb_powfail)();	/* 004: power failure */
	int	(*scb_doadump)();	/* 008: power restore */
	int	(*scb_vec3)();		/* 00c: reserved */
	int	(*scb_vec4)();		/* 010: reserved */
	int	(*scb_vec5)();		/* 014: reserved */
	int	(*scb_vec6)();		/* 018: reserved */
	int	(*scb_hardclock)();	/* 01c: interval timer (clock) */
	int	(*scb_vec8)();		/* 020: reserved */
	int	(*scb_vec9)();		/* 024: reserved */
	int	(*scb_cnrint)();	/* 028: console receive */
	int	(*scb_cnxint)();	/* 02c: console transmit */
	int	(*scb_rmtrint)();	/* 030: remote line receive */
	int	(*scb_rmtxint)();	/* 034: remote line transmit */
	int	(*scb_vec14)();		/* 038: reserved */
	int	(*scb_vec15)();		/* 03c: reserved */
	int	(*scb_softint[15])();	/* 040: software ints (ipl 1f-1) */
	int	(*scb_vec31)();		/* 07c: reserved */
	int	(*scb_buserr)();	/* 080: bus error */
	int	(*scb_vec33)();		/* 084: reserved */
	int	(*scb_vec34)();		/* 088: reserved */
	int	(*scb_vec35)();		/* 08c: reserved */
	int	(*scb_vec36)();		/* 090: reserved */
	int	(*scb_vec37)();		/* 094: reserved */
	int	(*scb_vec38)();		/* 098: reserved */
	int	(*scb_vec39)();		/* 09c: reserved */
	int	(*scb_vec40)();		/* 0a0: reserved */
	int	(*scb_vec41)();		/* 0a4: reserved */
	int	(*scb_vec42)();		/* 0a8: reserved */
	int	(*scb_syscall)();	/* 0ac: system call (kcall) */
	int	(*scb_privinflt)();	/* 0b0: privileged/reserved inst */ 
	int	(*scb_respoflt)();	/* 0b4: reserved operand */
	int	(*scb_resadflt)();	/* 0b8: reserved addressing mode */
	int	(*scb_protflt)();	/* 0bc: access control violation */
	int	(*scb_transflt)();	/* 0c0: translation not valid */
	int	(*scb_kspnotval)();	/* 0c4: kernel stack invalid */
	int	(*scb_tracep)();	/* 0c8: trace trap */
	int	(*scb_bptflt)();	/* 0cc: breakpoint */
	int	(*scb_arithtrap)();	/* 0d0: arithmetic exception */
	int	(*scb_alignflt)();	/* 0d4: alignment fault */
	int	(*scb_sfexcep)();	/* 0d8: system forced exception */
	int	(*scb_fpm)();		/* 0dc: floating point emulation */
	int	(*scb_vec56)();		/* 0e0: reserved */
	int	(*scb_vec57)();		/* 0e4: reserved */
	int	(*scb_vec58)();		/* 0e8: reserved */
	int	(*scb_vec59)();		/* 0ec: reserved */
	int	(*scb_vec60)();		/* 0f0: reserved */
	int	(*scb_vec61)();		/* 0f4: reserved */
	int	(*scb_vec62)();		/* 0f8: reserved */
	int	(*scb_vec63)();		/* 0fc: reserved */
	int	(*scb_devint[192])();	/* 100: device vectors */
};

Added sys/tahoe/tahoe/scb.s.



































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*	scb.s	1.1	86/01/05	*/
/*	scb.s	TAHOE 4.2 version 84/03/1	*/

/*
 * System control block
 */


#define	_Xnull	0
#define	STRAY	.long	_Xstray
#define	STRAY8	STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY
#define	STRAY15	STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY8
#define	KS(a)	.long	_X/**/a
#define	IS(a)	.long	_X/**/a

_scb:	.globl	_scb
/* 000 */	STRAY;		IS(powfail);	IS(doadump);	STRAY;
/* 004 */	STRAY;		STRAY;		STRAY;		IS(hardclock);
/* 008 */	STRAY;		STRAY;		IS(cnrint);	IS(cnxint);
/* 00c */	IS(rmtrint);	IS(rmtxint);	STRAY;		STRAY;
/* 010 */	IS(soft15);	IS(soft14);	IS(soft13);	IS(netintr);
/* 014 */	IS(soft11);	IS(soft10);	IS(soft9);	IS(softclock);
/* 018 */	IS(soft7); 	IS(soft6);	IS(soft5);	IS(soft4);
/* 01c */	IS(soft3);	IS(soft2);	IS(soft1);	STRAY;
/* 020 */	IS(buserr);	STRAY;		STRAY;		STRAY;
/* 024 */	STRAY;		STRAY;		STRAY;		STRAY;
/* 028 */	STRAY;		STRAY;		STRAY;		KS(syscall);
/* 02c */	KS(privinflt);	KS(resopflt);	KS(resadflt);	KS(protflt);
/* 030 */	KS(transflt);	IS(kspnotval);	KS(tracep);	KS(bptflt);
/* 034 */	KS(arithtrap);	KS(alignflt);	KS(sfexcep);	KS(fpm);
/* 038 */	STRAY;		STRAY;		STRAY;		STRAY;
/* 03c */	STRAY;		STRAY;		STRAY;		STRAY;
#include "vx.h"
#if NVX > 0
/* 040 */	IS(vackint0);	IS(vcmdrsp0);	IS(vunsol0);	STRAY;
#else
/* 040 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 1
/* 044 */	IS(vackint1);	IS(vcmdrsp1);	IS(vunsol1);	STRAY;
#else
/* 044 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 2
/* 048 */	IS(vackint2);	IS(vcmdrsp2);	IS(vunsol2);	STRAY;
#else
/* 048 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 3
/* 04c */	IS(vackint3);	IS(vcmdrsp3);	IS(vunsol3);	STRAY;
#else
/* 04c */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 4
/* 050 */	IS(vackint4);	IS(vcmdrsp4);	IS(vunsol4);	STRAY;
#else
/* 050 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 5
/* 054 */	IS(vackint5);	IS(vcmdrsp5);	IS(vunsol5);	STRAY;
#else
/* 054 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 6
/* 058 */	IS(vackint6);	IS(vcmdrsp6);	IS(vunsol6);	STRAY;
#else
/* 058 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 7
/* 05c */	IS(vackint7);	IS(vcmdrsp7);	IS(vunsol7);	STRAY;
#else
/* 05c */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 8
/* 060 */	IS(vackint8);	IS(vcmdrsp8);	IS(vunsol8);	STRAY;
#else
/* 060 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 9
/* 064 */	IS(vackint9);	IS(vcmdrsp9);	IS(vunsol9);	STRAY;
#else
/* 064 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 10
/* 068 */	IS(vackint10);	IS(vcmdrsp10);	IS(vunsol10);	STRAY;
#else
/* 068 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
#if NVX > 11
/* 06c */	IS(vackint11);	IS(vcmdrsp11);	IS(vunsol11);	STRAY;
#else
/* 06c */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
/* 070 */	STRAY;		STRAY15;
#include "cy.h"
#if NCY > 0
/* 080 */	IS(cyintr0);	STRAY15;
#else
/* 080 */	STRAY;		STRAY15;
#endif
#include "ace.h"
#if NACE > 0
/* 090 */	IS(acecint0);	IS(acerint0);	STRAY;		STRAY;
#else
/* 090 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
/* 094 */	STRAY;		STRAY;		STRAY;		STRAY;	
#if NACE > 1
/* 098 */	IS(acecint1);	IS(acerint1);	STRAY;		STRAY;
#else
/* 098 */	STRAY;		STRAY;		STRAY;		STRAY;
#endif
/* 09c */	STRAY;		STRAY;		STRAY;		STRAY;	
/* 0a0 */	STRAY;		STRAY15;
/* 0b0 */	STRAY;		STRAY15;
/* 0c0 */	STRAY;		STRAY15;
/* 0d0 */	STRAY;		STRAY15;
#include "fsd.h"
#if NVD > 0
/* 0e0 */	IS(vdintr0);
#else
/* 0e0 */	STRAY;
#endif
#if NVD > 1
/* 0e4 */	IS(vdintr1);
#else
/* 0e4 */	STRAY;
#endif
#if NVD > 2
/* 0e8 */	IS(vdintr2);
#else
/* 0e8 */	STRAY;
#endif
#if NVD > 3
/* 0ec */	IS(vdintr3);	
#else
/* 0ec */	STRAY;	
#endif

/* 0e4 */	STRAY;		STRAY;		STRAY;		STRAY;	
/* 0e8 */	STRAY8;
/* 0f0 */	STRAY;		STRAY;		STRAY;		STRAY;	
/* 0f4 */	STRAY;		STRAY;		STRAY;		STRAY;	
/* 0f8 */	STRAY;		STRAY;		STRAY;		STRAY;	
/* 0fC */	STRAY;		STRAY;		STRAY;		STRAY;

Changes to sys/tahoe/tahoe/swapgeneric.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*	swapgeneric.c	1.1	85/07/21	*/

#include "../machine/pte.h"

#include "../h/param.h"
#include "../h/conf.h"
#include "../h/buf.h"
#include "../h/vm.h"
#include "../h/systm.h"
#include "../h/reboot.h"

#include "../machine/cp.h"
#include "../machine/mtpr.h"
#include "../vba/vbavar.h"

/*
 * Generic configuration;  all in one
 */
dev_t	rootdev, argdev, dumpdev;
int	nswap;
struct	swdevt swdevt[] = {
|



|
|
|
|
|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*	swapgeneric.c	1.2	86/01/05	*/

#include "../machine/pte.h"

#include "param.h"
#include "conf.h"
#include "buf.h"
#include "vm.h"
#include "systm.h"
#include "reboot.h"

#include "../tahoe/cp.h"
#include "../tahoe/mtpr.h"
#include "../tahoevba/vbavar.h"

/*
 * Generic configuration;  all in one
 */
dev_t	rootdev, argdev, dumpdev;
int	nswap;
struct	swdevt swdevt[] = {
31
32
33
34
35
36
37

38
39
40
41
42
43
44
	caddr_t	gc_driver;
	char	*gc_name;
	dev_t	gc_root;
} genericconf[] = {
	{ (caddr_t)&vddriver,	"fsd",	makedev(1, 0),	},
	{ (caddr_t)&vddriver,	"smd",	makedev(1, 0),	},
	{ (caddr_t)&vddriver,	"xfd",	makedev(1, 0),	},

	{ 0 },
};

setconf()
{
	register struct vba_device *ui;
	register struct genericconf *gc;







>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	caddr_t	gc_driver;
	char	*gc_name;
	dev_t	gc_root;
} genericconf[] = {
	{ (caddr_t)&vddriver,	"fsd",	makedev(1, 0),	},
	{ (caddr_t)&vddriver,	"smd",	makedev(1, 0),	},
	{ (caddr_t)&vddriver,	"xfd",	makedev(1, 0),	},
	{ (caddr_t)&vddriver,	"xsd",	makedev(1, 0),	},
	{ 0 },
};

setconf()
{
	register struct vba_device *ui;
	register struct genericconf *gc;
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
		}
		if (name[3] >= '0' && name[3] <= '7' && name[4] == 0) {
			unit = name[3] - '0';
			goto found;
		}
		printf("bad/missing unit number\n");
bad:
		printf("use fsd%%d, smd%%d, or xfd%%d\n");
		goto retry;
	}
	unit = 0;
	for (gc = genericconf; gc->gc_driver; gc++) {
		for (ui = vbdinit; ui->ui_driver; ui++) {
			if (ui->ui_alive == 0)
				continue;







|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
		}
		if (name[3] >= '0' && name[3] <= '7' && name[4] == 0) {
			unit = name[3] - '0';
			goto found;
		}
		printf("bad/missing unit number\n");
bad:
		printf("use fsd%%d, smd%%d, xfd%%d, or xsd%%d\n");
		goto retry;
	}
	unit = 0;
	for (gc = genericconf; gc->gc_driver; gc++) {
		for (ui = vbdinit; ui->ui_driver; ui++) {
			if (ui->ui_alive == 0)
				continue;
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
	/* swap size and dumplo set during autoconfigure */
	if (swaponroot)
		rootdev = dumpdev;
}

getchar()
{
	char	c;
	int timo;
	extern struct	cpdcb_i consin[];
	extern struct	cphdr *lasthdr;
#define cpin consin[CPCONS]

	timo = 10000;
	uncache((char *)&lasthdr->cp_unit);
	while ((lasthdr->cp_unit & CPTAKE)==0 && --timo )
		uncache((char *)&lasthdr->cp_unit);
	cpin.cp_hdr.cp_unit = CPCONS;	/* Resets done bit */
	cpin.cp_hdr.cp_comm = CPREAD;
	cpin.cp_hdr.cp_count = 1;
	mtpr(&cpin, CPMDCB);
	while ((cpin.cp_hdr.cp_unit & CPDONE) == 0) 
		uncache (&cpin.cp_hdr.cp_unit);
	uncache (&cpin.cpi_buf[0]);
	c = cpin.cpi_buf[0] & 0x7f;
	lasthdr = (struct cphdr *)&cpin;
	if (c == '\r')
		c = '\n';
	printf("%c", c);	/* takes care of interrupts & parity */
	return (c);
}







|

|
|




|
|



|

|
|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
	/* swap size and dumplo set during autoconfigure */
	if (swaponroot)
		rootdev = dumpdev;
}

getchar()
{
	char c;
	int timo;
	extern struct cpdcb_i consin[];
	extern struct cphdr *lasthdr;
#define cpin consin[CPCONS]

	timo = 10000;
	uncache((char *)&lasthdr->cp_unit);
	while ((lasthdr->cp_unit&CPTAKE) == 0 && --timo)
		uncache(&lasthdr->cp_unit);
	cpin.cp_hdr.cp_unit = CPCONS;	/* Resets done bit */
	cpin.cp_hdr.cp_comm = CPREAD;
	cpin.cp_hdr.cp_count = 1;
	mtpr(CPMDCB, &cpin);
	while ((cpin.cp_hdr.cp_unit & CPDONE) == 0) 
		uncache(&cpin.cp_hdr.cp_unit);
	uncache(&cpin.cpi_buf[0]);
	c = cpin.cpi_buf[0] & 0x7f;
	lasthdr = (struct cphdr *)&cpin;
	if (c == '\r')
		c = '\n';
	printf("%c", c);	/* takes care of interrupts & parity */
	return (c);
}

Added sys/tahoe/tahoe/symbols.raw.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#	symbols.raw	1.1	86/01/05
	_version
#dmesg
	_msgbuf
#iostat
	_dk_busy
	_dk_time
	_dk_xfer
	_dk_wds
	_tk_nin
	_tk_nout
	_dk_seek
	_cp_time
	_dk_mspw
#	_io_info
#ps
	_proc
	_Usrptmap
	_usrpt
	_text
	_nswap
	_maxslp
	_ccpu
	_ecmx
	_nproc
	_ntext
#pstat
	_inode
	_text
	_proc
#	_dz_tty
#	_dz_cnt
	_cons
	_file
	_Usrptmap
	_usrpt
	_nswap
	_swapmap
#	_dh11
#	_ndh11
#vmstat
	_cp_time
	_rate
	_total
	_deficit
	_forkstat
	_sum
	_firstfree
	_maxfree
#	_rectime
#	_pgintime
	_dk_xfer
	_boottime
#w
	_proc
	_swapdev
	_Usrptmap
	_usrpt
	_nswap
	_avenrun
	_boottime
#netstat
	_mbstat
	_ipstat
	_tcb
	_tcpstat
	_udb
	_udpstat
	_rawcb
	_Sysmap
	_Syssize
	_ifnet
	_rthost
	_rtnet
	_icmpstat
#routed
	_ifnet
#rwho
	_avenrun
	_boottime

Added sys/tahoe/tahoe/sys_machdep.c.









































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*	sys_machdep.c	1.1	86/01/05	*/

#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/ioctl.h"
#include "../h/file.h"
#include "../h/proc.h"
#include "../h/uio.h"
#include "../h/kernel.h"
#include "../h/mtio.h"
#include "../h/buf.h"

#include "../machine/dkio.h"
#include "../machine/pte.h"

#ifdef TRACE
int	nvualarm;

vtrace()
{
	register struct a {
		int	request;
		int	value;
	} *uap;
	int vdoualarm();

	uap = (struct a *)u.u_ap;
	switch (uap->request) {

	case VTR_DISABLE:		/* disable a trace point */
	case VTR_ENABLE:		/* enable a trace point */
		if (uap->value < 0 || uap->value >= TR_NFLAGS)
			u.u_error = EINVAL;
		else {
			u.u_r.r_val1 = traceflags[uap->value];
			traceflags[uap->value] = uap->request;
		}
		break;

	case VTR_VALUE:		/* return a trace point setting */
		if (uap->value < 0 || uap->value >= TR_NFLAGS)
			u.u_error = EINVAL;
		else
			u.u_r.r_val1 = traceflags[uap->value];
		break;

	case VTR_UALARM:	/* set a real-time ualarm, less than 1 min */
		if (uap->value <= 0 || uap->value > 60 * hz ||
		    nvualarm > 5)
			u.u_error = EINVAL;
		else {
			nvualarm++;
			timeout(vdoualarm, (caddr_t)u.u_procp->p_pid,
			    uap->value);
		}
		break;

	case VTR_STAMP:
		trace(TR_STAMP, uap->value, u.u_procp->p_pid);
		break;
	}
}

vdoualarm(arg)
	int arg;
{
	register struct proc *p;

	p = pfind(arg);
	if (p)
		psignal(p, 16);
	nvualarm--;
}
#endif

#ifdef COMPAT
/*
 * Note: these tables are sorted by
 * ioctl "code" (in ascending order).
 */
int dctls[] = { DKIOCHDR, 0 };
int fctls[] = { FIOCLEX, FIONCLEX, FIOASYNC, FIONBIO, FIONREAD, 0 };
int mctls[] = { MTIOCTOP, MTIOCGET, 0 };
int tctls[] = {
	TIOCGETD, TIOCSETD, TIOCHPCL, TIOCMODG, TIOCMODS,
	TIOCGETP, TIOCSETP, TIOCSETN, TIOCEXCL, TIOCNXCL,
	TIOCFLUSH,TIOCSETC, TIOCGETC, TIOCREMOTE,TIOCMGET,
	TIOCMBIC, TIOCMBIS, TIOCMSET, TIOCSTART,TIOCSTOP,
	TIOCPKT,  TIOCNOTTY,TIOCSTI,  TIOCOUTQ, TIOCGLTC,
	TIOCSLTC, TIOCSPGRP,TIOCGPGRP,TIOCCDTR, TIOCSDTR,
	TIOCCBRK, TIOCSBRK, TIOCLGET, TIOCLSET, TIOCLBIC,
	TIOCLBIS, 0
};

/*
 * Map an old style ioctl command to new.
 */
mapioctl(cmd)
	int cmd;
{
	register int *map, c;

	switch ((cmd >> 8) & 0xff) {

	case 'd':
		map = dctls;
		break;

	case 'f':
		map = fctls;
		break;

	case 'm':
		map = mctls;
		break;

	case 't':
		map = tctls;
		break;

	default:
		return (0);
	}
	while ((c = *map) && (c&0xff) < (cmd&0xff))
		map++;
	if (c && (c&0xff) == (cmd&0xff))
		return (c);
	return (0);
}
#endif

Changes to sys/tahoe/tahoe/trap.c.

1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25





















26
27
28
29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*	trap.c	4.10	84/02/09	*/

#include "../machine/psl.h"
#include "../machine/reg.h"
#include "../machine/pte.h"


#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/proc.h"
#include "../h/seg.h"
#include "../machine/trap.h"
#include "../h/acct.h"
#include "../h/kernel.h"
#include "../machine/mtpr.h"
#ifdef SYSCALLTRACE
#include "../sys/syscalls.c"
#endif

#include "../machine/fp_in_krnl.h"

#define	USER	040		/* user-mode flag added to type */

struct	sysent	sysent[];
int nsysent;






















/*
 * Called from the trap handler when a processor trap occurs.
 */

trap(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
unsigned code;
{
	/* Next 2 dummy variables MUST BE the first local */
	/* variables; leaving place for registers 0 and 1 */
	/* which are not preserved by the 'cct' */

	int	dumm1;		/* register 1 */
	int	dumm0;		/* register 0 */
	register dumm3;		/* register 12 is the 1'st register variable */
				/* in TAHOE  (register 11 in VAX) */

	register int *locr0 = ((int *)&psl)-PS;
	register int i;
	register struct proc *p;
	struct timeval syst;
	char	*typename;




	syst = u.u_ru.ru_stime;
	if (USERMODE(locr0[PS])) {
		type |= USER;
		u.u_ar0 = locr0;
	}
	switch (type) {

	default: switch (type) {
		case T_RESADFLT:
			typename = "reserved addressing mode";break;
		case T_PRIVINFLT:
			typename = "illegal opcode";break;
		case T_RESOPFLT:
			typename = "reserved operand";break;
		case T_BPTFLT:
			typename = "breakpoint";break;
		case T_SYSCALL:
			typename = "kernel call";break;
		case T_ARITHTRAP:
			typename = "arithmetic exception";break;
		case T_ASTFLT:
			typename = "system forced exception";break;
		case T_SEGFLT:
			typename = "limit fault";break;
		case T_PROTFLT:
			typename = "illegal access type";break;
		case T_TRCTRAP:
			typename = "trace trap";break;
		case T_PAGEFLT:
			typename = "page fault";break;
		case T_TABLEFLT:
			typename = "page table fault";break;
		case T_ALIGNFLT:
			typename = "alignment fault";break;
		case T_KSPNOTVAL:
			typename = "kernel stack not valid";break;
		}
		printf("System trap (%s), code = %x, pc = %x\n", 
				typename, code, pc);
		panic("trap");


	case T_PROTFLT + USER:	/* protection fault */
		i = SIGBUS;
		break;

	case T_PRIVINFLT + USER:	/* privileged instruction fault */
	case T_RESADFLT + USER:	/* reserved addressing fault */
	case T_RESOPFLT + USER:	/* resereved operand fault */
	case T_ALIGNFLT + USER:	/* unaligned data fault */
		u.u_code = type &~ USER;
		i = SIGILL;
		break;

	case T_ASTFLT + USER:	/* Allow process switch */
	case T_ASTFLT:
		astoff();
		if ((u.u_procp->p_flag & SOWEUPC) && u.u_prof.pr_scale) {
			addupc(pc, &u.u_prof, 1);
			u.u_procp->p_flag &= ~SOWEUPC;
		}
		goto out;
|

|
|
|
>

|
|
|
|
|
|
<
|
|
|



>
|



|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




>

|

<
<
<
|
<
<
<
<
<




<

>
>
>







|
|
<
<
<
<
<
<
|
<
<
|
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

|




|
|
|




|







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55



56





57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73






74


75




76
77














78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*	trap.c	1.4	86/01/09	*/

#include "../tahoe/psl.h"
#include "../tahoe/reg.h"
#include "../tahoe/pte.h"
#include "../tahoe/mtpr.h"

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "proc.h"
#include "seg.h"

#include "acct.h"
#include "kernel.h"
#define	SYSCALLTRACE
#ifdef SYSCALLTRACE
#include "../sys/syscalls.c"
#endif

#include "../tahoe/trap.h"

#define	USER	040		/* user-mode flag added to type */

struct	sysent sysent[];
int	nsysent;

char	*trap_type[] = {
	"Reserved addressing mode",		/* T_RESADFLT */
	"Privileged instruction",		/* T_PRIVINFLT */
	"Reserved operand",			/* T_RESOPFLT */
	"Breakpoint",				/* T_BPTFLT */
	0,
	"Kernel call",				/* T_SYSCALL */
	"Arithmetic trap",			/* T_ARITHTRAP */
	"System forced exception",		/* T_ASTFLT */
	"Segmentation fault",			/* T_SEGFLT */
	"Protection fault",			/* T_PROTFLT */
	"Trace trap",				/* T_TRCTRAP */
	0,
	"Page fault",				/* T_PAGEFLT */
	"Page table fault",			/* T_TABLEFLT */
	"Alignment fault",			/* T_ALIGNFLT */
	"Kernel stack not valid",		/* T_KSPNOTVAL */
	"Bus error",				/* T_BUSERR */
};
#define	TRAP_TYPES	(sizeof (trap_type) / sizeof (trap_type[0]))

/*
 * Called from the trap handler when a processor trap occurs.
 */
/*ARGSUSED*/
trap(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
	unsigned type, code;
{



	int r0, r1;		/* must reserve space */





	register int *locr0 = ((int *)&psl)-PS;
	register int i;
	register struct proc *p;
	struct timeval syst;


#ifdef lint
	r0 = 0; r0 = r0; r1 = 0; r1 = r1;
#endif
	syst = u.u_ru.ru_stime;
	if (USERMODE(locr0[PS])) {
		type |= USER;
		u.u_ar0 = locr0;
	}
	switch (type) {

	default:
		printf("trap type %d, code = %x, pc = %x\n", type, code, pc);






		type &= ~USER;


		if (type < TRAP_TYPES && trap_type[type])




			panic(trap_type[type]);
		else














			panic("trap");
		/*NOTREACHED*/

	case T_PROTFLT + USER:		/* protection fault */
		i = SIGBUS;
		break;

	case T_PRIVINFLT + USER:	/* privileged instruction fault */
	case T_RESADFLT + USER:		/* reserved addressing fault */
	case T_RESOPFLT + USER:		/* resereved operand fault */
	case T_ALIGNFLT + USER:		/* unaligned data fault */
		u.u_code = type &~ USER;
		i = SIGILL;
		break;

	case T_ASTFLT + USER:		/* Allow process switch */
	case T_ASTFLT:
		astoff();
		if ((u.u_procp->p_flag & SOWEUPC) && u.u_prof.pr_scale) {
			addupc(pc, &u.u_prof, 1);
			u.u_procp->p_flag &= ~SOWEUPC;
		}
		goto out;
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143










144



145
146
147
148


149
150




151
152
153
154
155
156
157
	 */
	case T_SEGFLT + USER:
		if (grow((unsigned)locr0[SP]) || grow(code))
			goto out;
		i = SIGSEGV;
		break;

	case T_TABLEFLT:		/* allow page table faults in kernel mode */
	case T_TABLEFLT + USER:   /* page table fault */
		panic("ptable fault");

	case T_PAGEFLT:		/* allow page faults in kernel mode */
	case T_PAGEFLT + USER:	/* page fault */
		i = u.u_error;
		if(fastreclaim(code) == 0)
			pagein(code, 0);
		u.u_error = i;
		if (type == T_PAGEFLT)
			return;
		goto out;

	case T_BPTFLT + USER:	/* bpt instruction fault */
	case T_TRCTRAP + USER:	/* trace trap */
		locr0[PS] &= ~PSL_T;
		i = SIGTRAP;
		break;










	case T_KSPNOTVAL:



	case T_KSPNOTVAL + USER:
		i = SIGKILL;	/* There is nothing to do but to kill the 
				 * process.. */
		printf("KSP NOT VALID.\n");


		break;





	}
	psignal(u.u_procp, i);
out:
	p = u.u_procp;
	if (p->p_cursig || ISSIG(p))
		psig();
	p->p_pri = p->p_usrpri;







|
|


|
|

<
|





|
|



>
>
>
>
>
>
>
>
>
>

>
>
>

<
<
|
>
>
|

>
>
>
>







110
111
112
113
114
115
116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149


150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	 */
	case T_SEGFLT + USER:
		if (grow((unsigned)locr0[SP]) || grow(code))
			goto out;
		i = SIGSEGV;
		break;

	case T_TABLEFLT:		/* allow page table faults in kernel */
	case T_TABLEFLT + USER:		/* page table fault */
		panic("ptable fault");

	case T_PAGEFLT:			/* allow page faults in kernel mode */
	case T_PAGEFLT + USER:		/* page fault */
		i = u.u_error;

		pagein(code, 0);
		u.u_error = i;
		if (type == T_PAGEFLT)
			return;
		goto out;

	case T_BPTFLT + USER:		/* bpt instruction fault */
	case T_TRCTRAP + USER:		/* trace trap */
		locr0[PS] &= ~PSL_T;
		i = SIGTRAP;
		break;

	/*
	 * For T_KSPNOTVAL and T_BUSERR, can not allow spl to
	 * drop to 0 as clock could go off and we would end up
	 * doing an rei to the interrupt stack at ipl 0 (a
	 * reserved operand fault).  Instead, we allow psignal
	 * to post an ast, then return to user mode where we
	 * will reenter the kernel on the kernel's stack and
	 * can then service the signal.
	 */
	case T_KSPNOTVAL:
		if (noproc)
			panic("ksp not valid");
		/* fall thru... */
	case T_KSPNOTVAL + USER:


		printf("pid %d: ksp not valid\n", u.u_procp->p_pid);
		/* must insure valid kernel stack pointer? */
		psignal(u.u_procp, SIGKILL);
		return;

	case T_BUSERR + USER:
		u.u_code = code;
		psignal(u.u_procp, SIGBUS);
		return;
	}
	psignal(u.u_procp, i);
out:
	p = u.u_procp;
	if (p->p_cursig || ISSIG(p))
		psig();
	p->p_pri = p->p_usrpri;
178
179
180
181
182
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210



211
212
213
214
215
216
217
218
219
220

221
222


223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288




289
290
291
292
293
294
295
		if (ticks)
			addupc(locr0[PC], &u.u_prof, ticks);
	}
	curpri = p->p_pri;
}

#ifdef SYSCALLTRACE
int syscalltrace = 0;
#endif

/*
 * Called from the trap handler when a system call occurs
 */

syscall(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
unsigned code;
{
	/* Next 2 dummy variables MUST BE the first local */
	/* variables; leaving place for registers 0 and 1 */
	/* which are not preserved by the 'cct' */

	int	dumm1;		/* register 1 */
	int	dumm0;		/* register 0 */
	register dumm3;		/* register 12 is the 1'st register variable */
				/* in TAHOE  (register 11 in VAX) */

	register int *locr0 = ((int *)&psl)-PS;
	register caddr_t params;		/* known to be r10 below */
	register int i;				/* known to be r9 below */
	register struct sysent *callp;
	register struct proc *p;
	struct	timeval syst;
	int opc;




	syst = u.u_ru.ru_stime;
	if (!USERMODE(locr0[PS]))
		panic("syscall");
	u.u_ar0 = locr0;
	if (code == 139) {			/* XXX */
		sigcleanup();			/* XXX */
		goto done;			/* XXX */
	}
	params = (caddr_t)locr0[FP] + NBPW;
	u.u_error = 0;

	/*------ DIRTY CODE !!!!!!!!!---------*/
	/* try to reconstruct pc, assuming code is an immediate constant */


	opc = pc - 2;		/* short literal */
	if (code > 0x3f) {
		opc--;	/* byte immediate */
		if (code > 0x7f) {
			opc--;	/* word immediate */
			if (code > 0x7fff)
				opc -= 2;	/* long immediate */
		}
	}
	/*------------------------------------*/
	callp = (code >= nsysent) ? &sysent[63] : &sysent[code];
	if (callp == sysent) {
		i = fuword(params);
		params += NBPW;
	callp = (code >= nsysent) ? &sysent[63] : &sysent[code];
	}
	if (i = callp->sy_narg * sizeof (int)) {
		asm("prober $1,(r10),r9");		/* GROT */
		asm("bnequ ok");			/* GROT */
		u.u_error = EFAULT;			/* GROT */

		goto bad;				/* GROT */
asm("ok:");						/* GROT */
		bcopy(params,u.u_arg,i);
	}
	u.u_ap = u.u_arg;
	u.u_dirp = (caddr_t)u.u_arg[0];
	u.u_r.r_val1 = 0;
	u.u_r.r_val2 = locr0[R1]; /*------------ CHECK again */
	if (setjmp(&u.u_qsave)) {
		if (u.u_error == 0 && u.u_eosys == JUSTRETURN)
			u.u_error = EINTR;
	} else {
		u.u_eosys = JUSTRETURN;
#ifdef SYSCALLTRACE
		if (syscalltrace) {
			register int i;
			char *cp;

			if (code >= nsysent)
				printf("0x%x", code);
			else
				printf("%s", syscallnames[code]);
			cp = "(";
			for (i= 0; i < callp->sy_narg; i++) {
				printf("%s%x", cp, u.u_arg[i]);
				cp = ", ";
			}
			if (i)
				putchar(')', 0);
			putchar('\n', 0);
		}
#endif

		(*(callp->sy_call))();
	}
	if (u.u_eosys == RESTARTSYS)
		pc = opc;
	else if (u.u_error) {
bad:
		locr0[R0] = u.u_error;
		locr0[PS] |= PSL_C;	/* carry bit */
	} else {
		locr0[PS] &= ~PSL_C;	/* clear carry bit */
		locr0[R0] = u.u_r.r_val1;
		locr0[R1] = u.u_r.r_val2;
	}




done:
	p = u.u_procp;
	if (p->p_cursig || ISSIG(p))
		psig();
	p->p_pri = p->p_usrpri;
	if (runrun) {
		/*







|



|

>

|

<
<
<
|
<
<
<
<
<

|
|


|


>
>
>




|
|
|



>
|
|
>
>


|

|




|




|

|
|
<
|
>
|
<
<

<
<

|

|


|



















<
|

|
<
|
<
|
|
|
|
|
|
|
>
>
>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202



203





204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

248
249
250


251


252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

278
279
280

281

282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
		if (ticks)
			addupc(locr0[PC], &u.u_prof, ticks);
	}
	curpri = p->p_pri;
}

#ifdef SYSCALLTRACE
int	syscalltrace = 0;
#endif

/*
 * Called from locore when a system call occurs
 */
/*ARGSUSED*/
syscall(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
	unsigned code;
{



	int r0, r1;			/* must reserve space */





	register int *locr0 = ((int *)&psl)-PS;
	register caddr_t params;
	register int i;
	register struct sysent *callp;
	register struct proc *p;
	struct timeval syst;
	int opc;

#ifdef lint
	r0 = 0; r0 = r0; r1 = 0; r1 = r1;
#endif
	syst = u.u_ru.ru_stime;
	if (!USERMODE(locr0[PS]))
		panic("syscall");
	u.u_ar0 = locr0;
	if (code == 139) {			/* 4.2 COMPATIBILTY XXX */
		osigcleanup();			/* 4.2 COMPATIBILTY XXX */
		goto done;			/* 4.2 COMPATIBILTY XXX */
	}
	params = (caddr_t)locr0[FP] + NBPW;
	u.u_error = 0;
/* BEGIN GROT */
	/*
	 * Try to reconstruct pc, assuming code
	 * is an immediate constant
	 */
	opc = pc - 2;		/* short literal */
	if (code > 0x3f) {
		opc--;				/* byte immediate */
		if (code > 0x7f) {
			opc--;			/* word immediate */
			if (code > 0x7fff)
				opc -= 2;	/* long immediate */
		}
	}
/* END GROT */
	callp = (code >= nsysent) ? &sysent[63] : &sysent[code];
	if (callp == sysent) {
		i = fuword(params);
		params += NBPW;
		callp = (code >= nsysent) ? &sysent[63] : &sysent[code];
	}
	if ((i = callp->sy_narg * sizeof (int)) &&
	    (u.u_error = copyin(params, (caddr_t)u.u_arg, (u_int)i)) != 0) {

		locr0[R0] = u.u_error;
		locr0[PS] |= PSL_C;	/* carry bit */
		goto done;


	}


	u.u_r.r_val1 = 0;
	u.u_r.r_val2 = locr0[R1];
	if (setjmp(&u.u_qsave)) {
		if (u.u_error == 0 && u.u_eosys != RESTARTSYS)
			u.u_error = EINTR;
	} else {
		u.u_eosys = NORMALRETURN;
#ifdef SYSCALLTRACE
		if (syscalltrace) {
			register int i;
			char *cp;

			if (code >= nsysent)
				printf("0x%x", code);
			else
				printf("%s", syscallnames[code]);
			cp = "(";
			for (i= 0; i < callp->sy_narg; i++) {
				printf("%s%x", cp, u.u_arg[i]);
				cp = ", ";
			}
			if (i)
				putchar(')', 0);
			putchar('\n', 0);
		}
#endif

		(*callp->sy_call)();
	}
	if (u.u_eosys == NORMALRETURN) {

		if (u.u_error) {

			locr0[R0] = u.u_error;
			locr0[PS] |= PSL_C;	/* carry bit */
		} else {
			locr0[PS] &= ~PSL_C;	/* clear carry bit */
			locr0[R0] = u.u_r.r_val1;
			locr0[R1] = u.u_r.r_val2;
		}
	} else if (u.u_eosys == RESTARTSYS)
		pc = opc;
	/* else if (u.u_eosys == JUSTRETURN) */
		/* nothing to do */
done:
	p = u.u_procp;
	if (p->p_cursig || ISSIG(p))
		psig();
	p->p_pri = p->p_usrpri;
	if (runrun) {
		/*
320
321
322
323
324
325
326

327
328
329
330
331

332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
/*
 * nonexistent system call-- signal process (may want to handle it)
 * flag error if process won't see signal immediately
 * Q: should we do that all the time ??
 */
nosys()
{

	if (u.u_signal[SIGSYS] == SIG_IGN || u.u_signal[SIGSYS] == SIG_HOLD)
		u.u_error = EINVAL;
	psignal(u.u_procp, SIGSYS);
}


/*
 * Ignored system call
 */
nullsys()
{

}

fpemulate(hfsreg,acc_most,acc_least,dbl,op_most,op_least,opcode,pc,psl)
{
/*
 * Emulate the F.P. 'opcode'. Update psl flags as necessary.
 * If all OK, set 'opcode' to 0, else to the F.P. exception #.
 * Not all parameter longwords are relevant - depends on opcode.
 *
 * The entry mask is set so ALL registers are saved - courtesy of
 *  locore.s. This enables F.P. opcodes to change 'user' registers
 *  before return.
 */

 /* WARNING!!!! THIS CODE MUST NOT PRODUCE ANY FLOATING POINT EXCEPTIONS. */

	/* Next 2 dummy variables MUST BE the first local */
	/* variables; leaving place for registers 0 and 1 */
	/* which are not preserved by the 'cct' */

	int	dumm1;		/* register 1 */
	int	dumm0;		/* register 0 */
	register dumm3;		/* register 12 is the 1'st register variable */
				/* in TAHOE  (register 11 in VAX) */

	register int *locr0 = ((int *)&psl)-PS; /* R11 */
	int hfs = 0; 			/* returned data about exceptions */
	float (*f_proc)();		/* fp procedure to be called.	*/
	double (*d_proc)();		/* fp procedure to be called.	*/
	int dest_type;			/* float or double.	*/
	union{
		float ff;			/* float result. 	*/
		int fi;
	}f_res;
	union{
		double	dd;			/* double result.	*/
		int	di[2] ;
	}d_res;
	extern float 	Kcvtlf(), Kaddf(), Ksubf(), Kmulf(), Kdivf();
	extern double 	Kcvtld(), Kaddd(), Ksubd(), Kmuld(), Kdivd();
	extern float   	Ksinf(), Kcosf(), Katanf(), Klogf(), Ksqrtf(), Kexpf();
	
	

	switch(opcode & 0x0FF){

	case CVLF:	f_proc = Kcvtlf; dest_type = FLOAT; 
			locr0[PS] &= ~PSL_DBL;break;	/* clear double bit */
	case CVLD:	d_proc = Kcvtld; dest_type = DOUBLE; 
			locr0[PS] |= PSL_DBL; break;	/* turn on double bit */
	case ADDF:	f_proc = Kaddf; dest_type = FLOAT;
			break;
	case ADDD:	d_proc = Kaddd; dest_type = DOUBLE;
			break;
	case SUBF:	f_proc = Ksubf; dest_type = FLOAT;
			break;
	case SUBD:	d_proc = Ksubd; dest_type = DOUBLE;
			break;
	case MULF:	f_proc = Kmulf; dest_type = FLOAT;
			break;
	case MULD:	d_proc = Kmuld; dest_type = DOUBLE;
			break;
	case DIVF:	f_proc = Kdivf; dest_type = FLOAT;
			break;
	case DIVD:	d_proc = Kdivd; dest_type = DOUBLE;
			break;
	case SINF:	f_proc = Ksinf; dest_type = FLOAT;
			break;
	case COSF:	f_proc = Kcosf; dest_type = FLOAT;
			break;
	case ATANF:	f_proc = Katanf; dest_type = FLOAT;
			break;
	case LOGF:	f_proc = Klogf; dest_type = FLOAT;
			break;
	case SQRTF:	f_proc = Ksqrtf; dest_type = FLOAT;
			break;
	case EXPF:	f_proc = Kexpf; dest_type = FLOAT;
			break;
	}

	switch(dest_type){

	case FLOAT: 
		f_res.ff = (*f_proc)(acc_most,acc_least,op_most,op_least,&hfs);

		if (f_res.fi == 0 ) locr0[PS] |= PSL_Z;
		if (f_res.fi < 0 ) locr0[PS] |= PSL_N;
		break;
	case DOUBLE:
		d_res.dd = (*d_proc)(acc_most,acc_least,op_most,op_least,&hfs);
		if ((d_res.di[0] == 0) && (d_res.di[1] == 0))
						locr0[PS] |= PSL_Z;
		if (d_res.di[0] < 0 ) locr0[PS] |= PSL_N;
		break;
	}

	if (hfs & HFS_OVF){
		locr0[PS] |= PSL_V;	/* turn on overflow bit */
		/* if (locr0[PS] & PSL_IV)   {  /* overflow elabled?	*/
			opcode = OVF_EXC;
			u.u_error = (hfs & HFS_DOM) ? EDOM : ERANGE;
			return;
		/*}*/
	}
	else if (hfs & HFS_UNDF){
		if (locr0[PS] & PSL_FU){  /* underflow elabled?	*/
			opcode = UNDF_EXC;
			u.u_error = (hfs & HFS_DOM) ? EDOM : ERANGE;
			return;
		} 
	}
	else if (hfs & HFS_DIVZ){
		opcode = DIV0_EXC;
		return;
	}
	else if (hfs & HFS_DOM)
		u.u_error = EDOM;
	else if (hfs & HFS_RANGE)
		u.u_error = ERANGE;

	switch(dest_type){
	case FLOAT:
		if ((hfs & HFS_OVF) || (hfs & HFS_UNDF)) {
			f_res.ff = 0.0;
			locr0[PS] |= PSL_Z;
		}
		mvtofacc(f_res.ff, &acc_most);
		break;
	case DOUBLE:
		if ((hfs & HFS_OVF) || (hfs & HFS_UNDF)) {
			d_res.dd = 0.0;
			locr0[PS] |= PSL_Z;
		}
		mvtodacc(d_res.di[0], d_res.di[1], &acc_most);
		break;
	}
	opcode=0;
}







>





>







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345








































































































































/*
 * nonexistent system call-- signal process (may want to handle it)
 * flag error if process won't see signal immediately
 * Q: should we do that all the time ??
 */
nosys()
{

	if (u.u_signal[SIGSYS] == SIG_IGN || u.u_signal[SIGSYS] == SIG_HOLD)
		u.u_error = EINVAL;
	psignal(u.u_procp, SIGSYS);
}

#ifdef notdef
/*
 * Ignored system call
 */
nullsys()
{

}
#endif








































































































































Added sys/tahoe/tahoe/udiv.s.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*	udiv.s	1.1	86/01/05	*/

#include "../tahoe/SYS.h"
/*
 * result = udiv(dividend, divisor)
 *
 * unsigned long division
 */
	.text
ASENTRY(udiv, R2|R3)
	bitl	$0x80000000,8(fp)	# if (divisor & 0x80000000) {
	jeql	2f			  
	cmpl	8(fp),4(fp)		# if (divisor > dividend)
	jlequ	1f
	clrl	r0			#	return (0);
	ret
1:					# else
	movl	$1,r0			#  	return (1);
	ret				# }
2:
	clrl	r0			# return (dividend / divisor);
	movl	4(fp),r1
	ediv	8(fp),r0,r2,r3
	movl	r2,r0
	ret

Changes to sys/tahoe/tahoe/vm_machdep.c.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*	vm_machdep.c	1.1	85/07/21	*/

#include "../machine/pte.h"

#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/proc.h"
#include "../h/cmap.h"
#include "../h/mount.h"
#include "../h/vm.h"
#include "../h/text.h"


#include "../machine/mtpr.h"

/*
 * Set a red zone in the kernel stack after the u. area.
 */
setredzone(pte, vaddr)
	register struct pte *pte;
	caddr_t vaddr;
{

	pte += (sizeof (struct user) + NBPG - 1) / NBPG;
	*(int *)pte &= ~PG_PROT;
	*(int *)pte |= PG_URKR;
	if (vaddr)
		mtpr(vaddr + sizeof (struct user) + NBPG - 1, TBIS);
}

#ifndef mapin
mapin(pte, v, pfnum, count, prot)
	struct pte *pte;
	u_int v, pfnum;
	int count, prot;
{

	while (count > 0) {
		*(int *)pte++ = pfnum | prot;
		mtpr(ptob(v), TBIS);
		v++;
		pfnum++;
		count--;
	}
}
#endif

|



|
|
|
|
|
|
|
|
|
>

|













|











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*	vm_machdep.c	1.2	86/01/05	*/

#include "../machine/pte.h"

#include "param.h"
#include "systm.h"
#include "dir.h"
#include "user.h"
#include "proc.h"
#include "cmap.h"
#include "mount.h"
#include "vm.h"
#include "text.h"
#include "kernel.h"

#include "../tahoe/mtpr.h"

/*
 * Set a red zone in the kernel stack after the u. area.
 */
setredzone(pte, vaddr)
	register struct pte *pte;
	caddr_t vaddr;
{

	pte += (sizeof (struct user) + NBPG - 1) / NBPG;
	*(int *)pte &= ~PG_PROT;
	*(int *)pte |= PG_URKR;
	if (vaddr)
		mtpr(TBIS, vaddr + sizeof (struct user) + NBPG - 1);
}

#ifndef mapin
mapin(pte, v, pfnum, count, prot)
	struct pte *pte;
	u_int v, pfnum;
	int count, prot;
{

	while (count > 0) {
		*(int *)pte++ = pfnum | prot;
		mtpr(TBIS, ptob(v));
		v++;
		pfnum++;
		count--;
	}
}
#endif

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
	panic("mapout");
}
#endif

/*
 * Check for valid program size
 */
chksize(ts, ds, ss)
	register unsigned ts, ds, ss;
{
	static int maxdmap = 0;

	if (ts > MAXTSIZ || ds > MAXDSIZ || ss > MAXSSIZ) {
		u.u_error = ENOMEM;
		return (1);
	}
	/* check for swap map overflow */
	if (maxdmap == 0) {
		register int i, blk;

		blk = dmmin;
		for (i = 0; i < NDMAP; i++) {
			maxdmap += blk;
			if (blk < dmmax)
				blk *= 2;
		}
	}
	if (ctod(ts) > NXDAD * dmtext ||
	    ctod(ds) > maxdmap || ctod(ss) > maxdmap) {
		u.u_error = ENOMEM;
		return (1);
	}
	/*
	 * Make sure the process isn't bigger than our
	 * virtual memory limit.
	 *
	 * THERE SHOULD BE A CONSTANT FOR THIS.
	 */
	if (ts + ds + ss + LOWPAGES + HIGHPAGES > btoc(USRSTACK)) {
		u.u_error = ENOMEM;
		return (1);
	}
	return (0);
}

/*ARGSUSED*/
newptes(pte, v, size)
	register struct pte *pte;
	u_int v;
	register int size;
{
	register caddr_t a = ptob(v);

#ifdef lint
	pte = pte;
#endif
	if (size >= 8) {
		mtpr(0, TBIA);
		return;
	}
	while (size > 0) {
		mtpr(a, TBIS);
		a += NBPG;
		size--;
	}
}

/*
 * Change protection codes of text segment.







|
|

<

|
<
<
<
<
<
<
|
<
<
<
<
<
<
<
|
<
|
<
<
<
<
|
<
<
<
<


















|



|







57
58
59
60
61
62
63
64
65
66

67
68






69







70

71




72




73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
	panic("mapout");
}
#endif

/*
 * Check for valid program size
 */
chksize(ts, ids, uds, ss)
	register unsigned ts, ids, uds, ss;
{


	if (ts > maxtsize ||






	    ctob(ids) > u.u_rlimit[RLIMIT_DATA].rlim_cur ||







	    ctob(uds) > u.u_rlimit[RLIMIT_DATA].rlim_cur ||

	    ctob(ids + uds) > u.u_rlimit[RLIMIT_DATA].rlim_cur ||




	    ctob(ss) > u.u_rlimit[RLIMIT_STACK].rlim_cur) {




		u.u_error = ENOMEM;
		return (1);
	}
	return (0);
}

/*ARGSUSED*/
newptes(pte, v, size)
	register struct pte *pte;
	u_int v;
	register int size;
{
	register caddr_t a = ptob(v);

#ifdef lint
	pte = pte;
#endif
	if (size >= 8) {
		mtpr(TBIA, 0);
		return;
	}
	while (size > 0) {
		mtpr(TBIS, a);
		a += NBPG;
		size--;
	}
}

/*
 * Change protection codes of text segment.
160
161
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321

322
323
324













325




326

327















328
329
























330


































































331
332






























































333
334


335












































	register int *ptaddr, i;

	ptaddr = (int *)mfpr(P0BR);
	for (i = 0; i < u.u_tsize; i++) {
		ptaddr[i] &= ~PG_PROT;
		ptaddr[i] |= tprot;
	}
	mtpr(0, TBIA);
}


/*
 * Rest are machine-dependent
 */

getmemc(addr)
	caddr_t addr;
{
	register int c;
	struct pte savemap;

	savemap = mmap[0];
	*(int *)mmap = PG_V | PG_KR | btop(addr);
	mtpr(vmmap, TBIS);
	uncache (&vmmap[(int)addr & PGOFSET]);
	c = *(char *)&vmmap[(int)addr & PGOFSET];
	mmap[0] = savemap;
	mtpr(vmmap, TBIS);
	return (c & 0377);
}

putmemc(addr, val)
	caddr_t addr;
{
	struct pte savemap;

	savemap = mmap[0];
	*(int *)mmap = PG_V | PG_KW | btop(addr);
	mtpr(vmmap, TBIS);
	*(char *)&vmmap[(int)addr & PGOFSET] = val;

	mtpr (0, PADC);
	mtpr (0, PACC);

	mmap[0] = savemap;
	mtpr(vmmap, TBIS);
}


/*
 * Move pages from one kernel virtual address to another.
 * Both addresses are assumed to reside in the Sysmap,
 * and size must be a multiple of CLSIZE.
 */
pagemove(from, to, size)
	register caddr_t from, to;
	int size;
{
	register struct pte *fpte, *tpte;

	if (size % CLBYTES)
		panic("pagemove");
	fpte = &Sysmap[btop(from - 0xC0000000)];
	tpte = &Sysmap[btop(to - 0xC0000000)];
	while (size > 0) {
		*tpte++ = *fpte;
		*(int *)fpte++ = 0;
		mtpr(from, TBIS);
		mtpr(to, TBIS);
		mtpr(to, P1DC);		/* purge !! */
		from += NBPG;
		to += NBPG;
		size -= NBPG;
	}
}

#ifndef GLOBKEY
ckeyrelease(key)
/* 
 * release code key
 */
{
	register int ipl,i,j ;
	ipl = spl8();
	if (--ckey_cnt[key-1] < 0 ) {
/*
		panic ("Code key release");
*/
		printf("Ckey release, key=%d\n", key);
		ckey_cnt[key-1] = 0;
		splx(ipl);
	}
	splx(ipl);
}


dkeyrelease(key)
/* 
 * release data key
 */
{
	if (--dkey_cnt[key-1] != 0 ) panic ("Data key release");
}


int
getcodekey()
/* 
 * Get a code key
 */
{
	register int i, ipl, first;

	first = 1;
	ipl = spl8();
retry:
	for (i=0; i<255; i++) {
		if ( (int)ckey_cache[i] == 0) {
			ckey_cache[i] = 1;
			ckey_cnt[i] = 1;
			splx(ipl);
			return (i+1);
		};
	}
	if ( !first) {
		splx(ipl);
		panic ("Not enough code keys\n");
	}
	mtpr (0, PACC);
	first = 0;
	for (i=0; i<255; i++)
		if ( ckey_cnt[i] > 0 ) ckey_cache[i] = 1;
		else ckey_cache[i] = 0;
	goto retry;
}

int
getdatakey()
/* 
 * Get a data key
 */
{
	register int i, ipl, first;
	
	first = 1;
	ipl = spl8();
retry:
	for (i=0; i<255; i++)
		if ( (int)dkey_cache[i] == 0) {
			dkey_cache[i] = 1;
			dkey_cnt[i] = 1;
			splx(ipl);
			return (i+1);
		};
	if ( !first) {
		splx(ipl);
		panic("Not enough data keys\n");
	}
	mtpr (0, PADC);
	first = 0;
	for (i=0; i<255; i++)
		if ( dkey_cnt[i] > 0 ) dkey_cache[i] = 1;
		else dkey_cache[i] = 0;
	goto retry;

}
#endif














/* General (includes system) virtual address to physical */




vtoph(p, v)

register struct proc *p;















register unsigned v;
{
























	register struct pte *thispte;



































































	thispte = vtopte (p, btop(v));






























































	return ( (thispte->pg_pfnum << PGSHIFT) + (v & PGOFSET));
}


		



















































|


>



<








|
|


|










|


|
|


|

>



















|
|
|






|
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<

<
<
<
|
|
|
<
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
|
<
<
<
<
|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
>



>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

214















215
216



217



218
219
220





221
222










223
224










225
226






227




228



229











230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
	register int *ptaddr, i;

	ptaddr = (int *)mfpr(P0BR);
	for (i = 0; i < u.u_tsize; i++) {
		ptaddr[i] &= ~PG_PROT;
		ptaddr[i] |= tprot;
	}
	mtpr(TBIA, 0);
}

#ifdef notdef
/*
 * Rest are machine-dependent
 */

getmemc(addr)
	caddr_t addr;
{
	register int c;
	struct pte savemap;

	savemap = mmap[0];
	*(int *)mmap = PG_V | PG_KR | btop(addr);
	mtpr(TBIS, vmmap);
	uncache(&vmmap[(int)addr & PGOFSET]);
	c = *(char *)&vmmap[(int)addr & PGOFSET];
	mmap[0] = savemap;
	mtpr(TBIS, vmmap);
	return (c & 0377);
}

putmemc(addr, val)
	caddr_t addr;
{
	struct pte savemap;

	savemap = mmap[0];
	*(int *)mmap = PG_V | PG_KW | btop(addr);
	mtpr(TBIS, vmmap);
	*(char *)&vmmap[(int)addr & PGOFSET] = val;

	mtpr(PADC, 0);
	mtpr(PACC, 0);

	mmap[0] = savemap;
	mtpr(TBIS, vmmap);
}
#endif

/*
 * Move pages from one kernel virtual address to another.
 * Both addresses are assumed to reside in the Sysmap,
 * and size must be a multiple of CLSIZE.
 */
pagemove(from, to, size)
	register caddr_t from, to;
	int size;
{
	register struct pte *fpte, *tpte;

	if (size % CLBYTES)
		panic("pagemove");
	fpte = &Sysmap[btop(from - 0xC0000000)];
	tpte = &Sysmap[btop(to - 0xC0000000)];
	while (size > 0) {
		*tpte++ = *fpte;
		*(int *)fpte++ = 0;
		mtpr(TBIS, from);
		mtpr(TBIS, to);
		mtpr(P1DC, to);		/* purge !! */
		from += NBPG;
		to += NBPG;
		size -= NBPG;
	}
}

#ifndef vtopte

/*















 * Convert a virtual page 
 * number to a pte address.



 */



/*VARARGS1*/
struct pte *
vtopte(p, v)





	register struct proc *p;
{











	if ((v & 0x300000) == 0x300000)










		return (struct pte *)(mfpr(SBR) + 0xc0000000 + (v&0xfffff)*4);
	if (p == 0)






		panic("vtopte (no proc)");




	if (v < p->p_tsize + p->p_dsize)



		return (p->p_p0br + v);











	return (p->p_p0br + (p->p_szpt*NPTEPG + v - (BTOPUSRSTACK + UPAGES)));
}
#endif

/*
 * Code and data key management routines.
 *
 * The arrays ckey_cnt and ckey_cache are allways kept in such a way
 * that the following invariant holds:
 *	ckey_cnt > 0	=>'s	ckey_cache == 1
 * meaning as long as a code key is used by at least one process, it's
 * marked as being 'in the cache'. Of course, the following invariant
 * also holds:
 *	ckey_cache == 0	=>'s	ckey_cnt == 0
 * which is just the reciprocal of the 1'st invariant.
 * Equivalent invariants hold for the data key arrays.
 */

/* 
 * Release a code key.
 */
ckeyrelease(key)
	int key;
{
	register int s;

	s = spl8();
	if (--ckey_cnt[key] < 0) {
		printf("ckeyrelease: key = %d\n", key);
		ckey_cnt[key] = 0;
	}
	splx(s);
}

/* 
 * Release a data key.
 */
dkeyrelease(key)
	int key;
{
	register int s;

	s = spl8();
	if (--dkey_cnt[key] != 0) {
		printf("dkeyrelease: key = %d\n", key);
		dkey_cnt[key] = 0;
	}
	splx(s);	
}

struct	keystats {
	long	ks_allocs;	/* number of keys allocated */
	long	ks_free;	/* key allocated from free slot */
	long	ks_norefs;	/* key marked in use, but refcnt 0 */
	long	ks_taken;	/* key taken from single process */
	long	ks_shared;	/* key taken from multiple processes */
};
struct	keystats ckeystats;
struct	keystats dkeystats;

/* 
 * Get a code key.
 */
getcodekey()
{
	register int i, s, freekey, sharedkey;
	register struct proc *p;

	ckeystats.ks_allocs++;
	s = spl8();
	freekey = 0;
	for (i = 1; i <= MAXCKEY; i++) {
		if ((int)ckey_cache[i] == 0) {	/* free key, take it */
			ckey_cache[i] = 1, ckey_cnt[i] = 1;
			splx(s);
			ckeystats.ks_free++;
			return (i);
		}
		if (ckey_cnt[i] == 0) {		/* save for potential use */
			if (freekey == 0)
				freekey = i;
		} else if (ckey_cnt[i] > 1 && i != MAXCKEY)
			sharedkey = i;
	}
	/*
	 * All code keys were marked as being in cache.
	 * Moreover, we are assured that sharedkey has a meaningful value,
	 * since we know that the init process and the shell are around
	 * and they have shared text!
	 */
	/*
	 * If a key was in the cache, but not in use, grab it.
	 */
	if (freekey != 0) {
		/*
		 * If we've run out of bonified free keys,
		 * try and free up some other keys to avoid
		 * future cache purges.
		 */
		for (i = 1; i <= MAXCKEY; i++)
			if (ckey_cnt[i] == 0)
				ckey_cache[i] = 0;
		ckey_cnt[freekey] = 1, ckey_cache[freekey] = 1;
		mtpr(PACC, 0);
		splx(s);
		ckeystats.ks_norefs++;
		return (freekey);
	}

	/*
	 * All keys are marked as in the cache and in use.
	 *
	 * Strip some process of their code key. First time,
	 * 1) Try hard not to do that to kernel processes !!
	 * 2) Try hard NOT to strip shared text processes of
	 *    their (shared) key, because then they'll run
	 *    with different keys from now on, i.e. less efficient
	 *    cache utilization.
	 */
	for (p = proc; p < procNPROC; p++)
		/*
		 * Look for a meaningful key but not
		 * used and not shared text.
		 */
		if (p->p_ckey && p->p_ckey != MAXCKEY &&
		    ckey_cnt[p->p_ckey] < 2) {
			i = p->p_ckey;
			p->p_ckey = 0;
			ckey_cnt[i] = 1, ckey_cache[i] = 1;
			mtpr(PACC, 0);
			splx(s);
			ckeystats.ks_taken++;
			return (i);
		}

	/*
	 * Second time around!
	 * Highly unlikely situation. It means that all keys are
	 * allocated AND shared (i.e. we have at least 510 active
	 * processes).
	 * Strip some of them. We pick some key (known to be shared
	 * by several processes) and strip the poor process group.
	 * At least 2 processes will loose but we gain one key to be reused.
	 * The way 'shared_key' was produced (above) virtually assures
	 * us that this key isn't the 'init' group key (1) nor the
	 * 'shell' group key (2 or 3). It's probably something like 254.
	 * Could be more straightforward to strip all processes, but it's
	 * better to invest in one more loop here and keep the cache
	 * utilization to a maximum.
	 */
	for (p = proc; p < procNPROC; p++)
		if (p->p_ckey == sharedkey) {
			p->p_ckey = 0;
			ckey_cnt[sharedkey]--;
		}
	if (ckey_cnt[sharedkey] != 0) {
		printf("getcodekey: key = %d cnt = %d\n",
		    sharedkey, ckey_cnt[sharedkey]);
		panic("getcodekey");
	}
	ckey_cnt[sharedkey] = 1, ckey_cache[sharedkey] = 1;
	mtpr(PACC, 0);
	splx(s);
	ckeystats.ks_shared++;
	return (sharedkey);
}

/* 
 * Get a data key.
 *
 * General strategy:
 * 1) Try to find a data key that isn't in the cache. Allocate it.
 * 2) If all data keys are in the cache, find one which isn't
 *    allocated. Clear all status and allocate this one.
 * 3) If all of them are allocated, pick some process, strip him
 *    of the data key and allocate it. We (cold-bloodedly) pick
 *    one process to be the poor looser because that's the
 *    easiest way to do it and because this extreme situation
 *    ( >255 active processes ) is expected to be temporary,
 *    after which 1) or 2) above should be the usual case.
 * The poor looser is the first process which has a data key.
 * However, we try to spare known kernel processes and daemons
 * (fired at bootstrap time), by searching from proc[LOOSER] and on.
 */
getdatakey()
{
	register int i, s, freekey;
	register struct proc *p;

	dkeystats.ks_allocs++;
	s = spl8();
	freekey = 0;
	for (i = 1; i <= MAXDKEY; i++) {
		if ((int)dkey_cache[i] == 0) {	/* free key, take it */
			dkey_cache[i] = 1, dkey_cnt[i] = 1;
			splx(s);
			dkeystats.ks_free++;
			return (i);
		}
		if (dkey_cnt[i] == 0 && freekey == 0)
			freekey = i;
	}
	if (freekey) {
		/*
		 * Try and free up some more keys to avoid
		 * future allocations causing a cache purge.
		 */
		for (i = 1; i < MAXDKEY; i++)
			if (dkey_cnt[i] == 0)
				dkey_cache[i] = 0;
		dkey_cnt[freekey] = 1, dkey_cache[freekey] = 1;
		mtpr(PADC, 0);
		splx(s);
		dkeystats.ks_norefs++;
		return (freekey);
	}

	/*
	 * Now, we have to take a code from someone.
	 */
#define LOOSER 20
	for (p = &proc[LOOSER]; p < procNPROC; p++)
		if (p->p_dkey != 0) {
			i = p->p_dkey;
			p->p_dkey = 0;
			dkey_cnt[i] = 1;
			dkey_cache[i] = 1;
			mtpr(PADC, 0);
			splx(s);
			dkeystats.ks_taken++;
			return (i);
		}
	panic("getdatakey");
	/*NOTREACHED*/
}

/*VARGARGS1*/
vtoph(p, v)
	register struct proc *p;
	register unsigned v;
{
	register struct pte *pte;

	pte = vtopte(p, btop(v));
	return ((pte->pg_pfnum << PGSHIFT) + (v & PGOFSET));
}

Changes to sys/tahoe/vba/cy.c.

1
2
3
4
5
6
7
8

9
10
11



12
13
14
15
16
17
18
19
20
21
22
23


24







25
26


27
28

29
30
31
32
33


34
35






36











37
38
39

40
41

42
43


44
45
46







47

48


49
50
51
52
53
54
55








56
57
58
59
60
61
62
63
64

65
66
67
68

69
70
71
72
73
74
75
76
77









78
79




80
81



82
83
84


85
86

87















88
89

90
91
92
93
94

95
96
97
98
99




100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125



126
127


128








129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

147
148
149
150









151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183

184
185

186
187
188
189
190



191

192
193
194
195










196
197
198
199
200
201
202



203





204
205
206
207

208
209
210
211

212
213
214
215
216
217
218



219
220
221
222
223
224
225
226
227
228




229
230
231











232
233

234





235
236
237

238

239





240
241
242
243
244
245

246
247
248
249
250
251
252
253
254
255
256


257
258
259
260
261
262

263
264
265
266
267
268
269
270
271
272
273
274
275
276


277
278
279




280
281
282


283
284
285
286
287
288
289
290
291
292
293

294

295
296
297
298
299









300
301







302
303
304
305

306
307



308



309




310
















311







312
313
314
315
316
317
318
319
320


321
322


323
324
325
326
327
328
329
330
331
332
333
334

335

336




337









338













339
340
341
342
343

344
345
346
347
348


349





350


351



352
353




354


355








356








357



358
359
360
361
362
363



364






365


366







367




368









369





370

371



372


373
374



375
376
377
378
379
380










































381



382
383
384
385
386
387

388
389
390

391
392
393
394
395
396
397

398



399
400
401

402

403
404


405
406





407




408












409
410
411
412
413

414

415
416

417
418



419




420


421
422
423






424



425
426








427










428

429
430
431



432


433




434
435
436
437
438











439
440






441
442


443
444
445
446
447
448
449
450
451
452
453


454

455
456
457
458

459
460
461
462
463
464
465
466



467





468



469
470
471



472







473
474
475
476
477
478

479



480
481
482


483
484
485

486
487
488
489

490

491
492
493
494




495
496
497
498
499
500
501

502
503




504

505



506
507




508
509

510



511
512
513

514
515


516
517




518
519
520
521
522





523
524
525
526
527
528
529
530
531

532
533


534
535








536



537






538














539
540
541

542

543


544



545

















546


547





548
549
550
551
552
553
554

555
556

557
558

559

560

561


562

563

564





















565





566












567
568
569
570







571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586


587
588
589
590
591
592


593

594





595









596
597
598
599


600
601







602
603







604





605








606





607








608
609
610
611
612
613
614
615
616
617




618









619
620








621
622








623


624
625

626
627

628

629
630

631
632



633

634
635
636
637

638
639
640

641

642






643

644
645

646
647
648
649
650
651







652


653


654
655








656
657




658



659
660


661
662
663

664


665



666
667




668
669
670



671
672




673

674
675
676
677





678
679


680
681


682
683
684
685
686
687
688

689
690

691

692
693
694

695

696




697
698












699











700

701

702


703
704
705
706
707
708
709
710





711
712


713
714





















715








716
717
718
719
720
721
722
723
724

725




726

727
728









729




730
731
732


733
734
735
736


737
738



739


740






741


742
743
744



745




746
747
748

749
750
751
752
753





754






755








756
757
758


759
760
761
762

763

764
765
766
767
768

769
770
771
772






773




774

775
776






777

778
779
780

781




782
783
784



785
786
787
788
789
790
791



792
793
794

795
796




















797
798
799
800
801
802
803
804
805

806
807

808
809
810
811











812

813













814
815
816
817
818
819
820
821
822

823

824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852




853
854
855

856

857
858
859


860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881

882
883
884
885
886


887
888
889
890
891
892
893
894
895
896
897
898
899
900
901


902
903

904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927



928
929
930
931
932
933
934
935
936
937

938


939
940
941
942
943


944
945


946
947
948
949
950
951
952
953
954
955

956
957
958
959
960
961
962
963
964
965
966
967
968
969
970

971
972
973
974




975
976
977

978
979

980
981
982
983
984
985
986
987
988
989
990
991




992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017

1018
1019

1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032



1033

1034
1035

1036


1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047






1048

1049
1050
1051



1052
1053
1054
1055
1056
1057
1058
1059
1060
1061




1062
1063
1064
1065
1066
1067

1068

1069
1070
1071

1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
/*	cy.c	1.1	85/07/21	*/
/*	cy.c	Tahoe version 	Mar 1983.	*/

#include "cy.h"
#if NCY > 0 /* number of CYPHER tapes in system */
/*
 * Cypher tape driver
 *

 */
#include "../h/param.h"
#include "../h/systm.h"



#include "../h/vm.h"
#include "../h/buf.h"
#include "../h/dir.h"
#include "../h/conf.h"
#include "../h/user.h"
#include "../h/file.h"
#include "../machine/pte.h"
#include "../vba/vbavar.h"
#include "../h/mtio.h"
#include "../machine/mtpr.h"
#include "../h/ioctl.h"
#include "../h/cmap.h"


#include "../h/uio.h"








#include "../vba/cyvar.h"



#define NTM 1		/* number of TAPEMASTER controllers */


/*
 * There is a ccybuf per tape controller.
 * It is used as the token to pass to the control routines
 * and also acts as a lock on the slaves on the


 * controller, since there is only one per controller.
 * In particular, when the tape is rewinding on close we release






 * the user process but any further attempts to use the tape drive











 * before the rewind completes will hang waiting for ccybuf.
 */
struct	buf	ccybuf[NTM];


/*

 * Raw tape operations use rcybuf.  The driver
 * notices when rcybuf is being used and allows the user


 * program to continue after errors and read records
 * not of the standard length (BSIZE).
 */







struct	buf	rcybuf[NTM];

long	cybufused = 0;



/*
 * Driver interface routines and variables.
 */
int	cyprobe(), cyslave(), cyattach(), cydgo(), cyintr();
int	cywait(), cyrewind();
unsigned	tminphys();








struct	vba_ctlr *cyminfo[NTM];
struct	vba_device *cydinfo[NCY];
struct	buf cyutab[NCY];
short	cytotm[NCY];
extern char	cyutl[];
long	cystd[] = { 0x400000, 0 };
struct	vba_driver cydriver =
 { cyprobe, cyslave, cyattach, cydgo, cystd, "yc", cydinfo, "cy",
	cyminfo, 0 };


/* bits in minor device */
#define	CYUNIT(dev)	(minor(dev)&07)		/* tape unit number */
#define	TMUNIT(dev)	(cytotm[CYUNIT(dev)])	/* tape controller number */

#define	T_NOREWIND	0x08			/* no rewind bit */
#define	T_100IPS	0x10			/* high speed flag */

int	pflag;			/* probe flag, set every interrupt by cyintr */

#define	INF	(daddr_t)1000000L
extern int hz;

struct scp	/* SYSTEM CONFIGUREATION POINTER */









{
  char sysbus ;	/* width of system buss 0=8;1=16 */




  char nu1 ;
  char pt_scb[4] ;	/* pointer to ->SYSTEM CONFIGUREATION BLOCK */



};

/* absolute address - jumpered on the controller */


#define	SCP	((struct scp *)0xc0000c06)


struct Scb	/* SYSTEM CONFIGUREATION BLOCK */















{
  char sysblk[1] ;	/* 0x03 fixed value code */

  char nu2[1] ;
  char pt_ccb[4] ;	/* pointer to ->CHANNEL CONTROL BLOCK */
}Scb;

struct ccb	/* CHANNEL CONTROL BLOCK */

{
  char ccw[1] ;		/* 0x11 normal; 0x09 clear non_vect interrupt */
  char gate[1] ;	/* This is "the" GATE */
  char pt_tpb[4] ;	/* pointer to ->TAPE OPERATION BLOCK or MOVE BLOCK */
}ccb;





struct tpb	/* TAPE OPERATIONS PARAMETER BLOCK */
{
  long cmd ;		/* COMMAND (input) */
  char control[2] ;	/* CONTROL (input) */
  short count ;	/* RETURN COUNT (output) */
  short size ;	/* BUFFER SIZE (input/output) */
  short rec_over ;	/* RECORDS/OVERRUN (input/output) */
  char pt_data[4] ;	/* pointer to ->SOURCE/DEST (input) */
  char status[2] ;	/* STATUS (output) */
  char pt_link[4] ;	/* pointer to ->INTERRUPT/PARAMETER BLOCK (input) */
} tpb[NTM];

struct tpb cycool	/* tape parameter block to clear interrupts */
= {
	0L,		/* command */
	0, 0,		/* control */
	0,		/* count */
	0,		/* size */
	0,		/* rec_over */
	0, 0, 0, 0,	/* pt_data */
	0, 0,		/* status */
	0, 0, 0, 0		/* pt_link */
} ;	
/*
 * Software state per tape transport.



 *
 * 1. A tape drive is a unique-open device; we refuse opens when it is already.


 * 2. We keep track of the current position on a block tape and seek








 *    before operations by forward/back spacing if necessary.
 * 3. We remember if the last operation was a write on a tape, so if a tape
 *    is open read write and the last thing done is a write we can
 *    write a standard end of tape mark (two eofs).
 */
struct	cy_softc {
	char	cy_openf;	/* lock against multiple opens */
	char	cy_lastiow;	/* last op was a write */
	daddr_t	cy_blkno;	/* block number, for block device tape */
	daddr_t	cy_nxrec;	/* position of end of tape, if known */
	daddr_t	cy_timo;	/* time until timeout expires */
	short	cy_tact;	/* timeout is active */
	short	cy_count;	/* return count of last operation */
	char	cy_status[2];	/* return status of last operation */
} cy_softc[NTM];

/* 
 * I/O buffer for raw devices.

 */
char cybuf[TBUFSIZ*NBPG]; 		/* 10k buffer */

/*









 * States for um->um_tab.b_active, the per controller state flag.
 * This is used to sequence control in the driver.
 */
#define	SSEEK	1		/* seeking */
#define	SIO	2		/* doing seq i/o */
#define	SCOM	3		/* sending control command */
#define	SREW	4		/* sending a drive rewind */

/*
 * Determine if there is a controller for
 * a cypher at address ctlr_vaddr.  
 * Reset the controller.
 * Our goal is to make the device interrupt.
 */
cyprobe(ctlr_vaddr)
	caddr_t ctlr_vaddr;
{
	int *ip;

	pflag = 0;			/* clear interrupt flag */
	if (badcyaddr(ctlr_vaddr + 1))	/* check for versabuss timeout  */
		return (0);
	/*
	 * Initialize the system configuration pointer
	 */
	ip = (int *)vtopte(0, btop(SCP)); *ip &= ~PG_PROT; *ip |= PG_KW;
	mtpr(SCP, TBIS);
	SCP->sysbus = 1;			/* system width = 16 bits. */
	/* initialize the pointer to the system configuration block */
	set_pointer((int)&Scb.sysblk[0], (char *)SCP->pt_scb);
	/*
	 * Initialize the system configuration block.
	 */

	Scb.sysblk[0] = 0x3;		/* fixed value */
	/* initialize the pointer to the channel control block */

	set_pointer((int)&ccb.ccw[0], (char *)Scb.pt_ccb);
	/*
	 * Initialize the channel control block.
	 */
	ccb.ccw[0] = 0x11;		/* normal interrupts */



	/* initialize the pointer to the tape parameter block */

	set_pointer((int)&tpb[0], (char *)ccb.pt_tpb);
	/*
	 * set the command to be CONFIGURE.
	 */










	tpb[0].cmd = CONFIG;
	tpb[0].control[0] = CW_I;	/* interrupt on completion */
	tpb[0].control[1] = CW_16bits;
	ccb.gate[0] = GATE_CLOSED;	
	*ip &= ~PG_PROT; *ip |= PG_KR;
	mtpr(SCP, TBIS);
	TM_ATTENTION(ctlr_vaddr, 0xff);	/* execute! */



	if (cywait()) return(0);





	else return(1);
}

/*

 * Due to a design flaw, we cannot ascertain if the tape
 * exists or not unless it is on line - ie: unless a tape is
 * mounted. This is too severe a restriction to bear,
 * so all units are assumed to exist.

 */
/*ARGSUSED*/
cyslave(ui, ctlr_vaddr)
	struct vba_device *ui;
	caddr_t ctlr_vaddr;
{




	return (1);
}

/*
 * Record attachment of the unit to the controller.
 */
/*ARGSUSED*/
cyattach(ui)
	struct vba_device *ui;
{





	/*
	 * Cytotm is used in TMUNIT to index the ccybuf and rcybuf











	 * arrays given a cy unit number.
	 */

	cytotm[ui->ui_unit] = ui->ui_mi->um_ctlr;





}

int	cytimer();

/*

 * Open the device.  Tapes are unique open





 * devices, so we refuse if it is already open.
 * We also check that a tape is available, and
 * don't block waiting here; if you want to wait
 * for a tape you should timeout in user code.
 */
cyopen(dev, flag)

	dev_t dev;
	int flag;
{
	register int cyunit, s;
	register struct vba_device *ui;
	register struct cy_softc *cy;

	cyunit = CYUNIT(dev);
	if (cyunit>=NCY || (cy = &cy_softc[cyunit])->cy_openf ||
	    (ui = cydinfo[cyunit]) == 0 || ui->ui_alive == 0)
		return ENXIO;


	cycommand(dev, (int)DRIVE_S, 1);	/* drive status */
	uncache(&tpb[cyunit].status[0]);
	if ((tpb[cyunit].status[0]&(CS_DR|CS_OL)) != (CS_DR|CS_OL)) {
		uprintf("cy%d: not online\n", cyunit);
		return EIO;
	}

	if ((flag&FWRITE) && (tpb[cyunit].status[0]&CS_P)) {
		uprintf("cy%d: no write ring\n", cyunit);
		return EIO;
	}
	cy->cy_openf = 1;
	cy->cy_blkno = (daddr_t)0;
	cy->cy_nxrec = INF;
	cy->cy_lastiow = 0;
	s = spl8();
	if (cy->cy_tact == 0) {
		cy->cy_timo = INF;
		cy->cy_tact = 1;
		timeout(cytimer, (caddr_t)dev, 5*hz);
	}


	splx(s);
	return 0;
}





/*
 * Close tape device.


 *
 * If tape was open for writing or last operation was
 * a write, then write two EOF's and backspace over the last one.
 * Unless this is a non-rewinding special file, rewind the tape.
 * Make the tape available to others.
 */
cyclose(dev, flag)
	register dev_t dev;
	register flag;
{
	register struct cy_softc *cy = &cy_softc[CYUNIT(dev)];



	if (flag == FWRITE || (flag&FWRITE) && cy->cy_lastiow) {
		cycommand(dev, (int)WRIT_FM, 1);	/* write file mark */
		cycommand(dev, (int)WRIT_FM, 1);
		cycommand(dev, (int)SP_BACK, 1);	/* space back */
	}









	if ((minor(dev)&T_NOREWIND) == 0)
		/*







		 * 0 count means don't hang waiting for rewind complete
		 * rather ccybuf stays busy until the operation completes
		 * preventing further opens from completing by
		 * preventing a SENSE operation from completing.

		 */
		cycommand(dev, (int)REWD_TA, 0);



	cy->cy_openf = 0;



}





















int commflag;	/* signal cystrategy that it is called from cycommand */








/*
 * Execute a command on the tape drive
 * a specified number of times.
 */
cycommand(dev, com, count)
	dev_t dev;
	int com, count;
{


	register struct buf *bp;
	int s;



	bp = &ccybuf[TMUNIT(dev)];
	s = spl8();
	while (bp->b_flags&B_BUSY) {
		/*
		 * This special check is because B_BUSY never
		 * gets cleared in the non-waiting rewind case.
		 */
		if (bp->b_repcnt == 0 && (bp->b_flags&B_DONE))
			break;
		bp->b_flags |= B_WANTED;
		sleep((caddr_t)bp, PRIBIO);

	}

	bp->b_flags = B_BUSY|B_READ;




	splx(s);









	bp->b_dev = dev;













	bp->b_repcnt = count;
	bp->b_command = com;
	bp->b_blkno = 0;
	commflag = 1;
	cystrategy(bp);

	commflag = 0;
	/*
	 * In case of rewind from close, don't wait.
	 * This is the only case where count can be 0.
	 */


	if (count == 0)





		return;


	iowait(bp);



	if (bp->b_flags&B_WANTED)
		wakeup((caddr_t)bp);




	bp->b_flags &= B_ERROR;


}

















/*



 * Queue a tape operation.
 */
cystrategy(bp)
	register struct buf *bp;
{
	int cyunit = CYUNIT(bp->b_dev);



	int s;






	register struct vba_ctlr *um;


	register struct buf *dp;












	/*









	 * Put transfer at end of unit queue





	 */

	dp = &cyutab[cyunit];



	bp->av_forw = NULL;


	s = spl8();
/*



 * Next piece of logic takes care of unusual cases when more than
 * a full block is required. 
 * The driver reads the tape to a temporary buffer and
 * then moves the amount needed back to the process.
 * In this case, the flag NOT1K is set.
 */














































	if (commflag == 0)
		buf_setup(bp, 1);
	um = cydinfo[cyunit]->ui_mi;
	if (dp->b_actf == NULL) {
		dp->b_actf = bp;
		/*

		 * Transport not already active...
		 * put at end of controller queue.
		 */

		dp->b_forw = NULL;
		if (um->um_tab.b_actf == NULL)
			um->um_tab.b_actf = dp;
		else
			um->um_tab.b_actl->b_forw = dp;
		um->um_tab.b_actl = dp;
	} else

		dp->b_actl->av_forw = bp;



	dp->b_actl = bp;
	/*
	 * If the controller is not busy, get

	 * it going.

	 */
	if (um->um_tab.b_active == 0)


		cystart(um);
	splx(s);





}

















/*
 * Start activity on a cypher controller.
 */
cystart(um)
	register struct vba_ctlr *um;

{

	register struct buf *bp, *dp;
	register struct tpb *tp; 

	register struct cy_softc *cy;
	register int phadr;



	int cyunit, timer;




	daddr_t blkno;


	caddr_t	ctlr_vaddr;
	ctlr_vaddr = um->um_addr;
	/*






	 * Look for an idle transport on the controller.



	 */
loop:








	if ((dp = um->um_tab.b_actf) == NULL)










		return;

	if ((bp = dp->b_actf) == NULL) {
		um->um_tab.b_actf = dp->b_forw;
		goto loop;



	}


	cyunit = CYUNIT(bp->b_dev);




	cy = &cy_softc[cyunit];
	tp = &tpb[cyunit];
	/*
	 * Default is that last command was NOT a write command;
	 * if we do a write command we will notice this in cyintr().











	 */
	cy->cy_lastiow = 0;






	uncache(&tp->status[0]);
	uncache(&tp->count);


	cy->cy_count = TM_SHORT(tp->count);
	cy->cy_status[0] = tp->status[0];
	cy->cy_status[1] = tp->status[1];
	if (cy->cy_openf < 0 || 
		(bp->b_command != DRIVE_S) && 
		((tp->status[0]&CS_OL) != CS_OL)) {
		/*
		 * Have had a hard error on a non-raw tape
		 * or the tape unit is now unavailable
		 * (e.g. taken off line).
		 */


		bp->b_flags |= B_ERROR;

		goto next;
	}
	if (bp == &ccybuf[TMUNIT(bp->b_dev)]) {
		/*

		 * Execute control operation with the specified count.
		 * Set next state; give 5 minutes to complete
		 * rewind, or 10 seconds per iteration (minimum 60
		 * seconds and max 5 minutes) to complete other ops.
		 */
		if (bp->b_command == REWD_TA) {
			um->um_tab.b_active = SREW;
			cy->cy_timo = 5 * 60;



		} else {





			um->um_tab.b_active = SCOM;



			cy->cy_timo = imin(imax(10*(int)bp->b_repcnt, 60), 5*60);
		}
		/*



		 * Prepare parameter block for controller







		 */
		tp->cmd = bp->b_command;
		tp->control[0] = (CW_I | (cyunit<<CW_TSs));
		if (minor(bp->b_dev)&T_100IPS)
			tp->control[1] = (CW_100ips | CW_16bits);
		else	tp->control[1] = (CW_25ips | CW_16bits);

		if (bp->b_command == SP_BACK) {



			tp->control[1] |= CW_R;
			tp->cmd = SPACE;
			tp->rec_over = TM_SHORT((short)bp->b_repcnt);


		}
		if (bp->b_command == SP_FORW) 
			tp->rec_over = TM_SHORT((short)bp->b_repcnt);

		if (bp->b_command == SRFM_BK) {
			tp->control[1] |= CW_R;
			tp->cmd = SERH_FM;
			tp->rec_over = TM_SHORT((short)bp->b_repcnt);

		}

		if (bp->b_command == SRFM_FD) 
			tp->rec_over = TM_SHORT((short)bp->b_repcnt);
		tp->status[0] = tp->status[1] = 0;
		tp->count = 0;




		set_pointer((int)&tpb[cyunit], (char *)ccb.pt_tpb);
		goto dobpcmd;
	}
	/*
	 * The following checks handle boundary cases for operation
	 * on non-raw tapes.  On raw tapes the initialization of
	 * cy->cy_nxrec by cyphys causes them to be skipped normally

	 */
	if (bdbtofsb(bp->b_blkno) > cy->cy_nxrec) {




		/*

		 * Can't read past known end-of-file.



		 */
		bp->b_flags |= B_ERROR;




		bp->b_error = ENXIO;
		goto next;

	}



	if (bdbtofsb(bp->b_blkno) == cy->cy_nxrec &&
	    bp->b_flags&B_READ) {
		/*

		 * Reading at end of file returns 0 bytes.
		 */


		bp->b_resid = bp->b_bcount;
		clrbuf(bp);




		goto next;
	}
	if ((bp->b_flags&B_READ) == 0)
		/*
		 * Writing sets EOF





		 */
		cy->cy_nxrec = bdbtofsb(bp->b_blkno) + 1;
	/*
	 * If the data transfer command is in the correct place,
	 * set up the tape parameter block, and start the i/o.
	 */
	if ((blkno = cy->cy_blkno) == bdbtofsb(bp->b_blkno)) {
		um->um_tab.b_active = SIO;
		cy->cy_timo = 60;	/* premature, but should serve */


		phadr = get_ioadr(bp, cybuf, CYmap, cyutl);



		if ( (bp->b_flags & B_READ) == 0) 








			tp->cmd = WRIT_BU;



		else tp->cmd = READ_BU;






		tp->control[0] = (CW_I | (cyunit<<CW_TSs));














		if (minor(bp->b_dev)&T_100IPS)
			tp->control[1] = (CW_100ips | CW_16bits);
		else	tp->control[1] = (CW_25ips | CW_16bits);

		tp->status[0] = tp->status[1] = 0;

		tp->count = 0;


		tp->size = TM_SHORT(bp->b_bcount);



		set_pointer(phadr, (char *)tp->pt_data);

















		set_pointer((int)&tpb[cyunit], (char *)ccb.pt_tpb);


		goto dobpcmd;





	}
	/*
	 * Tape positioned incorrectly;
	 * set to seek forwards or backwards to the correct spot.
	 */
	um->um_tab.b_active = SSEEK;
	tp->cmd = SPACE;

	tp->control[0] = (CW_I | (cyunit<<CW_TSs));
	if (minor(bp->b_dev)&T_100IPS)

		tp->control[1] = (CW_100ips | CW_16bits);
	else	tp->control[1] = (CW_25ips | CW_16bits);

	tp->status[0] = tp->status[1] = 0;

	set_pointer((int)&tpb[cyunit], (char *)ccb.pt_tpb);

	if (blkno < bdbtofsb(bp->b_blkno)) 


		tp->rec_over = TM_SHORT((short)(blkno - bdbtofsb(bp->b_blkno)));

	else {

		tp->rec_over = TM_SHORT((short)(bdbtofsb(bp->b_blkno) - blkno));





















		tp->control[1] |= CW_R;





	}












	cy->cy_timo = imin(imax(10 * (int)TM_SHORT(tp->rec_over), 60), 5 * 60);
dobpcmd:
	/*
	 * Do the command in bp.







	 */
	timer = 8000;			/* software tolerance for gate open */
	uncache(&ccb.gate[0]);
	while (ccb.gate[0] != GATE_OPEN) {
		if (--timer == 0) {
			ccb.ccw[0] = 0x9;	/* forget it...... */
			TM_RESET(ctlr_vaddr, 0xff);
			bp->b_flags |= B_ERROR;
			goto next;
		}
		uncache(&ccb.gate[0]);
	}
	ccb.ccw[0] = 0x11;		/* normal mode */
	ccb.gate[0] = GATE_CLOSED;	
	TM_ATTENTION(ctlr_vaddr, 0xff);		/* execute! */
	return;



next:
	/*
	 * Done with this operation due to error or
	 * the fact that it doesn't do anything.
	 * dequeue the transfer and continue processing this slave.


	 */

	um->um_tab.b_errcnt = 0;





	dp->b_actf = bp->av_forw;









	iodone(bp);
	goto loop;
}



/*
 * Kept for historical reasons. Probably not neccessary. 







 */
cydgo(um)







	struct vba_ctlr *um;





{








}














/*
 * Cy interrupt routine.
 */
/*ARGSUSED*/
cyintr(ctlr)
	int ctlr;
{
	struct buf *dp;
	register struct buf *bp;
	register struct tpb *tp;




	register struct vba_ctlr *um = cyminfo[ctlr];









	register struct cy_softc *cy;
	caddr_t ctlr_vaddr;








	int cyunit;
	register state;











	/*
	 * First we clear the interrupt and close the gate.

	 */
	ctlr_vaddr = um->um_addr;

	ccb.ccw[0] = 0x9;	/* clear the interrupt */

	ccb.gate[0] = GATE_CLOSED;
	set_pointer((int)&cycool, (char *)ccb.pt_tpb);

	cycool.cmd = NO_OP;	/* no operation */
	cycool.control[0] = 0;	/* No INTERRUPTS */



	cycool.control[1] = 0;

	TM_ATTENTION(ctlr_vaddr, 0xff);	/* cool it ! */
	cywait();
	/*
	 * Now we can start handling the interrupt.

	 */
	pflag = 1;		/* set for the probe routine */
	if (intenable == 0) return;	/* ignore all interrupts */

	if ((dp = um->um_tab.b_actf) == NULL)

		return;






	bp = dp->b_actf;

	cyunit = CYUNIT(bp->b_dev);
	tp = &tpb[cyunit];

	cy = &cy_softc[cyunit];
	/*
	 * If last command was a rewind, and tape is still
	 * rewinding, wait for the rewind complete interrupt.
	 */
	if (um->um_tab.b_active == SREW) {







		um->um_tab.b_active = SCOM;


		/* uncache(&tp->status[1]); */


		/* if (tp->status[1]&CS_CC != CS_CC) { */ /* not completed */
			/* cy->cy_timo = 5*60; */	 /* 5 minutes */








			/* return; */
		/* } */




	}



	/*
	 * An operation completed... update status


	 */
	cy->cy_timo = INF;
	uncache(&tp->count);

	uncache(&tp->status[0]);


	cy->cy_count = TM_SHORT(tp->count);



	cy->cy_status[0] = tp->status[0];
	cy->cy_status[1] = tp->status[1];




	if ((bp->b_flags & B_READ) == 0)
		cy->cy_lastiow = 1;
	state = um->um_tab.b_active;



	um->um_tab.b_active = 0;
	/*




	 * Check for errors.

	 */
	if (tp->status[1] & CS_ERm) {
		/*
		 * If we hit the end of the tape file, update our position.





		 */
		if (tp->status[0] & CS_FM) 


		{
			cyseteof(bp);		/* set blkno and nxrec */


			state = SCOM;
			goto opdone;
		}
		/* If reading raw device and block was too short ignore the
		 * error and let the user program decide what to do.
		 */
		if ((tp->status[0] & ER_TOF) && /* (bp->b_flags & B_PHYS) && */

			(bp->b_flags & B_READ)) goto cont;
		cy->cy_openf = -1;		/* cause to close */

		printf("cy%d: hard error bn %d er=%x\n", cyunit,

		    bp->b_blkno, tp->status[1]&CS_ERm);
		bp->b_flags |= B_ERROR;
		goto opdone;

	}

	/*




	 * If we were reading block tape and the record
	 * was too long, we consider this an error.












	 */











cont:

	uncache(&tp->count);

	uncache(&tp->cmd);


	if (bp != &rcybuf[TMUNIT(bp->b_dev)] && (tp->cmd == READ_BU) &&
	    bp->b_bcount < TM_SHORT(tp->count)) {
		cy->cy_openf = -1;		/* cause to close */
		printf("cy%d: error - tape block too long \n", cyunit);
		bp->b_flags |= B_ERROR;
		goto opdone;
	}
	/*





	 * No errors.
	 * Advance tape control FSM.


	 */
	switch (state) {






























	case SIO:
		/*
		 * Read/write increments tape block number
		 */
		cy->cy_blkno++;
		end_transfer(bp, cybuf, CYmap, cyutl);
		goto opdone;

	case SCOM:

		/*




		 * For forward/backward space record update current position.

		 */
		if (bp == &ccybuf[TMUNIT(bp->b_dev)])









		switch (bp->b_command) {





		case SP_FORW:
			cy->cy_blkno += bp->b_repcnt;


			break;

		case SP_BACK:
			cy->cy_blkno -= bp->b_repcnt;


			break;
		}



		goto opdone;









	case SSEEK:


		cy->cy_blkno = bdbtofsb(bp->b_blkno);
		goto opcont;




	default:




		panic("cyintr");
	}
opdone:

	/*
	 * Reset error count and remove
	 * from device queue.
	 */
	um->um_tab.b_errcnt = 0;





	dp->b_actf = bp->av_forw;






	uncache(&tp->count);








	bp->b_resid = bp->b_bcount - TM_SHORT(tp->count);
	iodone(bp);
	/*


	 * Circulate slave to end of controller
	 * queue to give other slaves a chance.
	 */
	um->um_tab.b_actf = dp->b_forw;

	if (dp->b_actf) {

		dp->b_forw = NULL;
		if (um->um_tab.b_actf == NULL)
			um->um_tab.b_actf = dp;
		else
			um->um_tab.b_actl->b_forw = dp;

		um->um_tab.b_actl = dp;
	}
	if (um->um_tab.b_actf == 0)
		return;






opcont:




	cystart(um);

}







cytimer(dev)

	int dev;
{
	register struct cy_softc *cy = &cy_softc[CYUNIT(dev)];

	int	s;





	if (cy->cy_timo != INF && (cy->cy_timo -= 5) < 0) {
		printf("cy%d: lost interrupt\n", CYUNIT(dev));



		cy->cy_timo = INF;
		s = spl8();
		cyintr(TMUNIT(dev));
		splx(s);
		return;
	}
	if (cy->cy_timo != INF ) timeout(cytimer, (caddr_t)dev, 5*hz);



}

cyseteof(bp)

	register struct buf *bp;
{




















	register int cyunit = CYUNIT(bp->b_dev);
	register struct cy_softc *cy = &cy_softc[cyunit];
	register struct tpb *tp;

	tp = &tpb[cyunit];
	uncache(&tp->rec_over);
	if (bp == &ccybuf[TMUNIT(bp->b_dev)]) {
		if (cy->cy_blkno > bdbtofsb(bp->b_blkno)) {
			/* reversing */

			cy->cy_nxrec = bdbtofsb(bp->b_blkno) - (int)TM_SHORT(tp->rec_over);
			cy->cy_blkno = cy->cy_nxrec;

		} else {
			/* spacing forward */
			cy->cy_blkno = bdbtofsb(bp->b_blkno) + (int)TM_SHORT(tp->rec_over);
			cy->cy_nxrec = cy->cy_blkno - 1;











		}

		return;













	} 
	/* eof on read */
	cy->cy_nxrec = bdbtofsb(bp->b_blkno);
}

cyread(dev, uio)
dev_t dev;
struct uio *uio;
{

	register error;


	error = cyphys(dev, uio);
	if (error)
		return error;
	while (cybufused) sleep (&cybufused, PRIBIO+1);
	cybufused = 1;
	error = physio(cystrategy, &rcybuf[TMUNIT(dev)], dev, B_READ, tminphys, uio);
	cybufused = 0;
	wakeup (&cybufused);
	return error;
}

cywrite(dev, uio)
dev_t dev;
struct uio *uio;
{
	register error;

	error = cyphys(dev, uio);
	if (error)
		return error;
	while (cybufused) sleep (&cybufused, PRIBIO+1);
	cybufused = 1;
	error = physio(cystrategy, &rcybuf[TMUNIT(dev)], dev, B_WRITE, tminphys, uio);
	cybufused = 0;
	wakeup (&cybufused);
	return error;
}






cyreset(uban)
	int uban;

{

	register struct vba_ctlr *um;
	register cy0f, cyunit;
	register struct vba_device *ui;


	register struct buf *dp;

	for (cy0f = 0; cy0f < NTM; cy0f++) {
		if ((um = cyminfo[cy0f]) == 0 || um->um_alive == 0 ||
		   um->um_vbanum != uban)
			continue;
		printf(" cy%d", cy0f);
		um->um_tab.b_active = 0;
		um->um_tab.b_actf = um->um_tab.b_actl = 0;
		for (cyunit = 0; cyunit < NCY; cyunit++) {
			if ((ui = cydinfo[cyunit]) == 0 || ui->ui_mi != um ||
			    ui->ui_alive == 0)
				continue;
			dp = &cyutab[cyunit];
			dp->b_active = 0;
			dp->b_forw = 0;
			dp->b_command = DRIVE_R;
			if (um->um_tab.b_actf == NULL)
				um->um_tab.b_actf = dp;
			else
				um->um_tab.b_actl->b_forw = dp;
			um->um_tab.b_actl = dp;

			if (cy_softc[cyunit].cy_openf > 0)
				cy_softc[cyunit].cy_openf = -1;
		}
		cystart(um);
	}


}


cyioctl(dev, cmd, data, flag)
	caddr_t data;
	dev_t dev;
{
	int cyunit = CYUNIT(dev);
	register struct cy_softc *cy = &cy_softc[cyunit];
	register struct buf *bp = &ccybuf[TMUNIT(dev)];
	register callcount;
	int fcount;
	struct mtop *mtop;
	struct mtget *mtget;
	/* we depend of the values and order of the MT codes here */


	static cyops[] =
	   {WRIT_FM, SRFM_FD, SRFM_BK, SP_FORW, SP_BACK, REWD_TA, OFF_UNL, NO_OP};


	switch (cmd) {
		case MTIOCTOP:	/* tape operation */
		mtop = (struct mtop *)data;
		switch(mtop->mt_op) {
		case MTWEOF:
			callcount = mtop->mt_count;
			fcount = 1;
			break;
		case MTFSF: case MTBSF:
			callcount = mtop->mt_count;
			fcount = INF;
			break;
		case MTFSR: case MTBSR:
			callcount = 1;
			fcount = mtop->mt_count;
			break;
		case MTREW: case MTOFFL: case MTNOP:
			callcount = 1;
			fcount = 1;
			break;
		default:
			return ENXIO;
		}



		if (callcount <= 0 || fcount <= 0)
			return EINVAL;
		while (--callcount >= 0) {
			cycommand(dev, cyops[mtop->mt_op], fcount);
			if ((bp->b_flags&B_ERROR) || cy->cy_status[1]&CS_ERm)
				break;
		}
		return geterror(bp);
	case MTIOCGET:
		mtget = (struct mtget *)data;

		mtget->mt_dsreg = cy->cy_status[0];


		mtget->mt_erreg = cy->cy_status[1];
		mtget->mt_resid = cy->cy_count;
		mtget->mt_type = MT_ISCY;
		break;
	default:


		return ENXIO;
	}


	return 0;
}



/*
 * Check that a raw device exists.
 * If it does, set up cy_blkno and cy_nxrec
 * so that the tape will appear positioned correctly.
 */

cyphys(dev, uio)
dev_t dev;
struct uio *uio;
{
	register int cyunit = CYUNIT(dev);
	register daddr_t a;
	register struct cy_softc *cy;
	register struct vba_device *ui;

	if (cyunit >= NCY || (ui=cydinfo[cyunit]) == 0 || ui->ui_alive == 0)
		return ENXIO;
	cy = &cy_softc[cyunit];
	a = bdbtofsb(uio->uio_offset >> PGSHIFT);
	cy->cy_blkno = a;
	cy->cy_nxrec = a + 1;

	return 0;
}

/*




 *  Set a TAPEMASTER pointer (first parameter), into the
 *  4 bytes array pointed by the second parameter.
 */

set_pointer(pointer, dest)
int pointer;

char * dest;
{
	*dest++ = pointer & 0xff;		/* low byte - offset */
	*dest++ = (pointer >> 8) & 0xff;	/* high byte - offset */
	*dest++ = 0; 
	*dest   = (pointer & 0xf0000) >> 12;	/* base */
}

cydump(dev)
dev_t	dev;
{
	register struct vba_device *ui;




	register struct tpb *tp;
	int cyunit = CYUNIT(dev);
	int blk, num;
	int start;

	start = 0x800;
	num = maxfree;
	tp = &tpb[cyunit];
	if (cyunit >= NCY || (ui=cydinfo[cyunit]) == 0 || ui->ui_alive == 0) 
		return(ENXIO);
	if (cywait) return(EFAULT);
	while (num > 0) {
		blk = num > TBUFSIZ ? TBUFSIZ : num;
		bcopy(start*NBPG, cybuf, blk*NBPG);
		tp->cmd = WRIT_BU;	
		tp->control[0] = cyunit<<CW_TSs;
		tp->control[1] = (CW_100ips | CW_16bits);
		tp->status[0] = tp->status[1] = 0;
		tp->size = TM_SHORT(blk*NBPG);
		set_pointer((int)cybuf, (char *)tp->pt_data);
		set_pointer((int)&tpb[cyunit], (char *)ccb.pt_tpb);
		ccb.gate[0] = GATE_CLOSED;	
		TM_ATTENTION(cyaddr, 0xff);		/* execute! */
		start += blk;
		num -= blk;
		if (cywait) return(EFAULT);

		uncache(&tp->status[1]);
		if (tp->status[1]&CS_ERm)		/* error */

			return (EIO);
	}
	cyeof(tp, cyunit);
	if (cywait) return(EFAULT);
	cyeof(tp, cyunit);
	if (cywait) return(EFAULT);
	uncache(&tp->status[1]);
	if (tp->status[1]&CS_ERm)		/* error */
		return (EIO);
	cyrewind(tp, cyunit);
	return (0);
}




cywait()

{
	register cnt;




	cnt = 5000;		/* 5 seconds timeout */
	do {
		--cnt;
		DELAY(1000);
		uncache(&ccb.gate[0]);
	}
	while (cnt>0 && ccb.gate[0] == GATE_CLOSED);
	if (cnt == 0) return(1);	/* timeout */
	else return(0);
}







cyeof(tp, unit)

	register struct tpb *tp;
	int unit;
{



	tp->cmd = WRIT_FM;	
	tp->control[0] = unit<<CW_TSs;
	tp->control[1] = (CW_100ips | CW_16bits);
	tp->status[0] = tp->status[1] = 0;
	tp->rec_over = TM_SHORT(1);
	set_pointer((int)&tpb[unit], (char *)ccb.pt_tpb);
	ccb.gate[0] = GATE_CLOSED;	
	TM_ATTENTION(cyaddr, 0xff);		/* execute! */
}






cyrewind(tp, unit)
	register struct tpb *tp;
	int unit;
{
	tp->cmd = REWD_TA;	

	tp->control[0] = unit<<CW_TSs;

	tp->control[1] = (CW_100ips | CW_16bits);
	tp->status[0] = tp->status[1] = 0;
	set_pointer((int)&tpb[unit], (char *)ccb.pt_tpb);

	ccb.gate[0] = GATE_CLOSED;	
	TM_ATTENTION(cyaddr, 0xff);		/* execute! */
}

unsigned
tminphys(bp)
register struct buf *bp;
{

	if (bp->b_bcount > sizeof cybuf)
		bp->b_bcount = sizeof cybuf;
}
#endif
|
<


|

|
|
>
|
|
|
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
>
>
>
>
>
>
>

|
>
>

|
>

<
<
<
<
>
>
|
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
<
<
>
|
<
>
|
|
>
>
|
<
<
>
>
>
>
>
>
>
|
>
|
>
>

|
<
<
|
<
|
>
>
>
>
>
>
>
>
|
|
<
<
<
<
|
|
|
>

|
<
|
>
|
<
|
<
|
<
|
|
|
>
>
>
>
>
>
>
>
>
|
<
>
>
>
>
|
<
>
>
>


|
>
>
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
|
<
<
|
<
>
|
<
<
<
|
>
>
>
>
|
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<

<
>
>
>

<
>
>
|
>
>
>
>
>
>
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<

|
<
>
|
<
|
|
>
>
>
>
>
>
>
>
>
<
<
<
<
<
<
<

|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

>
|
|
>
|

|

<
>
>
>
|
>
|

|

>
>
>
>
>
>
>
>
>
>
|
<
|
|
<
<
|
>
>
>
|
>
>
>
>
>
|



>
|
<
<
<
>

<
|
|
|


>
>
>



<
<
<
<
|
|

>
>
>
>

|
|
>
>
>
>
>
>
>
>
>
>
>
|
<
>
|
>
>
>
>
>


|
>
|
>
|
>
>
>
>
>
|
<
<
<
<

>
|
<

|
<
|

|
<
|
|
>
>
|
|
<
<
|
<
>
|
<
<
<
<
<
<
|
<
|
<
<
<

>
>
|
|
|
>
>
>
>
|
<
<
>
>
|
<
<
<
<
<




|
>

>
|
|
|
|

>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
|
<
<
<
>
|
|
>
>
>
|
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
|
<
<
<
|
|
<

>
>
|

>
>
|
|
|
|
<
<
<
<
|
<
|
|
>

>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
<
>
|
|
|
|
|
>
>
|
>
>
>
>
>
|
>
>
|
>
>
>
|
<
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>

>
>
>
|

|
|

|
>
>
>
|
>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
|
>
>
>
|
>
>
|
<
>
>
>
|
<
<
<
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
|
|
|
|
<
>
|
<
<
>
|
<
|
|
<
|
|
>
|
>
>
>
|
|
<
>
|
>
|
<
>
>
|
<
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>

|

|
|
>

>
|
|
>
|
|
>
>
>
|
>
>
>
>
|
>
>
|
<
|
>
>
>
>
>
>
|
>
>
>
|
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
|
>
|
|
|
>
>
>
|
>
>
|
>
>
>
>
|
|
|
|
<
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
|
|
>
>
|
|
<
<
|
<
<
<
|
|
<
>
>
|
>
|
|
|
<
>
|
<
<
<
<
|
<
|
>
>
>
|
>
>
>
>
>
|
>
>
>
|
|
|
>
>
>
|
>
>
>
>
>
>
>
|
|
<
|
|
|
>
|
>
>
>
|
|
|
>
>
|
|
|
>
|
<
<
|
>

>
|
<
<
|
>
>
>
>
|
<
|
|
<
<
<
>
|
<
>
>
>
>
|
>
|
>
>
>
|
|
>
>
>
>
|
<
>
|
>
>
>
|
|
<
>
|
<
>
>
|
<
>
>
>
>
|
|
|
|
<
>
>
>
>
>
|
<
|
<
<
<
<
|
<
>
|
|
>
>
|
|
>
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
|
>
|
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
|
|
|
|
|
|
|
>
|
|
>
|
<
>
|
>
|
>
|
>
>
|
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>
>
>
>
>
>
>
|
<
<
<
<
<
<
<
<
|
<
<
<
<
<
|
>
>
|
<
<
|
|
|
>
>
|
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
<
|
|
>
>

<
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>

<
|
<
<
<
|
|
|
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
|
>
>
|
<
>
|
|
>
|
>
|
<
>
|
<
>
>
>
|
>
|
|
|
<
>
|
|
<
>
|
>
|
>
>
>
>
>
>
|
>
|
|
>
|
|
|
|
|
|
>
>
>
>
>
>
>
|
>
>
|
>
>
|
<
>
>
>
>
>
>
>
>
|
<
>
>
>
>

>
>
>

<
>
>
|
<
|
>
|
>
>
|
>
>
>
|
<
>
>
>
>
|
<
<
>
>
>
|
<
>
>
>
>
|
>
|
|
|
<
>
>
>
>
>
|
|
>
>
|
<
>
>
|
<
|
<
<
<
|
>
|
<
>
|
>
|
<
<
>
|
>
|
>
>
>
>
|
<
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
|
>
>
|
<
<
<
<
<
|
|
>
>
>
>
>
|
<
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
<
<
<
<
<
<
|
|
>
|
>
>
>
>
|
>
|
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
|
|
>
>
|
|
<
|
>
>
|
|
>
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
|
|
|
>
>
>
|
>
>
>
>
|
|
|
>
|
<
|
|
|
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
|
|
>
>
|
<
|
|
>
|
>
|
<
<
|
|
>
|
|
|
|
>
>
>
>
>
>
|
>
>
>
>
|
>


>
>
>
>
>
>
|
>
|

|
>
|
>
>
>
>
|
|
|
>
>
>
|
|
<
<
<
|
|
>
>
>
|
|
|
>
|
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
|
|
|
|
|
<
|
>
|
|
>
|
<
|
|
>
>
>
>
>
>
>
>
>
>
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
<



|
|

>
|
>
|
<
<
<
<
<
<
<
<
<
|


|
|

|

<
<
|
<
<
<
<
<
<


>
>
>
>
|
|
<
>
|
>
|
|
<
>
>
|
|
<
<
<
<
<
<
<
<
|
|
|
|
|
|
|
|
|
<
|
|
>
|
<
|
<
|
>
>
|
|
|
<
<
<
<
<
<
<
<
<
<
|
|
>
>
|
<
>
|
<
<
|
|
|
<
|
|
<
<
<
|
<
<
<
|
<
<
<
<
<
<
|
>
>
>
|
|
|
|
|
|
<
<
<
|
>
|
>
>
|
|
|
|
|
>
>
|
<
>
>
|
|
|
|
|
<
<
<
|
<
>
|
|
<
<
<
|
|
<
|
|
|
<
<
|
<
>
|
|
|
<
>
>
>
>
|
|
<
>
|
|
>
|
<
<
<
|
<

<
<
<
<
|
>
>
>
>
|
<
<
<
|
<
|
|
<
<
<
<
<
<
|
<
<
<
<
<
<
|
<
<
<
<
>
|
<
>
|
|
<
<
<
<
<
<
<
<
<
|
|
>
>
>
|
>

|
>

>
>
|
<
<
|
<
|
<
<
<
|
|
>
>
>
>
>
>
|
>
|
<

>
>
>
<
<
<
<
<
<
<
<
|
|
>
>
>
>
|
<
|
|
|
|
>
|
>
|
<
<
>
|
<
|
|
<
<
<
<
<
<
<


1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44




45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67


68
69

70
71
72
73
74
75


76
77
78
79
80
81
82
83
84
85
86
87
88
89


90

91
92
93
94
95
96
97
98
99
100
101




102
103
104
105
106
107

108
109
110

111

112

113
114
115
116
117
118
119
120
121
122
123
124
125

126
127
128
129
130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158

159
160


161

162
163



164
165
166
167
168
169











170











171

172
173
174
175

176
177
178
179
180
181
182
183
184
185
186
187
188













189
190

191
192

193
194
195
196
197
198
199
200
201
202
203







204
205






















206
207
208
209
210
211
212
213
214
215

216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

236
237


238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253



254
255

256
257
258
259
260
261
262
263
264
265
266




267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308




309
310
311

312
313

314
315
316

317
318
319
320
321
322


323

324
325






326

327



328
329
330
331
332
333
334
335
336
337
338


339
340
341





342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415



416
417

418
419
420
421
422
423
424
425
426
427
428




429

430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467

468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489

490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576

577
578
579
580





581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631

632
633


634
635

636
637

638
639
640
641
642
643
644
645
646

647
648
649
650

651
652
653

654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701

702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753

754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778


779



780
781

782
783
784
785
786
787
788

789
790




791

792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821

822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839


840
841
842
843
844


845
846
847
848
849
850

851
852



853
854

855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871

872
873
874
875
876
877
878

879
880

881
882
883

884
885
886
887
888
889
890
891

892
893
894
895
896
897

898




899

900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992

993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057








1058





1059
1060
1061
1062


1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086

1087
1088
1089
1090
1091

1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138

1139



1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181

1182
1183
1184
1185
1186
1187
1188

1189
1190

1191
1192
1193
1194
1195
1196
1197
1198

1199
1200
1201

1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236

1237
1238
1239
1240
1241
1242
1243
1244
1245

1246
1247
1248
1249
1250
1251
1252
1253
1254

1255
1256
1257

1258
1259
1260
1261
1262
1263
1264
1265
1266
1267

1268
1269
1270
1271
1272


1273
1274
1275
1276

1277
1278
1279
1280
1281
1282
1283
1284
1285

1286
1287
1288
1289
1290
1291
1292
1293
1294
1295

1296
1297
1298

1299



1300
1301
1302

1303
1304
1305
1306


1307
1308
1309
1310
1311
1312
1313
1314
1315

1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347





1348
1349
1350
1351
1352
1353
1354
1355

1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390






1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423

1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460

1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490

1491
1492
1493
1494
1495
1496


1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543



1544
1545
1546
1547
1548
1549
1550
1551
1552
1553

1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574

1575
1576
1577
1578
1579

1580
1581
1582
1583
1584
1585

1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615


1616
1617
1618
1619
1620
1621
1622
1623
1624
1625









1626
1627
1628
1629
1630
1631
1632
1633


1634






1635
1636
1637
1638
1639
1640
1641
1642

1643
1644
1645
1646
1647

1648
1649
1650
1651








1652
1653
1654
1655
1656
1657
1658
1659
1660

1661
1662
1663
1664

1665

1666
1667
1668
1669
1670
1671










1672
1673
1674
1675
1676

1677
1678


1679
1680
1681

1682
1683



1684



1685






1686
1687
1688
1689
1690
1691
1692
1693
1694
1695



1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708

1709
1710
1711
1712
1713
1714
1715



1716

1717
1718
1719



1720
1721

1722
1723
1724


1725

1726
1727
1728
1729

1730
1731
1732
1733
1734
1735

1736
1737
1738
1739
1740



1741

1742




1743
1744
1745
1746
1747
1748



1749

1750
1751






1752






1753




1754
1755

1756
1757
1758









1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772


1773

1774



1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785

1786
1787
1788
1789








1790
1791
1792
1793
1794
1795
1796

1797
1798
1799
1800
1801
1802
1803
1804


1805
1806

1807
1808







1809
1810
/*	cy.c	1.2	86/01/05	*/


#include "cy.h"
#if NCY > 0
/*
 * Cipher Tapemaster driver.
 */
int	cydebug = 0;

#include "../tahoe/mtpr.h"
#include "../tahoe/pte.h"

#include "param.h"
#include "systm.h"
#include "vm.h"
#include "buf.h"
#include "file.h"
#include "dir.h"
#include "user.h"
#include "proc.h"
#include "signal.h"
#include "uio.h"
#include "ioctl.h"
#include "mtio.h"
#include "errno.h"
#include "cmap.h"

#include "../tahoevba/vbavar.h"
#include "../tahoevba/cyreg.h"

#define	MAXCONTROLLERS		4
#define MAX_BLOCKSIZE		(TBUFSIZ*NBPG)
#define NUM_UNIT		(NCY * 4)

#define	TRUE			1
#define	FALSE			0

#define	RETRY			1
#define EXTEND			2
#define	FATAL			3

#define	MAINTAIN_POSITION	0
#define	DONT_MAINTAIN_POSITION	1





#define	PROCESSED		0x80000000
#define	SLEEPING		0x80000000
#define	b_cmd	av_back		/* only unused word in request */

extern	int cywrite_filemark(), cysearch_fm_forw(), cysearch_fm_back();
extern	int cy_space_forw(), cy_space_back(), cyrewind_tape_ta();
extern	int cyrewind_tape_unl(), cydrive_status(), cyrewind_tape_ov();
extern	int cyraw_read(), cyraw_write(), cybuf_read(), cybuf_write();
extern	int cywait_until_ready(), cywrite_0_fm(), cywrite_1_fm();
extern	int cywrite_2_fm(), cyno_op(), cywrite_eov();

static	int (*cmd_tbl[15])() = {
	cywrite_filemark,
#define	DO_W_FM	0
	cysearch_fm_forw,
#define	DO_SFMF	1
	cysearch_fm_back,
#define	DO_SFMB	2
	cy_space_forw,
#define	DO_SPF	3
	cy_space_back,
#define	DO_SPB	4
	cyrewind_tape_ta,


#define	DO_RWTA	5
	cyrewind_tape_unl,

#define	DO_RWUN	6
	cydrive_status,
#define	DO_STAT	7
	cyrewind_tape_ov,
#define	DO_RWOV	8
	cywait_until_ready,


#define DO_WAIT 9
	cywrite_eov,
#define DO_WEOV	10
	cyraw_read,
#define DO_RRD	11
	cyraw_write,
#define DO_RWT	12
	cybuf_read,
#define DO_BRD	13
	cybuf_write
#define DO_BWT	14
};




extern	int cyprobe(), cyslave(), cyattach(), cydgo();

extern unsigned	cyminsize();
#if NCY > 0
extern	char	cy0utl[];
#endif
#if NCY > 1
extern	char	cy1utl[];
#endif
static	fmt_scp *scp_ptrs[MAXCONTROLLERS] =
    { (fmt_scp *)0xc0000c06, (fmt_scp *)0xc0000c16, };
struct	vba_ctlr *cyminfo[NCY];
struct	vba_device *cydinfo[NUM_UNIT];




struct vba_driver cydriver = {
    cyprobe, cyslave, cyattach, cydgo, (long *)scp_ptrs,
    "yc", cydinfo, "cy", cyminfo
};

/*

 * Per-controller data structure.
 */
typedef struct {

	struct pte	*map;

	char		*utl;

	int		(*interupt_path)();
	label_t		environ;  /* Environment variable for longjmps */
	struct buf	*my_request;
	struct buf	*wakeup_request;
	short		bs;	  /* buffer size */
	fmt_ccb		ccb;	  /* Channel control blocks */
	fmt_scb		scb;	  /* System configuration blocks */
	fmt_tpb		tpb;	  /* Tape parameter blocks */
	fmt_tpb		last;	  /* Tape parameter blocks */
	fmt_tpb		noop;	  /* Tape parameter blocks */
	long		rawbuf[MAX_BLOCKSIZE/sizeof(long)+1];
} ctlr_tab;


extern	int cy_normal_path();
ctlr_tab ctlr_info[NCY] = {
#if NCY > 0
	{CY0map, cy0utl, cy_normal_path},
#endif

#if NCY > 1
	{CY1map, cy1utl, cy_normal_path},
#endif
};

/*
 * Per-drive information.
 */
typedef struct {
	int		(*cleanup)();
	struct buf	u_queue;
	struct buf	rawbp;
	long		blkno;
	long		file_number;
	short		last_control;
	short		last_status;
	short		last_resid;
	unsigned long	bad_count;
	unsigned	control_proto: 16;
	unsigned	error_count  : 8;
	unsigned	open	     : 1;
	unsigned	eof	     : 1;
	unsigned	bot	     : 1;
	unsigned	eot	     : 1;
	char		*message;
} unit_tab;
unit_tab unit_info[NUM_UNIT];


cyprobe(ctlr_vaddr)
	register caddr_t ctlr_vaddr;


{

	static int ctlr = -1;			/* XXX */




	ctlr++;
	if (badcyaddr(ctlr_vaddr + 1) || 
	    !cy_init_controller(ctlr_vaddr, ctlr, 1))
		return (0);
	return (sizeof (caddr_t));		/* XXX */
}























/*

 * Initialize the controller after a controller reset or during autoconfigure.
 * All of the system control blocks are initialized and the controller is
 * asked to configure itself for later use.
 *

 * If the print value is true cy_first_TM_attention will anounce
 * the type of controller we are (Tapemasher) and will print the size
 * of the internal controller buffer.
 */
cy_init_controller(ctlr_vaddr, ctlr, print)
	register caddr_t ctlr_vaddr;
	register int ctlr, print;
{
	register int *pte;
	register fmt_scp *SCP;
	register fmt_scb *SCB;
	register fmt_ccb *CCB;
	register ctlr_tab *ci;














	/*

	 * Initialize the system configuration pointer.
	 */

	SCP = scp_ptrs[ctlr];
	/* make kernel writable */
	pte = (int *)vtopte((struct proc *)0, btop(SCP)); 
	*pte &= ~PG_PROT; *pte |= PG_KW;
	mtpr(TBIS, SCP);
	/* load the correct values in the scp */
	SCP->bus_size = _16_BITS;
	load_mbus_addr((caddr_t)&ctlr_info[ctlr].scb, SCP->scb_ptr);
	/* put it back to read-only */
	*pte &= ~PG_PROT; *pte |= PG_KR;
	mtpr(TBIS, SCP);








	/*






















	 * Init system configuration block.
	 */
	SCB = &ctlr_info[ctlr].scb;
	SCB->fixed_value = 0x3;
	/* set pointer to the channel control block */
	load_mbus_addr((caddr_t)&ctlr_info[ctlr].ccb, SCB->ccb_ptr);

	/*
	 * Initialize the chanel control block.
	 */

	CCB = &ctlr_info[ctlr].ccb;
	CCB->ccw = CLEAR_INTERUPT;
	CCB->gate = GATE_OPEN;
	/* set pointer to the tape parameter block */
	load_mbus_addr((caddr_t)&ctlr_info[ctlr].tpb, CCB->tpb_ptr);

	/*
	 * Issue a noop cmd and get the internal buffer size for buffered i/o.
	 */
	ci = &ctlr_info[ctlr];
	/* set command to be CONFIGURE */
	ci->tpb.cmd = NO_OP;
	ci->tpb.control = CW_16bits;
	ci->ccb.gate = GATE_CLOSED;	
	CY_ATTENTION(ctlr_vaddr);	/* execute! */
	if (cywait(&ci->ccb) || (ci->tpb.status & CS_ERm)) {
		printf("yc%d: time-out during init\n", ctlr);
		return (0);
	}
	ci->tpb.cmd = CONFIG;

	ci->tpb.control = CW_16bits;
	ci->ccb.gate = GATE_CLOSED;	


	CY_ATTENTION(ctlr_vaddr);	/* execute! */
	if (cywait(&ci->ccb) || (ci->tpb.status & CS_ERm)) {
		cyprint_err("Tapemaster configuration failure",
		    0, ci->tpb.status);
		return (0);
	}
	uncache(&ci->tpb.count);
	ci->bs = MULTIBUS_SHORT(ci->tpb.count);
	if (print)
		printf("yc%d: %dKb buffer\n", ctlr, ci->bs/1024);
	return (1);
}

/*
 * Check to see if a drive is attached to a controller.
 * Since we can only tell that a drive is there if a tape is loaded and



 * the drive is placed online, we always indicate the slave is present.
 */

cyslave(vi, addr)
	struct vba_device *vi;
	caddr_t addr;
{

#ifdef lint
	vi = vi; addr = addr;
#endif
	return (1);
}





cyattach(dev_info)
	struct vba_device *dev_info;
{
	register unit_tab *ui = &unit_info[dev_info->ui_unit];
	register struct buf *cq = &dev_info->ui_mi->um_tab;
	register struct buf *uq = cq->b_forw;
	register struct buf *start_queue = uq;

	/* Add unit to controllers queue */
	if (cq->b_forw == NULL) {
		cq->b_forw = &ui->u_queue;
		ui->u_queue.b_forw = &ui->u_queue;
	} else {
		while(uq->b_forw != start_queue)
			uq = uq->b_forw;
		ui->u_queue.b_forw = start_queue;
		uq->b_forw = &ui->u_queue;
	}
	ui->cleanup = cyno_op;
	ui->last_status = 0;
	ui->last_control = 0;
	ui->file_number = 0;

	ui->bad_count = 0;
	ui->blkno = 0;
	ui->open = FALSE;
	ui->bot = TRUE;
	ui->eot = FALSE;
	ui->eof = FALSE;
	ui->message = NULL;
}

cydgo()
{

}

/* macro to pack the unit number into Tapemaster format */
#define	UNIT(unit) \
    (((cydinfo[unit]->ui_slave & 1) << 11) | \
     ((cydinfo[unit]->ui_slave & 2) << 9) | \
     ((cydinfo[unit]->ui_slave & 4) >> 2))





cyopen(dev, flag)
	register int flag;
	register dev_t dev;

{
	register int unit = CYUNIT(dev);

	register unit_tab *ui;

	if (unit >= NUM_UNIT || cydinfo[unit] == 0 ||

	    (ui = &unit_info[unit])->open)
		return (ENXIO);
	ui->control_proto = UNIT(unit) | CW_INTR | CW_16bits;
	ui->blkno = 0;
	ui->bad_count = 0;
	ui->eof = 0;


	ui->open = 1;

	cycmd(dev, DO_WAIT, 1);			/* wait for tape to rewind */
	if ((ui->last_status&CS_OL) == 0) {	/* not on-line */






		ui->open = 0;

		return (ENXIO);



	}
	if ((flag&FWRITE) && (ui->last_status&CS_P)) {
		uprintf("cy%d: write protected\n", unit);
		ui->open = 0;
		return (ENXIO);
	}
	if (ui->last_status&CS_LP) {
		ui->file_number = 0;
		ui->bot = 1;
		ui->eof = ui->eot = 0;
	}


	return (0);
}






cyclose(dev, flag)
	register dev_t dev;
	register flag;
{
	register int unit = CYUNIT(dev);
	register unit_tab *ui = &unit_info[unit];

	if (ui->last_status&CS_OL) {
		if ((flag&FWRITE) && (minor(dev)&T_NOREWIND))
			cycmd(dev, DO_WEOV, 1);
		else if ((minor(dev) & T_NOREWIND) == 0)
			cycmd(dev, DO_RWOV, 1); 
	}
	if (ui->bad_count != 0) {
#ifdef notdef
		ui->bad_count *= 889;
		uprintf("cy%d: Warning - %d.%dcm of tape were used for recovering bad spots.\n", unit, ui->bad_count/100, ui->bad_count%100);
#endif
		ui->bad_count = 0;
	}
	ui->open = 0;
}

/*
 * Cycmd is used internally to implement all the ioctl functions.
 * We duplicate the code in physio
 * that is used for syncronizing the processes (sleep / wakeup) so
 * that we can treat our internal command requests exactly like
 * regular reads and writes.  They get put on the controller queue,
 * start processes them and iodone is called to wake us up on completion.
 *
 * We don't call physio directly because it expects data to be moved



 * and has a lot more overhead than we really need.
 */
cycmd(dev, command, count)
	register dev_t dev;
	register int command, count;
{
	register int unit = CYUNIT(dev);
	register unit_tab *ui = &unit_info[unit];
	register struct buf *uq;
	int s;
	
	s = spl3();
	while (ui->rawbp.b_flags & B_BUSY) {
		ui->rawbp.b_flags |= B_WANTED;
		sleep((caddr_t)&ui->rawbp, PRIBIO+1);
	}
	splx(s);
	/* load the request queue element */
	ui->rawbp.b_error = 0;
	ui->rawbp.b_dev = dev;
	ui->rawbp.b_cmd = (struct buf *)command;
	ui->rawbp.b_bcount = count;
	ui->rawbp.b_flags = B_PHYS | B_BUSY;
	s = spl3();
	uq = &ui->u_queue;
	ui->rawbp.av_forw = NULL;
	if (uq->av_forw == NULL) 
		uq->av_forw = &ui->rawbp;
	else
		uq->av_back->av_forw = &ui->rawbp;
	uq->av_back = &ui->rawbp;
	cystart(cydinfo[unit]->ui_mi, &ui->rawbp, s);

	/* wait for operation to complete */
	while ((ui->rawbp.b_flags&B_DONE) == 0)
		sleep((caddr_t)&ui->rawbp, PRIBIO);
	ui->rawbp.b_flags &= ~(B_PHYS | B_BUSY);
	if (ui->rawbp.b_flags & B_WANTED)
		wakeup((caddr_t)&ui->rawbp);
	return (geterror(&ui->rawbp));
}




cystrategy(bp)
	register struct buf *bp;

{
	register int unit = CYUNIT(bp->b_dev);
	register unit_tab *ui = &unit_info[unit];	
	register struct buf *uq;
	int s;

	/* check the validity of the request */
	if (bp->b_bcount > MAX_BLOCKSIZE) {
		uprintf("cy%d: Maximum block size is %dk!\n",
		    unit, MAX_BLOCKSIZE/1024);
		bp->b_error = EIO;




		bp->b_resid = bp->b_bcount;

		bp->b_flags |= B_ERROR;
		iodone(bp);
		return;
	}
	vbasetup(bp, MAX_BLOCKSIZE);
	if (bp->b_flags & B_PHYS)
		bp->b_cmd = (struct buf *)(bp->b_flags&B_READ? DO_RRD : DO_RWT);
	else
		bp->b_cmd = (struct buf *)(bp->b_flags&B_READ? DO_BRD : DO_BWT);
	/* place request on queue and start it */
	s = spl3();
	uq = &ui->u_queue;
	bp->av_forw = NULL;
	if (uq->av_forw == NULL)
		uq->av_forw = bp;
	else
		uq->av_back->av_forw = bp;
	uq->av_back = bp;
	cystart(cydinfo[unit]->ui_mi, bp, s);
}

struct	buf *cyget_next();
int	cystart_timeout();
/*
 * Cystart is called once for every request that is placed on a
 * controller's queue.  Start is responsible for fetching requests for
 * a controller queue, starting the operation, and waiting for completion,
 * and releasing the buf structure back to UNIX or cycmd, before fetching
 * the next request.
 *
 * The controller's queue looks like this:
 *
 *                      +---------------------------------------+
 *                      |                                       | 
 *      +-----------+   |   +-----------+        +-----------+  |
 *      |  b_forw   |---+-->|  b_forw   |--~ ~-->|  b_forw   |--+
 *      +-----------+       +-----------+        +-----------+
 *      |  b_back   |       | ......... |        | ......... |

 *      +-----------+       +-----------+        +-----------+
 *      | ......... |      First unit queue     Last unit queue
 *      +-----------+          element              element
 * head of controller queue
 *  (cyminfo[ctlr].um_tab)
 */
cystart(vi, bp, s)
	register struct vba_ctlr *vi;
	register struct buf *bp;
{
	int unit = CYUNIT(bp->b_dev), ctlr = vi->um_ctlr;
	register struct buf *next, *cq = &vi->um_tab;
	register unit_tab *ui = &unit_info[unit];
	register ctlr_tab *ci = &ctlr_info[ctlr];

	if (cq->b_active&SLEEPING) {
		untimeout(cystart_timeout, (caddr_t)cq);
		cystart_timeout(cq);
	}
	if (cq->b_active) {
		sleep((caddr_t)bp, PRIBIO-1);
		if (bp->b_flags&PROCESSED) {

			if (ui->message) {
				uprintf("cy%d: %s\n", unit, ui->message);
				ui->message = 0;
			}
			bp->b_flags &= ~PROCESSED;
			iodone(bp);
			return;
		}
	}
	cq->b_active = 1;
	splx(s);
	ci->my_request = bp;
	cydo_my_command(ctlr, cq, ci);
	if (ui->message) {
		uprintf("cy%d: %s\n", unit, ui->message);
		ui->message = 0;
	}
	bp->b_flags &= ~PROCESSED;
	iodone(bp);
	if ((next = cyget_next(cq)) != NULL)
		wakeup((caddr_t)next);
	else
		cq->b_active = 0;
}

/*
 * Cystart_timeout wakes up the start routine after it's 3
 * second wait time is up or when a new command enters the queue.
 * The timer is used to give up the processor while all drives
 * on the queue are rewinding and we need to wait for them to be dome.
 */
cystart_timeout(cq)
	register struct buf *cq;
{

	cq->b_active &= ~SLEEPING;
	wakeup((caddr_t)cq);
}

/*
 * Cydo_my command scans the request queues once for a
 * particular controller and calls the appropriate processing routine
 * each time we find a request that can be started.
 */
cydo_my_command(ctlr, cq, ci)
	register struct buf *cq;
	register ctlr_tab *ci;
{
	register struct buf *next;

	while ((next = cyget_next(cq)) != NULL) {
		if (cq->b_forw->b_active&SLEEPING) {
			cq->b_active |= SLEEPING;
			timeout(cystart_timeout, (caddr_t)cq, 1*60);
			sleep((caddr_t)cq, PRIBIO);
			continue;
		}
		if (setjmp(&ctlr_info[ctlr].environ))
			cydone(cq);
		else {
			register int cmd = (int)next->b_cmd;

			(*cmd_tbl[cmd])(next, cq);
		}
		if (next->b_flags & PROCESSED) {
			if (ci->my_request == next)
				break;
			wakeup((caddr_t)next);
		}
	}
}

struct buf *
cyget_next(cq)
	register struct	buf *cq;
{
	register struct buf *bp, *uq, *next = NULL;

	cq->b_forw = cq->b_forw->b_forw;
	uq = cq->b_forw;
	do {
		if ((bp = uq->av_forw) != NULL) {
			if ((uq->b_active&SLEEPING) == 0) {
				cq->b_forw = uq;
				return (bp);
			}
			next = uq;

		}
		uq = uq->b_forw;
	} while(uq != cq->b_forw);
	if (next != NULL) {





		cq->b_forw = next;
		return (next->av_forw);
	}
	return (NULL);
}

/*
 * Mark the current command on the controller's q completed and remove it.
 */
cydone(cq)
	struct buf *cq;
{
	register struct buf *uq = cq->b_forw;
	int s;

	uq->av_forw->b_flags |= PROCESSED;
	s = spl3();
	if ((uq->av_forw = uq->av_forw->av_forw) == NULL) 
		uq->av_back = NULL;
	splx(s);
}

/*
 * The following routines implement the individual commands.
 *
 * Each command is responsible for a few things. 1) Each has to keep
 * track of special cases that are related to the individual command and
 * the previous commands sequence, 2) each is required to call iodone when
 * command is actually finished, 3) it must use cyexecute to actually
 * start the controller, and 4) they are required to keep the tape in
 * a consistant state so that other commands will not be messed up.
 */

/*
 * Read requests from the raw device.
 * The special cases are:
 *  1) we can not read after a write.  (writting defines end of file)
 *  2) reading past end of file returns 0 bytes;
 */
cyraw_read(bp, cq)
	register struct buf *bp;
	struct buf *cq;
{
	int unit = CYUNIT(bp->b_dev);
	register unit_tab *ui = &unit_info[unit];
	register ctlr_tab *ci = &ctlr_info[cydinfo[unit]->ui_ctlr];
	int addr, lock_flag, command;

	if (ui->cleanup != cyno_op || ui->eof) {
		bp->b_resid = bp->b_bcount;
		bp->b_error = ENXIO, bp->b_flags |= B_ERROR;

		cydone(cq);
		return;


	}
	if (bp->b_bcount > ci->bs)

		command = READ_TA, lock_flag = CW_LOCK;
	else

		command = READ_BU, lock_flag = 0;
	ui->blkno++;
	addr = vbastart(bp, (caddr_t)ci->rawbuf, (long *)ci->map, ci->utl);
	cyexecute(command, bp->b_bcount, addr, lock_flag, unit, 10, FALSE);
	vbadone(bp, (caddr_t)ci->rawbuf, (long *)ci->map, ci->utl);
	cydone(cq);
}

/*

 * Write requests from the raw device.
 * The special cases are:
 *  1) we don't allow writes after end of tape is reached.
 */

cyraw_write(bp, cq)
	register struct buf *bp;
	struct buf *cq;

{
	int unit = CYUNIT(bp->b_dev);
	register unit_tab *ui = &unit_info[CYUNIT(unit)];
	register ctlr_tab *ci = &ctlr_info[cydinfo[unit]->ui_ctlr];
	int addr, lock_flag, command;

	if (ui->eot) {
		bp->b_resid = bp->b_bcount;
		bp->b_error = ENXIO, bp->b_flags |= B_ERROR;
		longjmp(&ci->environ);
	}
	ui->cleanup = cywrite_2_fm;
	if (bp->b_bcount > ci->bs)
		command = WRIT_TA, lock_flag = CW_LOCK;
	else
		command = WRIT_BU, lock_flag = 0;
	ui->blkno++;
	addr = vbastart(bp, (caddr_t)ci->rawbuf, (long *)ci->map, ci->utl);
	cyexecute(command, bp->b_bcount, addr, lock_flag, unit, 10, FALSE);
	vbadone(bp, (caddr_t)ci->rawbuf, (long *)ci->map, ci->utl);
	cydone(cq);
}

/*
 * Write a filemark on a tape.
 */
cywrite_filemark(bp, cq)
	register struct buf *bp;
	struct buf *cq;
{
	int unit = CYUNIT(bp->b_dev);
	register unit_tab *ui = &unit_info[CYUNIT(unit)];

	if (bp->b_bcount == 0) {
		cydone(cq);
		return;
	}
	bp->b_bcount--;
	if (ui->cleanup == cywrite_1_fm)
		ui->cleanup = cywrite_0_fm;
	if (ui->cleanup == cywrite_2_fm || ui->cleanup == cyno_op)
		ui->cleanup = cywrite_1_fm;
	ui->file_number++;
	ui->eof = 1;
	ui->blkno = 0;
	cyexecute(WRIT_FM, (long)1, 0, 0, unit, 10, FALSE);
}


/*
**	cysearch_fm_forw is the ioctl to search for a filemark in the
**  forward direction on tape.
**
**	Since only one device can be active on a given controller at any
**  given instant in time, we try to be nice and let onther devices  on
**  this controller be scheduled after we space over each record.  This will
**  at least give the apperance of overlapped operations on the controller.
**
**  The special cases are:
**  1) if the last command was a write the we can't search.
*/

cysearch_fm_forw(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register ctlr_tab	*ci = &ctlr_info[ctlr];

	if((ui->cleanup != cyno_op) || ui->eot) {
		request->b_resid = request->b_bcount;
		request->b_error = ENXIO, request->b_flags |= B_ERROR;
		longjmp(&ci->environ);
	}
	if(request->b_bcount && !ui->eot) {
		if(!ui->eot) {
			ui->blkno++;
			cyexecute(SPAC_FM, (long)1, 0, 0, unit, 5, FALSE);
			if(!(ui->eof || ui->eot))
				return;
		}
		request->b_bcount--;
		ui->eof = FALSE;
		if(!ui->eot) {
			ui->file_number++;
			ui->blkno = 0;
			return;
		}
	}
	if(ui->eot) {
		request->b_resid = request->b_bcount;
		request->b_flags |= B_ERROR, request->b_error = ENXIO;
	}
	cydone(cq);
}


/*
**	cysearch_fm_back is the ioctl to search for a filemark in the

**  reverse direction on tape.
**
**	Since only one device can be active on a given controller at any
**  given instant in time, we try to be nice and let onther devices  on
**  this controller be scheduled after we space over each record.  This will
**  at least give the apperance of overlapped operations on the controller.
**
**  The special cases are:
**  1) can't search past begining of tape.
**  2) if the lasr operation was a write data then we need to add
**     an end of volume record before we start searching.
*/

cysearch_fm_back(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];

	if(!ui->bot) {
		(*ui->cleanup)(unit, MAINTAIN_POSITION);
		if(ui->blkno == 0)
			request->b_bcount++;
		ui->blkno = 0xffffffff;


		if(request->b_bcount && !ui->bot) {



			cyexecute(SPAC_FM, (long)1, 0, CW_REV, unit, 6, FALSE);
			if(ui->eof) {

				ui->eof = FALSE;
				ui->file_number--;
				request->b_bcount--;
			}
			return;
		}
		if(ui->bot) {

			ui->file_number = 0;
			if(request->b_bcount) {




				request->b_resid = request->b_bcount;

				request->b_error = ENXIO;
				request->b_flags |= B_ERROR;
			}
		}
		else {
			request->b_cmd = (struct buf *)DO_SFMF;
			request->b_bcount = 1;
			return;
		}
	}
	ui->blkno = 0;
	ui->eof = FALSE;
	cydone(cq);
}


/*
**	cy_space_forw is used to search forward a given number of records on
**  tape.
**
**	Since only one device can be active on a given controller at any
**  given instant in time, we try to be nice and let onther devices  on
**  this controller be scheduled after we space over each record.  This will
**  at least give the apperance of overlapped operations on the controller.
**
**  The special cases are:
**  1) we can't space over a filemark.
**  2) if the last command was a write data or filemark we can't space forward.
*/


cy_space_forw(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register ctlr_tab	*ci = &ctlr_info[ctlr];

	if((ui->cleanup != cyno_op) || ui->eof) {
		request->b_resid = request->b_bcount;
		request->b_error = ENXIO, request->b_flags |= B_ERROR;
		longjmp(&ci->environ);
	}
	if(request->b_bcount) {
		ui->blkno++;
		cyexecute(SPAC_FM, (long)1, 0, 0, unit, 10, FALSE);
		if(!ui->eof && request->b_bcount) {


			request->b_bcount--;
			return;
		}
	}
	if(ui->eof) {


		request->b_resid = request->b_bcount;
		request->b_error = ENXIO, request->b_flags |= B_ERROR;
	}
	cydone(cq);
}



/*



**	Cy_space_back spaces backward a given number of records.
**

**	Since only one device can be active on a given controller at any
**  given instant in time, we try to be nice and let onther devices  on
**  this controller be scheduled after we space over each record.  This will
**  at least give the apperance of overlapped operations on the controller.
**
**  The special cases are:
**  1) we can't space over a filemark.
**  2) we can't space past the beginning of tape.
**  3) if the last operation was a write data then we need to add
**     an end of volume record before we start searching.
*/

cy_space_back(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	register int		unit = CYUNIT(request->b_dev);

	register unit_tab	*ui = &unit_info[CYUNIT(unit)];

	if(!ui->bot) {
		(*ui->cleanup)(unit, MAINTAIN_POSITION);
		if(request->b_bcount+1 && !ui->bot && !ui->eof) {
			request->b_bcount--;
			ui->blkno--;

			cyexecute(SPACE, (long)1, 0, CW_REV, unit, 15, FALSE);
			return;

		}
		if(!ui->bot) {
			request->b_bcount = 1;

			cy_space_forw(request, cq);
		}
		ui->eof = FALSE;
	}
	cydone(cq);
}

/*

 * Rewind tape and wait for completion.
 * An overlapped rewind is issued and then we change the command type to
 * a wait for ready ioctl.  Wait for ready contains the logic to poll
 * without blocking anything in the system, until the drive becomes ready or
 * drops off line whichever comes first.
 */

/*ARGSUSED*/




cyrewind_tape_ta(bp, cq)

	struct buf *bp, *cq;
{

	cyrewind_tape(bp, REWD_OV);
	bp->b_cmd = (struct buf *)DO_WAIT;
}

/*
 * Do an overlapped rewind and then unload the tape.
 * This feature is handled by the individual tape drive and
 * in some cases can not be performed.
 */
cyrewind_tape_unl(bp, cq)
	struct buf *bp, *cq;
{

	cyrewind_tape(bp, OFF_UNL);
	cydone(cq);
}

/*
 * Do an overlapped rewind.
 */
cyrewind_tape_ov(bp, cq)
	struct buf *bp, *cq;
{

	cyrewind_tape(bp, REWD_OV);
	cydone(cq);
}

/*
 * Common code for all rewind commands.
 * The special cases are:
 *  3) if the last operation was a write data then we need to add
 *     an end of volume record before we start searching.
 */
cyrewind_tape(bp, cmd)
	register struct buf *bp;
	int cmd;
{
	register int unit = CYUNIT(bp->b_dev);
	register unit_tab *ui = &unit_info[unit];

	(*ui->cleanup)(unit, DONT_MAINTAIN_POSITION);
	ui->blkno = 0;
	ui->eof = FALSE;
	ui->bot = TRUE;
	ui->eot = FALSE;
	ui->file_number = 0;
	bp->b_resid = 0;
	ui->cleanup = cyno_op;
	cyexecute(cmd, (long)0, 0, 0, unit, cmd == REWD_OV ? 10 : 10*60, 0);
}

/*
**	Cywait_until_ready is used to wait for rewinds to complete.
**  We check the status and if the tape is still rewinding we re-enter ourself
**  on the activity queue to give other requests a chance to execute before we
**  check the status again.  One other thing is that we only want to  check
**  the status every five seconds.  so we set a timer for five seconds and
**  check the time left every time we enter this routine.  If there is still
**  time left then we simply reinsert ourself on the queue again and wait
**  until next time ..
*/
cywait_until_ready(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	extern int		cywait_timeout();
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[unit];

	cyexecute(DRIVE_S, (long)0, 0, 0, unit, 10, FALSE);
	if((!(ui->last_status & CS_OL)) || (ui->last_status & CS_RDY)) {
		cydone(cq);
		return;
	}
	cq->b_forw->b_active |= SLEEPING;
	timeout(cywait_timeout, (caddr_t)cq->b_forw, 2*60);
}

/*
 * Reset the timing flag for nice_wait after 3 seconds.
 * This makes this drive eligible for scheduling again.
 */
cywait_timeout(uq)
	struct buf *uq;
{

	uq->b_active &= ~SLEEPING;
}


/*
 * Process a status ioctl request.
 * It depends entirly on the interupt routines to load the last_XXX
 * registers in unit_info[].
 */
cydrive_status(bp, cq)
	struct buf *bp, *cq;
{

	cyexecute(DRIVE_S, (long)0, 0, 0, CYUNIT(bp->b_dev), 10, FALSE);
	cydone(cq);
}

/*
**	cybuf_read handles the read requests from the block device.
**
**  The special cases are:
**  1)	we can not read after a write.  (writting defines end of file)
**  2)  reading past end of file returns 0 bytes;
**  3)  if we are mispositioned we have to seek to the correct block.
**  4)  we can hit end of tape while seeking.
**  5)  we want to be nice to other processes while seeking so we
**  	break the request up into smaller requests.
**  6)  returns error if the block was larger than requested. 
*/
cybuf_read(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register ctlr_tab	*ci = &ctlr_info[ctlr];
	register int		addr, command, bus_lock;

	cydebug = 1;
	if(cyseek(request, cq)) {
		if(ui->cleanup != cyno_op) {
			clrbuf(request);
			longjmp(&ci->environ);
		}
		if(request->b_bcount > ci->bs)
			command = READ_TA, bus_lock = CW_LOCK;
		else
			command = READ_BU, bus_lock = 0;
		ui->blkno++;
		addr = vbastart(request, (caddr_t)ci->rawbuf, (long *)ci->map,
		    ci->utl);
		cyexecute(command,request->b_bcount,addr,bus_lock,unit,8,FALSE);
		vbadone(request, (caddr_t)ci->rawbuf, (long *)ci->map, ci->utl);
		cydone(cq);
	}
}


/*
**	cybuf_write handles the write requests from the block device.
**
**  The special cases are:
**  1)  if we are mispositioned we have to seek to the correct block.
**  2)  we can hit end of tape while seeking.
**  3)  we want to be nice to other processes while seeking so we
**  	break the request up into smaller requests.
**  4) we don't allow writes after end of tape is reached.
*/














cybuf_write(request, cq)
register struct buf	*request;
register struct buf	*cq;
{


	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register ctlr_tab	*ci = &ctlr_info[ctlr];
	register int		addr, command, bus_lock;
	
	if(ui->eot && (request->b_blkno >= ui->blkno)) {
		request->b_error = ENXIO, request->b_flags |= B_ERROR;
		request->b_resid = request->b_bcount;
		longjmp(&ci->environ);
	}
	if(cyseek(request, cq)) {
		ui->cleanup = cywrite_2_fm;
		ui->blkno++;
		if(request->b_bcount > ci->bs)
			command = WRIT_TA, bus_lock = CW_LOCK;
		else
			command = WRIT_BU, bus_lock = 0;
		addr = vbastart(request, (caddr_t)ci->rawbuf, (long *)ci->map,
		    ci->utl);
		load_mbus_addr((caddr_t)addr, (short *)&ci->tpb.data_ptr);
		cyexecute(command,request->b_bcount,addr,bus_lock,unit,5,FALSE);
		vbadone(request, (caddr_t)ci->rawbuf, (long *)ci->map, ci->utl);
		cydone(cq);

	}
}


/*

**	cyseek is used by the block device to position the tape correctly
**  before each read or write request.
**
**  The special cases are:
**  1)  we can hit end of tape while seeking.
**  2)  we want to be nice to other processes while seeking so we
**  	break the request up into smaller requests.
*/
cyseek(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register ctlr_tab	*ci = &ctlr_info[ctlr];

#ifdef lint
	cq = cq;
#endif
	if(request->b_blkno < ui->blkno) {
		register int	count;

		(*ui->cleanup)(unit, MAINTAIN_POSITION);
		count = ((request->b_blkno+1) == ui->blkno) ? 2 : 1;
		ui->blkno -= count;
		cyexecute(SPAC_FM, (long)1, 0, CW_REV, unit, 10, FALSE);
		if(!ui->eof)
			return FALSE;
		ui->eof = FALSE;
		request->b_blkno = ui->blkno + 1;
	}
	if(request->b_blkno > ui->blkno) {
		if((ui->cleanup != cyno_op) || ui->eof || ui->eot) {
			request->b_resid = request->b_bcount;
			request->b_error = ENXIO, request->b_flags |= B_ERROR;
			longjmp(&ci->environ);
		}
		ui->blkno++;
		cyexecute(SPAC_FM, (long)1, 0, 0, unit, 10, FALSE);
		return FALSE;
	}
	return TRUE;
}


/*

*/




cywrite_eov(request, cq)
register struct buf	*request;
register struct buf	*cq;
{
	extern int		cyno_op();
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[CYUNIT(unit)];

	if(ui->cleanup != cyno_op) {
		(*ui->cleanup)(unit, DONT_MAINTAIN_POSITION);
		cyexecute(SPACE, (long)2, 0, CW_REV, unit, 10, FALSE);
		cyexecute(SPACE, (long)1, 0, 0, unit, 10, FALSE);
		unit_info[unit].cleanup = cyno_op;
		ui->blkno = 0;
	}
	cydone(cq);
}


/*
**	Do nothing
*/
/*ARGSUSED*/
cyno_op(unit, action)
int	unit, action;
{
}


/*
**	Write 0 file marks to tape
*/
/*ARGSUSED*/
cywrite_0_fm(unit, action)
int	unit, action;
{
	unit_info[unit].cleanup = cyno_op;
}


/*

**	Write 1 file mark to tape
*/

cywrite_1_fm(unit, action)
int	unit, action;
{


	cyexecute(WRIT_FM, (long)1, 0, 0, unit, 5, FALSE);
	if(action == MAINTAIN_POSITION) {

		cyexecute(SPACE, (long)2, 0, CW_REV, unit, 10, FALSE);
		cyexecute(SPACE, (long)1, 0, 0, unit, 10, FALSE);
	}
	unit_info[unit].cleanup = cyno_op;
}


/*

**	Write 2 file marks to tape
*/


cywrite_2_fm(unit, action)
int	unit, action;
{

	cyexecute(WRIT_FM, (long)1, 0, 0, unit, 5, FALSE);
	cyexecute(WRIT_FM, (long)1, 0, 0, unit, 5, FALSE);
	if(action == MAINTAIN_POSITION) {
		cyexecute(SPACE, (long)3, 0, CW_REV, unit, 10, FALSE);
		cyexecute(SPACE, (long)1, 0, 0, unit, 2, FALSE);
	}
	unit_info[unit].cleanup = cyno_op;
}


extern	int cytimeout();
extern	int cy_normal_path();
/*
**	Cyexecute is used to start all commands to the controller.  We
**  do all common code here before starting.
*/

cyexecute(command, count, addr, control_flags, unit, time, interupt_routine)
	register int command;
	long count;
	int addr, control_flags, unit, time, interupt_routine;
{
	register int		priority;
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register unit_tab	*ui = &unit_info[unit];
	register ctlr_tab	*ci = &ctlr_info[ctlr];
	register struct buf	*request = ui->u_queue.av_forw;

	ci->tpb.cmd = command;
	ci->tpb.control = ui->control_proto | control_flags;
	ci->tpb.status = ci->tpb.count = (short)0;

	load_mbus_addr((caddr_t)addr, (short *)&ci->tpb.data_ptr);
	switch(command) {
		case READ_BU:
		case READ_TA:
		case WRIT_BU:
		case WRIT_TA:
			ci->tpb.size = MULTIBUS_SHORT((short)count);
			ci->tpb.rec_over = (short)0;
			break;

		default:
			ci->tpb.size = (short)0;
			ci->tpb.rec_over = MULTIBUS_SHORT((short)count);
			break;
	}
	load_mbus_addr((caddr_t)0, ci->tpb.link_ptr);
	if(!interupt_routine)
		ci->last = ci->tpb;
	/*

	gag! but it the last possible moment to wait 
	for this controller to get out of it's own way.....
	*/

	uncache(&ci->ccb.gate);
	while(ci->ccb.gate == GATE_CLOSED)
		uncache(&ci->ccb.gate);
	load_mbus_addr((caddr_t)&ci->tpb, ci->ccb.tpb_ptr);
	ci->ccb.ccw = NORMAL_INTERUPT;
	ci->ccb.gate = GATE_CLOSED;
	if(!interupt_routine)
		ci->interupt_path = cy_normal_path;
	timeout(cytimeout, (caddr_t)ctlr, time*60);
	priority = spl3();

	CY_ATTENTION(cyminfo[ctlr]->um_addr);
	if(!interupt_routine) {
		sleep((caddr_t)ci, PRIBIO+3);
		splx(priority);
		if(request->b_flags & B_ERROR) {


			if((command == READ_BU) || (command == READ_TA) ||
			    (command == WRIT_BU) || (command == WRIT_TA))
				vbadone(request, (caddr_t)ci->rawbuf,
				     (long *)ci->map,ci->utl);

			longjmp(&ci->environ);
		}
		return;
	}
	splx(priority);
}


/*

**	cytimeout is the interupt timeout routine.  We assume that a
**  particular command has gone astray, so we completely reset the controller,
**  and call the interupt routine to help us clean up.  Before the interupt
**  routine is called we jam a controller timeout value in the status register
**  to fake out the calling routines.
*/

cytimeout(ctlr)
register int	ctlr;
{

	register int	priority = spl3();
	register char	*ctlr_vaddr = cyminfo[ctlr]->um_addr;
	register int	tmp_stat;





	uncache(&ctlr_info[ctlr].tpb.status);
	tmp_stat = ctlr_info[ctlr].tpb.status;
	CY_RESET(ctlr_vaddr);

	cy_init_controller(ctlr_vaddr, ctlr, 0);
	splx(priority);
	ctlr_info[ctlr].tpb = ctlr_info[ctlr].last;
	ctlr_info[ctlr].tpb.status = (tmp_stat & ~CS_ERm) | CS_OL | ER_TIMOUT;


	cyintr(ctlr);
}

/*
**	Cyintr is the interupt routine for the Tapemaster controller.
**
**	Due to controller problems, the first thing we have to do is turn
**  off the Tapemaster interupting mechanism.  If we don't we will be flooded
**  with bogus interupts and the system will spend all it's time processing

**  them.  To Turn the interupts off we issue a NOOP command with the 'turn
**  off interupts' code in the ccb.
**
**	  take note that since this command TURNS OFF the interupts it
**	  itself CANNOT interupt...  This means that polling must be done
**	  at sometime to make sure that tis command is completed.  The polling
**	  is done before the next command is issued to reduce polling (halting
**	  UNIX) time.
**
**	After we turn off interupts we uncache all the values in the tpb
**  and call the correct processing routine.  This routine can be for normal
**  interupts or for interupts generated during a retry operation.
*/

cyintr(ctlr)
register int ctlr;
{
	extern int		cytimeout();
	register ctlr_tab	*ci = &ctlr_info[ctlr]; 

	untimeout(cytimeout, (caddr_t)ctlr);
	/* turn off interupts for the stupid controller */
	ci->ccb.ccw = CLEAR_INTERUPT;
	ci->noop.cmd = NO_OP;
	ci->noop.control = (short)0;
	load_mbus_addr((caddr_t)&ci->noop, ci->ccb.tpb_ptr);
	ci->ccb.gate = GATE_CLOSED;
	CY_ATTENTION(cyminfo[ctlr]->um_addr);
	uncache_tpb(ci);
	(*ci->interupt_path)(ctlr);
}







/*
**	This is the portion of the interupt routine that processes all
**  normal cases i.e. non retry cases.   We check the operations status
**  if it is retryable we set the interupt path to the retry routines and
**  start the backward spaceing.  when the spacing is done the retry logic
**  will be called and this routine will be skipped entirely.
**

**	If the command is ok or not retryable we set the status accordingly
**  and wakeup cyexecute to continue processing.
*/

cy_normal_path(ctlr)
register int ctlr;
{
	extern int		cy_retry_path();
	extern int		cy_extended_gap_path();
	register int		error;
	register struct buf	*cq = &cyminfo[ctlr]->um_tab;
	register struct buf	*uq = cq->b_forw;
	register struct buf	*request = uq->av_forw;
	register int		unit = CYUNIT(request->b_dev);
	register unit_tab	*ui = &unit_info[unit];
	register ctlr_tab	*ci = &ctlr_info[ctlr]; 

	if (error = cydecode_error(unit, ci->tpb.status)) {
		if(error != FATAL) {
			if (error == RETRY)
				ci->interupt_path = cy_retry_path;
			else
				ci->interupt_path = cy_extended_gap_path;
			cyexecute(SPACE, (long)2, 0, CW_REV, unit, 5, TRUE);
			return;
		}
	}
	request->b_resid=request->b_bcount-MULTIBUS_SHORT(ci->tpb.count);
	ui->error_count = 0;
	ui->last_resid = request->b_resid;
	ui->last_status = ci->tpb.status;
	ui->last_control = ci->tpb.control;
	if (error == FATAL)
		request->b_flags |= B_ERROR, request->b_error = EIO;
	wakeup((caddr_t)ci);






}


/*
**	Cy_retry_path finishes up the retry sequence for the tape.
** If we were going in the reverse direction it means that we have to
** space forward to correctly position ourselfs in back of the tape gap
** instead of in front of it.  If we were going forward it means that
** we are positioned correctly and we can actually restart the instruction
** that failed before.
*/

cy_retry_path(ctlr)
register int	ctlr;
{
	extern int		cy_do_again_path();
	register struct buf	*cq = &cyminfo[ctlr]->um_tab;
	register struct buf	*uq = cq->b_forw;
	register struct buf	*request = uq->av_forw;
	register int		unit = CYUNIT(request->b_dev);
	register ctlr_tab	*ci = &ctlr_info[ctlr]; 

	if(!(ci->tpb.status & CS_OL)) {
		ci->interupt_path = cy_normal_path;
		cy_normal_path(ctlr);
		return;
	}
	if(ci->tpb.control & CW_REV) {
		if(!(ci->tpb.status & CS_LP)) {
			ci->interupt_path = cy_do_again_path;
			cyexecute(SPACE, (long)1, 0, 0, unit, 5, TRUE);
			return;
		}

		cy_do_again_path(ctlr);
	}
}


/*
**
*/

cy_extended_gap_path(ctlr)
register int	ctlr;
{
	extern int		cy_do_again_path();
	register ctlr_tab	*ci = &ctlr_info[ctlr]; 
	register struct buf	*cq = &cyminfo[ctlr]->um_tab;
	register struct buf	*uq = cq->b_forw;
	register struct buf	*request = uq->av_forw;
	register int		unit = CYUNIT(request->b_dev);

	if(!(ci->tpb.status & CS_OL)) {
		ci->interupt_path = cy_normal_path;
		cy_normal_path(ctlr);
		return;
	}
	if(ci->tpb.control & CW_REV) {
		if(!(ci->tpb.status & CS_LP)) {
			cyexecute(SPACE, (long)1, 0, 0, unit, 5, TRUE);
			return;
		}
	}
	ci->interupt_path = cy_do_again_path;
	cyexecute(ERASE_F, (long)unit_info[unit].error_count, 0, 0,
	    unit, 5, TRUE);
}


/*

**
*/

cy_do_again_path(ctlr)
register int	ctlr;
{
	extern int		cy_normal_path();
	register ctlr_tab	*ci = &ctlr_info[ctlr]; 

	if(!(ci->tpb.status & CS_OL)) {
		ci->interupt_path = cy_normal_path;
		cy_normal_path(ctlr);
		return;
	}
	ci->tpb = ci->last;
	uncache(&ci->ccb.gate);
	while(ci->ccb.gate == GATE_CLOSED)
		uncache(&ci->ccb.gate);
	load_mbus_addr((caddr_t)&ci->tpb, ci->ccb.tpb_ptr);
	ci->ccb.ccw = NORMAL_INTERUPT;
	ci->ccb.gate = GATE_CLOSED;
	ci->interupt_path = cy_normal_path;
	CY_ATTENTION(cyminfo[ctlr]->um_addr);
}


/*
**	for each longword in the tpb we call uncache to  purge it from
**  the cache.  This is done so that we can correctly access tpb data
**  that was placed there by the controller.

*/

uncache_tpb(ci)
ctlr_tab	*ci;
{
	register long	*ptr = (long *)&ci->tpb;


	register int	i;

	for(i=0; i<((sizeof(fmt_tpb)+sizeof(long)-1)/sizeof(long)); i++)
		uncache(ptr++);
}


/*
**	Cyprint_error is the common printing routine for all messages
**  that need to print the tape status along with it.  This is so we
**  we can save space, have consistant messages, and we can send the messages
**  to the correct places.
*/

cyprint_err(message, unit, status)
register char	*message;
register int	unit, status;
{
	status &= 0xffff;
	printf("cy%d: %s!   Status = %x\n", unit, message, status);
}

/*
**	Decode the error to determine whether the previous command was
**  ok, retryable, or fatal and return the value.  If it was a hardware
**  problem we print the message to the console, otherwise we print it
**  to the user's terminal later when execute returns.
*/

cydecode_error(unit, status)
register int	unit,	status;
{
	register unit_tab	*ui = &unit_info[unit];
	register ctlr_tab	*ci = &ctlr_info[cydinfo[unit]->ui_ctlr];

	if(!(status & CS_OL) && (ci->tpb.cmd != OFF_UNL)) {
		ui->message = "Drive is not on-line";
		cyprint_err(ui->message, unit, status);
		return FATAL;
	}
	ui->bot = ((status & CS_LP) != 0);
	ui->eof = ((status & CS_FM) != 0);
	switch(status & CS_ERm) {
	case ER_EOT:
		if(ci->tpb.control & CW_REV) {
			ui->bot = TRUE;
			ui->eot = FALSE;



		}
		else if(!ui->eot){
			ui->message = "End of tape";
			ui->bot = FALSE;
			ui->eot = TRUE;
		}
	case 0 :
	case ER_FM:
	case ER_NOSTRM:
		return	0;

	case ER_TIMOUT:
	case ER_TIMOUT1:
	case ER_TIMOUT2:
	case ER_TIMOUT3:
	case ER_TIMOUT4:
		ui->message = "Drive timed out during transfer";
		cyprint_err(ui->message, unit, status);
		return FATAL;
	case ER_NEX:	
		ui->message =
		    "Controller referenced non-existant system memory";
		cyprint_err(ui->message, unit, status);
		return FATAL;
	case ER_DIAG:
	case ER_JUMPER:
		ui->message = "Controller diagnostics failed";
		cyprint_err(ui->message, unit, status);
		return FATAL;
	case ER_STROBE:
		if (ci->tpb.cmd == READ_BU) {
			ci->last.cmd = READ_TA;	

			return RETRY;
		}
		if(ci->tpb.cmd == READ_TA)
			return 0;
		ui->message = "Unsatisfactory media found";

		return	FATAL;
	case ER_FIFO:
	case ER_NOTRDY:
		ui->error_count = 1;
		return RETRY;
	case ER_PROT:

		ui->message = "Tape is write protected";
		return FATAL;
	case ER_CHKSUM:
		ui->message = "Checksum error in controller proms";
		cyprint_err(ui->message, unit, status);
		return FATAL;
	case ER_HARD:
		ui->error_count++;
		if((ci->tpb.cmd == WRIT_TA) ||
		    (ci->tpb.cmd == WRIT_BU) ||
		    (ci->tpb.cmd == WRIT_FM)) {
			ui->bad_count++;
			return EXTEND;
		}
		ui->message = "Unrecoverable media error during read";
		return FATAL;
	case ER_PARITY:
		if(++ui->error_count < 8)
			return	RETRY;
		ui->message = "Unrecoverable tape parity error";
		return FATAL;
	case ER_BLANK:
		ui->message="Blank tape found (data expected)";
		return FATAL;
	case ER_HDWERR:
	default:
		ui->message = "Unrecoverble hardware error";
		cyprint_err(ui->message, unit, status);
		return FATAL;
	}


}

cyread(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	unit_tab *ui = &unit_info[CYUNIT(dev)];
	
	return (physio(cystrategy, &ui->rawbp, dev, B_READ, cyminsize, uio));
}











cywrite(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	unit_tab *ui = &unit_info[CYUNIT(dev)];



	return (physio(cystrategy,&ui->rawbp, dev, B_WRITE, cyminsize, uio));






}

/*ARGSUSED*/
cyioctl(dev, cmd, data, flag)
	dev_t dev;
	caddr_t data;
{


	switch (cmd) {

	case MTIOCTOP: {
		struct mtop *mp = (struct mtop *)data;


		if (mp->mt_op <= DO_WAIT)
			return (cycmd(dev, (int)mp->mt_op, (int)mp->mt_count));
		return (EIO);
	}









	case MTIOCGET: {
		register unit_tab *ui = &unit_info[CYUNIT(dev)];
		register struct mtget *mp = (struct mtget *)data;

		mp->mt_type = MT_ISCY;
		mp->mt_dsreg = ui->last_control;
		mp->mt_erreg = ui->last_status;
		mp->mt_resid = ui->last_resid;

		mp->mt_fileno = ui->file_number;
		mp->mt_blkno = ui->blkno;
		cycmd(dev, DO_STAT, 1);
		break;

	}


	default:
		return (ENXIO);
	}
	return (0);
}











/*
 * Dump routine.
 */
cydump(dev)

	dev_t dev;
{


	register int		unit = CYUNIT(dev);
	register int		ctlr = cydinfo[unit]->ui_ctlr;
	register unit_tab	*ui = &unit_info[unit];

	register ctlr_tab	*ci = &ctlr_info[ctlr];
	register int		blk_siz;



	register int		num = maxfree;



	register int		start = 0x800;







	if ((unit >= NCY) || cydinfo[unit]) 
		return(ENXIO);
	ui->control_proto = CW_LOCK | CW_25ips | CW_16bits;
	if (cywait(&ci->ccb))
		return(EFAULT);
	while (num > 0) {
		blk_siz = num > TBUFSIZ ? TBUFSIZ : num;
		bcopy((caddr_t)(start*NBPG), (caddr_t)ci->rawbuf,
		    (unsigned)(blk_siz*NBPG));



		ci->tpb.cmd = WRIT_TA;	
		ci->tpb.control = ui->control_proto;
		ci->tpb.status = 0;
		ci->tpb.size = MULTIBUS_SHORT(blk_siz*NBPG);
		load_mbus_addr((caddr_t)0, ci->tpb.link_ptr);
		load_mbus_addr((caddr_t)ci->rawbuf, (short *)&ci->tpb.data_ptr);
		load_mbus_addr((caddr_t)&ci->tpb, ci->ccb.tpb_ptr);
		ci->ccb.gate = GATE_CLOSED;	
		CY_ATTENTION(cyminfo[ctlr]->um_addr);
		start += blk_siz;
		num -= blk_siz;
		if (cywait(&ci->ccb))
			return(EFAULT);

		uncache(&ci->tpb);
		if (ci->tpb.status&CS_ERm)		/* error */
			return (EIO);
	}
	for(num=0; num<2; num++) {
		ci->tpb.cmd = WRIT_FM;	
		ci->tpb.control = ui->control_proto;



		ci->tpb.status = ci->tpb.size = 0;

		ci->tpb.count = MULTIBUS_SHORT(1);
		load_mbus_addr((caddr_t)0, ci->tpb.link_ptr);
		load_mbus_addr((caddr_t)ci->rawbuf, (short *)&ci->tpb.data_ptr);



		load_mbus_addr((caddr_t)&ci->tpb, ci->ccb.tpb_ptr);
		ci->ccb.gate = GATE_CLOSED;	

		CY_ATTENTION(cyminfo[ctlr]->um_addr);
		if (cywait(&ci->ccb))
			return(EFAULT);


		uncache(&ci->tpb);

		if (ci->tpb.status&CS_ERm)		/* error */
			return (EIO);
	}
	ci->tpb.cmd = REWD_OV;	

	ci->tpb.control = ui->control_proto;
	ci->tpb.status = ci->tpb.size = 0;
	ci->tpb.count = MULTIBUS_SHORT(1);
	load_mbus_addr((caddr_t)0, ci->tpb.link_ptr);
	load_mbus_addr((caddr_t)ci->rawbuf, (short *)&ci->tpb.data_ptr);
	load_mbus_addr((caddr_t)&ci->tpb, ci->ccb.tpb_ptr);

	ci->ccb.gate = GATE_CLOSED;	
	CY_ATTENTION(cyminfo[ctlr]->um_addr);
	if (cywait(&ci->ccb))
		return EFAULT;
	uncache(&ci->tpb);



	return 0;

}





/*
 * Poll until the controller is ready.
 */
cywait(cp)
	register fmt_ccb *cp;



{

	register int i = 5000;







	uncache(&cp->gate);






	while (i-- > 0 && cp->gate == GATE_CLOSED) {




		DELAY(1000);
		uncache(&cp->gate);

	}
	return (i <= 0);
}










/*
 * Load a 20 bit pointer into the i/o registers.
 */
load_mbus_addr(in, out)
	caddr_t in;
	short *out;
{
	register int tmp_in = (int)in;
	register char *out_ptr = (char *)out;

	*out_ptr++ = (char)(tmp_in & 0xff);
	*out_ptr++ = (char)((tmp_in >> 8) & 0xff);
	*out_ptr++ = (char)0;


	*out_ptr++ = (char)((tmp_in & 0xf0000) >> 12);

}




/*
**	CYMINSIZE s supposed to adjust the buffer size for any raw i/o.
**  since tapes can not read  the tail end of partial blocks we ignore
**  this request and strategy will return an appropriate error message later.
**
**	If this is not done UNIX will lose data that is on the tape.
*/
unsigned
cyminsize(bp)
	struct buf *bp;

{
	if (bp->b_bcount > MAX_BLOCKSIZE)
		bp->b_bcount = MAX_BLOCKSIZE;	
}









/*
 * Unconditionally reset all controllers to their initial state.
 */
cyreset(vba)
	int vba;
{

	register caddr_t addr;
	register int ctlr;

	for (ctlr = 0; ctlr < NCY; ctlr++)
		if (cyminfo[ctlr] && cyminfo[ctlr]->um_vbanum == vba) {
			addr = cyminfo[ctlr]->um_addr;
			CY_RESET(addr);
			if (!cy_init_controller(addr, ctlr, 0)) {


				printf("cy%d: reset failed\n", ctlr);
				cyminfo[ctlr] = NULL;

			}
		}







}
#endif

Added sys/tahoe/vba/cyreg.h.













































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*	cyreg.h	7.1	86/01/05	*/

/* get controller attention and start an operation */
#define CY_ATTENTION(addr) movob(addr, 0xff)	/* also known as: GO */
#define CY_RESET(addr)    CY_ATTENTION(addr+1) /* reset controller */
#define CYUNIT(d)	  (minor(d) & 0xf)

#define MULTIBUS_SHORT(x) (short)((((x)>>8)&0xff) | (((x)<<8)&0xff00))

#define	NORMAL_INTERUPT	0x11
#define	CLEAR_INTERUPT	0x09

#define	T_NOREWIND	0x80


/* Tape Parameter Block definitions */
typedef struct {
	long		cmd;		/* Command */
	short		control;	/* Control */
	short		count;		/* Return count */
	short		size;		/* Buffer size */
	short		rec_over;	/* Records/Overrun */
	char		*data_ptr;	/* Pointer to source/dest */
	short		status;		/* Status */
	short		link_ptr[2];	/* Pointer to next parameter block */
} fmt_tpb;

/* Controller commands */

/* Group. I Control status/commands */
#define	CONFIG	(0x00000000)	/* configure */
#define	SET_PA	(0x08000000)	/* set page */
#define	NO_OP	(0x20000000)	/* no operation */
#define	DRIVE_S	(0x28000000)	/* drive status */
#define	TAPE_AS	(0x74000000)	/* tape assign */
#define	DRIVE_R	(0x90000000)	/* drive reset */

/* Group. II Tape position commands */
#define	REWD_OV	(0x04000000)	/* rewind overlapped */
#define	READ_FO	(0x1C000000)	/* read foreign tape */
#define	REWD_TA	(0x34000000)	/* rewind tape */
#define	OFF_UNL	(0x38000000)	/* off_line and unload */
#define	WRIT_FM	(0x40000000)	/* write filemark */
#define	SERH_FM	(0x44000000)	/* search filemark */
#define	SRFM_FD	(0x44000000)	/* search filemark forward */
#define	SRFM_BK	(0xC4000000)	/* search filemark backward */
#define	SPACE	(0x48000000)	/* skip record */
#define	SP_FORW	(0x48000000)	/* space forward */
#define	SP_BACK	(0xC8000000)	/* space backwords */
#define	ERASE_F	(0x4C000000)	/* erase fixed length */
#define	ERASE_T	(0x50000000)	/* erase to end of tape */
#define	SPAC_FM	(0x70000000)	/* space filemark */
#define	SP_FM_F	(0x70000000)	/* space filemark forward */
#define	SP_FM_B	(0xC9000000)	/* space filemark backward */
#define	SERH_MU	(0x94000000)	/* search multiple filemarks */

/* Group. III Data transfer commands */
#define	READ_BU	(0x10000000)	/* read buffered */
#define	WRIT_BU	(0x14000000)	/* write buffered */
#define	EDIT_BU	(0x18000000)	/* edit buffered */
#define	READ_TA	(0x2C000000)	/* read tape */
#define	WRIT_TA	(0x30000000)	/* write tape */
#define	EDIT_TA	(0x3C000000)	/* edit tape */
#define	READ_ST	(0x60000000)	/* read streaming */
#define	WRIT_ST	(0x64000000)	/* write streaming */

/* Group. IV Special commands */
#define	EXCHANG	(0x0C000000)	/* exchange system and tapemaster RAM */
#define	BLOCK_M	(0x80000000)	/* block move */

/* Group. V Diagnostic commands */
#define	TEST_SH	(0x54000000)	/* short memory test */
#define	TEST_LG	(0x58000000)	/* long memory test */
#define	TEST_CN	(0x5C000000)	/* controller confidence test */
#define	TEST_RW	(0x68000000)	/* test read/write timeing */


/* Control field bit definitions */
#define	CW_UNIT		(0x000c<<8) /* tape select mask, 2 bit field */
#define	CW_MAIL		(0x0010<<8) /* mailbox flag */
#define	CW_INTR		(0x0020<<8) /* interrupt flag */
#define	CW_LINK		(0x0040<<8) /* link flag */
#define	CW_LOCK		(0x0080<<8) /* bus lock flag */
#define	CW_BANK		(0x0100>>8) /* bank select */
#define	CW_REV		(0x0400>>8) /* reverse flag */
#define	CW_SPEED	(0x0800>>8) /* speed/density */
#define	    CW_25ips	0
#define	    CW_100ips	(0x0800>>8)
#define	CW_STREAM  	(0x1000>>8) /* continuous */
#define	CW_WIDTH  	(0x8000>>8) /* width */
#define	    CW_8bits	0
#define	    CW_16bits	(0x8000>>8)


/* Status field bit definitions */
#define	CS_P	(0x0002<<8)	/* Protected, no write ring */
#define	CS_FB	(0x0004<<8)	/* formatter busy */
#define	CS_RDY	(0x0008<<8)	/* drive ready */
#define	CS_EOT	(0x0010<<8)	/* end of tape detected */
#define	CS_LP	(0x0020<<8)	/* tape is at load point */
#define	CS_OL	(0x0040<<8)	/* drive on_line */
#define	CS_FM	(0x0080<<8)	/* Filemark detected */
#define	CS_ERm	(0x1F00>>8)	/* Error value mask */
#define	CS_CR	(0x2000>>8)	/* Controller executed retries */
#define	CS_CC	(0x4000>>8)	/* Command Completed successfully */
#define	CS_CE	(0x8000>>8)	/* Command execution has begun */

#define	CYDS_BITS "\20\6CS_CR\7CS_CC\8CS_CE\12CS_P\13CS_FB\14CS_RDY\15CS_EOT\
\16CS_LP\17CS_OL\20CS_FM"

/* Error value definitions for CS_ERm field */
#define	ER_TIMOUT	(0x01)	/* timed out data busy false */
#define	ER_TIMOUT1	(0x02)	/* data busy false,formatter,ready */
#define	ER_TIMOUT2	(0x03)	/* time out ready busy false */
#define	ER_TIMOUT3	(0x04)	/* time out ready busy true */
#define	ER_TIMOUT4	(0x05)	/* time out data busy true */
#define	ER_NEX		(0x06)	/* time out memory */
#define	ER_BLANK	(0X07)	/* blank tape */
#define	ER_DIAG		(0x08)	/* micro-diagnostic */
#define	ER_EOT		(0x09)	/* EOT forward, BOT rev. */
#define	ER_HARD		(0x0A)	/* retry unsuccessful */
#define	ER_FIFO		(0x0B)	/* FIFO over/under flow */
#define	ER_PARITY	(0x0D)	/* drive to tapemaster parity error */
#define	ER_CHKSUM	(0x0E)	/* prom checksum */
#define	ER_STROBE	(0x0F)	/* time out tape strobe */
#define	ER_NOTRDY	(0x10)	/* tape not ready */
#define	ER_PROT		(0x11)	/* write, no enable ring */
#define	ER_JUMPER	(0x13)	/* missing diagnostic jumper */
#define	ER_LINK		(0x14)	/* bad link, link inappropriate */
#define	ER_FM		(0x15)	/* unexpected filemark */
#define	ER_PARAM	(0x16)	/* bad parameter, byte count ? */
#define	ER_HDWERR	(0x18)	/* unidentified hardware error */
#define	ER_NOSTRM	(0x19)	/* streaming terminated */


/* Channel control block definitions */
typedef struct {
	char	ccw;		/* channel control word */
	char	gate;		/* Tpb access gate */
	short	tpb_ptr[2];	/* points to first tape parameter block */
} fmt_ccb;

#define GATE_OPEN	(char)(0x00)
#define GATE_CLOSED	(char)(0xFF)
#define NORMAL_INTERUP	0x11   



/* System configuration block structrure definitions */
typedef struct {
	char	fixed_value;	/* 0x03 fixed value code */
	char	unused_scb;
	short	ccb_ptr[2];	/* pointer to ->CHANNEL CONTROL BLOCK */
} fmt_scb;


/* System configuration pointer structure definitions */
typedef struct {
	char	bus_size;	/* width of system bus 0=8; 1=16 */
	char	unused_scp;
	short	scb_ptr[2];	/* pointer to ->SYSTEM CONFIGUREATION BLOCK */
} fmt_scp;

#define	_16_BITS	1
#define	_8_BITS		0

Changes to sys/tahoe/vba/scat_vddc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*	scat_vddc.c	1.1	85/07/21	*/

#include "fsd.h"
#if NVD > 0
/*
**	VDDC Driver - Versabus to SMD direct interface version.
**		Written for TAHOE vmunix, CCI-WDC 9/1/83.		
**		Modified June 1984 to use scatter/gather.
*/

#include "../h/param.h"
#include "../h/buf.h"
#include "../h/cmap.h"
#include "../h/conf.h"
#include "../h/dir.h"
#include "../h/dk.h"
#include "../h/map.h"
#include "../machine/mtpr.h"
#include "../machine/pte.h"
#include "../h/systm.h"
#include "../vba/vbavar.h"
#include "../h/user.h"
#include "../h/vmmac.h"
#include "../h/proc.h"
#include "../h/uio.h"
#include "../vba/vddc.h"

int	vddebug = 1;	/* if = 1, error messages are printed on the console */
int	vdintflg = 0;	/* if = 1, interrupts are handled by the driver, 
			 * otherwise they are just ignored. (during setup) */

static struct size FSD[] = {
    9600,       0,	/* minor 0/ 8/16/24 = fsd0a - fsd3a - cyl   0 -  59*/
|
















|
|

|




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*	scat_vddc.c	1.2	86/01/05	*/

#include "fsd.h"
#if NVD > 0
/*
**	VDDC Driver - Versabus to SMD direct interface version.
**		Written for TAHOE vmunix, CCI-WDC 9/1/83.		
**		Modified June 1984 to use scatter/gather.
*/

#include "../h/param.h"
#include "../h/buf.h"
#include "../h/cmap.h"
#include "../h/conf.h"
#include "../h/dir.h"
#include "../h/dk.h"
#include "../h/map.h"
#include "../tahoe/mtpr.h"
#include "../tahoe/pte.h"
#include "../h/systm.h"
#include "../tahoevba/vbavar.h"
#include "../h/user.h"
#include "../h/vmmac.h"
#include "../h/proc.h"
#include "../h/uio.h"
#include "../tahoevba/vddc.h"

int	vddebug = 1;	/* if = 1, error messages are printed on the console */
int	vdintflg = 0;	/* if = 1, interrupts are handled by the driver, 
			 * otherwise they are just ignored. (during setup) */

static struct size FSD[] = {
    9600,       0,	/* minor 0/ 8/16/24 = fsd0a - fsd3a - cyl   0 -  59*/

Changes to sys/tahoe/vba/scope.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*	scope.h	1.1	85/07/21	*/

/*  Some I/O addresses used to generate pulses for scopes */
#define	OUT1	0xffffb034
#define	OUT2	0xffffb018
#define	OUT3	0xffffb020
#define	OUT4	0xffffb004
#define	OUT5	0xffffb024
#define	OUT6	0xffffb00c
#define	OUT7	0xffffb02c

#define	IOaddr(off)	(char *)(&vmem[(off) & 0x0fffff])

extern char vmem[];
int	iospace_mapped;
#define	scope_out(x)	if(iospace_mapped) movob (0, IOaddr(OUT/**/x))
#define	scope_in(x)	if(iospace_mapped) dummy =  *IOaddr(IN/**/x)
|










|



|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*	scope.h	1.2	86/01/05	*/

/*  Some I/O addresses used to generate pulses for scopes */
#define	OUT1	0xffffb034
#define	OUT2	0xffffb018
#define	OUT3	0xffffb020
#define	OUT4	0xffffb004
#define	OUT5	0xffffb024
#define	OUT6	0xffffb00c
#define	OUT7	0xffffb02c

#define	IOaddr(off)	(caddr_t)(&vmem[(off) & 0x0fffff])

extern char vmem[];
int	iospace_mapped;
#define	scope_out(x)	if(iospace_mapped) movob(IOaddr(OUT/**/x),0)
#define	scope_in(x)	if(iospace_mapped) dummy =  *IOaddr(IN/**/x)

Changes to sys/tahoe/vba/vba.c.

1
2
3
4

5
6
7
8
9
10
11
12
13

14
15

16
17



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45




46

47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76





77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109






110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*	vba.c	1.1	85/07/21	*/

#include "../h/param.h"
#include "../h/buf.h"

#include "../h/cmap.h"
#include "../h/conf.h"
#include "../h/dir.h"
#include "../h/dk.h"
#include "../h/map.h"
#include "../machine/mtpr.h"
#include "../machine/pte.h"
#include "../h/systm.h"
#include "../vba/vbavar.h"

#include "../h/user.h"
#include "../h/vmmac.h"

#include "../h/proc.h"





/*
 * Next piece of logic takes care of unusual cases when less (or more) than
 * a full block (or sector) are required. This is done by the swaping
 * logic, when it brings page table pages from the swap device.
 * Since some controllers can't read less than a sector, the
 * only alternative is to read the disk to a temporary buffer and
 * then to move the amount needed back to the process (usually proc[0]
 * or proc[2]).
 * On Tahoe, the virtual addresses versus physical I/O problem creates
 * the need to move I/O data through an intermediate buffer whenever one
 * of the following is true:
 *	1) The data length is not a multiple of sector size
 *	2) The base address + length cross a physical page boundary
 *	3) The virtual address for I/O is not in the system space.
 */

buf_setup(bp, sectsize)
struct	buf *bp;
long	sectsize;	/* This disk's physical sector size */
{
/*
 * IO buffer preparation for possible buffered transfer.
 * The relevant page table entries are kept in the 'buf' structure,
 * for later use by the driver's 'start' routine or 'interrupt'
 * routine, when user's data has to be moved to the intermediate
 * buffer.
 */




	caddr_t	source_pte_adr;


	if ((((int)bp->b_un.b_addr & PGOFSET) + bp->b_bcount) > NBPG ||
			(bp->b_bcount % sectsize) != 0 ||
			((int)bp->b_un.b_addr & 0xc0000000) != 0xc0000000) {
		bp->b_flags |= B_NOT1K;
		if (bp->b_flags & B_DIRTY)
			source_pte_adr = (caddr_t)vtopte(&proc[2], 
						btop(bp->b_un.b_addr));
			else source_pte_adr = (caddr_t)vtopte(bp->b_proc, 
						btop(bp->b_un.b_addr));
		bp->b_ptecnt = (bp->b_bcount + NBPG -1 +
			((int)bp->b_un.b_addr & PGOFSET)) / NBPG;

		bcopy (source_pte_adr, bp->b_upte, bp->b_ptecnt*4);
	}
}

int mapbusy;		/* semaphore on the system IOmap buffer */

get_ioadr(bp, buffer, map, utl)
struct buf *bp;
char	*buffer;	/* Driver's own intermediate buffer. */
long	*map;		/* A bunch of system pte's */
struct	user *utl;	/* The system address mapped through 'map' */
/*
 * This routine is usually called by the 'start' routine. It
 * returns the physical address of the first byte for IO, to
 * be presented to the controller. If intermediate buffering is
 * needed and a write out is done, now is the time to get the
 * original user's data in the buffer.
 */





{
	register phadr, i;

	if (bp->b_flags & B_NOT1K) {
		phadr = vtoph (bp->b_proc, buffer);
		if ( (bp->b_flags & B_READ) == 0) {
			for (i=0; i<bp->b_ptecnt; i++) {
				map[i] = bp->b_upte[i] 
					& ~PG_PROT | PG_V | PG_KR;
				mtpr ((caddr_t)utl + i*NBPG, TBIS);
				mtpr ((caddr_t)utl + i*NBPG, P1DC);
			}
			bcopy (((int)bp->b_un.b_addr & PGOFSET) + 
					(caddr_t)utl, buffer,bp->b_bcount);
		}
	} 
	else
		phadr = vtoph (bp->b_proc, bp->b_un.b_addr);
	return (phadr);
}

end_transfer(bp, buffer, map, utl)
register struct buf *bp;
char	*buffer;	/* Driver's own intermediate buffer. */
long	*map;	/* A bunch of system pte's */
struct	user *utl;	/* The system address mapped through 'map' */
{
/*
 * Called by the driver's interrupt routine, after the data is
 * realy in or out. If that was a read, and the NOT1K flag was on,
 * now is the time to move the data back into user's space. 
 * Mostly analogous to the get_ioadr routine, but in the reverse direction.
 */






	register i, cnt;

	if (bp->b_flags & B_READ)
		if (bp->b_flags & B_NOT1K) {
			for (cnt = bp->b_bcount ; cnt >= 0; cnt -= NBPG) {
				mtpr ((int)buffer + cnt-1, P1DC);
				mtpr ((caddr_t)bp->b_un.b_addr + cnt-1, P1DC);
			}
			if ( ((int)buffer & PGOFSET) != 0)
				mtpr (buffer, P1DC);
			if ( ((int)bp->b_un.b_addr & PGOFSET) != 0)
				mtpr ((caddr_t)bp->b_un.b_addr, P1DC);
			for (i=0; i<bp->b_ptecnt; i++) {
				map[i] = bp->b_upte[i] 
					& ~PG_PROT | PG_V | PG_KW;
				mtpr ((caddr_t)utl + i*NBPG, TBIS);
			}
			bcopy (buffer, 
				((int)bp->b_un.b_addr & PGOFSET) + 
					(caddr_t)utl, bp->b_bcount);
		}
		else
			mtpr (bp->b_un.b_addr, P1DC);
	bp->b_flags &= ~B_NOT1K;
}

movob (byte, address)
{
	asm(" movob 7(fp),*8(fp);");
}

movow (word, address)
{
	asm(" movow 6(fp),*8(fp);");
}

|

|
|
>
|
|
|
|
|
|
|
|
|
>
|
|
>
|

>
>
>

















<
<
<
<







>
>
>
>

>


|
|

<
<
|
|
|

|
>
|



<
<
<
<
<
<
<







>
>
>
>
>




|
|



|
|

|
|

<
|
|



<
<
<
<
<
<




|

>
>
>
>
>
>





|
|

|
|
|
|



|

<
|
|
<
|
|


<
<
<
<
<
<
<
<
<
<
<
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40




41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58


59
60
61
62
63
64
65
66
67
68







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

96
97
98
99
100






101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

130
131

132
133
134
135











/*	vba.c	1.2	86/01/05	*/

#include "../tahoe/mtpr.h"
#include "../tahoe/pte.h"

#include "param.h"
#include "buf.h"
#include "cmap.h"
#include "conf.h"
#include "dir.h"
#include "dk.h"
#include "map.h"
#include "systm.h"
#include "user.h"
#include "vmparam.h"
#include "vmmac.h"
#include "proc.h"

#include "../tahoevba/vbavar.h"

/*
 * Tahoe VERSAbus adapator support routines.
 */

/*
 * Next piece of logic takes care of unusual cases when less (or more) than
 * a full block (or sector) are required. This is done by the swaping
 * logic, when it brings page table pages from the swap device.
 * Since some controllers can't read less than a sector, the
 * only alternative is to read the disk to a temporary buffer and
 * then to move the amount needed back to the process (usually proc[0]
 * or proc[2]).
 * On Tahoe, the virtual addresses versus physical I/O problem creates
 * the need to move I/O data through an intermediate buffer whenever one
 * of the following is true:
 *	1) The data length is not a multiple of sector size
 *	2) The base address + length cross a physical page boundary
 *	3) The virtual address for I/O is not in the system space.
 */





/*
 * IO buffer preparation for possible buffered transfer.
 * The relevant page table entries are kept in the 'buf' structure,
 * for later use by the driver's 'start' routine or 'interrupt'
 * routine, when user's data has to be moved to the intermediate
 * buffer.
 */
vbasetup(bp, sectsize)
	register struct buf *bp;
	int sectsize;	/* This disk's physical sector size */
{
	caddr_t	source_pte_adr;
	register int v;

	if ((((int)bp->b_un.b_addr & PGOFSET) + bp->b_bcount) > NBPG ||
	    (bp->b_bcount % sectsize) != 0 ||
	    ((int)bp->b_un.b_addr & 0xc0000000) != 0xc0000000) {
		bp->b_flags |= B_NOT1K;


		v = btop(bp->b_un.b_addr);
		source_pte_adr = (caddr_t)(bp->b_flags&B_DIRTY ?
		    vtopte(&proc[2], v) : vtopte(bp->b_proc, v));
		bp->b_ptecnt = (bp->b_bcount + NBPG -1 +
		    ((int)bp->b_un.b_addr & PGOFSET)) / NBPG;
		bcopy(source_pte_adr, (caddr_t)bp->b_upte,
		    (unsigned)bp->b_ptecnt*4);
	}
}








/*
 * This routine is usually called by the 'start' routine. It
 * returns the physical address of the first byte for IO, to
 * be presented to the controller. If intermediate buffering is
 * needed and a write out is done, now is the time to get the
 * original user's data in the buffer.
 */
vbastart(bp, v, map, utl)
	struct buf *bp;
	caddr_t v;		/* Driver's own intermediate buffer. */
	long *map;		/* A bunch of system pte's */
	caddr_t utl;	/* The system address mapped through 'map' */
{
	register phadr, i;

	if (bp->b_flags & B_NOT1K) {
		phadr = vtoph(bp->b_proc, (unsigned)v);
		if ((bp->b_flags & B_READ) == 0) {
			for (i=0; i<bp->b_ptecnt; i++) {
				map[i] = bp->b_upte[i] 
					& ~PG_PROT | PG_V | PG_KR;
				mtpr(TBIS, utl + i*NBPG);
				mtpr(P1DC, utl + i*NBPG);
			}
			bcopy(((int)bp->b_un.b_addr & PGOFSET) + utl,
			    v, (unsigned)bp->b_bcount);
		}

	} else
		phadr = vtoph(bp->b_proc, (unsigned)bp->b_un.b_addr);
	return (phadr);
}







/*
 * Called by the driver's interrupt routine, after the data is
 * realy in or out. If that was a read, and the NOT1K flag was on,
 * now is the time to move the data back into user's space. 
 * Similar to the vbastart routine, but in the reverse direction.
 */
vbadone(bp, v, map, utl)
	register struct buf *bp;
	caddr_t v;	/* Driver's own intermediate buffer. */
	long *map;	/* A bunch of system pte's */
	caddr_t utl;	/* The system address mapped through 'map' */
{
	register i, cnt;

	if (bp->b_flags & B_READ)
		if (bp->b_flags & B_NOT1K) {
			for (cnt = bp->b_bcount ; cnt >= 0; cnt -= NBPG) {
				mtpr(P1DC, (int)v + cnt-1);
				mtpr(P1DC, (caddr_t)bp->b_un.b_addr + cnt-1);
			}
			if (((int)v & PGOFSET) != 0)
				mtpr(P1DC, v);
			if (((int)bp->b_un.b_addr & PGOFSET) != 0)
				mtpr(P1DC, (caddr_t)bp->b_un.b_addr);
			for (i=0; i<bp->b_ptecnt; i++) {
				map[i] = bp->b_upte[i] 
					& ~PG_PROT | PG_V | PG_KW;
				mtpr(TBIS, utl + i*NBPG);
			}

			bcopy(v, ((int)bp->b_un.b_addr & PGOFSET)+utl,
			    (unsigned)bp->b_bcount);

		} else
			mtpr(P1DC, bp->b_un.b_addr);
	bp->b_flags &= ~B_NOT1K;
}











Changes to sys/tahoe/vba/vd.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86




87
88
89
90
91

92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

168
169
170
171
172
173
174
175
176
177
178
179



180
181
182
183
184
185
186
187

188
189


190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
260
261
262
263




264
265

266
267
268

269
270
271
272

273

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306




307
308
309
310
311
312
313
314
315
316
317
318
319




320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348

349

350
351











352
353
354
355
356
357
358
359
360
361
362
363
364



365
366



367

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382

383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410


411
412
413
414
415
416
417
418
419
420
421
422
423
424

425
426
427
428
429
430



431

432
433
434


























































435






























436
437
438





439
440

















441




442


443
444
445

446
447
448
449
450

451
452
453
454
455
456
457
458
459
460

461
462
463
464

465

466
467







468

469
470
471
472
473
474
475
476



477

478
479
480
481
482
483
484


485
486
487
488
489
490
491
492
493
494
495
496
497
498

499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514

515
516

517
518
519
520



521
522
523

524

525



526
527

528
529
530
531
532

533
534
535
536

537
538




539

540
541
542
543
544

545
546
547







548


549
550
551
552

553
554

555
556
557
558

559
560
561
562



563
564
565



566
















567
568
569
570
571
572


573






574

575
576
577
578
579
580




581
582
583


584
585








586





587




588



589
590
591
592
593
594

595
596
597
598
599
600
601
602

603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620



621

622
623







624
625
626
627
628
629

630
631
632
633

634

635
636

637
638

639
640
641
642
643
644
645
646
647
648

649

650


651



652
653
654


655

656
657
658
659
660

661
662










663
664
665
666
667
668
669
670

671


672






673







674



675




















































676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730


731
732
733
734

735
736
737
738
739
740
741
742
743
744
745

746




747
748

749


750





751

752



753







754


755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774


775




776


777
778

779
780
781
782

783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806



807
808
809
810
811
812
813
814



815








816













817
818




819
820

821
822
823

824
825
826
827

828
829




830
831
832
833
834
835
836

837
838






839

840

841
/*	vd.c	1.1	85/07/21	*/

#include "fsd.h"
#if NVD > 0
/*
**	VDDC Driver - Versabus to SMD direct interface version.
**		Written for TAHOE vmunix, CCI-WDC 9/1/83.		
*/

#include "../h/param.h"
#include "../h/buf.h"
#include "../h/cmap.h"
#include "../h/conf.h"
#include "../h/dir.h"
#include "../h/dk.h"
#include "../h/map.h"
#include "../machine/mtpr.h"
#include "../machine/pte.h"
#include "../h/systm.h"
#include "../vba/vbavar.h"
#include "../h/user.h"
#include "../h/vmmac.h"
#include "../h/proc.h"
#include "../h/uio.h"
#include "../vba/vddc.h"

int	vddebug = 1;	/* if = 1, error messages are printed on the console */
int	vdintflg = 0;	/* if = 1, interrupts are handled by the driver, 
			 * otherwise they are just ignored. (during setup) */

static struct size FSD[] = {
    9600,       0,	/* minor 0/ 8/16/24 = fsd0a - fsd3a - cyl   0 -  59*/
   12000,    9600,	/* minor 1/ 9/17/25 = fsd0b - fsd3b - cyl  60 - 134*/
  108480,   21600,	/* minor 2/10/18/26 = fsd0c - fsd3c - cyl 135 - 812*/
    1600,  130080,	/* minor 3/11/19/27 = fsd0d - fsd3d - cyl 813 - 822*/
  130080,       0,	/* minor 4/12/20/28 = fsd0e - fsd3e - cyl   0 - 812*/
  131680,       0,	/* minor 5/13/21/29 = fsd0f - fsd3f - cyl   0 - 822*/
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
       0,	0,	/* Non existent minor device */
};

static struct size	SMD[]= {
    20064,	0, 	/* minor 32/40/48/56 = smd0a - smd3a cyl 0- 65 */
    13680,  20064, 	/* minor 33/41/49/57 = smd0b - smd3b cyl 66- 110 */
   214928,  33744, 	/* minor 34/42/50/58 = smd0c - smd3c cyl 111-817 */
     1520, 248672, 	/* minor 35/43/51/59 = smd0d - smd3d cyl 818-822 */
   248672,	0, 	/* minor 36/44/52/60 = smd0e - smd3e cyl 0-817 */
   250192,	0, 	/* minor 37/45/53/61 = smd0f - smd3f cyl 0-822 */
	0,	0, 	/* minor 38/46/54/62 = smd0g - smd3g */
	0,	0, 	/* minor 39/47/55/63 = smd0h - smd3h */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
};

static struct size XFSD[] = {
    20352,	0, 	/* minor 64/72/80/88 = xfsd0a - xfsd3a cyl 0- 52 */
    20352,  20352, 	/* minor 65/73/81/89 = xfsd0b - xfsd3b cyl 53- 105 */
   230400,  40704, 	/* minor 66/74/82/90 = xfsd0c - xfsd3c cyl 106-705 */
     1920, 271104, 	/* minor 67/75/83/91 = xfsd0d - xfsd3d cyl 706-710 */
   271104,	0, 	/* minor 68/76/84/92 = xfsd0e - xfsd3e cyl 0-705 */
   273024,	0, 	/* minor 69/77/85/93 = xfsd0f - xfsd3f cyl 0-710 */
	0,	0, 	/* minor 70/78/86/94 = xfsd0g - xfsd3g */
	0,	0, 	/* minor 71/79/87/95 = xfsd0h - xfsd3h */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
	0,	0,	/* Non existent minor device */
};





/*
/*
/* Layout of minor number assignments for the VDDC devices.
/*

/* 	  1
/*	  5		            3 2   0
/*	 +---------------------------+-----+
/*	 |     		 Unit number | FLS |
/*	 +---------------------------+-----+
/*			      	   |    |_____ File system # ( 0-7 )
/*			      	   |__________ Unit # in the system
/*
/********************************************************/

#define VDUNIT(x)	(minor(x) >> 3)
#define FLSYS(x)	(minor(x) & 0x07)

#define PHYS(x)		( vtoph( 0, (int) (x) ) )


/* Drive types should be in order of drive capacity for auto-configuration */
/* e.g: smallest capacity = drive type 0, highest capacity = type NXPDRV-1 */

struct vdst {
	short nsect;
	short ntrak;
	short nspc;
	short ncyl;
	struct size *sizes;
	short dtype;		/* type as in byte 5 (drive) of iopb */
	char	*name;		/* drive name for autoconf */
} vdst[] = {

16,	10,	16*10,	823,	FSD,	0,	"fsd",
16,	19,	16*19,	823,	SMD,	1, 	"smd",
16,	24,	16*24,  711,   XFSD,	2,	"xfd"
};



struct	vba_ctlr *vdminfo[NVD];
struct  vba_device *vddinfo[NFSD];

/*
**	Internal Functions
*/
int	vdopen();
int	vdclose();
int	vdprobe();		/* See if VDDC is really there */
int	vd_setup();		/* Called from vdprobe */
int	vdslave();		/* See if drive is really there */
int	vdattach();
int	vddgo();
int	vdstrategy();		/* VDDC strategy routine */
int	vdstart();		/* Top level interface to device queue */
int	vdintr();		/* Top Level ISR */
int	vdread();		/* raw i/o read routine */
int	vdwrite();		/* raw i/o write routine */
int	vddump();		/* dump routine */
int	vdsize();		/* sizes for swapconfig */
int	dskrst();		/* reset a drive after hard error */

long	vdstd[] = {
		0x0f2000 };

struct	vba_driver vddriver = {
	vdprobe, vdslave, vdattach, vddgo, vdstd, 
	"smd/fsd", vddinfo, "vd", vdminfo
};

struct	buf	vdutab[NFSD];
struct 	buf	rvdbuf[NFSD];
char	vdbuf[NVD][MAXBPTE * NBPG];	/* internal buffer for raw/swap i/o */
long	vdbufused[NVD];
extern char	vd0utl[],vd1utl[],vd2utl[],vd3utl[];

/*
**	Disk Address
*/
struct	dskadr	{
	char	track;		/* all 8 bits */
	char	sector;		/* low order 5 bits */

	short	cylinder;	/* low order 12 bits */
};

/*
**	DCB Trailer Formats
**********************************/

/*
**	Read / Write Trailer
*/
struct	trrw	{
	char	*memadr;			/* memory address */



	long	wcount;				/* 16 bit word count */
	struct	dskadr	disk;			/* disk address */
};

/*
**	Format Trailer
*/
struct	trfmt	{

	char	*addr;			/* data buffer to be filled on sector*/
	long	nsectors;		/* # of sectors to be formatted */


	struct	dskadr	disk;
	struct	dskadr  hdr;
};

/*
**	Reset / Configure Trailer
*/
struct	treset	{
	long	ncyl;		/* # cylinders */
	long	nsurfaces;	/* # surfaces */
};				/* # of sectors is defined by VDDC */
				/* to be 32/track of 512 data bytes each */

/*
**	Seek Trailer
*/
struct	trseek	{
	struct	dskadr	disk;
};

/*
**	DCB Format
*/
struct	fmt_dcb	{
	struct	fmt_dcb	*nxtdcb;	/* next dcb in chain or End of Chain */
	short	intflg;			/* interrupt settings and flags */
	short	opcode;			/* DCB Command code etc... */
	long	operrsta;		/* Error & Status info */
	short	fill;			/* not used */
	char	devselect;		/* Drive selection */
	char	trailcnt;		/* Trailer Word Count */
	long	err_memadr;		/* Error memory address */
	short	fill2;
	short	err_wcount;		/* Error word count */
	short	err_track;		/* Error track/sector */
	short	err_cyl;		/* Error cylinder adr */
	union	{
		struct	trrw	rwtrail;	/* read/write trailer */
		struct	trfmt	fmtrail;	/* format trailer */
		struct	treset	resetrail;	/* reset/configure trailer */
		struct	trseek	seektrail;	/* seek trailer */
	} trail;
};

/*
**	MDCB Format
*/
struct	fmt_mdcb	{
	struct	fmt_dcb	*firstdcb;	/* first dcb in chain */
	struct	fmt_dcb	*procdcb;	/* dcb being processed */
	struct	fmt_dcb	*intdcb;	/* dcb causing interrupt */
	long	vddcstat;		/* VDDC status */
}mdcbx[NVD];

/*
**	DCB
*/

struct	fmt_dcb		dcbx[NVD];

int vdtimeout;	
#define	POLLTILLDONE(x, name) { \
	vdtimeout = 1000*(x); \

	uncache((char *)&dcb->operrsta); \
	while (! (dcb->operrsta & DCBCMP)) { \
		DELAY(1000); \
		vdtimeout--; \
		uncache((char *)&dcb->operrsta); \
		if (vdtimeout <=0) { \
			printf("vd: timeout on %s\n", name);\
			return(0); \
		} \
	} \
}





/*

**	See if the controller is really there. 
**	if TRUE - initialize the controller.
*/

vdprobe(cntrl_vaddr)
caddr_t cntrl_vaddr;
{
	if ( badaddr(cntrl_vaddr,2) ) return(0); /* no controller */

	else 

		if (vd_setup(cntrl_vaddr))	/* initialize the controller */
			return(1);
		else return(0);		/* initialization error */	
}

vd_setup(cntrl_vaddr)
caddr_t cntrl_vaddr;
{
	register struct fmt_dcb *dcb = &dcbx[0];
	register struct fmt_mdcb *mdcb = &mdcbx[0];
	int j;

	VDDC_RESET(cntrl_vaddr);		/* Reset the controller */
		/* Burn some time ...... needed after accessing reset port */
	for (j=0; j<20; j++)
		DELAY(1000);

	/* setup & issue INIT to initialize VDDC */

	dcb->opcode = INIT;
	dcb->nxtdcb = (struct fmt_dcb *)0;
	dcb->intflg = NOINT;
	mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
	dcb->operrsta  = 0;
	VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) );	/* do it */
	POLLTILLDONE(1,"INIT");		/* poll till done */
	if (dcb->operrsta & HRDERR) {
		if (vddebug)
			printf("vd: init error, err=%b\n",
			    dcb->operrsta, ERRBITS);
		return(0);
	}
	/* setup & issue DIAGNOSE */





	dcb->opcode = DIAG;
	dcb->nxtdcb = (struct fmt_dcb *)0;
	dcb->intflg = NOINT;
	mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
	dcb->operrsta  = 0;
	VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) )	/* do it */
	POLLTILLDONE(1,"DIAG")		/* poll till done */
	if (dcb->operrsta & HRDERR) {
		if (vddebug)
			printf("vd: diagnose error, err=%b\n",
			    dcb->operrsta, ERRBITS);
		return(0);




	}
	/* Start drives command */
#ifdef notdef
	dcb->opcode = VDSTART;
	dcb->nxtdcb = (struct fmt_dcb *)0;
	dcb->intflg = NOINT;
	mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
	dcb->operrsta  = 0;
	VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) )	/* do it */
	POLLTILLDONE(20,"VDSTART")		/* poll till done */
	if (dcb->operrsta & HRDERR) {
		if (vddebug)
			printf("vd: start error, err=%b\n",
			    dcb->operrsta, ERRBITS);
		return(0);
	}
#endif
	return(1);
   }

/*
 * See if a drive is really there
 * Try to Reset/Configure the drive, then test its status.
*/
vdslave(ui,cntrl_vaddr)
register struct vba_device *ui;
register caddr_t cntrl_vaddr;
{
	register struct fmt_dcb	*dcb = &dcbx[0];

	register struct fmt_mdcb *mdcb = &mdcbx[ui->ui_ctlr];

	register struct vdst *st;
	int dsktype;












	/*
	**  check drive status - see if drive exists. 
	*/
	dcb->opcode = VDSTATUS;
	dcb->intflg = NOINT;
	dcb->operrsta  = 0;
	dcb->devselect = (char)ui->ui_slave;
	dcb->trailcnt = (char)0;
	mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
	mdcb->vddcstat = 0;
	VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb))	/* do it */
	POLLTILLDONE(5,"VDSTATUS")



#ifdef notdef
	if (dcb->operrsta & HRDERR) {



		if (vddebug) 

		  printf("vd%d: status error, err=%b\n", ui->ui_unit,
		      dcb->operrsta, ERRBITS);
		return(0);
	}
#endif
	uncache((char *)&mdcb->vddcstat);
	if (mdcb->vddcstat & DRVNRDY) return(0); /* not ready-> non existent */

	/*
	 * drive is alive, now get its type!
	 * Seek on all drive types starting from the largest one.
	 * a sucessful seek to the last sector/cylinder/track verifies 
	 * the drive type connected to this port. 
	 */
	for (dsktype = NVDDRV-1; dsktype >= 0; dsktype--) {	

		st = &vdst[dsktype];
		dcb->opcode = RSTCFG;		/* configure drive command */
		dcb->intflg = NOINT;
		dcb->operrsta  = 0;
		dcb->trail.resetrail.ncyl = st->ncyl;
		dcb->trail.resetrail.nsurfaces = st->ntrak;
		dcb->devselect = (char)ui->ui_slave;
		dcb->trailcnt = (char)2;
		mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
		VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) )	/* do it */
		POLLTILLDONE(3,"RSTCFG")
		if (dcb->operrsta & HRDERR) {
			if (vddebug) 
				printf("vd%d: reset error, err=%b\n", 
				    ui->ui_unit, dcb->operrsta, ERRBITS);
			return(0);
		}
		mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
		dcb->intflg = NOINT;
		dcb->opcode =  RD;
		dcb->operrsta = 0;
		dcb->devselect = (char)ui->ui_slave;
		dcb->trailcnt = (char)3;
		dcb->trail.rwtrail.memadr = (char *)PHYS(vdbuf);
		dcb->trail.rwtrail.wcount = 256;
		dcb->trail.rwtrail.disk.cylinder = st->ncyl -4;
		dcb->trail.rwtrail.disk.track = st->ntrak -1;
		dcb->trail.rwtrail.disk.sector = 0;


		VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) )	/* do it */
		POLLTILLDONE(5,"RD")
if (vddebug) 
	printf("vd%d: cyl %d, trk %d, sec %d, operrsta err=%b\n", 
	   ui->ui_unit, 
	   dcb->trail.rwtrail.disk.cylinder,
	   dcb->trail.rwtrail.disk.track,
	   dcb->trail.rwtrail.disk.sector,
	   dcb->operrsta, ERRBITS);
		if ( (dcb->operrsta & HRDERR) == 0) 
		/* found the drive type! */
			break;
	}
	if (dsktype < 0) {

		/* If reached here, a drive which is not defined in the 
		 * 'vdst' tables is connected. Cannot set it's type.
		 */
		printf("vd%d: unrecognized drive type\n", ui->ui_unit);
		return(0);
	}



	ui->ui_type = dsktype;

	vddriver.ud_dname = st->name;
	return(1);
}

























































































vdattach(ui)
struct vba_device *ui;
{





	if (ui->ui_dk >= 0)
		dk_mspw[ui->ui_dk] = .0000020345;	/* BAD VALUE */

















}







vddgo(um)
struct vba_ctlr *um;
{

}

vdstrategy(bp)
register struct buf *bp;
{

	register struct vba_device *ui;
	register struct vba_ctlr *um;
	register int unit;
	register struct buf *dp;
	register struct size *sizep;
	int index, blocks, s;

	vdintflg = 1;		/* enable interrupts handling by the driver */
	blocks = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
	unit = VDUNIT(bp->b_dev);

	ui = vddinfo[unit];
	if (ui == 0 || ui->ui_alive == 0) goto bad1;
	index = FLSYS(bp->b_dev); /* get file system index */
	sizep = vdst[ui->ui_type].sizes;

	if (bp->b_blkno < 0 ||

	 (dkblock(bp)+blocks > sizep[index].nblocks))	/* disk overflow */
		goto bad1;







	s = spl8();

	dp = &vdutab[ui->ui_unit];
	bp->b_resid = bp->b_blkno + sizep[index].block0; 
					/* block # plays same role as
					   cylinder # for disksort, as long
					   as increasing blocks correspond to
					   increasing cylinders on disk */

	buf_setup (bp, SECTSIZ);





	disksort(dp, bp);
	if (dp->b_active == 0) {	/* unit is on controller queue */
		/* put the device on the controller queue */
		dp->b_forw = NULL;		/* end of queue indicator */
		um = ui->ui_mi;		/* get controller structure !! */
		if (um->um_tab.b_actf == NULL)	/* controller queue is empty */
			um->um_tab.b_actf = dp; 


		else
			um->um_tab.b_actl->b_forw = dp; /* add into queue */
		um->um_tab.b_actl = dp;		/* update queue tail */
		dp->b_active ++;
	}
	bp = &ui->ui_mi->um_tab;	/* controller structure addr */
	if (bp->b_actf && 		/* cntrl queue not empty */
		bp->b_active == 0)	/* controller not active */
		(void) vdstart(ui->ui_mi);/* go start I/O */
	splx(s);
	return;

bad1:
	bp->b_flags |= B_ERROR;

	iodone(bp);
	return;
}


/*
 * Start up a transfer on a drive.
 */
vdstart(um)
register struct vba_ctlr *um;
{
	register struct buf *bp, *dp;
	register struct fmt_dcb *dcb = &dcbx[um->um_ctlr];
	register struct fmt_mdcb *mdcb;
	register struct size *sizep;	/* Pointer to one of the tables */
	register struct vdst *st;

	register int index ;		/* Index in the relevant table */
	register int phadr;		/* Buffer's physical address */

	register caddr_t cntrl_vaddr = um->um_addr;
	int	sblock, unit;
	int ct;




loop:
	/*
	 * Pull a request off the controller queue

	 */

	if ((dp = um->um_tab.b_actf) == NULL)



		return ;
	if ((bp = dp->b_actf) == NULL) {

		dp->b_active = 0;	/* device removed from ctlr queue */
		um->um_tab.b_actf = dp->b_forw;
		goto loop;
	}
	/*

		 * Mark controller busy, and
		 * prepare a command packet for the controller.
		 */
	um->um_tab.b_active++;

	unit = VDUNIT(bp->b_dev);
	st = &vdst[vddinfo[unit]->ui_type];




	mdcb = &mdcbx[vddinfo[unit]->ui_ctlr];

	index = FLSYS(bp->b_dev);
	sizep = st->sizes;
	mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
	dcb->intflg = INTDUN;		/* interrupt on completion */
	dcb->opcode = (bp->b_flags & B_READ) ? RD : WD;

	dcb->operrsta = 0;
	dcb->devselect = (char)(vddinfo[unit])->ui_slave;
	dcb->trailcnt = (char)3;







	ct = vddinfo[unit]->ui_ctlr;



	switch (ct) {
		case 0:
			phadr = get_ioadr(bp, vdbuf[0], VD0map, (caddr_t)vd0utl);

			break;
		case 1:

			phadr = get_ioadr(bp, vdbuf[1], VD1map, (caddr_t)vd1utl);
			break;
		case 2:
			phadr = get_ioadr(bp, vdbuf[2], VD2map, (caddr_t)vd2utl);

			break;
		case 3:
			phadr = get_ioadr(bp, vdbuf[3], VD3map, (caddr_t)vd3utl);
			break;



	}
/*
	phadr = get_ioadr(bp, vdbuf, IOmap, (caddr_t)ioutl);



*/

















	if (vddinfo[unit]->ui_dk >= 0) {
		int dku = vddinfo[unit]->ui_dk;
		dk_busy |= 1<<dku;
		dk_xfer[dku]++;
		dk_wds[dku] += bp->b_bcount>>6;


	}






	dcb->trail.rwtrail.memadr = (char *)phadr;

	dcb->trail.rwtrail.wcount = (bp->b_bcount + 1) / 2;
	sblock = sizep[index].block0 + bp->b_blkno;
	dcb->trail.rwtrail.disk.cylinder = (short)(sblock / st->nspc);
	dcb->trail.rwtrail.disk.track = (char)((sblock % st->nspc) / st->nsect);
	dcb->trail.rwtrail.disk.sector = (char)(sblock*2 % (st->nsect*2));





#ifdef VDDCPERF
	scope_out(1);
#endif



	VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb))	/* do it */








}














/*
 * Handle a disk interrupt.
 */
vdintr(vdnum)
register vdnum;
{

	register struct buf *bp, *dp;
	register struct vba_ctlr *um = vdminfo[vdnum];	
	register struct fmt_dcb *dcb = &dcbx[vdnum];
	register struct fmt_mdcb *mdcb = &mdcbx[vdnum];
	register struct vdst *st;
	int unit;
	struct vba_device *ui;


#ifdef VDDCPERF
	scope_out(2);
#endif
	if (intenable == 0 || vdintflg == 0) 	/* ignore all interrupts */
		return;
	if (um->um_tab.b_active == NULL) return;/* unexpected interrupt */
	uncache((char *)&mdcb->intdcb);
	uncache((char *)&dcb->operrsta);
	if ( mdcb->intdcb != (struct fmt_dcb *)PHYS(dcb)) {	/* dcb causing interrupt */
		printf("vd%d: bad dcb=%x (phys=%x)\n",
		    vdnum, mdcb->intdcb, PHYS(dcb));
		return;
	}
	if (! (dcb->operrsta & DCBCMP))	{ /* unexpected interrupt */
		printf("vd%d: unexpected interrupt, err=%b\n", vdnum,
		    dcb->operrsta, ERRBITS);
		return;
	}



	dp = um->um_tab.b_actf;		/* device queue head in ctlr queue */

	bp = dp->b_actf;		/* first buffer in device queue */
	unit = VDUNIT(bp->b_dev);







	ui = vddinfo[unit];
	if (ui->ui_dk >= 0)
		dk_busy &= ~(1 << ui->ui_dk);
	if (dcb->operrsta & (HRDERR|SFTERR)) {
		st = &vdst[ui->ui_type];
		if (dcb->operrsta & HRDERR) {

			harderr(bp, &st->name[7]);
			printf("status=%b\n", dcb->operrsta, ERRBITS);
			dskrst(bp);
			bp->b_flags |= B_ERROR;

		} else

#define	SECTOR(x)	((x)*2)
			printf("%s%d: soft error sn%d status=%b\n", &st->name[7], unit,

			   SECTOR(bp->b_blkno + st->sizes[FLSYS(bp->b_dev)].block0),
			   dcb->operrsta, ERRBITS);

	}
	switch (vdnum) {
		case 0:
			end_transfer(bp, vdbuf[0], VD0map, (caddr_t)vd0utl);
			break;
		case 1:
			end_transfer(bp, vdbuf[1], VD1map, (caddr_t)vd1utl);
			break;
		case 2:
			end_transfer(bp, vdbuf[2], VD2map, (caddr_t)vd2utl);

			break;

		case 3:


			end_transfer(bp, vdbuf[3], VD3map, (caddr_t)vd3utl);



			break;
	}



	um->um_tab.b_active = 0;

	um->um_tab.b_errcnt = 0;
	if (dp->b_forw != NULL) {		/* more than 1 unit on queue */
		um->um_tab.b_actf = dp->b_forw;	/* next device on ctlr queue */
		dp->b_forw = um->um_tab.b_actl->b_forw;	/* be last in queue */
		um->um_tab.b_actl->b_forw = dp;	/* last points now to dp */

		um->um_tab.b_actl = dp;		/* pointer in ctlr structure */
	}










	dp->b_errcnt = 0;
	dp->b_actf = bp->av_forw;		/* remove first from queue */
	bp->b_resid = 0;	/* All data read here */

#ifdef VDDCPERF
	scope_out(3);
#endif


	iodone(bp);


	vdstart(um);		/* start requests for next device on queue */






}
































































vdread(dev, uio)
dev_t dev;
struct uio *uio;
{
	register int unit = VDUNIT(dev);
	register int error;
	register int ct;
	register int s;

	if (unit >= NFSD)
		error = ENXIO;
	else {
		ct = vddinfo[unit]->ui_ctlr;
		s = spl8();
		while (vdbufused[ct]) sleep (&vdbufused[ct],PRIBIO+1);
		vdbufused[ct] = 1;
		splx(s);
		error = physio(vdstrategy, &rvdbuf[unit], dev, B_READ, minphys, uio);
		vdbufused[ct] = 0;
		wakeup (&vdbufused[ct]);
	}
	return error;
}

vdwrite(dev, uio)
dev_t dev;
struct uio *uio;
{
	register int unit = VDUNIT(dev);
	register int error;
	register int ct;
	register int s;

	if (unit >= NFSD)
		error = ENXIO;
	else {
		ct = vddinfo[unit]->ui_ctlr;
		s = spl8();
		while (vdbufused[ct]) sleep (&vdbufused[ct],PRIBIO+1);
		vdbufused[ct] = 1;
		splx(s);
		error = physio(vdstrategy, &rvdbuf[unit], dev, B_WRITE, minphys, uio);
		vdbufused[ct] = 0;
		wakeup (&vdbufused[ct]);
	}
	return error;
}

#define	DUMPSIZE	32	/* Up to 32k at a time - controller limit */

vddump(dev)
dev_t	dev;
/*
 * Dump the main memory to the given device.
 */


{
	register struct vba_ctlr *um;
	register struct fmt_dcb *dcb = &dcbx[0];
	register struct fmt_mdcb *mdcb = &mdcbx[0];

	register struct vdst *st;
	register int unit;
	register caddr_t cntrl_vaddr ;
	register struct size *sizep;	/* Pointer to one of the tables */
	int index,sblock,blkcount,thiscount;
	int	memaddr;

	unit = VDUNIT(dev);
	um = (vddinfo[unit])->ui_mi;
	st = &vdst[(vddinfo[unit])->ui_type];
	dcb = &dcbx[um->um_ctlr];

	cntrl_vaddr = um->um_addr;




	memaddr = 0x0;
	index = FLSYS(dev);

	sizep = st->sizes;


	blkcount = maxfree - 2;		/* In 1k byte pages */





	if (dumplo + blkcount > sizep[index].nblocks) return(EINVAL);

	sblock = sizep[index].block0 + dumplo;



	while (blkcount > 0) {







		thiscount = MIN (blkcount, DUMPSIZE);


		mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
		dcb->intflg = NOINT;
		dcb->opcode = WD;
		dcb->operrsta = 0;
		dcb->devselect = (char)(vddinfo[unit])->ui_slave;
		dcb->trailcnt = (char)3;
		dcb->trail.rwtrail.memadr = (char *)memaddr;
		dcb->trail.rwtrail.wcount = thiscount*512;
		dcb->trail.rwtrail.disk.cylinder= (short)(sblock/st->nspc);
		dcb->trail.rwtrail.disk.track = (char)((sblock % st->nspc) 
			/ st->nsect);
		dcb->trail.rwtrail.disk.sector = (char)(sblock*2 % (st->nsect*2));
		VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) )	/* do it */
		POLLTILLDONE(5,"WD");
		if (dcb->operrsta & HRDERR) {
			if (vddebug)
				printf("vd%d: i/o error, err=%b\n", unit,
				    dcb->operrsta, ERRBITS);
			return(EIO);
		};


		blkcount -= thiscount;




		memaddr += thiscount*NBPG;


		sblock += thiscount;
	}

	return(0);
}

vdopen(dev, flag)

register dev_t dev;
int flag;
{
	register struct vba_device *ui;
	register unit = VDUNIT(dev);

	ui = vddinfo[unit];
	if (ui == 0 || ui->ui_alive == 0 || ui->ui_type >= NVDDRV)
		return ENXIO;
	return 0;
}

vdsize(dev)
register dev_t dev;
{
	register struct vba_device *ui;
	register unit = VDUNIT(dev);

	ui = vddinfo[unit];
	if (ui == 0 || ui->ui_alive == 0 || ui->ui_type >= NVDDRV)
		return -1;
	return vdst[ui->ui_type].sizes[FLSYS(dev)].nblocks;
}




/* reset a drive after a hard error */
dskrst(bp)
	register struct buf *bp;
{
	register struct vdst *st;
	register struct fmt_dcb *dcb;
	register struct fmt_mdcb *mdcb;
	register struct vba_device *ui;



	register caddr_t cntrl_vaddr ;








	int unit;














	unit = VDUNIT(bp->b_dev);




	ui = vddinfo[unit];
	mdcb = &mdcbx[ui->ui_ctlr];

	dcb = &dcbx[ui->ui_ctlr];
	cntrl_vaddr = (ui->ui_mi)->um_addr;
	st = &vdst[vddinfo[unit]->ui_type];

	dcb->opcode = RSTCFG;		/* configure drive command */
	dcb->intflg = NOINT;
	dcb->operrsta  = 0;
	dcb->trail.resetrail.ncyl = st->ncyl;

	dcb->trail.resetrail.nsurfaces = st->ntrak;
	dcb->devselect = (char)ui->ui_slave;




	dcb->trailcnt = (char)2;
	mdcb->firstdcb = (struct fmt_dcb *)PHYS(dcb);
	VDDC_ATTENTION(cntrl_vaddr,PHYS(mdcb) )	/* do it */
	POLLTILLDONE(3,"reset")
	if (dcb->operrsta & HRDERR) {
		if (vddebug) {
			harderr(bp, &st->name[7]);

			printf("reset failed, err=%b\n", dcb->operrsta,ERRBITS);
		}






	}

}

#endif
|




|
<
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>
>
>
>

<
<
<
<
>
|
<
<
<
<
<
<
<
<


|
>
|
|

<
|
|
|
|
<
<
<
<
<
<
<

<
<
<
<
|
>



|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
<

<
<
<
<
<
<

|
|
|
<
<
>
|
<
|
<
<
<
|
<
<
<
|
<
>
>
>
<
<
<


|
|
|
>
|
|
>
>
|
<
<
|
<
<
<
<
|
|
<
<
|
<
<
<
<
<
<
|
|
<
<
|
|
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
|
<

<
<
<
<
|
<
<
<
|
|
<
<
<
|
|
|
|
<
<
>
|
<
<
<
<
|
<
<
<
<
|
>
>
>
>
|
<
>
|
|
<
>
|
|
<
<
>
|
>
|
|
<
|
<
<
<
<
<
<
<
<
<
<
<
<

<
|
<
<
<
<
<
<
<
<
<
<
<
<
|
|
>
>
>
>
|
<
<
<
<
<
<
<
<
|
<
<
|
>
>
>
>
|
<
<
<
<
<
<
|
<
<
<
<
<
<
|

<
|
|



|
|
|
|
|

|
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
|
<
<
<
|
|
|
<
|
<
|
<
<
>
>
>
|
|
>
>
>
|
>
|
<
|
|
<
<
<
|

<

|


|
>
|
<
|
|
<
<
|
<
<
<
<
<
<
<
<
|
<
|

|

|
|
|
|
|
|
|
>
>
|
|
|
|
<
<
<
<
|
<
<


|
>
|


|
|

>
>
>
|
>
|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|

>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>

|

>



|

>
|
|
|
|
|
<

<
|
<
>
|
|
|
<
>
|
>
|
|
>
>
>
>
>
>
>
|
>
|
<
<
<
<
<
|
|
>
>
>
|
>
|
<
<
<
<
<
|
>
>
|
<
<
<
<
<
<
<
<
|

<
|
|
>

<

<




|
|

|
<
|
|
|
>
|
|
>
|
|
|
|
>
>
>
|
|
<
>
|
>
|
>
>
>
|
<
>
|
<
<
|
<
>
|
|
<
<
>
|
|
>
>
>
>
|
>
|
<
|
<
|
>
|
|
|
>
>
>
>
>
>
>
|
>
>
|
|
|
<
>
|
<
>
|
|
|
<
>
|
|
|
|
>
>
>
|
|
<
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
<
<
<
|
>
>

>
>
>
>
>
>
|
>
|
<
|
|
|
|
>
>
>
>



>
>
|
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
|
>
>
>



|
|

>
|
<
|
|
|
|
<

>



|
<
<
|
<
<
|
<


<
<
<
<
<
>
>
>
|
>
|

>
>
>
>
>
>
>
|
|
<
|
|
|
>
|
|
<
|
>
|
>
|
<
>
|
|
>
|
<
<
|
|
|
<
<
|
|
>
|
>
|
>
>
|
>
>
>
|

|
>
>
|
>
|
<
<
<
|
>
|
|
>
>
>
>
>
>
>
>
>
>
|
<
<
|



|
>

>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
|


<
|
<


|
|
<
<
<
<
<
|
<
<
<
<



|
|


<
|
<


|
|
<
<
<
<
<
|
<
<
|
<
|
<
<
<
<
<

|

>
>

|
|
|
>
|
|
|
|
<
|

<
<
<
|
>
|
>
>
>
>
|
<
>
|
>
>
|
>
>
>
>
>
|
>
|
>
>
>
|
>
>
>
>
>
>
>
|
>
>
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
>
>
|
>
>
>
>
|
>
>
|
<
>
|
|
|
<
>
|
<
<
<
<
|
<
<
|
<



|

|
<

<
|
|
|


>
>
>
|
|
|

|
|
|
|
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
|
|
>
|
|
|
>
|
<
<
|
>
|
<
>
>
>
>
|
<
<
|
<
<
<
>
|
|
>
>
>
>
>
>

>

>

1
2
3
4
5
6

7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22











































23


















24
25
26
27
28




29
30








31
32
33
34
35
36
37

38
39
40
41







42




43
44
45
46
47
48






















49
50
51

52






53
54
55
56


57
58

59



60



61

62
63
64



65
66
67
68
69
70
71
72
73
74
75


76




77
78


79






80
81


82
83



84
85











86

87




88



89
90



91
92
93
94


95
96




97




98
99
100
101
102
103

104
105
106

107
108
109


110
111
112
113
114

115












116

117












118
119
120
121
122
123
124








125


126
127
128
129
130
131






132






133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163



164
165
166

167

168


169
170
171
172
173
174
175
176
177
178
179

180
181



182
183

184
185
186
187
188
189
190

191
192


193








194

195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211




212


213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

370

371

372
373
374
375

376
377
378
379
380
381
382
383
384
385
386
387
388
389
390





391
392
393
394
395
396
397
398





399
400
401
402








403
404

405
406
407
408

409

410
411
412
413
414
415
416
417

418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
441

442
443


444

445
446
447


448
449
450
451
452
453
454
455
456
457

458

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476

477
478

479
480
481
482

483
484
485
486
487
488
489
490
491
492

493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513




514
515
516
517
518
519
520
521
522
523
524
525
526

527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572

573
574
575
576

577
578
579
580
581
582


583


584

585
586





587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602

603
604
605
606
607
608

609
610
611
612
613

614
615
616
617
618


619
620
621


622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656


657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742

743

744
745
746
747





748




749
750
751
752
753
754
755

756

757
758
759
760





761


762

763





764
765
766
767
768
769
770
771
772
773
774
775
776
777

778
779



780
781
782
783
784
785
786
787

788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817














818
819

820
821
822
823
824
825
826
827
828
829
830

831
832
833
834

835
836




837


838

839
840
841
842
843
844

845

846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901


902
903
904

905
906
907
908
909


910



911
912
913
914
915
916
917
918
919
920
921
922
923
924
/*	vd.c	1.2	86/01/05	*/

#include "fsd.h"
#if NVD > 0
/*
 * VDDC - Versabus SMD/ESMD driver.

 */

#include "../tahoe/mtpr.h"
#include "../tahoe/pte.h"

#include "param.h"
#include "buf.h"
#include "cmap.h"
#include "conf.h"
#include "dir.h"
#include "dk.h"
#include "map.h"
#include "systm.h"
#include "user.h"
#include "vmmac.h"
#include "proc.h"
#include "uio.h"






























































#include "../tahoevba/vbavar.h"
#define	VDGENDATA
#include "../tahoevba/vddcreg.h"
#undef VDGENDATA





#define	MAX_BLOCKSIZE	(MAXBPTE*NBPG)
#define	DUMPSIZE	64	/* controller limit */









#define VDUNIT(x)	(minor(x) >> 3)
#define FILSYS(x)	(minor(x) & 0x07)
#define PHYS(x)		(vtoph((struct proc *)0, (unsigned)(x)))
#define TRUE		1
#define	FALSE		0


#define CTLR_ERROR	1
#define DRIVE_ERROR	2
#define HARD_DATA_ERROR	3
#define SOFT_DATA_ERROR	4












#define b_cylin	b_resid
#define b_daddr	b_error

struct	vba_ctlr *vdminfo[NVD];
struct  vba_device *vddinfo[NFSD];
int	vdprobe(), vdslave(), vdattach(), vddgo();






















struct	vba_driver vddriver =
    { vdprobe, vdslave, vdattach, vddgo, vddcaddr, "smd/fsd",
      vddinfo, "vd", vdminfo };








/*
 * Per-drive state.
 */
typedef struct {


	struct	buf raw_q_element;
	short	sec_per_blk;

	short	sec_per_cyl;



	char	status;



	struct	buf xfer_queue;

	int	drive_type;
	fs_tab	info;
} unit_tab;




/*
 * Per-controller state.
 */
typedef struct {
	char	ctlr_type;	/* controller type */
	char	*map;		/* i/o page map */
	char	*utl;		/* mapped i/o space */
	u_int	cur_slave:8;	/* last active unit number */
	u_int	int_expected:1;	/* expect an interupt */
	u_int	ctlr_started:1;	/* start command was issued */


	u_int	overlap_seeks:1;/* should overlap seeks */




	u_int	off_cylinder:16;/* off cylinder bit map */
	u_int	unit_type[16];	/* slave types */


	u_int	cur_cyl[16];	/* cylinder last selected */






	long	cur_trk[16];	/* track last selected */
	fmt_mdcb ctlr_mdcb;	/* controller mdcb */


	fmt_dcb	ctlr_dcb;	/* r/w dcb */
	fmt_dcb	seek_dcb[4];	/* dcbs for overlapped seeks */



	/* buffer for raw/swap i/o */
	char	rawbuf[MAX_BLOCKSIZE];











} ctlr_tab;






extern char	vd0utl[];



#if NVD > 1
extern char	vd1utl[];



#endif
#if NVD > 2
extern char	vd2utl[];
#endif


#if NVD > 3
extern char	vd3utl[];




#endif





#define	VDCINIT(map, utl) { \
    UNKNOWN, (char *)map, utl, 0, FALSE, FALSE, TRUE, 0, \
	{ UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, \
	  UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN } \
}

ctlr_tab vdctlr_info[NVD] = {
	VDCINIT(VD0map, vd0utl),
#if NVD > 1

	VDCINIT(VD1map, vd1utl),
#endif
#if NVD > 2


	VDCINIT(VD2map, vd2utl),
#endif
#if NVD > 3
	VDCINIT(VD3map, vd3utl),
#endif

};














unit_tab vdunit_info[NFSD];













/*
 * See if the controller is really there; if so, initialize it.
 */
vdprobe(addr)
	cdr *addr;
{








	if (badaddr((caddr_t)addr, 2))


		return (0);
	addr->cdr_reset = 0xffffffff;
	DELAY(1000000);
	if (addr->cdr_reset != (unsigned)0xffffffff) {
		DELAY(1000000);
	} else {






		addr->cdr_reserved = 0x0;






		DELAY(3000000);
	}

	return (sizeof (cdr));
}

/*
 * See if a drive is really there
 * Try to reset/configure the drive, then test its status.
 */
vdslave(vi, addr)
	register struct vba_device *vi;
	register cdr *addr;
{
	register ctlr_tab *ci = &vdctlr_info[vi->ui_ctlr];
	register unit_tab *ui = &vdunit_info[vi->ui_unit];
	register fmt_mdcb *mdcb = &ci->ctlr_mdcb;
	register fmt_dcb *dcb = &ci->ctlr_dcb;
	register int type;

	if (ci->ctlr_type == UNKNOWN) {
		addr->cdr_reset = 0xffffffff;
		DELAY(1000000);
		if (addr->cdr_reset != (unsigned)0xffffffff) {
			ci->ctlr_type = SMDCTLR;
			ci->overlap_seeks = 0;
			DELAY(1000000);
		} else {
			ci->overlap_seeks = 1;
			ci->ctlr_type = SMD_ECTLR;
			addr->cdr_reserved = 0x0;
			DELAY(3000000);



			addr->cdr_csr = 0;
			addr->mdcb_tcf = AM_ENPDA;
			addr->dcb_tcf = AM_ENPDA;

			addr->trail_tcf = AM_ENPDA;

			addr->data_tcf = AM_ENPDA;


			addr->cdr_ccf = CCF_STS | XMD_32BIT | BSZ_16WRD |
			    CCF_ENP | CCF_EPE | CCF_EDE | CCF_ECE | CCF_ERR;
		}
		if (vdnotrailer(addr,
		    vi->ui_ctlr, vi->ui_slave, INIT, 10) & HRDERR) {
			printf("vd%d: init error\n", vi->ui_unit);
			return (0);
		}
		if (vdnotrailer(addr,
		    vi->ui_ctlr, vi->ui_slave, DIAG, 10) & HRDERR) {
			printf("vd%d: diagnostic error\n", vi->ui_unit);

			return (0);
		}



	}
	/*

	 * Seek on all drive types starting from the largest one.
	 * a successful seek to the last sector/cylinder/track verifies 
	 * the drive type connected to this port. 
	 */
	for (type = 0; type < nvddrv; type++) {	
		/* XXX */
		if (ci->ctlr_type == SMDCTLR && vdst[type].nsec != 32)

			continue;
		/* XXX */


		if (!vdconfigure_drive(addr, vi->ui_ctlr, vi->ui_slave, type,0))








			return (0);

		dcb->opcode = (short)RD;
		dcb->intflg = NOINT;
		dcb->nxtdcb = (fmt_dcb *)0;	/* end of chain */
		dcb->operrsta = 0;
		dcb->devselect = (char)(vi->ui_slave);
		dcb->trailcnt = (char)(sizeof (trrw) / sizeof (long));
		dcb->trail.rwtrail.memadr = (char *)PHYS(ci->rawbuf); 
		dcb->trail.rwtrail.wcount = vdst[type].secsize/sizeof(short);
		dcb->trail.rwtrail.disk.cylinder = vdst[type].ncyl - 2;
		dcb->trail.rwtrail.disk.track = vdst[type].ntrak - 1;
		dcb->trail.rwtrail.disk.sector = vdst[type].nsec - 1;
		mdcb->firstdcb = (fmt_dcb *)(PHYS(dcb));
		mdcb->vddcstat = 0;
		VDDC_ATTENTION(addr, (fmt_mdcb *)(PHYS(mdcb)), ci->ctlr_type);
		POLLTILLDONE(addr, dcb, 60, ci->ctlr_type);
		if (vdtimeout <= 0)
			printf(" during probe\n");




		if ((dcb->operrsta&HRDERR) == 0)


			break;
	}
	if (type >= nvddrv) {
		/*
		 * If reached here, a drive which is not defined in the 
		 * 'vdst' tables is connected. Cannot set it's type.
		 */
		printf("vd%d: unknown drive type\n", vi->ui_unit);
		return (0);
	}
	ui->drive_type = type;
	ui->info = vdst[type];
	ui->sec_per_blk = DEV_BSIZE / ui->info.secsize;
	vi->ui_type = type;
 	vi->ui_dk = 1;
	vddriver.ud_dname = ui->info.type_name;
	return (1);
}

vdconfigure_drive(addr, ctlr, slave, type, pass)
	register cdr *addr;
	int ctlr, slave, type, pass;
{
	register ctlr_tab *ci = &vdctlr_info[ctlr];

	ci->ctlr_dcb.opcode = RSTCFG;		/* command */
	ci->ctlr_dcb.intflg = NOINT;
	ci->ctlr_dcb.nxtdcb = (fmt_dcb *)0;	/* end of chain */
	ci->ctlr_dcb.operrsta = 0;
	ci->ctlr_dcb.devselect = (char)slave;
	ci->ctlr_dcb.trail.rstrail.ncyl = vdst[type].ncyl;
	ci->ctlr_dcb.trail.rstrail.nsurfaces = vdst[type].ntrak;
	if (ci->ctlr_type == SMD_ECTLR) {
		ci->ctlr_dcb.trailcnt = (char)4;
		ci->ctlr_dcb.trail.rstrail.nsectors = vdst[type].nsec;
		ci->ctlr_dcb.trail.rstrail.slip_sec = vdst[type].nslip;
	} else
		ci->ctlr_dcb.trailcnt = (char)2;
	ci->ctlr_mdcb.firstdcb = (fmt_dcb *)(PHYS(&ci->ctlr_dcb));
	ci->ctlr_mdcb.vddcstat = 0;
	VDDC_ATTENTION(addr, (fmt_mdcb *)(PHYS(&ci->ctlr_mdcb)), ci->ctlr_type);
	POLLTILLDONE(addr, &ci->ctlr_dcb, 5, ci->ctlr_type);
	if (vdtimeout <= 0) {
		printf(" during config\n");
		return (0);
	}
	if (ci->ctlr_dcb.operrsta & HRDERR) {
		if ((ci->ctlr_dcb.operrsta & (NOTCYLERR|DRVNRDY)) == 0)
			printf("vd%d: drive %d: config error\n", ctlr, slave);
		else if (pass == 0) {
			vdstart_drive(addr, ctlr, slave);
			return (vdconfigure_drive(addr, ctlr, slave, type, 1));
		} else if (pass == 2)
			return (vdconfigure_drive(addr, ctlr, slave, type, 3));
		return (0);
	}
	return (1);
}

vdstart_drive(addr, ctlr, slave)
	cdr *addr;
	register int ctlr, slave;
{
	int error = 0;

	printf("vd%d: starting drive %d, wait...", ctlr, slave);
	if (vdctlr_info[ctlr].ctlr_started) {
printf("DELAY(5500000)...");
		DELAY(5500000);
		goto done;
	}
	vdctlr_info[ctlr].ctlr_started = 1;
	error = vdnotrailer(addr, ctlr, 0, VDSTART, (slave*6)+62) & HRDERR;
	if (!error) {
printf("DELAY(%d)...", (slave * 5500000) + 62000000);
		DELAY((slave * 5500000) + 62000000);
	}
done:
	printf("\n");
	return (error == 0);
}

vdnotrailer(addr, ctlr, unit, function, time)
	register cdr *addr;
	int ctlr, unit, function, time;
{
	fmt_mdcb *mdcb = &vdctlr_info[ctlr].ctlr_mdcb;
	fmt_dcb *dcb = &vdctlr_info[ctlr].ctlr_dcb;
	int type = vdctlr_info[ctlr].ctlr_type;

	dcb->opcode = function;		/* command */
	dcb->intflg = NOINT;
	dcb->nxtdcb = (fmt_dcb *)0;	/* end of chain */
	dcb->operrsta = 0;
	dcb->devselect = (char)unit;
	dcb->trailcnt = (char)0;
	mdcb->firstdcb = (fmt_dcb *)(PHYS(dcb));
	mdcb->vddcstat = 0;
	VDDC_ATTENTION(addr, (fmt_mdcb *)(PHYS(mdcb)), type);
	POLLTILLDONE(addr, dcb, time, type);
	if (vdtimeout <= 0) {
		printf(" during init\n");
		return (DCBCMP|ANYERR|HRDERR|OPABRT);
	}
	return (dcb->operrsta);
}

vdattach(vi)
	register struct vba_device *vi;
{
	register unit_tab *ui = &vdunit_info[vi->ui_unit];
	register ctlr_tab *ci = &vdctlr_info[vi->ui_ctlr];
	register struct buf *cq = &vi->ui_mi->um_tab;
	register struct buf *uq = cq->b_forw;
	register struct buf *start_queue = uq;
	register fs_tab	*fs = &ui->info;

	ui->info = vdst[vi->ui_type];
	ui->sec_per_blk = DEV_BSIZE / ui->info.secsize;
	ui->sec_per_cyl = ui->info.nsec * ui->info.ntrak;
	ui->xfer_queue.b_dev = vi->ui_slave;
	ci->unit_type[vi->ui_slave] = vi->ui_type;
	/* load unit into controller's active unit list */
	if (uq == NULL) {
		cq->b_forw = &ui->xfer_queue;
		ui->xfer_queue.b_forw = &ui->xfer_queue;
		ui->xfer_queue.b_back = &ui->xfer_queue;
	} else {
		while (uq->b_forw != start_queue)
			uq = uq->b_forw;
		ui->xfer_queue.b_forw = start_queue;
		ui->xfer_queue.b_back = uq;
		uq->b_forw = &ui->xfer_queue;
		start_queue->b_back = &ui->xfer_queue;
	}
	/*
	 * (60 / rpm) / (number of sectors per track * (bytes per sector / 2))
	 */
	dk_mspw[vi->ui_unit] = 120.0 / (fs->rpm * fs->nsec * fs->secsize);
}

/*ARGSUSED*/
vddgo(um)
	struct vba_ctlr *um;
{

}

vdstrategy(bp)
	register struct buf *bp;
{
	register int unit = VDUNIT(bp->b_dev);
	register struct vba_device *vi = vddinfo[unit];
	register par_tab *par;
	register unit_tab *ui;
	register fs_tab *fs;
	register int blks, bn, s;



	if (bp->b_bcount == 0 || vi == 0 || vi->ui_alive == 0)

		goto bad;
	ui = &vdunit_info[unit];
	fs = &ui->info;
	par = &fs->partition[FILSYS(bp->b_dev)];

	blks = (bp->b_bcount + DEV_BSIZE-1) >> DEV_BSHIFT;
	if (bp->b_blkno + blks >= par->par_len) {
		blks = par->par_len - bp->b_blkno;
		if (blks <= 0)
			goto bad;
		bp->b_bcount = blks * DEV_BSIZE;
	}
	bn = bp->b_blkno + par->par_start;
	bn *= ui->sec_per_blk;
	bp->b_daddr = (bn / fs->nsec) % fs->ntrak;
	bp->b_cylin = bn / ui->sec_per_cyl;
	vbasetup(bp, ui->info.secsize);
	s = spl7();
	if (ui->xfer_queue.av_forw == NULL) {
		register ctlr_tab *ci = &vdctlr_info[vi->ui_ctlr];





		int slave = vi->ui_slave;

		if (bp->b_cylin != ci->cur_cyl[slave] ||
		    bp->b_daddr != ci->cur_trk[slave])
			ci->off_cylinder |= 1 << slave;
	}
	bp->b_daddr |= (bn % fs->nsec) << 8;
	disksort(&ui->xfer_queue, bp);





	if (!vddinfo[unit]->ui_mi->um_tab.b_active++) {
		splx(s);
		vdstart(vddinfo[unit]->ui_mi);
	} else








		splx(s);
	return;

bad:	
	bp->b_flags |= B_ERROR, bp->b_error = ENXIO;
	bp->b_resid = bp->b_bcount;
	iodone(bp);

}


/*
 * Start up a transfer on a drive.
 */
vdstart(ci)
	register struct vba_ctlr *ci;
{
	register struct buf *cq = &ci->um_tab;

	register struct buf *uq = cq->b_forw;

	/* search for next ready unit */
	cq->b_forw = cq->b_forw->b_forw;
	uq = cq->b_forw;
	do {
		if (uq->av_forw != NULL) {
			cq->b_forw = uq;
			vdexecute(ci, uq);
			return;
		}
		uq = uq->b_forw;
	} while (uq != cq->b_forw);
}

/*

 * Initiate seeks for all drives off-cylinder.
 */
vdload_seeks(ci, uq)
	register ctlr_tab *ci;
	register struct buf *uq;
{
	register int unit, slave, nseeks;
	register fmt_dcb *dcb;

	register struct buf *bp;
	register struct buf *start_queue = uq;




	nseeks = 0;
	do {
		bp = uq->av_forw;


		if (bp != NULL) {
			unit = VDUNIT(bp->b_dev);
			slave = vddinfo[unit]->ui_slave;
			if (ci->off_cylinder & (1 << slave)) {
				ci->off_cylinder &= ~(1 << slave);
				if (ci->cur_cyl[slave] != bp->b_cylin) {
					ci->cur_cyl[slave] = bp->b_cylin;
					dk_seek[unit]++;
				}
				ci->cur_trk[slave] = bp->b_daddr&0xff;

				dcb = &ci->seek_dcb[nseeks++];

				dcb->opcode = SEEK;
				dcb->intflg = NOINT | INT_PBA;
				dcb->operrsta = 0;
				dcb->devselect = (char)slave;
				dcb->trailcnt = (char)1;
				dcb->trail.sktrail.skaddr.cylinder =
				    bp->b_cylin;
				dcb->trail.sktrail.skaddr.track =
				    bp->b_daddr & 0xff;
				dcb->trail.sktrail.skaddr.sector = 0;
			}
		}
		uq = uq->b_forw;
	} while (uq != start_queue && nseeks < 4);
	return (nseeks);
}

extern	vd_int_timeout();

/*
 * Execute the next command on the unit queue uq.

 */
vdexecute(controller_info, uq)
	register struct vba_ctlr *controller_info;
	register struct buf *uq;

{
	register struct	buf *bp = uq->av_forw;
	register int ctlr = controller_info->um_ctlr;
	register ctlr_tab *ci = &vdctlr_info[ctlr];
	register int unit = VDUNIT(bp->b_dev);
	register int slave = vddinfo[unit]->ui_slave;
	register fmt_mdcb *mdcb = &ci->ctlr_mdcb; 
	register fmt_dcb *dcb = &ci->ctlr_dcb; 
	
	/*

	 * If there are overlapped seeks to perform, shuffle
	 * them to the front of the queue and get them started
	 * before any data transfers (to get some parallelism).
	 */
	if ((ci->off_cylinder & ~(1<<slave)) && ci->overlap_seeks) {
		register int i, nseeks;
		
		/* setup seek requests in seek-q */
		nseeks = vdload_seeks(ci, uq);
		/* place at the front of the master q */
		mdcb->firstdcb = (fmt_dcb *)PHYS(&ci->seek_dcb[0]);
		/* shuffle any remaining seeks up in the seek-q */
		for (i = 1; i < nseeks; i++)
			ci->seek_dcb[i-1].nxtdcb = 
			    (fmt_dcb *)PHYS(&ci->seek_dcb[i]);
		ci->seek_dcb[nseeks-1].nxtdcb = (fmt_dcb *)PHYS(dcb);
	} else {
		if (bp->b_cylin != ci->cur_cyl[slave]) {
			ci->cur_cyl[slave] = bp->b_cylin;
			dk_seek[unit]++;
		}




		ci->cur_trk[slave] = bp->b_daddr & 0xff;
		ci->off_cylinder = 0;
		mdcb->firstdcb = (fmt_dcb *)(PHYS(dcb));
	}
	dcb->opcode = (bp->b_flags & B_READ) ? RD : WD;
	dcb->intflg = INTDONE;
	dcb->nxtdcb = (fmt_dcb *)0;	/* end of chain */
	dcb->operrsta = 0;
	dcb->devselect = (char)slave;
	dcb->trailcnt = (char)(sizeof (trrw) / sizeof (long));
	dcb->trail.rwtrail.memadr = (char *)
	    vbastart(bp, ci->rawbuf, (long *)ci->map, ci->utl);
	dcb->trail.rwtrail.wcount = (short)((bp->b_bcount+1) / sizeof (short));

	dcb->trail.rwtrail.disk.cylinder = bp->b_cylin;
	dcb->trail.rwtrail.disk.track = bp->b_daddr & 0xff;
	dcb->trail.rwtrail.disk.sector = bp->b_daddr >> 8;
	mdcb->vddcstat = 0;
   	dk_wds[unit] += bp->b_bcount / 32;
	ci->int_expected = 1;
	timeout(vd_int_timeout, (caddr_t)ctlr, 20*60);
  	dk_busy |= 1 << unit;
#ifdef VDDCPERF
	scope_out(1);
#endif
	VDDC_ATTENTION((cdr *)(vdminfo[ctlr]->um_addr),
	    (fmt_mdcb *)(PHYS(mdcb)), ci->ctlr_type);
}

/*
 * Watch for lost interrupts.
 */
vd_int_timeout(ctlr)
	register int ctlr;
{
	register ctlr_tab *ci = &vdctlr_info[ctlr];
	register fmt_dcb *dcb = &ci->ctlr_dcb;

	uncache(&dcb->operrsta);
	printf("vd%d: lost interupt, status %x", ctlr, dcb->operrsta);
	if (ci->ctlr_type == SMD_ECTLR) {
		uncache(&dcb->err_code);
		printf(", error code %x", dcb->err_code);
	}
	printf("\n");
	if ((dcb->operrsta&DCBCMP) == 0) { 
		VDDC_ABORT((cdr *)(vdminfo[ctlr]->um_addr), ci->ctlr_type);
		dcb->operrsta |= DCBUSC | DCBABT | ANYERR | HRDERR | CTLRERR;
	}
	vdintr(ctlr);
}

/*
 * Handle a disk interrupt.
 */
vdintr(ctlr)
	register int ctlr;
{
	register ctlr_tab *ci;
	register struct buf *cq, *uq, *bp;

	register int slave, unit;
	register fmt_mdcb  *mdcb;
	register fmt_dcb *dcb;
	int code, s;


	untimeout(vd_int_timeout, (caddr_t)ctlr);
#ifdef VDDCPERF
	scope_out(2);
#endif
	ci = &vdctlr_info[ctlr];


	if (!ci->int_expected) {


		printf("vd%d: stray interrupt\n", ctlr);

		return;
	}





	/*
	 * Take first request off controller's queue.
	 */
	cq = &vdminfo[ctlr]->um_tab;
	uq = cq->b_forw;
	bp = uq->av_forw;
	unit = VDUNIT(bp->b_dev);
	dk_busy &= ~(1 << unit);
	dk_xfer[unit]++;
	ci->int_expected = 0;
	/* find associated control blocks */
	mdcb = &ci->ctlr_mdcb, uncache(&mdcb->intdcb);
	dcb = &ci->ctlr_dcb, uncache(&dcb->operrsta);
	if (ci->ctlr_type == SMD_ECTLR)
		uncache(&dcb->err_code);
	slave = uq->b_dev;

	switch (code = vddecode_error(dcb)) {

	case CTLR_ERROR:
	case DRIVE_ERROR:
		if (cq->b_errcnt >= 2)
			vdhard_error(ci, bp, dcb);

		if (code == CTLR_ERROR)
			vdreset_ctlr((cdr *)vdminfo[ctlr]->um_addr, ctlr);
		else
			reset_drive((cdr *)vdminfo[ctlr]->um_addr, ctlr,
			    slave, 2);

		if (cq->b_errcnt++ < 2) {	/* retry error */
			cq->b_forw = uq->b_back;
			vdstart(vdminfo[ctlr]);
			return;
		}


		bp->b_resid = bp->b_bcount;
		break;



	case HARD_DATA_ERROR:
		vdhard_error(ci, bp, dcb);
		bp->b_resid = 0;
		break;

	case SOFT_DATA_ERROR:
		vdsoft_error(ci, bp, dcb);
		/* fall thru... */

	default:			/* operation completed */
		bp->b_error = 0;
		bp->b_resid = 0;
		break;
	}
	vbadone(bp, ci->rawbuf, (long *)ci->map, ci->utl);
	/*
	 * Take next request on this unit q, or, if none,
	 * the next request on the next active unit q.
	 */
	s = spl7();



	uq->av_forw = bp->av_forw;
	if (uq->av_back != bp) {
		register struct buf *next;

		unit = VDUNIT(uq->av_forw->b_dev);
		slave = vddinfo[unit]->ui_slave;
		next = uq->av_forw;
		if (next->b_cylin != ci->cur_cyl[slave] ||
		    (next->b_daddr & 0xff) != ci->cur_trk[slave])
			ci->off_cylinder |= 1 << slave;
	} else
		uq->av_back = NULL;
	splx(s);
	/* reset controller state */
	cq->b_errcnt = 0;


	cq->b_active--;
#ifdef VDDCPERF
	scope_out(3);
#endif
	if (bp->b_flags & B_ERROR)
		bp->b_error = EIO;
	iodone(bp);
	vdstart(vdminfo[ctlr]);
}

/*
 * Convert controller status to internal operation/error code.
 */
vddecode_error(dcb)
	register fmt_dcb *dcb;
{

	if (dcb->operrsta & HRDERR) {
		if (dcb->operrsta & (HCRCERR | HCMPERR | UCDATERR | WPTERR |
		    DSEEKERR | NOTCYLERR |DRVNRDY | INVDADR))
			return (DRIVE_ERROR);
		if (dcb->operrsta & (CTLRERR | OPABRT | INVCMD | DNEMEM))
			return (CTLR_ERROR);
		return (HARD_DATA_ERROR);
	}
	if (dcb->operrsta & SFTERR)
		return (SOFT_DATA_ERROR);
	return (0);
}

/*
 * Report a hard error.
 */
vdhard_error(ci, bp, dcb)
	ctlr_tab *ci; 
	register struct buf *bp;
	register fmt_dcb *dcb;
{
	unit_tab *ui = &vdunit_info[VDUNIT(bp->b_dev)];

	bp->b_flags |= B_ERROR;
	harderr(bp, ui->info.type_name);
	printf("status %x", dcb->operrsta);
	if (ci->ctlr_type == SMD_ECTLR)
		printf(" ecode %x", dcb->err_code);
	printf("\n");
}

/*
 * Report a soft error.
 */
vdsoft_error(ci, bp, dcb)
	ctlr_tab *ci; 
	register struct buf *bp;
	register fmt_dcb *dcb;
{
	unit_tab *ui = &vdunit_info[VDUNIT(bp->b_dev)];

	printf("%s%d%c: soft error sn%d status %x", ui->info.type_name,
	    dkunit(bp), 'a'+(minor(bp->b_dev)&07), bp->b_blkno,
	    dcb->operrsta);
	if (ci->ctlr_type == SMD_ECTLR)
		printf(" ecode %x", dcb->err_code);
	printf("\n");
}

/*ARGSUSED*/
vdopen(dev, flag)
	dev_t dev;
	int flag;
{
	register unit = VDUNIT(dev);
	register struct vba_device *vi = vddinfo[unit];

	if (vi == 0 || vi->ui_alive == 0 || vi->ui_type >= nvddrv)
		return (ENXIO);
	if (vdunit_info[unit].info.partition[FILSYS(dev)].par_len == 0)
		return (ENXIO);
	return (0);
}

vdread(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	register int unit = VDUNIT(dev);

	register unit_tab *ui = &vdunit_info[unit];


	if (unit >= NFSD)
		return (ENXIO);
	return (physio(vdstrategy, &ui->raw_q_element, dev, B_READ,





	    minphys, uio));




}

vdwrite(dev, uio)
	dev_t dev;
	struct uio *uio;
{
	register int unit = VDUNIT(dev);

	register unit_tab *ui = &vdunit_info[unit];


	if (unit >= NFSD)
		return (ENXIO);
	return (physio(vdstrategy, &ui->raw_q_element, dev, B_WRITE,





	    minphys, uio));


}







/*
 * Crash dump.
 */
vddump(dev)
	dev_t dev;
{
	register int unit = VDUNIT(dev);
	register unit_tab *ui = &vdunit_info[unit];
	register fs_tab *fs = &ui->info;
	register int ctlr = vddinfo[unit]->ui_ctlr;
	register struct vba_ctlr *vba_vdctlr_info = vdminfo[ctlr];
	register int filsys = FILSYS(dev);
	register cdr *addr = (cdr *)(vba_vdctlr_info->um_addr);
	register int cur_blk, blkcount, blocks;

	caddr_t memaddr;




	vdreset_ctlr(addr, ctlr);
	blkcount = maxfree - 2;		/* In 1k byte pages */
	if (dumplo + blkcount > fs->partition[filsys].par_len) {
		blkcount = fs->partition[filsys].par_len - dumplo;
		printf("vd%d: Dump truncated to %dMB\n", unit, blkcount/1024);
	}
	cur_blk = fs->partition[filsys].par_start + dumplo;
	memaddr = 0;

	while (blkcount > 0) {
		blocks = MIN(blkcount, DUMPSIZE);
		if (!vdwrite_block(addr, ctlr, unit, memaddr, cur_blk, blocks))
			return (EIO);
		blkcount -= blocks;
		memaddr += blocks * NBPG;
		cur_blk += blocks;
	}
	return (0);
}

/*
 * Write a block to disk during a crash dump.
 */
vdwrite_block(caddr, ctlr, unit, addr, block, blocks)
	register cdr *caddr;
	register int ctlr, unit;
	register caddr_t addr;
	register int block, blocks;
{
	register fmt_mdcb *mdcb = &vdctlr_info[ctlr].ctlr_mdcb;
	register fmt_dcb *dcb = &vdctlr_info[ctlr].ctlr_dcb;
	register unit_tab *ui = &vdunit_info[unit];
	register fs_tab	 *fs = &ui->info;

	block *= (int)ui->sec_per_blk;
	blocks *= (int)ui->sec_per_blk;
	mdcb->firstdcb = (fmt_dcb *)(PHYS(dcb));
	dcb->intflg = NOINT;
	dcb->opcode = WD;














	dcb->operrsta = 0;
	dcb->devselect = (char)(vddinfo[unit])->ui_slave;

	dcb->trailcnt = (char)(sizeof (trrw) / sizeof (long));
	dcb->trail.rwtrail.memadr = addr;
	dcb->trail.rwtrail.wcount = (short)
	    ((blocks * fs->secsize)/ sizeof (short));
	dcb->trail.rwtrail.disk.cylinder = (short)(block / ui->sec_per_cyl);
	dcb->trail.rwtrail.disk.track = (char)((block / fs->nsec) % fs->ntrak);
	dcb->trail.rwtrail.disk.sector = (char)(block % fs->nsec);
	VDDC_ATTENTION(caddr, (fmt_mdcb *)(PHYS(mdcb)),
	    vdctlr_info[ctlr].ctlr_type);
	POLLTILLDONE(caddr, dcb, 5, vdctlr_info[ctlr].ctlr_type);
	if (vdtimeout <= 0) {

		printf(" during dump\n");
		return (0);
	}
	if (dcb->operrsta & HRDERR) {

		printf("vd%d: hard error, status %x\n", unit, dcb->operrsta);
		return (0);




	}


	return (1);

}

vdsize(dev)
	dev_t dev;
{
	struct vba_device *vi = vddinfo[VDUNIT(dev)];



	if (vi == 0 || vi->ui_alive == 0 || vi->ui_type >= nvddrv)
		return (-1);
	return (vdunit_info[VDUNIT(dev)].info.partition[FILSYS(dev)].par_len);
}

/*
 * Perform a controller reset.
 */
vdreset_ctlr(addr, ctlr)
	register cdr *addr;
	register int ctlr;
{
	register struct buf *cq = &vdminfo[ctlr]->um_tab;
	register struct buf *uq = cq->b_forw;
	register ctlr_tab *ci = &vdctlr_info[ctlr];
	
	VDDC_RESET(addr, ci->ctlr_type);
	ci->ctlr_started = 0;
	if (ci->ctlr_type == SMD_ECTLR) {
		addr->cdr_csr = 0;
		addr->mdcb_tcf = AM_ENPDA;
		addr->dcb_tcf = AM_ENPDA;
		addr->trail_tcf = AM_ENPDA;
		addr->data_tcf = AM_ENPDA;
		addr->cdr_ccf = CCF_STS | XMD_32BIT | BSZ_16WRD |
		    CCF_ENP | CCF_EPE | CCF_EDE | CCF_ECE | CCF_ERR;
	}
	if (vdnotrailer(addr, ctlr, 0, INIT, 10) & HRDERR) {
		printf("failed to init\n");
		return (0);
	}
	if (vdnotrailer(addr, ctlr, 0, DIAG, 10) & HRDERR) {
		printf("diagnostic error\n");
		return (0);
	}
	/*  reset all units attached to controller */
	uq = cq->b_forw;
	do {
		reset_drive(addr, ctlr, uq->b_dev, 0);
		uq = uq->b_forw;
	} while (uq != cq->b_forw);
	return (1);
}

/*
 * Perform a reset on a drive.
 */
reset_drive(addr, ctlr, slave, start)
	register cdr *addr;
	register int ctlr, slave, start;
{
	register int type = vdctlr_info[ctlr].unit_type[slave];

	if (type == UNKNOWN)
		return;
	if (!vdconfigure_drive(addr, ctlr, slave, type, start))


		printf("vd%d: drive %d: couldn't reset\n", ctlr, slave);
}


#ifdef notdef
/*
 * Dump the mdcb and DCB for diagnostic purposes.
 */
vdprintdcb(lp)


	register long *lp;



{
	register int i, dcb, tc;

	for (dcb = 0; lp; lp = (long *)(*lp), dcb++) {
		lp = (long *)((long)lp | 0xc0000000);
		printf("\nDump of dcb%d@%x:", dcb, lp);
		for (i = 0, tc = lp[3] & 0xff; i < tc+7; i++)
			printf(" %lx", lp[i]);
		printf("\n");
	}
	DELAY(1750000);
}
#endif
#endif

Added sys/tahoe/vba/vdreg.h.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
/*	vdreg.h	1.1	86/01/05	*/

/*
 * VDDC (Versabus Direct Disk Controller) definitions.
 */

/*
 * DCB Command Codes
 */
#define	RD		0x80		/* Read Data */
#define	FTR		0xc0		/* Full Track Read */
#define	RAS		0x90		/* Read and Scatter */
#define	C		0xa0		/* Compare */
#define	FTC		0xe0		/* Full Track Compare */
#define	RHDE		0x180		/* Read Header, Data & ECC (not used) */
#define	WD		0x00		/* Write Data */
#define	FTW		0x40		/* Full Track Write */
#define	WTC		0x20		/* Write Then Compare */
#define	FTWTC		0x60		/* Full Track Write Then Compare */
#define	GAW		0x10		/* Gather and Write */
#define	WDE		0x100		/* Write Data & ECC (not used) */
#define	FSECT		0x900		/* Format Sector */
#define	GWC		0x30		/* Gather Write & Compare */
#define	VDSTART		0x800		/* Start drives */
#define	VDRELEASE	0xa00		/* Stop drives */
#define	SEEK		0xb00		/* Seek */
#define	INIT		0xc00		/* Initialize VDDC */
#define	DIAG		0xd00		/* Diagnose (self-test) VDDC */
#define	RSTCFG		0xe00		/* Reset/Configure VDDC/DDI/Drive(s) */
#define	VDSTATUS	0xf00		/* VDDC Status */

#define	ABORT		0x80000000	/* ABORT active i/o */

/*
 * Error/status codes.
 */
#define	HCRCERR		0x1		/* Header CRC Error */
#define	HCMPERR		0x2		/* Header Compare Error */
#define	WPTERR		0x4		/* Write Protect Error/Status */
#define	CTLRERR		0x8		/* Controller Error */
#define	DSEEKERR	0x10		/* Disk Seek Error */
#define	UCDATERR	0x20		/* Uncorrectable Data Error */
#define	NOTCYLERR	0x40		/* Not on Cylinder Error */
#define	DRVNRDY		0x80		/* Drive Not Ready Error/Status */
#define	ALTACC		0x100		/* Alternate (track) accessed Status */
#define	SEEKSTRT	0x200		/* Seek Started Status */
#define	INVDADR		0x400		/* Invalid Disk Address Error */
#define	DNEMEM		0x800		/* Non-Existant Memory Error */
#define	PARERR		0x1000		/* Memory Parity Error */
#define	DCOMPERR	0x2000		/* Data Compare Error */
#define	DDIRDY		0x4000		/* DDI Ready Error/Status */
#define	OPABRT		0x8000		/* Operator Abort (Host) Error/Status */
#define	DSERLY		0x10000		/* Data Strobe Early */
#define	DSLATE		0x20000		/* Data Strobe Late */
#define	TOPLUS		0x40000		/* Track Offset Plus */
#define	TOMNUS		0x80000		/* Track Offset Minus */
#define	CPDCRT		0x100000	/* Cntlr Performed Data Correction */
#define	HRDERR		0x200000	/* Hard Error */
#define	SFTERR		0x400000	/* Soft Error (retry succesful) */
#define	ANYERR		0x800000	/* Any Error */
#define INVCMD		0x1000000	/* Programmer error */

/* hard error */
#define	HTYPES \
    (HCRCERR|HCMPERR|WPTERR|CTLRERR|DSEEKERR|UCDATERR|NOTCYLERR|DRVNRDY|\
     INVDADR|DNEMEM|PARERR|DCOMPERR)

#define	ERRS	0x3FFF
/* retryable errors */
#define	CANRETRY \
    (CTLRERR|DSEEKERR|NOTCYLERR|DCOMPERR|UCDATERR|PARERR|DNEMEM|HCRCERR|HCMPERR)

#define	ERRBITS	"\20\1HCRC\2HCMP\3WPT\4CTLR\5DSEEK\6UCDATA\7NOTCYL\10DRVNRDY\
\11ALTACC\12SEEKSTRT\13INVDADR\14DNEMEM\15PAR\16DCOMP\17DDIRDY\20OPABRT\
\21DSERLY\22DSLATE\23TOPLUS\24TOPMNUS\25CPDCRT\26HRDERR\27SFTERR\30ANYERR\
\31INVCMD"

/*
 * DCB status codes.
 */
#define	DCBABT		0x10000000	/* DCB Aborted */
#define	DCBUSC		0x20000000	/* DCB Unsuccesfully Completed */
#define	DCBCMP		0x40000000	/* DCB Complete */
#define	DCBSTR		0x80000000	/* DCB Started */

/*
 * MDCB status codes.
 */
#define	CTLRBSY		0x10000000	/* Cntlr Busy */
#define	INTCCDE		0x60000000	/* Interrupt Cause Code */
#define	DCBINT		0x80000000	/* DCB Interrupt Flag */

/*
 * VDDC interrupt modes.
 */
#define	NOINT	0x0		/* No Interrupt */
#define	INTERR	0x2		/* Interrupt on Error */
#define	INTSUC	0x1		/* Interrupt on Success */
#define	INTDONE	0x3		/* Interrupt on Error or Success */


/*
 * Constrol status definitions.
 */
#define	CS_SCS	0xf		/* Status Change Source (drive number) */
#define	CS_ELC	0x10		/* Error on Last Command */
#define	CS_ICC	0x60		/* Interupt Cause Code */
#define   ICC_NOI  0x00		/* No interupt */
#define   ICC_DUN  0x20		/* No interupt */
#define   ICC_ERR  0x40		/* No interupt */
#define   ICC_SUC  0x60		/* No interupt */
#define	CS_GO	0x80		/* Go bit (controller working) */
#define	CS_BE	0x100		/* Buss Error */
#define	CS_BOK	0x4000		/* Board O.K. */
#define	CS_SFL	0x8000		/* System fail */
#define	CS_LEC	0xff000000	/* Last Error Code */

/* Status word bit assignments */
#define	STA_UR	0x1		/* Unit Ready */
#define	STA_OC	0x2		/* On Cylinder */
#define	STA_SE	0x4		/* Seek Error */
#define	STA_DF	0x8		/* Drive Fault */
#define	STA_WP	0x10		/* Write Protected */
#define	STA_US	0x20		/* Unit Selected */

/* Interupt Control Field bit assignments */
#define	ICF_IPL	0x7		/* Interupt Priority Level */
#define	ICF_IEN	0x8		/* Interupt ENable */
#define	ICF_IV	0xff00		/* Interupt Vector */

/* Transfer Control Format bit assignments */
#define	TCF_AM	0xff		/* Address Modifier */
#define	  AM_SNPDA   0x01	/* Standard Non-Privileged Data Access */
#define	  AM_SASA    0x81	/* Standard Ascending Sequential Access */
#define	  AM_ENPDA   0xf1	/* Extended Non-Privileged Data Access */
#define	  AM_EASA    0xe1	/* Extended Ascending Sequential Access */
#define	TCF_BTE	0x800		/* Block Transfer Enable */

/* Controller Configuration Flags bit assignments */
#define	CCF_STS	0x1		/* Sectors per Track Selectable */
#define	CCF_EAV	0x2		/* Enable Auto Vector */
#define	CCF_ERR	0x4		/* Enable Reset Register */
#define	CCF_XMD	0x60		/* XMD transfer mode (buss size) */
#define	  XMD_8BIT  0x20	/*   Do only 8 bit transfers */
#define	  XMD_16BIT 0x40	/*   Do only 16 bit transfers */
#define	  XMD_32BIT 0x60	/*   Do only 32 bit transfers */
#define	CCF_BSZ	0x300		/* Burst SiZe */
#define	  BSZ_16WRD 0x000	/*   16 word transfer burst */
#define	  BSZ_12WRD 0x100	/*   12 word transfer burst */
#define	  BSZ_8WRD  0x200	/*   8 word transfer burst */
#define	  BSZ_4WRD  0x300	/*   4 word transfer burst */
#define	CCF_ENP	0x1000		/* ENable Parity */
#define	CCF_EPE	0x2000		/* Enable Parity Errors */
#define	CCF_EDE	0x10000		/* Error Detection Enable */
#define	CCF_ECE	0x20000		/* Error Correction Enable */

/*
 * Diagnostic register definitions.
 */
#define	DIA_DC	0x7f		/* Dump count mask */
#define	DIA_DWR	0x80		/* Dump Write / Read flag */
#define	DIA_ARE	0x100		/* Auto Rebuild Enable */
#define	DIA_CEN	0x200		/* Call ENable flag */
#define	DIA_KEY	0xAA550000	/* Reset KEY */

/* Sector Header bit assignments */
#define	VDMF	0x8000		/* Manufacturer Fault 1=good sector */
#define	VDUF	0x4000		/* User Fault 1=good sector */
#define	VDALT	0x2000		/* Alternate Sector 1=alternate */
#define	VDWPT	0x1000		/* Write Protect 1=Read Only Sector */

/* DCB Bit assignments */
#define	INT_IC	0x3		/* Interupt Control */
#define	  IC_NOI  0x0		/*   NO Interupt */
#define	  IC_IOD  0x1		/*   Interupt On Done */
#define	  IC_IOE  0x2		/*   Interupt On Error */
#define	  IC_IOS  0x3		/*   Interupt On Success */
#define	INT_PBA	0x4		/* Proceed before ACK */

/*
 * Perform a reset on the controller.
 */
#define	VDDC_RESET(addr, type) { \
	if (type == SMD_ECTLR) { \
		(addr)->diag_flags = DIA_KEY|DIA_CEN; \
		(addr)->cdr_mdcb_ptr = (fmt_mdcb *)0xffffffff; \
		DELAY(5000000); \
	} else { \
		(addr)->cdr_reset = 0x0; \
		DELAY(1500000); \
	} \
}

/*
 * Abort a controller operation.
 */
#define	VDDC_ABORT(a, type) { \
	if ((type) == SMDCTLR) { \
		movow(a, (ABORT & 0xffff0000) >> 16) ; \
		movow((int)(a)+2, ABORT & 0xffff); \
	} else \
		(a)->cdr_mdcb_ptr = (fmt_mdcb *)ABORT; \
	DELAY(1000000); \
}

/*
 * Start i/o on controller.
 */
#define VDDC_ATTENTION(ctlr, mdcbadr, type) {\
	if (type == SMDCTLR) { \
		movow(ctlr, ((int)mdcbadr & 0xffff0000) >> 16) ; \
		movow((int)(ctlr)+2, (int)mdcbadr & 0xffff); \
	} else \
		(ctlr)->cdr_mdcb_ptr = mdcbadr; \
}

/*
 * Poll controller until operation completes
 * or timeout expires.
 * YECH!!!! THIS SHOULD BE A SUBROUTINE!!!
 */
#define	POLLTILLDONE(c, a, x, t) { \
	vdtimeout = 1000 * (x); \
	uncache(&(a)->operrsta); \
	while ((((a)->operrsta) & (DCBCMP|DCBABT)) == 0) { \
		DELAY(1000); \
		vdtimeout--; \
		uncache(&(a)->operrsta); \
		if (vdtimeout <= 0) { \
			printf("vd%d: controller timeout", c); \
			VDDC_ABORT(c, t); \
			DELAY(30000); \
			break; \
		} \
	} \
	if (vdtimeout > 0) \
		if ((t) == SMD_ECTLR && vdtimeout > 0) { \
			uncache(&(c)->cdr_csr); \
			while((c)->cdr_csr&CS_GO) { \
				DELAY(50); \
				uncache(&(c)->cdr_csr); \
			} \
			DELAY(500); \
		} else \
			DELAY(200); \
	uncache(&(a)->operrsta); \
}

/*
 * A disk address.
 */
typedef struct {
	char	track;			/* all 8 bits */
	char	sector;			/* all 8  bits */
	short	cylinder;		/* low order 12 bits */
} dskadr;

/*
 * Sector formats.
 */
typedef union {
	struct {
		dskadr	hdr_addr;
		short	smd_crc;
	} smd;
	struct {
		dskadr	physical;
		dskadr	logical;
		long	smd_e_crc;
	} smd_e;
} fmt_hdr;

/*
 * DCB trailer formats.
 */
/* read/write trailer */
typedef struct {
	char	*memadr;	/* memory address */
	u_long	wcount;		/* 16 bit word count */
	dskadr	disk;		/* disk address */
} trrw;

/* scatter/gather trailer */
typedef struct {
	trrw	start_addr;
	struct {
		char	*nxt_addr;
		u_long	nxt_len;
	} addr_chain[126];
} trsg;

/* seek trailer format */
typedef struct {
	dskadr	skaddr;
} trseek;

/* format trailer */
typedef struct {
	char	*addr;		/* data buffer to be filled on sector*/
	long	nsectors;	/* # of sectors to be formatted */
	dskadr	disk;		/* disk physical address info */
	dskadr  hdr;		/* header address info */
} trfmt;

/* reset/configure trailer */
typedef struct {
	long	ncyl;		/* # cylinders */
	long	nsurfaces;	/* # surfaces */
	long	nsectors;	/* # sectors */
	long	slip_sec;	/* # of slip sectors */
} treset;

/*
 * DCB layout.
 */
typedef struct fmtdcb {
	struct	fmtdcb *nxtdcb;	/* next dcb */
	short	intflg;		/* interrupt settings and flags */
	short	opcode;		/* DCB command code etc... */
	long	operrsta;	/* error & status info */
	short	fill;		/* not used */
	char	devselect;	/* drive selection */
	char	trailcnt;	/* trailer Word Count */
	long	err_memadr;	/* error memory address */
	char	err_code;	/* error codes for SMD/E */
	char	fill2;		/* not used */
	short	err_wcount;	/* error word count */
	char	err_trk;	/* error track/sector */
	char	err_sec;	/* error track/sector */
	short	err_cyl;	/* error cylinder adr */
	union {
		trseek	sktrail;	/* seek command trailer */
#ifdef notdef
		trsg	sgtrail;	/* scatter/gather trailer */
#endif
		trrw	rwtrail;	/* read/write trailer */
		trfmt	fmtrail;	/* format trailer */
		treset	rstrail;	/* reset/configure trailer */
	} trail;
} fmt_dcb;

/*
 * MDCB layout.
 */
typedef struct {
	fmt_dcb	*firstdcb;	/* first dcb in chain */
	fmt_dcb	*procdcb;	/* dcb being processed */
	fmt_dcb	*intdcb;	/* dcb causing interrupt */
	long	vddcstat;	/* VDDC status */
} fmt_mdcb;

/*
 * Control-status communications block.
 */
typedef struct {
	fmt_mdcb *cdr_mdcb_ptr;	/* controller's mdcb */
	u_long	cdr_reset;	/* controller reset register */
	u_long	cdr_csr;	/* control/status register */
	long	cdr_reserved;	/* reserved */
	u_short	cdr_status[16];	/* per-drive status register */
	u_short	stat_chng;	/* status change interupt register */
	u_short	done_icf;	/* interupt-complete register */
	u_short	error_icf;	/* error-interupt register */
	u_short	success_icf;	/* success-interupt register */
	u_short	mdcb_tcf;	/* mdcb transfer control register */
	u_short	dcb_tcf;	/* dcb transfer control register */
	u_short	trail_tcf;	/* trail transfer control register */
	u_short	data_tcf;	/* data transfer control register */
	u_long	cdr_ccf;	/* controller configuration flags */
	u_long	sec_size;	/* drive sector size */
	u_long	diag_flags;	/* diagnostic flag register */
	u_long	diag_dump;	/* pointer for diagnostic addresses */
} cdr;

/* controller types */
#define	UNKNOWN		-1
#define	SMDCTLR		1	/* smd interface */
#define	SMD_ECTLR	2	/* extended-smd interface */

/* drive types */
#define	XSD	0
#define	FUJ	1 		/* fujitsu */
#define	XFD	2		/* CDC 340Mb Winchester */
#define	SMD	3		/* CDC 9766 or equivalent */
#define	FSD	4

/*
 * Drive logical partitions.
 */
typedef struct {
	long	par_start;	/* starting sector # */
	long	par_len;	/* size in sectors */
} par_tab;

typedef struct {
	int	secsize;		/* bytes/sector */
	int	nsec;			/* sectors/track */
	int	ntrak;			/* tracks/cylinder */
	int	ncyl;			/* # cylinders */
	int	nslip;			/* # slip sectors */
	int	rpm;			/* revolutions/minute */
	int	nbits;			/* bits/track */
	char	*type_name;		/* drive name */
	long	fmt_pat[16];		/* patterns to be used for formatting */
	par_tab	partition[8];		/* partition tables */
} fs_tab;

/* physical information for known disk drives.  */
#ifdef VDGENDATA
long	vddcaddr[] = { 0xf2000, 0xf2100, 0xf2200, 0xf2300 };
long	vdtimeout = 0;

fs_tab	vdst[] = {
	{512, 48, 24, 711, 0, 3600, 0,	"xsd",	/* 515 Mb FSD */
		{ 0x0264c993, 0x04c99326, 0x0993264c, 0x13264c98,
		  0x264c9930, 0x4c993260, 0x993264c0, 0x3264c980,
		  0x64c99300, 0xc9932600, 0x93264c00, 0x264c9800,
		  0x4c993000, 0x99326000, 0x3264c000, 0x54c98000},
		{{0,	 30528},	/* xsd0a cyl   0 - 52 */
		{30528,	 30528},	/* xsd0b cyl  53 - 105 */
		{61056,	 345600}, 	/* xsd0c cyl 106 - 705 */
		{0,	 61056}, 	/* xsd0d cyl 709 - 710 (a & b) */
		{0,	 406656},	/* xsd0e cyl   0 - 705 */
		{30528,	 376128}, 	/* xsd0f cyl  53 - 705 (b & c) */
		{61056,	 172800},	/* xsd0g cyl 106 - 405 (1/2 of c) */
		{233856, 172800}}	/* xsd0h cyl 406 - 705 (1/2 of c) */
	},
	{512, 64, 10, 823, 0, 3600, 0,	"fuj",	/* 360 Mb Fujitsu */
		{ 0x0264c993, 0x04c99326, 0x0993264c, 0x13264c98,
		  0x264c9930, 0x4c993260, 0x993264c0, 0x3264c980,
		  0x64c99300, 0xc9932600, 0x93264c00, 0x264c9800,
		  0x4c993000, 0x99326000, 0x3264c000, 0x54c98000},
		{{0,	 19200},	/* fuj0a cyl   0 - 59 */
		{19200,	 24000},	/* fuj0b cyl  60 - 134 */
		{43200,	 218560}, 	/* fuj0c cyl 135 - 817 */
		{0,	 43200}, 	/* fuj0d cyl 821 - 822 (a & b) */
		{0,	 261760},	/* fuj0e cyl   0 - 817 */
		{19200,	 242560}, 	/* fuj0f cyl   0 - 134 (b & c) */
		{43200,  109440},	/* fuj0g cyl 135 - 476 (1/2 of c) */
		{152640, 109120}}	/* fug0h cyl 477 - 817 (1/2 of c) */
	},
	{512, 32, 24, 711, 0, 3600, 0,	"xfd",	/* 340 Mb FSD */
		{ 0x0d9b366c, 0x1b366cd8, 0x366cd9b0, 0x6cd9b360,
		  0xd9b366c0, 0xb366cd80, 0x66cd9b00, 0xcd9b3600,
		  0x9b366300, 0x366cd800, 0x6cd9b000, 0xd9b36000,
		  0xb366c000, 0x66cd8000, 0xcd9b0000, 0x9b360000},
#ifdef MICKEY
		{{ 0,	 20352 },	/* xfd0a cyl   0-52 */
		{ 20352, 20352 },	/* xfd0b cyl  53-105 */
		{ 40704, 230400 },	/* xfd0c cyl 106-705 */
		{ 271104,1920 },	/* xfd0d cyl 706-710 */
		{ 0,	 271104 },	/* xfd0e cyl   0-705 */
		{ 0,	 273024 }},	/* xfd0f cyl   0-710 */
#else
		{{ 0,	 20352 },	/* xfd0a cyl   0 - 52 */
		{ 20352, 20352 },	/* xfd0b cyl  53 - 105 */
		{ 40704, 230400 },	/* xfd0c cyl 106 - 705 */
		{ 0,	 40704 },	/* xfd0d cyl 709 - 710 (a & b) */
		{ 0,	 271104 },	/* xfd0e cyl   0 - 705 */
		{ 20352, 250752 },	/* xfd0f cyl  53 - 705 (b & c) */
		{ 40704, 115200 },	/* xfd0g cyl 106 - 405 (1/2 of c) */
		{ 155904,115200 }}	/* xfd0h cyl 406 - 705 (1/2 of c) */
#endif
	},
	{512, 32, 19, 823, 0, 3600, 0,	"smd",	/* 300 Mb SMD */
		{ 0x0d9b366c, 0x1b366cd8, 0x366cd9b0, 0x6cd9b360,
		  0xd9b366c0, 0xb366cd80, 0x66cd9b00, 0xcd9b3600,
		  0x9b366300, 0x366cd800, 0x6cd9b000, 0xd9b36000,
		  0xb366c000, 0x66cd8000, 0xcd9b0000, 0x9b360000},
		{{ 0,	 20064},	/* smd0a cyl   0-65 */
		{ 20064, 13680},	/* smd0b cyl  66-110 */
		{ 33744, 214928},	/* smd0c cyl 111-817 */
		{ 248672,1520 },	/* smd0d cyl 818-822 */
		{ 0,	 248672 },	/* smd0e cyl   0-817 */
		{ 0,	 250192 }},	/* smd0f cyl   0-822 */
	},
	{512, 32, 10, 823, 0, 3600, 0,	"fsd",	/* 160 Mb FSD */
		{ 0x0d9b366c, 0x1b366cd8, 0x366cd9b0, 0x6cd9b360,
		  0xd9b366c0, 0xb366cd80, 0x66cd9b00, 0xcd9b3600,
		  0x9b366300, 0x366cd800, 0x6cd9b000, 0xd9b36000,
		  0xb366c000, 0x66cd8000, 0xcd9b0000, 0x9b360000},
		{{0,	 9600},		/* fsd0a cyl   0 -  59 */
		{9600,	 12000},	/* fsd0b cyl  60 - 134 */
		{21600,	 109280},	/* fsd0c cyl 135 - 817 */
		{0,	 21600},	/* fsd0d cyl   0 - 134 (a & b) */
		{0,	 130880},	/* fsd0e cyl   0 - 817 */
		{9600,	 121280},	/* fsd0f cyl  60 - 817 (b & c) */
		{21600,  54240},	/* fsd0g cyl 135 - 473 (1/2 of c) */
		{75840,  55040}}	/* fsd0h cyl 474 - 817 (1/2 of c) */
	}
};

int	nvddrv = (sizeof (vdst) / sizeof (fs_tab));

#else
#ifdef STANDALONE
extern long	vddcaddr[];
extern long	vdtimeout;
extern fs_tab	vdst[];
extern int	nvddrv;
#endif
#endif

Changes to sys/tahoe/vba/vx.c.

1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20

21



22
23
24
25
26
27
28
29
30
/*	vx.c	1.1	85/07/21	*/

#include "vx.h"
#if NVX > 0
/*
 *	VIOC-X driver
 */


#include "../h/param.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/map.h"
#include "../machine/pte.h"
#include "../h/buf.h"
#include "../vba/vbavar.h"
#include "../h/conf.h"
#include "../h/file.h"
#include "../h/uio.h"

#include "../vba/vioc.h"



#ifdef VXPERF
#include "../vba/scope.h"
#endif VXPERF
#include "vbsc.h"
#if NVBSC > 0
#include "../bsc/bscio.h"
#include "../bsc/bsc.h"
char bscport[NVXPORTS];
#endif
|






>







<

<



>
|
>
>
>

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*	vx.c	1.2	86/01/05	*/

#include "vx.h"
#if NVX > 0
/*
 *	VIOC-X driver
 */
#include "../tahoe/pte.h"

#include "../h/param.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/map.h"

#include "../h/buf.h"

#include "../h/conf.h"
#include "../h/file.h"
#include "../h/uio.h"
#include "../h/proc.h"
#include "../h/vm.h"

#include "../tahoevba/vbavar.h"
#include "../tahoevba/vioc.h"
#ifdef VXPERF
#include "../tahoevba/scope.h"
#endif VXPERF
#include "vbsc.h"
#if NVBSC > 0
#include "../bsc/bscio.h"
#include "../bsc/bsc.h"
char bscport[NVXPORTS];
#endif
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87

88

89
90
91
92
93

94
95
96
97
98
99
100

101
102
103
104
105
106
107
struct	vcx	vcx[NVIOCX] ;
struct	tty	vx_tty[NVXPORTS];
extern struct vcmds v_cmds[];
extern long reinit;

int	vxstart() ;
int	ttrstrt() ;
caddr_t vtoph();
struct	vxcmd	*vobtain() ;
struct	vxcmd	*nextcmd() ;

/*
 * Driver information for auto-configuration stuff.
 * (not tested and probably should be changed)
 */
int	vxprobe(), vxattach(), vxrint();
struct	vba_device *vxinfo[NVIOCX];
long	vxstd[] = { 0 };
struct	vba_driver vxdriver =
	{ vxprobe, 0, vxattach, 0, vxstd, "vioc ", vxinfo };

char vxtype[NVIOCX];	/* 0: viox-x/vioc-b; 1: vioc-bop */
char vxbbno = -1;
char vxbopno[NVIOCX];	/* BOP board no. if indicated by vxtype[] */
extern vbrall();


vxprobe(reg)
	caddr_t reg;
{
	register int br, cvec;
	register struct vblok *vp = (struct vblok *)reg;

#ifdef lint
	br = 0; cvec = br; br = cvec;

#endif

	if(badaddr(vp, 1))
		return(0);
	vp->v_fault = 0 ;
	vp->v_vioc = V_BSY ;
	vp->v_hdwre = V_RESET ;		/* reset interrupt */

	DELAY(4000000);

	return ( vp->v_fault == VREADY);

}

vxattach(ui)
	register struct vba_device *ui;
{

	VIOCBAS[ui->ui_unit] = ui->ui_addr;
	vxinit(ui->ui_unit,1);
}

/*
 * Open a VX line.
 */

vxopen(dev, flag)
{
	register struct tty *tp;	/* pointer to tty struct for port */
	register struct vcx *xp;	/* pointer to VIOC-X info/cmd buffer */
	register d;			/* minor device number */
	register long jj;








<











|















>


|
|
|
|
|
<

>
|
>





>

|





>







47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
struct	vcx	vcx[NVIOCX] ;
struct	tty	vx_tty[NVXPORTS];
extern struct vcmds v_cmds[];
extern long reinit;

int	vxstart() ;
int	ttrstrt() ;

struct	vxcmd	*vobtain() ;
struct	vxcmd	*nextcmd() ;

/*
 * Driver information for auto-configuration stuff.
 * (not tested and probably should be changed)
 */
int	vxprobe(), vxattach(), vxrint();
struct	vba_device *vxinfo[NVIOCX];
long	vxstd[] = { 0 };
struct	vba_driver vxdriver =
	{ vxprobe, 0, vxattach, 0, vxstd, "vx", vxinfo };

char vxtype[NVIOCX];	/* 0: viox-x/vioc-b; 1: vioc-bop */
char vxbbno = -1;
char vxbopno[NVIOCX];	/* BOP board no. if indicated by vxtype[] */
extern vbrall();


vxprobe(reg)
	caddr_t reg;
{
	register int br, cvec;
	register struct vblok *vp = (struct vblok *)reg;

#ifdef lint
	br = 0; cvec = br; br = cvec;
	vackint(0); vunsol(0); vcmdrsp(0); vxfreset(0);
#endif

	if (badaddr((caddr_t)vp, 1))
		return (0);
	vp->v_fault = 0;
	vp->v_vioc = V_BSY;
	vp->v_hdwre = V_RESET;		/* reset interrupt */

	DELAY(4000000);
	if (vp->v_fault != VREADY)
		return (0);
	return (sizeof (*vp));
}

vxattach(ui)
	register struct vba_device *ui;
{

	VIOCBAS[ui->ui_unit] = ui->ui_addr;
	vxinit(ui->ui_unit,(long)1);
}

/*
 * Open a VX line.
 */
/*ARGSUSED*/
vxopen(dev, flag)
{
	register struct tty *tp;	/* pointer to tty struct for port */
	register struct vcx *xp;	/* pointer to VIOC-X info/cmd buffer */
	register d;			/* minor device number */
	register long jj;

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
	if (tp->t_state&TS_XCLUDE && u.u_uid!=0)
		return EBUSY;	/* device is busy, sorry */

	/* wait for data carrier detect to go high */
	d = spl8();
	if( !vcmodem(dev,VMOD_ON) )
		while( (tp->t_state&TS_CARR_ON) == 0 )
			sleep(&tp->t_canq,TTIPRI);
	jj= (*linesw[tp->t_line].l_open)(dev,tp); /*let tty.c finish the open */
	splx(d);	/* 1/2/85 : assures open complete */
	return (jj);
}

/*
 * Close a VX line.
 */

vxclose(dev, flag)
dev_t dev;
int  flag;
{
	register struct tty *tp;
	register d;








|








>







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	if (tp->t_state&TS_XCLUDE && u.u_uid!=0)
		return EBUSY;	/* device is busy, sorry */

	/* wait for data carrier detect to go high */
	d = spl8();
	if( !vcmodem(dev,VMOD_ON) )
		while( (tp->t_state&TS_CARR_ON) == 0 )
			sleep((caddr_t)&tp->t_canq,TTIPRI);
	jj= (*linesw[tp->t_line].l_open)(dev,tp); /*let tty.c finish the open */
	splx(d);	/* 1/2/85 : assures open complete */
	return (jj);
}

/*
 * Close a VX line.
 */
/*ARGSUSED*/
vxclose(dev, flag)
dev_t dev;
int  flag;
{
	register struct tty *tp;
	register d;

240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
		register short *aa ;
		aa = (short *)kp->v_usdata;
		sp = (short *)(*aa  + (char *)kp) ;
	} else {
		c = kp->v_usdata[0] << 6;
		sp = (short *)((char *)kp + SILOBAS + c);
	}
nextsilo:
	i = *(savsilo = sp);
	if (i == 0) return(1);
	if(xp->v_vers == V_NEW)
		if( i > xp->v_silosiz ) {
			printf("vx: %d exceeds silo size\n",i) ;
			i = xp->v_silosiz;
		}







<







247
248
249
250
251
252
253

254
255
256
257
258
259
260
		register short *aa ;
		aa = (short *)kp->v_usdata;
		sp = (short *)(*aa  + (char *)kp) ;
	} else {
		c = kp->v_usdata[0] << 6;
		sp = (short *)((char *)kp + SILOBAS + c);
	}

	i = *(savsilo = sp);
	if (i == 0) return(1);
	if(xp->v_vers == V_NEW)
		if( i > xp->v_silosiz ) {
			printf("vx: %d exceeds silo size\n",i) ;
			i = xp->v_silosiz;
		}
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
			cp->par[7] = 3;		/* even parity */
		else
			cp->par[7] = 0;		/* no parity */
	}
	cp->par[5] = 0x4;			/* 1 stop bit */
	cp->par[6] = tp->t_ospeed;

	if (vcmd(xp->v_nbr, &cp->cmd) && wait)
		sleep(cp,TTIPRI);
	splx(s);
}

/*
 * VIOCX command response interrupt.
 * For transmission, restart output to any active port.
 * For all other commands, just clean up.







|
|







353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
			cp->par[7] = 3;		/* even parity */
		else
			cp->par[7] = 0;		/* no parity */
	}
	cp->par[5] = 0x4;			/* 1 stop bit */
	cp->par[6] = tp->t_ospeed;

	if (vcmd(xp->v_nbr, (caddr_t)&cp->cmd) && wait)
		sleep((caddr_t)cp,TTIPRI);
	splx(s);
}

/*
 * VIOCX command response interrupt.
 * For transmission, restart output to any active port.
 * For all other commands, just clean up.
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
			vinthandl(n,((V_BSY | RSPquals) << 8) | V_INTR);
		}
		cp->cmd++;
		return;
	case XMITDTA: case XMITIMM:
		break;
	case LPARAX:
		wakeup(cp);
	default:	/* MDMCTL or FDTATOX */
		vrelease(xp, cp);
		if (xp->v_state & V_RESETTING) {
			vinthandl(n,((V_BSY | RSPquals) << 8) | V_INTR);
		}
		return;
	}







|







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
			vinthandl(n,((V_BSY | RSPquals) << 8) | V_INTR);
		}
		cp->cmd++;
		return;
	case XMITDTA: case XMITIMM:
		break;
	case LPARAX:
		wakeup((caddr_t)cp);
	default:	/* MDMCTL or FDTATOX */
		vrelease(xp, cp);
		if (xp->v_state & V_RESETTING) {
			vinthandl(n,((V_BSY | RSPquals) << 8) | V_INTR);
		}
		return;
	}
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
	vrelease(xp,cp);
	if(xp->v_vers == V_NEW) {
		vp = pvp;
		xp->v_actport[(vp->line & 017) - xp->v_loport] |= 1 ;
		if(vxstart(tp) && (cp = nextcmd(xp)) != NULL)
		{
			xp->v_xmtcnt++;
			vcmd(n, &cp->cmd);
			return ;
		}
		xp->v_actport[(vp->line & 017) - xp->v_loport] = 0 ;
		return ;
	}
	xp->v_actflg = 1;
	hp = &vx_tty[xp->v_hiport+n*16];
	for(tp = &vx_tty[xp->v_loport+n*16];tp <= hp;tp++)
		if(vxstart(tp) && (cp = nextcmd(xp)) != NULL)
		{
			xp->v_xmtcnt++;
			vcmd(n, &cp->cmd);
		}
	if( (cp = nextcmd(xp)) != NULL )		/* command to send ? */
	{
		xp->v_xmtcnt++;
		vcmd(n,&cp->cmd);
	}
	xp->v_actflg = 0;
}

/*
 * Force out partial XMIT command after timeout
 */
vxforce(xp)
register struct vcx	*xp;
{
	register struct vxcmd	*cp;
	register int s;

	s = spl8();
	if((cp = nextcmd(xp)) != NULL) {
		xp->v_xmtcnt++;
		vcmd(xp->v_nbr, &cp->cmd);
	}
	splx(s);
}

/*
 * Start (restart) transmission on the given VX line.
 */
vxstart(tp)
register struct tty *tp;
{
	register short nch;
	register struct	vcx	*xp;
	register char *outb;
	register full = 0;
	int k, s, port;

	s = spl8();
	port = minor(tp->t_dev) & 017;







|











|




|
















|










|







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
	vrelease(xp,cp);
	if(xp->v_vers == V_NEW) {
		vp = pvp;
		xp->v_actport[(vp->line & 017) - xp->v_loport] |= 1 ;
		if(vxstart(tp) && (cp = nextcmd(xp)) != NULL)
		{
			xp->v_xmtcnt++;
			vcmd(n, (caddr_t)&cp->cmd);
			return ;
		}
		xp->v_actport[(vp->line & 017) - xp->v_loport] = 0 ;
		return ;
	}
	xp->v_actflg = 1;
	hp = &vx_tty[xp->v_hiport+n*16];
	for(tp = &vx_tty[xp->v_loport+n*16];tp <= hp;tp++)
		if(vxstart(tp) && (cp = nextcmd(xp)) != NULL)
		{
			xp->v_xmtcnt++;
			vcmd(n, (caddr_t)&cp->cmd);
		}
	if( (cp = nextcmd(xp)) != NULL )		/* command to send ? */
	{
		xp->v_xmtcnt++;
		vcmd(n, (caddr_t)&cp->cmd);
	}
	xp->v_actflg = 0;
}

/*
 * Force out partial XMIT command after timeout
 */
vxforce(xp)
register struct vcx	*xp;
{
	register struct vxcmd	*cp;
	register int s;

	s = spl8();
	if((cp = nextcmd(xp)) != NULL) {
		xp->v_xmtcnt++;
		vcmd(xp->v_nbr, (caddr_t)&cp->cmd);
	}
	splx(s);
}

/*
 * Start (restart) transmission on the given VX line.
 */
vxstart(tp)
register struct tty *tp;
{
	register short n;
	register struct	vcx	*xp;
	register char *outb;
	register full = 0;
	int k, s, port;

	s = spl8();
	port = minor(tp->t_dev) & 017;
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
			return(0);
		}
#ifdef VXPERF
	scope_out(3);
#endif VXPERF
		if(!(tp->t_flags&(RAW|LITOUT)))  
			full = 0200;
		if((nch = ndqb(&tp->t_outq, full)) == 0)   {
			if(full) {
				nch = getc(&tp->t_outq);
				timeout(ttrstrt, (caddr_t)tp, (nch&0177) +6);
				tp->t_state |= TS_TIMEOUT;
				full = 0;
			}
		} else {
			outb = (char *)tp->t_outq.c_cf;
			tp->t_state |= TS_BUSY;
			if(xp->v_vers == V_NEW)
				k = xp->v_actport[port - xp->v_loport] ;
			else
				k = xp->v_actflg ;

			full = vsetq(xp, port, outb, nch);

			if( (k&1) == 0 ) {	/* not called from vxxint */
				if(full || xp->v_xmtcnt == 0) {
					outb = (char *)(&nextcmd(xp)->cmd);
					xp->v_xmtcnt++;
					vcmd(xp->v_nbr, outb );
				} else
					timeout(vxforce,xp,3);
			}
		}
	}
	splx(s);
	return(full);	/* indicate if max commands or not */
}








|

|
|











|







|







509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
			return(0);
		}
#ifdef VXPERF
	scope_out(3);
#endif VXPERF
		if(!(tp->t_flags&(RAW|LITOUT)))  
			full = 0200;
		if((n = ndqb(&tp->t_outq, full)) == 0)   {
			if(full) {
				n = getc(&tp->t_outq);
				timeout(ttrstrt, (caddr_t)tp, (n&0177) +6);
				tp->t_state |= TS_TIMEOUT;
				full = 0;
			}
		} else {
			outb = (char *)tp->t_outq.c_cf;
			tp->t_state |= TS_BUSY;
			if(xp->v_vers == V_NEW)
				k = xp->v_actport[port - xp->v_loport] ;
			else
				k = xp->v_actflg ;

			full = vsetq(xp, port, outb, n);

			if( (k&1) == 0 ) {	/* not called from vxxint */
				if(full || xp->v_xmtcnt == 0) {
					outb = (char *)(&nextcmd(xp)->cmd);
					xp->v_xmtcnt++;
					vcmd(xp->v_nbr, outb );
				} else
					timeout(vxforce,(caddr_t)xp,3);
			}
		}
	}
	splx(s);
	return(full);	/* indicate if max commands or not */
}

566
567
568
569
570
571
572
573
574

575
576

577
578
579
580
581
582
583
584
585
586
587
588
589
long wait;
{
	register struct	vcx	*xp;	/* ptr to VIOC-X info/cmd buffer */
	register struct	vblok	*kp;	/* pointer to VIOC-X control block */
	register struct	vxcmd	*cp;	/* pointer to a command buffer */
	register char	*resp;		/* pointer to response buffer */
	register int	j;
	register struct	vcmds	*cpp;
	char type;

	register struct	bsc	*bp;	/* bsc change */
	extern	 struct	bsc	bsc[];



	kp = VBAS(i);		/* get base adr of cntl blok for VIOC */

	xp = &vcx[i];		/* index info/command buffers */
	cpp = &v_cmds[i];
	type = kp->v_ident;
	vxtype[i] =  0;		/* Type is Viox-x */
	switch(type) {
	case VIOCX:
		{
		xp->v_vers = V_OLD ;
		/* set DCD for printer ports */







<

>


>





<







572
573
574
575
576
577
578

579
580
581
582
583
584
585
586
587
588

589
590
591
592
593
594
595
long wait;
{
	register struct	vcx	*xp;	/* ptr to VIOC-X info/cmd buffer */
	register struct	vblok	*kp;	/* pointer to VIOC-X control block */
	register struct	vxcmd	*cp;	/* pointer to a command buffer */
	register char	*resp;		/* pointer to response buffer */
	register int	j;

	char type;
#if NVBSC > 0
	register struct	bsc	*bp;	/* bsc change */
	extern	 struct	bsc	bsc[];
#endif


	kp = VBAS(i);		/* get base adr of cntl blok for VIOC */

	xp = &vcx[i];		/* index info/command buffers */

	type = kp->v_ident;
	vxtype[i] =  0;		/* Type is Viox-x */
	switch(type) {
	case VIOCX:
		{
		xp->v_vers = V_OLD ;
		/* set DCD for printer ports */
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
	cp = vobtain(xp);	/* grap the control block */
	cp->cmd = LIDENT;	/* set command type */
	cp->par[0] = i * 4 + VCVECT; 	/* ack vector */
	cp->par[1] = cp->par[0] + 1;	/* cmd resp vector */
	cp->par[3] = cp->par[0] + 2;	/* unsol intr vector */
	cp->par[4] = 15;	/* max ports, no longer used */
	cp->par[5] = 0;		/* set 1st port number */
	vcmd(i, &cp->cmd);	/* initialize the VIOC-X */

	if (!wait) return;
	while(cp->cmd == LIDENT);    /* wait for command completion */

 	/* calculate address of response buffer */
 	resp = (char *)kp;
 	resp += kp->v_rspoff & 0x3FFF;







|







663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
	cp = vobtain(xp);	/* grap the control block */
	cp->cmd = LIDENT;	/* set command type */
	cp->par[0] = i * 4 + VCVECT; 	/* ack vector */
	cp->par[1] = cp->par[0] + 1;	/* cmd resp vector */
	cp->par[3] = cp->par[0] + 2;	/* unsol intr vector */
	cp->par[4] = 15;	/* max ports, no longer used */
	cp->par[5] = 0;		/* set 1st port number */
	vcmd(i, (caddr_t)&cp->cmd);	/* initialize the VIOC-X */

	if (!wait) return;
	while(cp->cmd == LIDENT);    /* wait for command completion */

 	/* calculate address of response buffer */
 	resp = (char *)kp;
 	resp += kp->v_rspoff & 0x3FFF;
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
	return(cp);
}

/*
 * assemble transmits into a multiple command.
 * up to 8 transmits to 8 lines can be assembled together
 */
vsetq(xp ,d ,addr, cnt)
register struct	vcx	*xp;
caddr_t	addr;
{

	register struct	vxcmd	*cp;
	register struct	vxmit	*mp;
	register char	*p;







|







752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
	return(cp);
}

/*
 * assemble transmits into a multiple command.
 * up to 8 transmits to 8 lines can be assembled together
 */
vsetq(xp ,d ,addr, n)
register struct	vcx	*xp;
caddr_t	addr;
{

	register struct	vxcmd	*cp;
	register struct	vxmit	*mp;
	register char	*p;
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785

786
787
788
789
790
791
792
793
794
795
796
797
798
			vxstreset(xp->v_nbr);
			return(0);
		}
		cp->cmd++;
	}

	mp = (struct vxmit *)(cp->par + (cp->cmd & 07)*sizvxmit);
	mp->bcount = cnt-1;

	mp->line = d;
	if((xp->v_vers == V_NEW) && (cnt <= 6)) {
		cp->cmd = XMITIMM ;
		p = addr;
		/* bcopy(addr, &(char *)mp->ostream, cnt) ; */
	} else {

		addr = vtoph(0, (caddr_t)addr) ; /* should be a sys address */
		p = (char *)&addr;
		cnt = sizeof addr;
		/* mp->ostream = addr ; */
	}
	for(i=0; i<cnt; i++)
		mp->ostream[i] = *p++;
	if(xp->v_vers == V_NEW)
		return(1) ;
	else
		return((cp->cmd&07) == 7) ;	/* Indicate if full */
}
#endif







|


|


|

>
|

|


|







777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
			vxstreset(xp->v_nbr);
			return(0);
		}
		cp->cmd++;
	}

	mp = (struct vxmit *)(cp->par + (cp->cmd & 07)*sizvxmit);
	mp->bcount = n-1;

	mp->line = d;
	if((xp->v_vers == V_NEW) && (n <= 6)) {
		cp->cmd = XMITIMM ;
		p = addr;
		/* bcopy(addr, &(char *)mp->ostream, n) ; */
	} else {
		addr = (caddr_t)vtoph((struct proc *)0, (unsigned)addr);
				/* should be a sys address */
		p = (char *)&addr;
		n = sizeof addr;
		/* mp->ostream = addr ; */
	}
	for(i=0; i<n; i++)
		mp->ostream[i] = *p++;
	if(xp->v_vers == V_NEW)
		return(1) ;
	else
		return((cp->cmd&07) == 7) ;	/* Indicate if full */
}
#endif

Changes to sys/tahoe/vba/vxc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*	vxc.c	1.1	85/07/21	*/

#include "vx.h"
#if NVX > 0
/*
 *  VIOC driver
 */
#include "../h/param.h"
#include "../h/file.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/errno.h"
#include "../h/time.h"
#include "../h/kernel.h"
#include "../vba/vioc.h"

#include "../sna/snadebug.h"
#ifdef VXPERF
#include "../vba/scope.h"
#endif VXPERF

#define CMDquals 0
#define RSPquals 1
#define UNSquals 2

long reinit = 0;
extern	struct	vcx	vcx[] ;
extern	struct	tty	vx_tty[];
struct	vcmds	v_cmds[NVIOCX] ;

extern char vxtype[];
extern char vxbbno;
extern char vxbopno[];
|













|
>


|






<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
/*	vxc.c	1.2	86/01/05	*/

#include "vx.h"
#if NVX > 0
/*
 *  VIOC driver
 */
#include "../h/param.h"
#include "../h/file.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/errno.h"
#include "../h/time.h"
#include "../h/kernel.h"
#include "../h/proc.h"
#include "../tahoevba/vioc.h"
#include "../sna/snadebug.h"
#ifdef VXPERF
#include "../tahoevba/scope.h"
#endif VXPERF

#define CMDquals 0
#define RSPquals 1
#define UNSquals 2


extern	struct	vcx	vcx[] ;
extern	struct	tty	vx_tty[];
struct	vcmds	v_cmds[NVIOCX] ;

extern char vxtype[];
extern char vxbbno;
extern char vxbopno[];
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89
90
91
92
	cp = &v_cmds[n] ;
	xp = &vcx[n];
	if (xp->v_state&V_RESETTING && cmdad != NULL) {
		/*
		 * When the vioc is resetting, don't process
		 * anything other than LIDENT commands.
		 */
		register struct vxcmd *cp = (struct vxcmd *)
				((char *)cmdad - sizeof(cp->c_fwd));
		if (cp->cmd != LIDENT) {
			vrelease(xp, cp);
			return(0);
		}
	}
	if (cmdad != (caddr_t) 0) {
		cp->cmdbuf[cp->v_fill] = cmdad ;
		if( ++cp->v_fill >= VC_CMDBUFL )  cp->v_fill = 0 ;
		if(cp->v_fill == cp->v_empty) {
			vpanic("vc: CMD Q OVFLO") ;
			vxstreset(n);
			splx(s);
			return(0);
		}
		cp->v_cmdsem++;
	}
	if(cp->v_cmdsem && cp->v_curcnt < vcx[n].v_maxcmd) {
		cp->v_cmdsem--;
		cp->v_curcnt++;
		vinthandl(n, ((V_BSY | CMDquals) << 8) | V_INTR ) ;
	}
	splx(s) ;

}

/*
 * VIOC acknowledge interrupt.  The VIOC has received the new
 * command.  If no errors, the new command becomes one of 16 (max)
 * current commands being executed.
 */







|
|
|
|




















>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
	cp = &v_cmds[n] ;
	xp = &vcx[n];
	if (xp->v_state&V_RESETTING && cmdad != NULL) {
		/*
		 * When the vioc is resetting, don't process
		 * anything other than LIDENT commands.
		 */
		register struct vxcmd *cmdp = (struct vxcmd *)
				((char *)cmdad - sizeof(cmdp->c_fwd));
		if (cmdp->cmd != LIDENT) {
			vrelease(xp, cmdp);
			return(0);
		}
	}
	if (cmdad != (caddr_t) 0) {
		cp->cmdbuf[cp->v_fill] = cmdad ;
		if( ++cp->v_fill >= VC_CMDBUFL )  cp->v_fill = 0 ;
		if(cp->v_fill == cp->v_empty) {
			vpanic("vc: CMD Q OVFLO") ;
			vxstreset(n);
			splx(s);
			return(0);
		}
		cp->v_cmdsem++;
	}
	if(cp->v_cmdsem && cp->v_curcnt < vcx[n].v_maxcmd) {
		cp->v_cmdsem--;
		cp->v_curcnt++;
		vinthandl(n, ((V_BSY | CMDquals) << 8) | V_INTR ) ;
	}
	splx(s) ;
	return(1);
}

/*
 * VIOC acknowledge interrupt.  The VIOC has received the new
 * command.  If no errors, the new command becomes one of 16 (max)
 * current commands being executed.
 */
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
			register struct vxcmd *cp1;
			register struct vxcmd *cp0 = (struct vxcmd *)
				((long)cp->cmdbuf[cp->v_empty] - 4);
			if ((cp0->cmd == XMITDTA) || (cp0->cmd == XMITIMM)) {
				cp1 = vobtain(&vcx[n]);
				*cp1 = *cp0;
				vxintr4 &= ~VXERR4;
				vcmd(n,&cp1->cmd);
			}
		}
#endif
		cp->v_curcmd[vp->v_vcid & VCMDLEN-1] = cp->cmdbuf[cp->v_empty] ;
		if( ++cp->v_empty >= VC_CMDBUFL )  cp->v_empty = 0 ;
	}
	if( ++cp->v_itrempt >= VC_IQLEN ) cp->v_itrempt = 0 ;
	vintempt(n) ;
	splx(s);
	vcmd(n, 0);	/* queue next cmd, if any */
}

/*
 *  Command Response interrupt.  The Vioc has completed
 *  a command.  The command may now be returned to
 *  the appropriate device driver .
 */







|









|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
			register struct vxcmd *cp1;
			register struct vxcmd *cp0 = (struct vxcmd *)
				((long)cp->cmdbuf[cp->v_empty] - 4);
			if ((cp0->cmd == XMITDTA) || (cp0->cmd == XMITIMM)) {
				cp1 = vobtain(&vcx[n]);
				*cp1 = *cp0;
				vxintr4 &= ~VXERR4;
				(void) vcmd(n,&cp1->cmd);
			}
		}
#endif
		cp->v_curcmd[vp->v_vcid & VCMDLEN-1] = cp->cmdbuf[cp->v_empty] ;
		if( ++cp->v_empty >= VC_CMDBUFL )  cp->v_empty = 0 ;
	}
	if( ++cp->v_itrempt >= VC_IQLEN ) cp->v_itrempt = 0 ;
	vintempt(n) ;
	splx(s);
	(void) vcmd(n, (caddr_t)0);	/* queue next cmd, if any */
}

/*
 *  Command Response interrupt.  The Vioc has completed
 *  a command.  The command may now be returned to
 *  the appropriate device driver .
 */
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
		cp->v_curcnt--;
		k = *((short *)&resp[4]);	/* cmd operation code */
		if((k & 0xFF00) == LIDENT) {	/* want hiport number */
			for(k=0; k<VRESPLEN; k++)
				cmd[k] = resp[k+4];
		}
		resp[1] = 0;
		vxxint(n, cmd) ;
		if ((&vcx[n])->v_state == V_RESETTING) return;
	}
	else {
		vpanic( "vc, cmdresp debug") ;
		splx(s);
		vxstreset(n);
		return;







|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
		cp->v_curcnt--;
		k = *((short *)&resp[4]);	/* cmd operation code */
		if((k & 0xFF00) == LIDENT) {	/* want hiport number */
			for(k=0; k<VRESPLEN; k++)
				cmd[k] = resp[k+4];
		}
		resp[1] = 0;
		vxxint(n, (struct vxcmd *)cmd) ;
		if ((&vcx[n])->v_state == V_RESETTING) return;
	}
	else {
		vpanic( "vc, cmdresp debug") ;
		splx(s);
		vxstreset(n);
		return;
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
	case CMDquals:		/* command */
		{
		int phys;

		if(cp->v_empty == cp->v_fill || vp->v_vcbsy&V_BSY)
			break;
		(&vcx[n])->v_mricmd = (caddr_t)cp->cmdbuf[cp->v_empty];
		phys = vtoph(0, cp->cmdbuf[cp->v_empty]) ; /* should be a sys address */
		vp->v_vcp[0] = ((short *)&phys)[0];
		vp->v_vcp[1] = ((short *)&phys)[1];
		vp->v_vcbsy = V_BSY ;
		*intr = item ;
		}
#ifdef VXPERF
	scope_out(4);







|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
	case CMDquals:		/* command */
		{
		int phys;

		if(cp->v_empty == cp->v_fill || vp->v_vcbsy&V_BSY)
			break;
		(&vcx[n])->v_mricmd = (caddr_t)cp->cmdbuf[cp->v_empty];
		phys = vtoph((struct proc *)0, (unsigned)cp->cmdbuf[cp->v_empty]) ; /* should be a sys address */
		vp->v_vcp[0] = ((short *)&phys)[0];
		vp->v_vcp[1] = ((short *)&phys)[1];
		vp->v_vcbsy = V_BSY ;
		*intr = item ;
		}
#ifdef VXPERF
	scope_out(4);
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
		return;

	/*
	 * Zero out the vioc structures, mark the vioc as being
	 * reset, reinitialize the free command list, reset the vioc
	 * and start a timer to check on the progress of the reset.
	 */
	bzero(&v_cmds[n], sizeof(struct vcmds));
	bzero(xp, sizeof(struct vcx));

	/*
	 * Setting V_RESETTING prevents others from issuing
	 * commands while allowing currently queued commands to
	 * be passed to the VIOC.
	 */
	xp->v_state |= V_RESETTING;







|
|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
		return;

	/*
	 * Zero out the vioc structures, mark the vioc as being
	 * reset, reinitialize the free command list, reset the vioc
	 * and start a timer to check on the progress of the reset.
	 */
	bzero((caddr_t)&v_cmds[n], (unsigned)sizeof (struct vcmds));
	bzero((caddr_t)xp, (unsigned)sizeof (struct vcx));

	/*
	 * Setting V_RESETTING prevents others from issuing
	 * commands while allowing currently queued commands to
	 * be passed to the VIOC.
	 */
	xp->v_state |= V_RESETTING;
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411

412

413
414
415
416
417
418
419
	return;
}

/* continue processing a reset on a vioc after an error (hopefully) */
vxinreset(vioc)
caddr_t vioc;
{
	register struct vcx *xp;
	register struct	vblok *vp ;
	register int n = (int)vioc;
	int s = spl8();
printf("vxinreset ");

	vp = VBAS(n);
	xp = &vcx[n];

	/*
	 * See if the vioc has reset.
	 */
	if (vp->v_fault != VREADY) {
		printf("failed\n");
		splx(s);
		return;
	}

	/*
	 * Send a LIDENT to the vioc and mess with carrier flags
	 * on parallel printer ports.
	 */
	vxinit(n, 0);
	splx(s);
}

/*
 * Restore modem control, parameters and restart output.
 * Since the vioc can handle no more then 24 commands at a time
 * and we could generate as many as 48 commands, we must do this in
 * phases, issuing no more then 16 commands at a time.
 */
/* finish the reset on the vioc after an error (hopefully) */
vxfnreset(n, cp)
register int n;
register struct vxcmd *cp;
{
	register struct vcx *xp;
	register struct	vblok *vp ;
	register struct tty *tp;
	register int i;

	register int on;

	extern int vxrestart();
	int s = spl8();
printf("vxfnreset ");

	vp = VBAS(n);
	xp = &vcx[n];








|

<




<














|


















>

>







365
366
367
368
369
370
371
372
373

374
375
376
377

378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
	return;
}

/* continue processing a reset on a vioc after an error (hopefully) */
vxinreset(vioc)
caddr_t vioc;
{
	register int n = (int)vioc;
	register struct	vblok *vp ;

	int s = spl8();
printf("vxinreset ");

	vp = VBAS(n);


	/*
	 * See if the vioc has reset.
	 */
	if (vp->v_fault != VREADY) {
		printf("failed\n");
		splx(s);
		return;
	}

	/*
	 * Send a LIDENT to the vioc and mess with carrier flags
	 * on parallel printer ports.
	 */
	vxinit(n, (long)0);
	splx(s);
}

/*
 * Restore modem control, parameters and restart output.
 * Since the vioc can handle no more then 24 commands at a time
 * and we could generate as many as 48 commands, we must do this in
 * phases, issuing no more then 16 commands at a time.
 */
/* finish the reset on the vioc after an error (hopefully) */
vxfnreset(n, cp)
register int n;
register struct vxcmd *cp;
{
	register struct vcx *xp;
	register struct	vblok *vp ;
	register struct tty *tp;
	register int i;
#ifdef notdef
	register int on;
#endif
	extern int vxrestart();
	int s = spl8();
printf("vxfnreset ");

	vp = VBAS(n);
	xp = &vcx[n];

449
450
451
452
453
454
455
456

457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
				}
			}
		}
		/*
		 * If carrier has changed while we were resetting,
		 * take appropriate action.
		 */
/*

		on = vp->v_dcd & 1<<i;
		if (on && (tp->t_state&TS_CARR_ON) == 0) {
			tp->t_state |= TS_CARR_ON ;
			wakeup((caddr_t)&tp->t_canq) ;
		} else if (!on && tp->t_state&TS_CARR_ON) {
			tp->t_state &= ~TS_CARR_ON ;
			if(tp->t_state & TS_ISOPEN) {
				ttyflush(tp, FREAD|FWRITE);
				if(tp->t_state&TS_FLUSH)
					wakeup((caddr_t)&tp->t_state) ;
				if((tp->t_flags&NOHANG)==0) {
					gsignal(tp->t_pgrp, SIGHUP) ;
					gsignal(tp->t_pgrp, SIGCONT);
				}
			}
		}
*/

	}

	xp->v_state |= V_RESETTING;

	timeout(vxrestart, (caddr_t)n, hz);
	splx(s);
}







<
>
















<
>







450
451
452
453
454
455
456

457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
481
				}
			}
		}
		/*
		 * If carrier has changed while we were resetting,
		 * take appropriate action.
		 */

#ifdef notdef
		on = vp->v_dcd & 1<<i;
		if (on && (tp->t_state&TS_CARR_ON) == 0) {
			tp->t_state |= TS_CARR_ON ;
			wakeup((caddr_t)&tp->t_canq) ;
		} else if (!on && tp->t_state&TS_CARR_ON) {
			tp->t_state &= ~TS_CARR_ON ;
			if(tp->t_state & TS_ISOPEN) {
				ttyflush(tp, FREAD|FWRITE);
				if(tp->t_state&TS_FLUSH)
					wakeup((caddr_t)&tp->t_state) ;
				if((tp->t_flags&NOHANG)==0) {
					gsignal(tp->t_pgrp, SIGHUP) ;
					gsignal(tp->t_pgrp, SIGCONT);
				}
			}
		}

#endif
	}

	xp->v_state |= V_RESETTING;

	timeout(vxrestart, (caddr_t)n, hz);
	splx(s);
}
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
{
	vxstreset(minor(dev)>>4);	/* completes asynchronously */
}

vxfreset(n)
register int n;
{
	register struct vblok *vp;

	if (n < 0 || n > NVX || VBAS(n) == NULL)
		return(ENODEV);
	vcx[n].v_state &= ~V_RESETTING;
	vxstreset(n);
	return(0);		/* completes asynchronously */
}
#endif








<









526
527
528
529
530
531
532

533
534
535
536
537
538
539
540
541
{
	vxstreset(minor(dev)>>4);	/* completes asynchronously */
}

vxfreset(n)
register int n;
{


	if (n < 0 || n > NVX || VBAS(n) == NULL)
		return(ENODEV);
	vcx[n].v_state &= ~V_RESETTING;
	vxstreset(n);
	return(0);		/* completes asynchronously */
}
#endif

Changes to sys/tahoe/vba/vxm.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*	vxm.c	1.1	85/07/21	*/

#include "vx.h"
#if NVX > 0
/*
 *	VIOC-X Modem control
 */

#include "../h/param.h"
#include "../h/file.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/conf.h"
#include "../vba/vioc.h"
#include "vbsc.h"
#if NVBSC > 0
#include "../bsc/bscio.h"
#include "../bsc/bsc.h"
extern char bscport[];
#endif

|












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*	vxm.c	1.2	86/01/05	*/

#include "vx.h"
#if NVX > 0
/*
 *	VIOC-X Modem control
 */

#include "../h/param.h"
#include "../h/file.h"
#include "../h/ioctl.h"
#include "../h/tty.h"
#include "../h/conf.h"
#include "../tahoevba/vioc.h"
#include "vbsc.h"
#if NVBSC > 0
#include "../bsc/bscio.h"
#include "../bsc/bsc.h"
extern char bscport[];
#endif

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

	/*
	 * Issue MODEM command
	 */
	cp->cmd = MDMCTL ;
	cp->par[0] = (flag == VMOD_ON) ? V_ENAB : V_DISAB ;
	cp->par[1] = port;
	vcmd(xp->v_nbr, &cp->cmd) ;
	port -= xp->v_loport ;
	if((kp->v_dcd >> port) & 1) {
		if(flag == VMOD_ON)
			tp->t_state |= TS_CARR_ON ;
		return(1) ;
	}
	return(0) ;







|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

	/*
	 * Issue MODEM command
	 */
	cp->cmd = MDMCTL ;
	cp->par[0] = (flag == VMOD_ON) ? V_ENAB : V_DISAB ;
	cp->par[1] = port;
	vcmd(xp->v_nbr, (caddr_t)&cp->cmd) ;
	port -= xp->v_loport ;
	if((kp->v_dcd >> port) & 1) {
		if(flag == VMOD_ON)
			tp->t_state |= TS_CARR_ON ;
		return(1) ;
	}
	return(0) ;
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
				if(cmdfound)
					tp->t_state &= ~(TS_BUSY|TS_FLUSH);
				/* cmd is already in vioc, have to flush it */
				else {
					cmdp = vobtain(xp);
					cmdp->cmd = FDTATOX ;
					cmdp->par[1] = port ;
					vcmd(n, &cmdp->cmd);
				}
			}
			if((tp->t_flags&NOHANG)==0) {
				gsignal(tp->t_pgrp, SIGHUP) ;
				gsignal(tp->t_pgrp, SIGCONT);
			}
		}







|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
				if(cmdfound)
					tp->t_state &= ~(TS_BUSY|TS_FLUSH);
				/* cmd is already in vioc, have to flush it */
				else {
					cmdp = vobtain(xp);
					cmdp->cmd = FDTATOX ;
					cmdp->par[1] = port ;
					vcmd(n, (caddr_t)&cmdp->cmd);
				}
			}
			if((tp->t_flags&NOHANG)==0) {
				gsignal(tp->t_pgrp, SIGHUP) ;
				gsignal(tp->t_pgrp, SIGCONT);
			}
		}

Changes to sys/vax/if/if_dmc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)if_dmc.c	6.8 (Berkeley) 12/19/85
 */

#include "dmc.h"
#if NDMC > 0

/*
 * DMC11 device driver, internet version





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)if_dmc.c	6.9 (Berkeley) 01/08/86
 */

#include "dmc.h"
#if NDMC > 0

/*
 * DMC11 device driver, internet version
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "vmmac.h"
#include "errno.h"

#include "../net/if.h"
#include "../net/netisr.h"
#include "../net/route.h"

#ifdef	BBNNET
#define	INET
#endif
#ifdef	INET
#include "../netinet/in.h"
#include "../netinet/in_systm.h"
#include "../netinet/ip.h"
#endif

#include "../vax/cpu.h"







<
<
<







34
35
36
37
38
39
40



41
42
43
44
45
46
47
#include "vmmac.h"
#include "errno.h"

#include "../net/if.h"
#include "../net/netisr.h"
#include "../net/route.h"




#ifdef	INET
#include "../netinet/in.h"
#include "../netinet/in_systm.h"
#include "../netinet/ip.h"
#endif

#include "../vax/cpu.h"

Changes to sys/vax/if/if_ex.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)if_ex.c	6.9 (Berkeley) 12/19/85
 */


#include "ex.h"
#if NEX > 0

/*





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)if_ex.c	6.10 (Berkeley) 01/07/86
 */


#include "ex.h"
#if NEX > 0

/*
102
103
104
105
106
107
108
109

110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
	u_short	xs_x2hhdr;		/* EXOS's reply queue header */
	struct	ex_msg xs_h2xent[NH2X];	/* request msg buffers */
	struct	ex_msg xs_x2hent[NX2H];	/* reply msg buffers */
	struct	confmsg xs_cm;		/* configuration message */
	struct	stat_array xs_xsa;	/* EXOS writes stats here */
	/* end mapped area */
#define	INCORE_BASE(p)	(((u_long)(&(p)->xs_h2xhdr)) & 0xFFFFFFF0)
#define	RVAL_OFF(n)	((u_long)(&(ex_softc[0].n)) - INCORE_BASE(&ex_softc[0]))

#define	LVAL_OFF(n)	((u_long)(ex_softc[0].n) - INCORE_BASE(&ex_softc[0]))

#define	H2XHDR_OFFSET	RVAL_OFF(xs_h2xhdr)
#define	X2HHDR_OFFSET	RVAL_OFF(xs_x2hhdr)
#define	H2XENT_OFFSET	LVAL_OFF(xs_h2xent)
#define	X2HENT_OFFSET	LVAL_OFF(xs_x2hent)
#define	CM_OFFSET	RVAL_OFF(xs_cm)
#define	SA_OFFSET	RVAL_OFF(xs_xsa)
#define	INCORE_SIZE	RVAL_OFF(xs_end)
	int	xs_end;			/* place holder */
} ex_softc[NEX];

/*
 * The following structure is a kludge to store a cvec value
 * between the time exprobe is called, and exconfig.
 */







|
>
|
>
|
|
|
|
|
|
|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	u_short	xs_x2hhdr;		/* EXOS's reply queue header */
	struct	ex_msg xs_h2xent[NH2X];	/* request msg buffers */
	struct	ex_msg xs_x2hent[NX2H];	/* reply msg buffers */
	struct	confmsg xs_cm;		/* configuration message */
	struct	stat_array xs_xsa;	/* EXOS writes stats here */
	/* end mapped area */
#define	INCORE_BASE(p)	(((u_long)(&(p)->xs_h2xhdr)) & 0xFFFFFFF0)
#define	RVAL_OFF(unit, n) \
	((u_long)(&(ex_softc[unit].n)) - INCORE_BASE(&ex_softc[unit]))
#define	LVAL_OFF(unit, n) \
	((u_long)(ex_softc[unit].n) - INCORE_BASE(&ex_softc[unit]))
#define	H2XHDR_OFFSET(unit)	RVAL_OFF(unit, xs_h2xhdr)
#define	X2HHDR_OFFSET(unit)	RVAL_OFF(unit, xs_x2hhdr)
#define	H2XENT_OFFSET(unit)	LVAL_OFF(unit, xs_h2xent)
#define	X2HENT_OFFSET(unit)	LVAL_OFF(unit, xs_x2hent)
#define	CM_OFFSET(unit)		RVAL_OFF(unit, xs_cm)
#define	SA_OFFSET(unit)		RVAL_OFF(unit, xs_xsa)
#define	INCORE_SIZE(unit)	RVAL_OFF(unit, xs_end)
	int	xs_end;			/* place holder */
} ex_softc[NEX];

/*
 * The following structure is a kludge to store a cvec value
 * between the time exprobe is called, and exconfig.
 */
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

189
190
191
192
193
194
195
exattach(ui)
	struct uba_device *ui;
{
	register struct ex_softc *xs = &ex_softc[ui->ui_unit];
	register struct ifnet *ifp = &xs->xs_if;
	register struct exdevice *addr = (struct exdevice *)ui->ui_addr;
	register struct ex_msg *bp;

	ifp->if_unit = ui->ui_unit;
	ifp->if_name = "ex";
	ifp->if_mtu = ETHERMTU;

	/*
	 * Temporarily map queues in order to configure EXOS
	 */
	xs->xs_ubaddr = uballoc(ui->ui_ubanum, INCORE_BASE(xs), INCORE_SIZE, 0);

	exconfig(ui, 0);			/* without interrupts */
	if (xs->xs_cm.cm_cc) goto badconf;

	bp = exgetcbuf(xs);
	bp->mb_rqst = LLNET_ADDRS;
	bp->mb_na.na_mask = READ_OBJ;
	bp->mb_na.na_slot = PHYSSLOT;







|







|
>







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
exattach(ui)
	struct uba_device *ui;
{
	register struct ex_softc *xs = &ex_softc[ui->ui_unit];
	register struct ifnet *ifp = &xs->xs_if;
	register struct exdevice *addr = (struct exdevice *)ui->ui_addr;
	register struct ex_msg *bp;
	int unit = ui->ui_unit;
	ifp->if_unit = ui->ui_unit;
	ifp->if_name = "ex";
	ifp->if_mtu = ETHERMTU;

	/*
	 * Temporarily map queues in order to configure EXOS
	 */
	xs->xs_ubaddr = uballoc(ui->ui_ubanum, INCORE_BASE(xs),
		INCORE_SIZE(unit), 0);
	exconfig(ui, 0);			/* without interrupts */
	if (xs->xs_cm.cm_cc) goto badconf;

	bp = exgetcbuf(xs);
	bp->mb_rqst = LLNET_ADDRS;
	bp->mb_na.na_mask = READ_OBJ;
	bp->mb_na.na_slot = PHYSSLOT;
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
		    sizeof (struct ether_header),
		    (int)btoc(EXMAXRBUF-sizeof(struct ether_header))) == 0) { 
			printf("ex%d: can't initialize\n", unit);
			xs->xs_if.if_flags &= ~IFF_UP;
			return;
		}
		xs->xs_ubaddr = uballoc(ui->ui_ubanum, INCORE_BASE(xs),
			INCORE_SIZE, 0);
	}
	exconfig(ui, 4);		/* with vectored interrupts*/
	/*
	 * Put EXOS on the Ethernet, using NET_MODE command
	 */
	bp = exgetcbuf(xs);
	bp->mb_rqst = LLNET_MODE;







|







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
		    sizeof (struct ether_header),
		    (int)btoc(EXMAXRBUF-sizeof(struct ether_header))) == 0) { 
			printf("ex%d: can't initialize\n", unit);
			xs->xs_if.if_flags &= ~IFF_UP;
			return;
		}
		xs->xs_ubaddr = uballoc(ui->ui_ubanum, INCORE_BASE(xs),
			INCORE_SIZE(unit), 0);
	}
	exconfig(ui, 4);		/* with vectored interrupts*/
	/*
	 * Put EXOS on the Ethernet, using NET_MODE command
	 */
	bp = exgetcbuf(xs);
	bp->mb_rqst = LLNET_MODE;
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
	for (i=0; i<20; i++) cm->cm_rsrvd[i] = 0;
	cm->cm_mba = 0xFFFFFFFF;
	cm->cm_nproc = 0xFF;
	cm->cm_nmbox = 0xFF;
	cm->cm_nmcast = 0xFF;
	cm->cm_nhost = 1;
	cm->cm_h2xba = P_UNIADDR(xs->xs_ubaddr);
	cm->cm_h2xhdr = H2XHDR_OFFSET;
	cm->cm_h2xtyp = 0;		/* should never wait for rqst buffer */
	cm->cm_x2hba = cm->cm_h2xba;
	cm->cm_x2hhdr = X2HHDR_OFFSET;
	cm->cm_x2htyp = itype;		/* 0 for none, 4 for vectored */
	for (i=0; (addr != ex_cvecs[i].xc_csraddr); i++)
#ifdef DEBUG
	if (i >= NEX)
		panic("ex: matching csr address not found");
#endif
		;







|


|







352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
	for (i=0; i<20; i++) cm->cm_rsrvd[i] = 0;
	cm->cm_mba = 0xFFFFFFFF;
	cm->cm_nproc = 0xFF;
	cm->cm_nmbox = 0xFF;
	cm->cm_nmcast = 0xFF;
	cm->cm_nhost = 1;
	cm->cm_h2xba = P_UNIADDR(xs->xs_ubaddr);
	cm->cm_h2xhdr = H2XHDR_OFFSET(unit);
	cm->cm_h2xtyp = 0;		/* should never wait for rqst buffer */
	cm->cm_x2hba = cm->cm_h2xba;
	cm->cm_x2hhdr = X2HHDR_OFFSET(unit);
	cm->cm_x2htyp = itype;		/* 0 for none, 4 for vectored */
	for (i=0; (addr != ex_cvecs[i].xc_csraddr); i++)
#ifdef DEBUG
	if (i >= NEX)
		panic("ex: matching csr address not found");
#endif
		;
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
		bp->mb_rsrv = 0;
		bp->mb_length = MBDATALEN;
		bp->mb_status = MH_HOST;
		bp->mb_next = bp+1;
	}
	xs->xs_h2xhdr =
		xs->xs_h2xent[NH2X-1].mb_link =
		(u_short)H2XENT_OFFSET;
	xs->xs_h2xnext =
		xs->xs_h2xent[NH2X-1].mb_next =
		xs->xs_h2xent;

	/* Now the reply queue. */
	for (bp = &xs->xs_x2hent[0]; bp < &xs->xs_x2hent[NX2H]; bp++) {
		bp->mb_link = (u_short)((char *)(bp+1)-INCORE_BASE(xs));
		bp->mb_rsrv = 0;
		bp->mb_length = MBDATALEN;
		bp->mb_status = MH_EXOS;
		bp->mb_next = bp+1;
	}
	xs->xs_x2hhdr =
		xs->xs_x2hent[NX2H-1].mb_link =
		(u_short)X2HENT_OFFSET;
	xs->xs_x2hnext =
		xs->xs_x2hent[NX2H-1].mb_next =
		xs->xs_x2hent;

	/*
	 * Write config msg address to EXOS and wait for
	 * configuration to complete (guaranteed response
	 * within 2 seconds).
	 */
	shiftreg = (u_long)0x0000FFFF;
	for (i = 0; i < 8; i++) {
		if (i == 4)
			shiftreg = P_UNIADDR(xs->xs_ubaddr) + CM_OFFSET;
		while (addr->xd_portb & EX_UNREADY)
			;
		addr->xd_portb = (u_char)(shiftreg & 0xFF);
		shiftreg >>= 8;
	}
	for (i = 1000000; (cm->cm_cc == 0xFF) && i; --i);
	if (cm->cm_cc)







|














|












|







377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
		bp->mb_rsrv = 0;
		bp->mb_length = MBDATALEN;
		bp->mb_status = MH_HOST;
		bp->mb_next = bp+1;
	}
	xs->xs_h2xhdr =
		xs->xs_h2xent[NH2X-1].mb_link =
		(u_short)H2XENT_OFFSET(unit);
	xs->xs_h2xnext =
		xs->xs_h2xent[NH2X-1].mb_next =
		xs->xs_h2xent;

	/* Now the reply queue. */
	for (bp = &xs->xs_x2hent[0]; bp < &xs->xs_x2hent[NX2H]; bp++) {
		bp->mb_link = (u_short)((char *)(bp+1)-INCORE_BASE(xs));
		bp->mb_rsrv = 0;
		bp->mb_length = MBDATALEN;
		bp->mb_status = MH_EXOS;
		bp->mb_next = bp+1;
	}
	xs->xs_x2hhdr =
		xs->xs_x2hent[NX2H-1].mb_link =
		(u_short)X2HENT_OFFSET(unit);
	xs->xs_x2hnext =
		xs->xs_x2hent[NX2H-1].mb_next =
		xs->xs_x2hent;

	/*
	 * Write config msg address to EXOS and wait for
	 * configuration to complete (guaranteed response
	 * within 2 seconds).
	 */
	shiftreg = (u_long)0x0000FFFF;
	for (i = 0; i < 8; i++) {
		if (i == 4)
			shiftreg = P_UNIADDR(xs->xs_ubaddr) + CM_OFFSET(unit);
		while (addr->xd_portb & EX_UNREADY)
			;
		addr->xd_portb = (u_char)(shiftreg & 0xFF);
		shiftreg >>= 8;
	}
	for (i = 1000000; (cm->cm_cc == 0xFF) && i; --i);
	if (cm->cm_cc)
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
	bp = exgetcbuf(xs);
	xs->xs_flags |= EX_STATPENDING;
	bp->mb_rqst = LLNET_STSTCS;
	bp->mb_ns.ns_mask = READ_OBJ;
	bp->mb_ns.ns_rsrv = 0;
	bp->mb_ns.ns_nobj = 8;		/* read all 8 stats objects */
	bp->mb_ns.ns_xobj = 0;		/* starting with the 1st one */
	bp->mb_ns.ns_bufp = P_UNIADDR(xs->xs_ubaddr) + SA_OFFSET;
	bp->mb_status |= MH_EXOS;
	addr->xd_portb = EX_NTRUPT;
exspnd:
	splx(s);
	xs->xs_if.if_timer = EXWATCHINTVL;
}








|







817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
	bp = exgetcbuf(xs);
	xs->xs_flags |= EX_STATPENDING;
	bp->mb_rqst = LLNET_STSTCS;
	bp->mb_ns.ns_mask = READ_OBJ;
	bp->mb_ns.ns_rsrv = 0;
	bp->mb_ns.ns_nobj = 8;		/* read all 8 stats objects */
	bp->mb_ns.ns_xobj = 0;		/* starting with the 1st one */
	bp->mb_ns.ns_bufp = P_UNIADDR(xs->xs_ubaddr) + SA_OFFSET(unit);
	bp->mb_status |= MH_EXOS;
	addr->xd_portb = EX_NTRUPT;
exspnd:
	splx(s);
	xs->xs_if.if_timer = EXWATCHINTVL;
}

Changes to sys/vax/vax/locore.s.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)locore.s	6.32 (Berkeley) 09/16/85
 */

#include "psl.h"
#include "pte.h"

#include "errno.h"
#include "cmap.h"





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)locore.s	6.33 (Berkeley) 01/08/86
 */

#include "psl.h"
#include "pte.h"

#include "errno.h"
#include "cmap.h"
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	.globl	_netisr
SCBVEC(netintr):
	PUSHR
#include "imp.h"
#if NIMP > 0
	bbcc	$NETISR_IMP,_netisr,1f; calls $0,_impintr; 1:
#endif
#if defined(INET) || defined(BBNNET)
	bbcc	$NETISR_IP,_netisr,1f; calls $0,_ipintr; 1:
#endif
#ifdef NS
	bbcc	$NETISR_NS,_netisr,1f; calls $0,_nsintr; 1:
#endif
	bbcc	$NETISR_RAW,_netisr,1f; calls $0,_rawintr; 1:
	POPR







|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	.globl	_netisr
SCBVEC(netintr):
	PUSHR
#include "imp.h"
#if NIMP > 0
	bbcc	$NETISR_IMP,_netisr,1f; calls $0,_impintr; 1:
#endif
#ifdef INET
	bbcc	$NETISR_IP,_netisr,1f; calls $0,_ipintr; 1:
#endif
#ifdef NS
	bbcc	$NETISR_NS,_netisr,1f; calls $0,_nsintr; 1:
#endif
	bbcc	$NETISR_RAW,_netisr,1f; calls $0,_rawintr; 1:
	POPR

Changes to usr.bin/apropos/apropos.1.

1
2
3
4
5
6
7
8
.\"	@(#)apropos.1	6.1 (Berkeley) 04/29/85
.\"
.TH APROPOS 1 ""
.AT 3
.SH NAME
apropos \- locate commands by keyword lookup
.SH SYNOPSIS
.B apropos
|







1
2
3
4
5
6
7
8
.\"	@(#)apropos.1	6.2 (Berkeley) 01/08/86
.\"
.TH APROPOS 1 ""
.AT 3
.SH NAME
apropos \- locate commands by keyword lookup
.SH SYNOPSIS
.B apropos
32
33
34
35
36
37
38
39
40
41
42
43
is actually just the
.B \-k
option to the
.IR man (1)
command.
.SH FILES
.DT
/usr/lib/whatis		data base
.SH "SEE ALSO"
man(1), whatis(1), catman(8)
.SH AUTHOR
William Joy







|




32
33
34
35
36
37
38
39
40
41
42
43
is actually just the
.B \-k
option to the
.IR man (1)
command.
.SH FILES
.DT
/usr/man/whatis		data base
.SH "SEE ALSO"
man(1), whatis(1), catman(8)
.SH AUTHOR
William Joy

Changes to usr.bin/compress/compress.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)compress.c	5.7 (Berkeley) 09/17/85";
#endif not lint

/* 
 * Compress - data compression program 
 */
#define	min(a,b)	((a>b) ? b : a)


|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)compress.c	5.8 (Berkeley) 01/10/86";
#endif not lint

/* 
 * Compress - data compression program 
 */
#define	min(a,b)	((a>b) ? b : a)

337
338
339
340
341
342
343

344
345
346
347
348
349
350
int debug = 0;
#else
fprintf(stderr,"Usage: compress [-fvc] [-b maxbits] [file ...]\n");
}
#endif /* DEBUG */
int nomagic = 0;	/* Use a 3-byte magic number header, unless old file */
int zcat_flg = 0;	/* Write output on stdout, suppress messages */

int quiet = 1;		/* don't tell me about compression */

/*
 * block compression parameters -- after all codes are used up,
 * and compression rate changes, start over.
 */
int block_compress = BLOCK_MASK;







>







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
int debug = 0;
#else
fprintf(stderr,"Usage: compress [-fvc] [-b maxbits] [file ...]\n");
}
#endif /* DEBUG */
int nomagic = 0;	/* Use a 3-byte magic number header, unless old file */
int zcat_flg = 0;	/* Write output on stdout, suppress messages */
int precious = 1;	/* Don't unlink output file on interrupt */
int quiet = 1;		/* don't tell me about compression */

/*
 * block compression parameters -- after all codes are used up,
 * and compression rate changes, start over.
 */
int block_compress = BLOCK_MASK;
628
629
630
631
632
633
634

635
636
637
638
639
640
641
642
643
644
645
646
647
648
649

650
651
652
653
654
655
656
		}
	    }
	    if(zcat_flg == 0) {		/* Open output file */
		if (freopen(ofname, "w", stdout) == NULL) {
		    perror(ofname);
		    continue;
		}

		if(!quiet)
			fprintf(stderr, "%s: ", *fileptr);
	    }

	    /* Actually do the compression/decompression */
	    if (do_decomp == 0)	compress();
#ifndef DEBUG
	    else			decompress();
#else
	    else if (debug == 0)	decompress();
	    else			printcodes();
	    if (verbose)		dump_tab();
#endif /* DEBUG */
	    if(zcat_flg == 0) {
		copystat(*fileptr, ofname);	/* Copy stats */

		if((exit_stat == 1) || (!quiet))
			putc('\n', stderr);
	    }
	}
    } else {		/* Standard input */
	if (do_decomp == 0) {
		compress();







>















>







629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
		}
	    }
	    if(zcat_flg == 0) {		/* Open output file */
		if (freopen(ofname, "w", stdout) == NULL) {
		    perror(ofname);
		    continue;
		}
		precious = 0;
		if(!quiet)
			fprintf(stderr, "%s: ", *fileptr);
	    }

	    /* Actually do the compression/decompression */
	    if (do_decomp == 0)	compress();
#ifndef DEBUG
	    else			decompress();
#else
	    else if (debug == 0)	decompress();
	    else			printcodes();
	    if (verbose)		dump_tab();
#endif /* DEBUG */
	    if(zcat_flg == 0) {
		copystat(*fileptr, ofname);	/* Copy stats */
		precious = 1;
		if((exit_stat == 1) || (!quiet))
			putc('\n', stderr);
	    }
	}
    } else {		/* Standard input */
	if (do_decomp == 0) {
		compress();
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
			return(0);
		}
	}
}

onintr ( )
{
    if (!zcat_flg)
	unlink ( ofname );
    exit ( 1 );
}

oops ( )	/* wild pointer -- assume bad input */
{
    if ( do_decomp == 1 ) 







|







1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
			return(0);
		}
	}
}

onintr ( )
{
    if (!precious)
	unlink ( ofname );
    exit ( 1 );
}

oops ( )	/* wild pointer -- assume bad input */
{
    if ( do_decomp == 1 ) 
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
		q = -q;
	}
	fprintf(stream, "%d.%02d%%", q / 100, q % 100);
}

version()
{
	fprintf(stderr, "%s, Berkeley 5.7 09/17/85\n", rcs_ident);
	fprintf(stderr, "Options: ");
#ifdef vax
	fprintf(stderr, "vax, ");
#endif
#ifdef NO_UCHAR
	fprintf(stderr, "NO_UCHAR, ");
#endif







|







1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
		q = -q;
	}
	fprintf(stream, "%d.%02d%%", q / 100, q % 100);
}

version()
{
	fprintf(stderr, "%s, Berkeley 5.8 01/10/86\n", rcs_ident);
	fprintf(stderr, "Options: ");
#ifdef vax
	fprintf(stderr, "vax, ");
#endif
#ifdef NO_UCHAR
	fprintf(stderr, "NO_UCHAR, ");
#endif

Changes to usr.bin/f77/f77.vax/f77.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18






19
20
21
22
23
24
25
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static	char sccsid[] = "@(#)f77.c	5.2 (Berkeley) 08/29/85";
#endif

/*
 * f77.c
 *
 * Driver program for the 4.2 BSD f77 compiler.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	f77.c,v $






 * Revision 5.2  85/08/10  05:16:14  donn
 * Ifdeffed 66 code, added -r8 flag.  From Jerry Berkman.
 * 
 * Revision 5.1  85/08/10  03:32:12  donn
 * 4.3 alpha
 * 
 * Revision 1.14  85/03/01  00:07:57  donn







|










>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static	char sccsid[] = "@(#)f77.c	5.3 (Berkeley) 01/07/86";
#endif

/*
 * f77.c
 *
 * Driver program for the 4.2 BSD f77 compiler.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	f77.c,v $
 * Revision 5.4  85/12/17  19:12:14  donn
 * Dynamically allocate buffer; add lint fixes.
 * 
 * Revision 5.3  85/11/25  00:00:02  donn
 * 4.3 beta
 * 
 * Revision 5.2  85/08/10  05:16:14  donn
 * Ifdeffed 66 code, added -r8 flag.  From Jerry Berkman.
 * 
 * Revision 5.1  85/08/10  03:32:12  donn
 * 4.3 alpha
 * 
 * Revision 1.14  85/03/01  00:07:57  donn
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162




163
164
165
166
167
168
169
170

171
172
173

174
175
176
177
178
179
180
181
182
183
#else
	static char eflags[30]	= "system=unix ";
#endif
static char rflags[30]	= "";
static char lflag[3]	= "-x";
static char *fflagp	= fflags+1;
static char *f2flagp	= f2flags;
static char *cflagp	= cflags+2;
static char *eflagp	= eflags+12;
static char *rflagp	= rflags;
static char *cppflags	= "";
static char **cppargs;
static char **loadargs;
static char **loadp;

static flag erred	= NO;
static flag loadflag	= YES;
static flag saveasmflag	= NO;
static flag profileflag	= NO;
static flag optimflag	= NO;
static flag debugflag	= NO;
static flag verbose	= NO;
static flag nofloating	= NO;
static flag fortonly	= NO;
static flag macroflag	= NO;
static flag sdbflag	= NO;
static flag namesflag	= YES;





static int ncpp;


main(argc, argv)
int argc;
char **argv;
{

int i, c, status;
char *setdoto(), *lastchar(), *lastfield(), *copys(), *argvtos();
ptr ckalloc();

register char *s;
char fortfile[20], *t;
char buff[100];
int intrupt();
int new_aoutname = NO;

sigivalue = signal(SIGINT, SIG_IGN) == SIG_IGN;
sigqvalue = signal(SIGQUIT,SIG_IGN) == SIG_IGN;
sighvalue = signal(SIGHUP, SIG_IGN) == SIG_IGN;
sigtvalue = signal(SIGTERM,SIG_IGN) == SIG_IGN;







<














<




>
>
>
>








>
|


>


|







142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#else
	static char eflags[30]	= "system=unix ";
#endif
static char rflags[30]	= "";
static char lflag[3]	= "-x";
static char *fflagp	= fflags+1;
static char *f2flagp	= f2flags;

static char *eflagp	= eflags+12;
static char *rflagp	= rflags;
static char *cppflags	= "";
static char **cppargs;
static char **loadargs;
static char **loadp;

static flag erred	= NO;
static flag loadflag	= YES;
static flag saveasmflag	= NO;
static flag profileflag	= NO;
static flag optimflag	= NO;
static flag debugflag	= NO;
static flag verbose	= NO;

static flag fortonly	= NO;
static flag macroflag	= NO;
static flag sdbflag	= NO;
static flag namesflag	= YES;

#if TARGET == PDP11
static flag nofloating	= NO;
#endif

static int ncpp;


main(argc, argv)
int argc;
char **argv;
{
register int i, n;
int c, status;
char *setdoto(), *lastchar(), *lastfield(), *copys(), *argvtos();
ptr ckalloc();
char *strcat();
register char *s;
char fortfile[20], *t;
char *buff;
int intrupt();
int new_aoutname = NO;

sigivalue = signal(SIGINT, SIG_IGN) == SIG_IGN;
sigqvalue = signal(SIGQUIT,SIG_IGN) == SIG_IGN;
sighvalue = signal(SIGHUP, SIG_IGN) == SIG_IGN;
sigtvalue = signal(SIGTERM,SIG_IGN) == SIG_IGN;
196
197
198
199
200
201
202




203
204
205
206
207
208
209
#if HERE == INTERDATA
	loadargs[3] = "main";
#endif
loadp = loadargs + 4;

--argc;
++argv;





while(argc>0 && argv[0][0]=='-' && argv[0][1]!='\0')
	{
	for(s = argv[0]+1 ; *s ; ++s) switch(*s)
		{
		case 'T':  /* use special passes */
			switch(*++s)







>
>
>
>







206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#if HERE == INTERDATA
	loadargs[3] = "main";
#endif
loadp = loadargs + 4;

--argc;
++argv;

for (i = 0, n = 50; i < argc; ++i)
	n += strlen(argv[i]) + 1;
buff = (char *) ckalloc(n);

while(argc>0 && argv[0][0]=='-' && argv[0][1]!='\0')
	{
	for(s = argv[0]+1 ; *s ; ++s) switch(*s)
		{
		case 'T':  /* use special passes */
			switch(*++s)
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
		case 'm':
			if(s[1] == '4')
				++s;
			macroflag = YES;
			break;

		case 'S':
			strcat(cflags, " -S");
			saveasmflag = YES;

		case 'c':
			if( new_aoutname == YES ){
				fprintf(diagfile, "-c prevents loading, -o %s ignored\n", aoutname);
				new_aoutname = NO;
				}







|







304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
		case 'm':
			if(s[1] == '4')
				++s;
			macroflag = YES;
			break;

		case 'S':
			(void) strcat(cflags, " -S");
			saveasmflag = YES;

		case 'c':
			if( new_aoutname == YES ){
				fprintf(diagfile, "-c prevents loading, -o %s ignored\n", aoutname);
				new_aoutname = NO;
				}
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346

		case 'g':
			if(optimflag)
				{
				fprintf(diagfile, "-g and -O are incompatible; -g ignored\n");
				break;
				}
			strcat(cflags," -g");
			sdbflag = YES;
			goto copyfflag;

		case 'p':
			profileflag = YES;
			strcat(cflags," -p");
			*fflagp++ = 'p';
			if(s[1] == 'g')
				{
				proffoot = GPRFFOOT;
				s++;
				}
			break;







|





|







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360

		case 'g':
			if(optimflag)
				{
				fprintf(diagfile, "-g and -O are incompatible; -g ignored\n");
				break;
				}
			(void) strcat(cflags," -g");
			sdbflag = YES;
			goto copyfflag;

		case 'p':
			profileflag = YES;
			(void) strcat(cflags," -p");
			*fflagp++ = 'p';
			if(s[1] == 'g')
				{
				proffoot = GPRFFOOT;
				s++;
				}
			break;
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443

#ifdef	NOCORE
if(!debugflag)
	{
	struct rlimit r;

	r.rlim_cur = r.rlim_max = 0;
	setrlimit(RLIMIT_CORE, &r);
	}
#endif	NOCORE

*fflagp = '\0';

if (ncpp > 0)
	cppflags = argvtos (ncpp,cppargs);







|







443
444
445
446
447
448
449
450
451
452
453
454
455
456
457

#ifdef	NOCORE
if(!debugflag)
	{
	struct rlimit r;

	r.rlim_cur = r.rlim_max = 0;
	(void) setrlimit(RLIMIT_CORE, &r);
	}
#endif	NOCORE

*fflagp = '\0';

if (ncpp > 0)
	cppflags = argvtos (ncpp,cppargs);
743
744
745
746
747
748
749
750

751
752
753
754
755
756
757
		{
		sprintf(buff, "%s -f %s %s", pass2opt, asmpass2, optzfname);
		if( sys(buff) )
			rmf(optzfname);
		else
			{
			sprintf(buff,"mv %s %s", optzfname, asmpass2);
			sys(buff);

			}
		}
#	endif
#endif

if(saveasmflag)
	{







|
>







757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
		{
		sprintf(buff, "%s -f %s %s", pass2opt, asmpass2, optzfname);
		if( sys(buff) )
			rmf(optzfname);
		else
			{
			sprintf(buff,"mv %s %s", optzfname, asmpass2);
			if( sys(buff) )
				fatal("can't rename optimizer output file");
			}
		}
#	endif
#endif

if(saveasmflag)
	{
768
769
770
771
772
773
774
775

776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795

796
797
798
799
800
801
802
		sprintf(buff, "%s %s %s %s >%s",
			CATNAME, asmfname, initfname, asmpass2, obj);
#else
	sprintf(buff, "%s %s %s %s >%s",
		CATNAME, asmfname, initfname, asmpass2, obj);
#endif
#endif
	sys(buff);

	*lastc = 'o';
	}
else
	{
	if(verbose)
		fprintf(diagfile, "  ASM.");
#if TARGET == INTERDATA
	sprintf(buff, "%s -o %s %s %s %s %s", asmname, obj, asmfname,
		initfname, setfname, asmpass2);
#endif

#if TARGET == VAX
	/* vax assembler currently accepts only one input file */
	if (sdbflag)
		sprintf(buff, "%s %s %s >>%s",
			CATNAME, asmpass2, initfname, asmfname);
	else
		sprintf(buff, "%s %s %s >>%s",
			CATNAME, initfname, asmpass2, asmfname);
	sys(buff);

#ifdef UCBVAXASM
	sprintf(buff, "%s -J -o %s %s", asmname, obj, asmfname);
#else
	sprintf(buff, "%s -o %s %s", asmname, obj, asmfname);
#endif
#endif








|
>



















|
>







783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
		sprintf(buff, "%s %s %s %s >%s",
			CATNAME, asmfname, initfname, asmpass2, obj);
#else
	sprintf(buff, "%s %s %s %s >%s",
		CATNAME, asmfname, initfname, asmpass2, obj);
#endif
#endif
	if( sys(buff) )
		fatal("can't concatenate assembly files");
	*lastc = 'o';
	}
else
	{
	if(verbose)
		fprintf(diagfile, "  ASM.");
#if TARGET == INTERDATA
	sprintf(buff, "%s -o %s %s %s %s %s", asmname, obj, asmfname,
		initfname, setfname, asmpass2);
#endif

#if TARGET == VAX
	/* vax assembler currently accepts only one input file */
	if (sdbflag)
		sprintf(buff, "%s %s %s >>%s",
			CATNAME, asmpass2, initfname, asmfname);
	else
		sprintf(buff, "%s %s %s >>%s",
			CATNAME, initfname, asmpass2, asmfname);
	if( sys(buff) )
		fatal("can't concatenate assembly files");
#ifdef UCBVAXASM
	sprintf(buff, "%s -J -o %s %s", asmname, obj, asmfname);
#else
	sprintf(buff, "%s -o %s %s", asmname, obj, asmfname);
#endif
#endif

856
857
858
859
860
861
862
863

864
865
866
867
868
869
870
#if HERE==PDP11 || HERE==INTERDATA || HERE==VAX
	if( (waitpid = fork()) == 0)
		{
		enbint(SIG_DFL);
		execv(ldname, v0);
		fatalstr("couldn't load %s", ldname);
		}
	await(waitpid);

#endif

#if HERE==INTERDATA
	if(optimflag)
		{
		char buff1[100], buff2[100];
		sprintf(buff1, "nopt %s -o junk.%d", aoutname, pid);







|
>







873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
#if HERE==PDP11 || HERE==INTERDATA || HERE==VAX
	if( (waitpid = fork()) == 0)
		{
		enbint(SIG_DFL);
		execv(ldname, v0);
		fatalstr("couldn't load %s", ldname);
		}
	if( await(waitpid) )
		erred = YES;
#endif

#if HERE==INTERDATA
	if(optimflag)
		{
		char buff1[100], buff2[100];
		sprintf(buff1, "nopt %s -o junk.%d", aoutname, pid);
938
939
940
941
942
943
944
945

946
947

948
949
950
951
952
953
954
while(*t)
	*s++ = *t++;
for(t = argv[1] ; *s++ = *t++ ; )
	;
if((waitpid = fork()) == 0)
	{
	if(inname)
		freopen(inname, "r", stdin);

	if(outname)
		freopen(outname, (append ? "a" : "w"), stdout);

	enbint(SIG_DFL);

	texec(path+9, argv);  /* command */
	texec(path+4, argv);  /*  /bin/command */
	texec(path  , argv);  /* /usr/bin/command */

	fatalstr("Cannot load %s",path+9);







|
>

|
>







956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
while(*t)
	*s++ = *t++;
for(t = argv[1] ; *s++ = *t++ ; )
	;
if((waitpid = fork()) == 0)
	{
	if(inname)
		if(freopen(inname, "r", stdin) == NULL)
			fatalstr("Cannot open %s", inname);
	if(outname)
		if(freopen(outname, (append ? "a" : "w"), stdout) == NULL)
			fatalstr("Cannot open %s", outname);
	enbint(SIG_DFL);

	texec(path+9, argv);  /* command */
	texec(path+4, argv);  /*  /bin/command */
	texec(path  , argv);  /* /usr/bin/command */

	fatalstr("Cannot load %s",path+9);
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025



enbint(k)
int (*k)();
{
if(sigivalue == 0)
	signal(SIGINT,k);
if(sigqvalue == 0)
	signal(SIGQUIT,k);
if(sighvalue == 0)
	signal(SIGHUP,k);
if(sigtvalue == 0)
	signal(SIGTERM,k);
}




intrupt()
{







|

|

|

|







1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045



enbint(k)
int (*k)();
{
if(sigivalue == 0)
	(void) signal(SIGINT,k);
if(sigqvalue == 0)
	(void) signal(SIGQUIT,k);
if(sighvalue == 0)
	(void) signal(SIGHUP,k);
if(sigtvalue == 0)
	(void) signal(SIGTERM,k);
}




intrupt()
{
1100
1101
1102
1103
1104
1105
1106

1107
1108
1109
1110
1111
1112
1113



stupid(s)
char *s;
{
char c;


if( (c = dotchar(s))
  && index("focsreF", c)
  && access(s, 0) == 0 )
	{
	fprintf(diagfile, "Loading on %s would destroy it\n", s);
	return(YES);







>







1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134



stupid(s)
char *s;
{
char c;
extern char *index();

if( (c = dotchar(s))
  && index("focsreF", c)
  && access(s, 0) == 0 )
	{
	fprintf(diagfile, "Loading on %s would destroy it\n", s);
	return(YES);
1262
1263
1264
1265
1266
1267
1268
1269

1270
1271
1272
1273
1274
1275
1276
1277
1278
}



ptr ckalloc(n)
int n;
{
ptr p, calloc();


if( p = calloc(1, (unsigned) n) )
	return(p);

fatal("out of memory");
/* NOTREACHED */
}









|
>

|







1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
}



ptr ckalloc(n)
int n;
{
ptr p;
extern char *calloc();

if( p = (ptr) calloc(1, (unsigned) n) )
	return(p);

fatal("out of memory");
/* NOTREACHED */
}


Changes to usr.bin/f77/libI77/open.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)open.c	5.1	06/07/85
 */

/*
 * open.c  -  f77 file open and I/O library initialization routines
 */

#include	<sys/types.h>





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)open.c	5.2	01/08/86
 */

/*
 * open.c  -  f77 file open and I/O library initialization routines
 */

#include	<sys/types.h>
41
42
43
44
45
46
47

48

49
50
51
52
53
54
55
	lunit = a->ounit;
	if(not_legal(lunit)) err(errflag,F_ERUNIT,"open")
	b= &units[lunit];
	if(a->osta) st = lcase(*a->osta);
	else st = 'u';
	if(SCRATCH)
	{	strcpy(buf,tmplate);

		mktemp(buf);

	}
	else 
	{
		if(a->ofnm) g_char(a->ofnm,a->ofnmlen,buf);
		else sprintf(buf,fortfile,lunit);
		/*   check if overriding file name via environment variable
		 *   first copy tail of name - delete periods as Bourne Shell







>
|
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	lunit = a->ounit;
	if(not_legal(lunit)) err(errflag,F_ERUNIT,"open")
	b= &units[lunit];
	if(a->osta) st = lcase(*a->osta);
	else st = 'u';
	if(SCRATCH)
	{	strcpy(buf,tmplate);
		/* make a new temp file name, err if mktemp fails */
		if( strcmp( mktemp(buf), "/" ) == 0 )
			err(errflag, F_ERSYS, "open")
	}
	else 
	{
		if(a->ofnm) g_char(a->ofnm,a->ofnmlen,buf);
		else sprintf(buf,fortfile,lunit);
		/*   check if overriding file name via environment variable
		 *   first copy tail of name - delete periods as Bourne Shell

Changes to usr.bin/f77/pass1.vax/defs.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16







17
18
19
20
21
22
23
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)defs.h	5.2 (Berkeley) 08/29/85
 */

/*
 * defs.h
 *
 * Definitions for f77pass1
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	defs.h,v $







 * Revision 5.3  85/08/10  06:31:09  donn
 * Added missing definition for intrconv().
 * 
 * Revision 5.2  85/08/10  04:01:53  donn
 * Jerry Berkman's change to add a definition for 'dblflag' and to ifdef
 * the Fortran 66 compatibility flags.
 * 





|










>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)defs.h	5.3 (Berkeley) 01/10/86
 */

/*
 * defs.h
 *
 * Definitions for f77pass1
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	defs.h,v $
 * Revision 5.5  86/01/10  17:11:11  donn
 * Add a vparamval field to Nameblock struct -- fix up klugy sharing between
 * Paramblock and Nameblock structs.
 * 
 * Revision 5.4  85/11/25  00:23:47  donn
 * 4.3 beta
 * 
 * Revision 5.3  85/08/10  06:31:09  donn
 * Added missing definition for intrconv().
 * 
 * Revision 5.2  85/08/10  04:01:53  donn
 * Jerry Berkman's change to add a definition for 'dblflag' and to ifdef
 * the Fortran 66 compatibility flags.
 * 
305
306
307
308
309
310
311

312
313
314
315
316
317
318
	{
	field tag;
	field vtype;
	field vclass;
	field vstg;
	expptr vleng;
	char varname[VL];

	unsigned vdovar:1;
	unsigned vdcldone:1;
	unsigned vadjdim:1;
	unsigned vsave:1;
	unsigned vprocclass:3;
	unsigned vregno:4;
	union	{







>







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
	{
	field tag;
	field vtype;
	field vclass;
	field vstg;
	expptr vleng;
	char varname[VL];
	expptr vparamval;
	unsigned vdovar:1;
	unsigned vdcldone:1;
	unsigned vadjdim:1;
	unsigned vsave:1;
	unsigned vprocclass:3;
	unsigned vregno:4;
	union	{

Changes to usr.bin/f77/pass1.vax/exec.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19













20
21
22
23
24
25
26
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)exec.c	5.4 (Berkeley) 08/29/85";
#endif not lint

/*
 * exec.c
 *
 * Routines for handling the semantics of control structures.
 * F77 compiler, pass 1.
 *
 * University of Utah CS Dept modification history:
 * 
 * $Log:	exec.c,v $













 * Revision 5.2  85/08/10  04:07:36  donn
 * Changed an error message to correct spelling and be more accurate.
 * From Jerry Berkman.
 * 
 * Revision 2.3  85/03/18  08:03:31  donn
 * Hacks for conversions from type address to numeric type -- prevent addresses
 * from being stored in shorts and prevent warnings about implicit conversions.







|











>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)exec.c	5.5 (Berkeley) 01/07/86";
#endif not lint

/*
 * exec.c
 *
 * Routines for handling the semantics of control structures.
 * F77 compiler, pass 1.
 *
 * University of Utah CS Dept modification history:
 * 
 * $Log:	exec.c,v $
 * Revision 5.6  85/12/20  19:42:46  donn
 * Change style of error reporting in last fix.
 * 
 * Revision 5.5  85/12/20  18:54:10  donn
 * Complain about calls to things which aren't subroutines.
 * 
 * Revision 5.4  85/12/18  19:57:58  donn
 * Assignment statements are executable statements -- advance the magic
 * parser state to forbid DATA statements and statement functions.
 * 
 * Revision 5.3  85/11/25  00:23:49  donn
 * 4.3 beta
 * 
 * Revision 5.2  85/08/10  04:07:36  donn
 * Changed an error message to correct spelling and be more accurate.
 * From Jerry Berkman.
 * 
 * Revision 2.3  85/03/18  08:03:31  donn
 * Hacks for conversions from type address to numeric type -- prevent addresses
 * from being stored in shorts and prevent warnings about implicit conversions.
259
260
261
262
263
264
265

266
267
268
269
270
271
272
		&& proctype == TYSUBR)
		{
		err("assignment to a subroutine name");
		return;
		}
	if(parstate < INDATA)
		enddcl();

	if (optimflag)
		optbuff (SKEQ, mkexpr(OPASSIGN, mklhs(lp), fixtype(rp)), 0, 0);
	else
		puteq (mklhs(lp), fixtype(rp));
	}
}








>







272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
		&& proctype == TYSUBR)
		{
		err("assignment to a subroutine name");
		return;
		}
	if(parstate < INDATA)
		enddcl();
	parstate = INEXEC;
	if (optimflag)
		optbuff (SKEQ, mkexpr(OPASSIGN, mklhs(lp), fixtype(rp)), 0, 0);
	else
		puteq (mklhs(lp), fixtype(rp));
	}
}

319
320
321
322
323
324
325











326
327
328
329
330
331
332
Namep name;
struct Listblock *args;
int nstars;
struct Labelblock *labels[ ];
{
register expptr p;












settype(name, TYSUBR, ENULL);
p = mkfunct( mkprim(name, args, CHNULL) );
p->exprblock.vtype = p->exprblock.leftp->headblock.vtype = TYINT;
if (nstars > 0)
	if (optimflag)
		optbuff (SKCMGOTO, p, nstars, labels);
	else







>
>
>
>
>
>
>
>
>
>
>







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
Namep name;
struct Listblock *args;
int nstars;
struct Labelblock *labels[ ];
{
register expptr p;

if (name->vdcldone)
	if (name->vclass != CLPROC && name->vclass != CLENTRY)
		{
		dclerr("call to non-subroutine", name);
		return;
		}
	else if (name->vtype != TYSUBR)
		{
		dclerr("subroutine invocation of function", name);
		return;
		}
settype(name, TYSUBR, ENULL);
p = mkfunct( mkprim(name, args, CHNULL) );
p->exprblock.vtype = p->exprblock.leftp->headblock.vtype = TYINT;
if (nstars > 0)
	if (optimflag)
		optbuff (SKCMGOTO, p, nstars, labels);
	else

Changes to usr.bin/f77/pass1.vax/expr.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



















19
20
21
22
23
24
25
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char *sccsid[] = "@(#)expr.c	5.4 (Berkeley) 08/29/85";
#endif not lint

/*
 * expr.c
 *
 * Routines for handling expressions, f77 compiler pass 1.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	expr.c,v $



















 * Revision 5.3  85/08/10  05:48:16  donn
 * Fixed another of my goofs in the substring parameter conversion code.
 * 
 * Revision 5.2  85/08/10  04:13:51  donn
 * Jerry Berkman's change to call pow() directly rather than indirectly
 * through pow_dd, in mkpower().
 * 







|










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char *sccsid[] = "@(#)expr.c	5.5 (Berkeley) 01/07/86";
#endif not lint

/*
 * expr.c
 *
 * Routines for handling expressions, f77 compiler pass 1.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	expr.c,v $
 * Revision 5.8  85/12/20  21:37:58  donn
 * Fix bug in mklhs() that caused the 'first character' substring parameter
 * to be evaluated twice.
 * 
 * Revision 5.7  85/12/20  19:42:05  donn
 * Be more specfic -- name the offending subroutine when it's used as a
 * function.
 * 
 * Revision 5.6  85/12/19  20:08:12  donn
 * Don't optimize first/last char values when they contain function calls
 * or array references.
 * 
 * Revision 5.5  85/12/19  00:35:22  donn
 * Lots of changes for handling hardware errors which can crop up when
 * evaluating constant expressions.
 * 
 * Revision 5.4  85/11/25  00:23:53  donn
 * 4.3 beta
 * 
 * Revision 5.3  85/08/10  05:48:16  donn
 * Fixed another of my goofs in the substring parameter conversion code.
 * 
 * Revision 5.2  85/08/10  04:13:51  donn
 * Jerry Berkman's change to call pow() directly rather than indirectly
 * through pow_dd, in mkpower().
 * 
634
635
636
637
638
639
640
641

642
643
644
645
646
647
648
		return( (expptr) p );

	case TPRIM:
		if(p->primblock.argsp && p->primblock.namep->vclass!=CLVAR)
			{
			if(p->primblock.namep->vtype == TYSUBR)
				{
				err("function invocation of subroutine");

				return( errnode() );
				}
			else
				return( mkfunct(p) );
			}
		else	return( mklhs(p) );
	}







|
>







653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
		return( (expptr) p );

	case TPRIM:
		if(p->primblock.argsp && p->primblock.namep->vclass!=CLVAR)
			{
			if(p->primblock.namep->vtype == TYSUBR)
				{
				dclerr("function invocation of subroutine",
					p->primblock.namep);
				return( errnode() );
				}
			else
				return( mkfunct(p) );
			}
		else	return( mklhs(p) );
	}
1279
1280
1281
1282
1283
1284
1285

1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319


1320
1321
1322








1323
1324

1325
1326
1327
1328
1329






1330
1331
1332



1333
1334
1335
1336
1337
1338
1339



expptr mklhs(p)
register struct Primblock *p;
{
expptr suboffset();

register Addrp s;
Namep np;

if(p->tag != TPRIM)
	return( (expptr) p );
np = p->namep;

s = mkplace(np);
if(s->tag!=TADDR || s->vstg==STGREG)
	{
	free( (charptr) p );
	return( (expptr) s );
	}

/* compute the address modified by subscripts */

s->memoffset = mkexpr(OPPLUS, s->memoffset, suboffset(p) );
frexpr(p->argsp);
p->argsp = NULL;

/* now do substring part */

if(p->fcharp || p->lcharp)
	{
	if(np->vtype != TYCHAR)
		errstr("substring of noncharacter %s", varstr(VL,np->varname));
	else	{
		if(p->lcharp == NULL)
			p->lcharp = (expptr) cpexpr(s->vleng);
		frexpr(s->vleng);
		if(p->fcharp)
			{
			if(p->fcharp->tag == TPRIM && p->lcharp->tag == TPRIM
			&& p->fcharp->primblock.namep == p->lcharp->primblock.namep)


				/* A trivial optimization -- upper == lower */
				s->vleng = ICON(1);
			else








				s->vleng = mkexpr(OPMINUS, p->lcharp,
					mkexpr(OPMINUS, p->fcharp, ICON(1) ));

			}
		else
			s->vleng = p->lcharp;
		}
	}







s->vleng = fixtype( s->vleng );
s->memoffset = fixtype( s->memoffset );



free( (charptr) p );
return( (expptr) s );
}











>














<
<
<
<
<
<
|












|
>
>



>
>
>
>
>
>
>
>


>





>
>
>
>
>
>



>
>
>







1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320






1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374



expptr mklhs(p)
register struct Primblock *p;
{
expptr suboffset();
expptr ep = ENULL;
register Addrp s;
Namep np;

if(p->tag != TPRIM)
	return( (expptr) p );
np = p->namep;

s = mkplace(np);
if(s->tag!=TADDR || s->vstg==STGREG)
	{
	free( (charptr) p );
	return( (expptr) s );
	}







/* do the substring part */

if(p->fcharp || p->lcharp)
	{
	if(np->vtype != TYCHAR)
		errstr("substring of noncharacter %s", varstr(VL,np->varname));
	else	{
		if(p->lcharp == NULL)
			p->lcharp = (expptr) cpexpr(s->vleng);
		frexpr(s->vleng);
		if(p->fcharp)
			{
			if(p->fcharp->tag == TPRIM && p->lcharp->tag == TPRIM
			&& p->fcharp->primblock.namep == p->lcharp->primblock.namep
			&& p->fcharp->primblock.argsp == NULL
			&& p->lcharp->primblock.argsp == NULL)
				/* A trivial optimization -- upper == lower */
				s->vleng = ICON(1);
			else
				{
				if(p->fcharp->tag == TEXPR
				|| (p->fcharp->tag == TPRIM
				   && p->fcharp->primblock.argsp != NULL))
					{
					ep = fixtype(p->fcharp);
					p->fcharp = (expptr) mktemp(ep->headblock.vtype, ENULL);
					}
				s->vleng = mkexpr(OPMINUS, p->lcharp,
					mkexpr(OPMINUS, p->fcharp, ICON(1) ));
				}
			}
		else
			s->vleng = p->lcharp;
		}
	}

/* compute the address modified by subscripts */

s->memoffset = mkexpr(OPPLUS, s->memoffset, suboffset(p) );
frexpr(p->argsp);
p->argsp = NULL;

s->vleng = fixtype( s->vleng );
s->memoffset = fixtype( s->memoffset );
if(ep)
	/* this code depends on memoffset being evaluated before vleng */
	s->memoffset = mkexpr(OPCOMMA, mkexpr(OPASSIGN, cpexpr(p->fcharp), ep), s->memoffset);
free( (charptr) p );
return( (expptr) s );
}




1839
1840
1841
1842
1843
1844
1845

























1846
1847
1848
1849
1850


1851


1852
1853
1854
1855
1856
1857
1858
	ltype = impltype[ k ];
	}
if(rtype == TYUNKNOWN && rtag == TPRIM && rp->primblock.argsp == NULL)
	{
	k = letter(rp->primblock.namep->varname[0]);
	rtype = impltype[ k ];
	}


























etype = cktype(opcode, ltype, rtype);
if(etype == TYERROR)
	goto error;



if(etype != TYUNKNOWN)


switch(opcode)
	{
	/* check for multiplication by 0 and 1 and addition to 0 */

	case OPSTAR:
		if( ISCONST(lp) )
			COMMUTE







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





>
>
|
>
>







1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
	ltype = impltype[ k ];
	}
if(rtype == TYUNKNOWN && rtag == TPRIM && rp->primblock.argsp == NULL)
	{
	k = letter(rp->primblock.namep->varname[0]);
	rtype = impltype[ k ];
	}

/*
 * Eliminate all but the topmost OPPAREN operator when folding constants.
 */
if(lp->tag == TEXPR &&
   lp->exprblock.opcode == OPPAREN &&
   lp->exprblock.leftp->tag == TCONST)
	{
	q = (expptr) cpexpr(lp->exprblock.leftp);
	frexpr(lp);
	lp = q;
	ltag = TCONST;
	ltype = lp->constblock.vtype;
	}
if(rp &&
   rp->tag == TEXPR &&
   rp->exprblock.opcode == OPPAREN &&
   rp->exprblock.leftp->tag == TCONST)
	{
	q = (expptr) cpexpr(rp->exprblock.leftp);
	frexpr(rp);
	rp = q;
	rtag = TCONST;
	rtype = rp->constblock.vtype;
	}

etype = cktype(opcode, ltype, rtype);
if(etype == TYERROR)
	goto error;

if(ltag==TCONST && (rp==0 || rtag==TCONST) )
	goto makenode;
if(etype == TYUNKNOWN)
	goto makenode;

switch(opcode)
	{
	/* check for multiplication by 0 and 1 and addition to 0 */

	case OPSTAR:
		if( ISCONST(lp) )
			COMMUTE
2061
2062
2063
2064
2065
2066
2067


2068
2069
2070
2071
2072
2073
2074

	case OPPAREN:
		break;

	default:
		badop("mkexpr", opcode);
	}



e = (expptr) ALLOC(Exprblock);
e->exprblock.tag = TEXPR;
e->exprblock.opcode = opcode;
e->exprblock.vtype = etype;
e->exprblock.leftp = lp;
e->exprblock.rightp = rp;







>
>







2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140

	case OPPAREN:
		break;

	default:
		badop("mkexpr", opcode);
	}

makenode:

e = (expptr) ALLOC(Exprblock);
e->exprblock.tag = TEXPR;
e->exprblock.opcode = opcode;
e->exprblock.vtype = etype;
e->exprblock.leftp = lp;
e->exprblock.rightp = rp;
2216
2217
2218
2219
2220
2221
2222







































2223
2224
2225
2226
2227
2228
2229
2230
2231













2232
2233
2234
2235
2236
2237
2238
	default:
		badop("cktype", op);
	}
error:	err(errs);
error1:	return(TYERROR);
}








































LOCAL expptr fold(e)
register expptr e;
{
Constp p;
register expptr lp, rp;
int etype, mtype, ltype, rtype, opcode;
int i, ll, lr;
char *q, *s;
union Constant lcon, rcon;














opcode = e->exprblock.opcode;
etype = e->exprblock.vtype;

lp = e->exprblock.leftp;
ltype = lp->headblock.vtype;
rp = e->exprblock.rightp;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









>
>
>
>
>
>
>
>
>
>
>
>
>







2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
	default:
		badop("cktype", op);
	}
error:	err(errs);
error1:	return(TYERROR);
}

#if HERE == VAX
#include <signal.h>
#include <setjmp.h>
#define	setfpe()	;asm("bispsw	$0x60")
jmp_buf jmp_fpe;

LOCAL int fold_fpe_handler( sig, code )
int sig;
int code;
{
char		*message;

switch ( code )
	{
	case FPE_INTOVF_TRAP:
		message = "integer overflow"; break;
	case FPE_INTDIV_TRAP:
		message = "integer divide by zero"; break;
	case FPE_FLTOVF_TRAP:
	case FPE_FLTOVF_FAULT:
		message = "floating overflow"; break;
	case FPE_FLTDIV_TRAP:
	case FPE_FLTDIV_FAULT:
		message = "floating divide by zero"; break;
	case FPE_FLTUND_TRAP:
	case FPE_FLTUND_FAULT:
		message = "floating underflow"; break;
	default:
		message		= "arithmetic exception";
	}
errstr("%s in constant expression", message);
longjmp(jmp_fpe, 1);
}
#endif

#ifndef setfpe
#define	setfpe()
#endif

LOCAL expptr fold(e)
register expptr e;
{
Constp p;
register expptr lp, rp;
int etype, mtype, ltype, rtype, opcode;
int i, ll, lr;
char *q, *s;
union Constant lcon, rcon;

#if HERE == VAX
int (*fpe_handler)();

if(setjmp(jmp_fpe))
	{
	(void) signal(SIGFPE, fpe_handler);
	frexpr(e);
	return(errnode());
	}
fpe_handler = signal(SIGFPE, fold_fpe_handler);
setfpe();
#endif

opcode = e->exprblock.opcode;
etype = e->exprblock.vtype;

lp = e->exprblock.leftp;
ltype = lp->headblock.vtype;
rp = e->exprblock.rightp;
2423
2424
2425
2426
2427
2428
2429


2430
2431
2432
2433
2434
2435
2436
}



consnegop(p)
register Constp p;
{


switch(p->vtype)
	{
	case TYSHORT:
	case TYLONG:
		p->const.ci = - p->const.ci;
		break;








>
>







2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
}



consnegop(p)
register Constp p;
{
setfpe();

switch(p->vtype)
	{
	case TYSHORT:
	case TYLONG:
		p->const.ci = - p->const.ci;
		break;

2520
2521
2522
2523
2524
2525
2526


2527
2528
2529
2530
2531
2532
2533

LOCAL consbinop(opcode, type, cp, ap, bp)
int opcode, type;
register union Constant *ap, *bp, *cp;
{
int k;
double temp;



switch(opcode)
	{
	case OPPLUS:
		switch(type)
			{
			case TYSHORT:







>
>







2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655

LOCAL consbinop(opcode, type, cp, ap, bp)
int opcode, type;
register union Constant *ap, *bp, *cp;
{
int k;
double temp;

setfpe();

switch(opcode)
	{
	case OPPLUS:
		switch(type)
			{
			case TYSHORT:
2792
2793
2794
2795
2796
2797
2798


2799
2800
2801
2802
2803
2804
2805


LOCAL zdiv(c, a, b)
register struct dcomplex *a, *b, *c;
{
double ratio, den;
double abr, abi;



if( (abr = b->dreal) < 0.)
	abr = - abr;
if( (abi = b->dimag) < 0.)
	abi = - abi;
if( abr <= abi )
	{







>
>







2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929


LOCAL zdiv(c, a, b)
register struct dcomplex *a, *b, *c;
{
double ratio, den;
double abr, abi;

setfpe();

if( (abr = b->dreal) < 0.)
	abr = - abr;
if( (abi = b->dimag) < 0.)
	abi = - abi;
if( abr <= abi )
	{

Changes to usr.bin/f77/pass1.vax/gram.dcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14











15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gram.dcl	5.2 (Berkeley) 08/29/85
 */

/*
 * Grammar for declarations, f77 compiler, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	gram.dcl,v $











 * Revision 5.4  85/08/20  23:37:33  donn
 * Fix from Jerry Berkman to prevent length problems with -r8.
 * 
 * Revision 5.3  85/08/15  20:16:29  donn
 * SAVE statements are not executable...
 * 
 * Revision 5.2  85/08/10  04:24:56  donn





|








>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gram.dcl	5.3 (Berkeley) 01/07/86
 */

/*
 * Grammar for declarations, f77 compiler, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	gram.dcl,v $
 * Revision 5.7  85/12/21  07:29:08  donn
 * Rule out CHARACTER*(*) declarations in main programs.
 * 
 * Revision 5.6  85/12/18  20:10:26  donn
 * Enforce more strict ordering of specification statements. per the
 * standard.  Some duplicated code is now concentrated in the nonterminal
 * 'inside', which is used to indicate the start of a program.
 * 
 * Revision 5.5  85/11/25  00:23:59  donn
 * 4.3 beta
 * 
 * Revision 5.4  85/08/20  23:37:33  donn
 * Fix from Jerry Berkman to prevent length problems with -r8.
 * 
 * Revision 5.3  85/08/15  20:16:29  donn
 * SAVE statements are not executable...
 * 
 * Revision 5.2  85/08/10  04:24:56  donn
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
	| data
	| namelist
	| SSAVE in_dcl
		{ NO66("SAVE statement");
		  saveall = YES; }
	| SSAVE in_dcl savelist
		{ NO66("SAVE statement"); }
	| SFORMAT
		{
		if (parstate == OUTSIDE)
			{
			newproc();
			startproc(PNULL, CLMAIN);
			parstate = INSIDE;
			}
		if (parstate < INDCL)
			parstate = INDCL;
		fmtstmt(thislabel);
		setfmt(thislabel);
		}
	| SPARAM in_dcl SLPAR paramlist SRPAR
		{ NO66("PARAMETER statement"); }
	;

dcl:	  type opt_comma name in_dcl dims lengspec
		{ settype($3, $1, $6);
		  if(ndim>0) setbound($3,ndim,dims);
		}







|

<
<
<
<
<
<
<
<



|







53
54
55
56
57
58
59
60
61








62
63
64
65
66
67
68
69
70
71
72
	| data
	| namelist
	| SSAVE in_dcl
		{ NO66("SAVE statement");
		  saveall = YES; }
	| SSAVE in_dcl savelist
		{ NO66("SAVE statement"); }
	| SFORMAT inside
		{








		fmtstmt(thislabel);
		setfmt(thislabel);
		}
	| SPARAM in_param SLPAR paramlist SRPAR
		{ NO66("PARAMETER statement"); }
	;

dcl:	  type opt_comma name in_dcl dims lengspec
		{ settype($3, $1, $6);
		  if(ndim>0) setbound($3,ndim,dims);
		}
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

125














126
127
128
129
130
131
132
		int typlen;
		
		p = $3;
		NO66("length specification *n");
		if( ! ISICON(p) || p->constblock.const.ci<0 )
			{
			$$ = 0;
			dclerr("- length must be a positive integer value",
				PNULL);
			}
		else if( dblflag )
			{
			typlen = p->constblock.const.ci;
			if( vartype == TYDREAL && typlen == 4 ) $$ = 8;
			else if( vartype == TYDCOMPLEX && typlen == 8 ) $$ = 16;
			else $$ = typlen;
			}
		else
			$$ = p->constblock.const.ci;
		}
	| SSTAR intonlyon SLPAR SSTAR SRPAR intonlyoff

		{ NO66("length specification *(*)"); $$ = -1; }














	;

common:	  SCOMMON in_dcl var
		{ incomm( $$ = comblock(0, CNULL) , $3 ); }
	| SCOMMON in_dcl comblock var
		{ $$ = $3;  incomm($3, $4); }
	| common opt_comma comblock opt_comma var







|













>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		int typlen;
		
		p = $3;
		NO66("length specification *n");
		if( ! ISICON(p) || p->constblock.const.ci<0 )
			{
			$$ = 0;
			dclerr("length must be a positive integer value",
				PNULL);
			}
		else if( dblflag )
			{
			typlen = p->constblock.const.ci;
			if( vartype == TYDREAL && typlen == 4 ) $$ = 8;
			else if( vartype == TYDCOMPLEX && typlen == 8 ) $$ = 16;
			else $$ = typlen;
			}
		else
			$$ = p->constblock.const.ci;
		}
	| SSTAR intonlyon SLPAR SSTAR SRPAR intonlyoff
		{
		NO66("length specification *(*)");
		if( parstate < INSIDE )
			{
			dclerr("variable length function or variable length string in main program", PNULL);
			$$ = 0;
			}
		else
		if( procclass == CLMAIN )
			{
			dclerr("variable length string in main program", PNULL);
			$$ = 0;
			}
		else
			$$ = -1;
		}
	;

common:	  SCOMMON in_dcl var
		{ incomm( $$ = comblock(0, CNULL) , $3 ); }
	| SCOMMON in_dcl comblock var
		{ $$ = $3;  incomm($3, $4); }
	| common opt_comma comblock opt_comma var
214
215
216
217
218
219
220






221
222
223
224
225
226
227
paramlist:  paramitem
	| paramlist SCOMMA paramitem
	;

paramitem:  name SEQUALS expr
		{ paramset( $1, $3 ); }
	;







var:	  name dims
		{ if(ndim>0) setbound($1, ndim, dims); }
	;


dims:







>
>
>
>
>
>







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
paramlist:  paramitem
	| paramlist SCOMMA paramitem
	;

paramitem:  name SEQUALS expr
		{ paramset( $1, $3 ); }
	;

in_param:	inside
		{ if(parstate > INDCL)
			dclerr("parameter statement out of order", PNULL);
		}
	;

var:	  name dims
		{ if(ndim>0) setbound($1, ndim, dims); }
	;


dims:
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281






282
283
284
285
286
287
288
		{ if(nstars < MAXLABLIST)  labarray[nstars++] = $3; }
	;

label:	  SICON
		{ $$ = execlab( convci(toklen, token) ); }
	;

implicit:  SIMPLICIT in_dcl implist
		{ NO66("IMPLICIT statement"); }
	| implicit SCOMMA implist
	;

implist:  imptype SLPAR letgroups SRPAR
	;

imptype:   { needkwd = 1; } type
		{ vartype = $2; }
	;







letgroups: letgroup
	| letgroups SCOMMA letgroup
	;

letgroup:  letter
		{ setimpl(vartype, varleng, $1, $1); }







|










>
>
>
>
>
>







288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
		{ if(nstars < MAXLABLIST)  labarray[nstars++] = $3; }
	;

label:	  SICON
		{ $$ = execlab( convci(toklen, token) ); }
	;

implicit:  SIMPLICIT in_implicit implist
		{ NO66("IMPLICIT statement"); }
	| implicit SCOMMA implist
	;

implist:  imptype SLPAR letgroups SRPAR
	;

imptype:   { needkwd = 1; } type
		{ vartype = $2; }
	;

in_implicit:	inside
		{ if(parstate >= INDCL)
			dclerr("implicit statement out of order", PNULL);
		}
	;

letgroups: letgroup
	| letgroups SCOMMA letgroup
	;

letgroup:  letter
		{ setimpl(vartype, varleng, $1, $1); }
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334


335




336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364

namelistlist:  name
		{ $$ = mkchain($1, CHNULL); }
	| namelistlist SCOMMA name
		{ $$ = hookup($1, mkchain($3, CHNULL)); }
	;

in_dcl:
		{ switch(parstate)	
			{
			case OUTSIDE:	newproc();
					startproc(PNULL, CLMAIN);
			case INSIDE:	parstate = INDCL;
			case INDCL:	break;



			default:




				dclerr("declaration among executables", PNULL);
			}
		}
	;

data:	data1
	{
	  if (overlapflag == YES)
	    warn("overlapping initializations");
	}

data1:	SDATA in_data datapair
    |	data1 opt_comma datapair
    ;

in_data:
		{ if(parstate == OUTSIDE)
			{
			newproc();
			startproc(PNULL, CLMAIN);
			}
		  if(parstate < INDATA)
			{
			enddcl();
			parstate = INDATA;
			}
		  overlapflag = NO;
		}
	;







|
|

|
|
|
<
|
>
>
|
>
>
>
>
|
<













|
<
<
<
<
<
|







350
351
352
353
354
355
356
357
358
359
360
361
362

363
364
365
366
367
368
369
370
371

372
373
374
375
376
377
378
379
380
381
382
383
384
385





386
387
388
389
390
391
392
393

namelistlist:  name
		{ $$ = mkchain($1, CHNULL); }
	| namelistlist SCOMMA name
		{ $$ = hookup($1, mkchain($3, CHNULL)); }
	;

inside:
		{ if(parstate < INSIDE)
			{
			newproc();
			startproc(PNULL, CLMAIN);
			parstate = INSIDE;

			}
		}
	;

in_dcl:	inside
		{ if(parstate < INDCL)
			parstate = INDCL;
		  if(parstate > INDCL)
			dclerr("declaration among executables", PNULL);

		}
	;

data:	data1
	{
	  if (overlapflag == YES)
	    warn("overlapping initializations");
	}

data1:	SDATA in_data datapair
    |	data1 opt_comma datapair
    ;

in_data:	inside





		{ if(parstate < INDATA)
			{
			enddcl();
			parstate = INDATA;
			}
		  overlapflag = NO;
		}
	;

Changes to usr.bin/f77/pass1.vax/gram.exec.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16








17
18
19
20
21
22
23
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gram.exec	5.1 (Berkeley) 06/07/85
 */

/*
 * gram.exec
 *
 * Grammar for executable statements, f77 compiler pass 1, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	gram.exec,v $








 * Revision 3.1  84/10/13  00:36:41  donn
 * Installed Jerry Berkman's version; preserved comment header.
 * 
 * Revision 1.3  84/08/06  18:38:43  donn
 * Fixed a bug in Jerry Berkman's label fixes which caused the same label to
 * be generated twice for some types of logical IF statements.
 * 





|










>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gram.exec	5.2 (Berkeley) 01/07/86
 */

/*
 * gram.exec
 *
 * Grammar for executable statements, f77 compiler pass 1, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	gram.exec,v $
 * Revision 5.2  85/12/18  20:17:38  donn
 * Modified end_spec to insist on parser state INEXEC after seeing an
 * executable statement.  This allows us to limit statement functions to
 * parser state INDATA.
 * 
 * Revision 5.1  85/08/10  03:47:22  donn
 * 4.3 alpha
 * 
 * Revision 3.1  84/10/13  00:36:41  donn
 * Installed Jerry Berkman's version; preserved comment header.
 * 
 * Revision 1.3  84/08/06  18:38:43  donn
 * Fixed a bug in Jerry Berkman's label fixes which caused the same label to
 * be generated twice for some types of logical IF statements.
 * 
178
179
180
181
182
183
184

185
186
187
188
189
190
191
end_spec:
		{ if(parstate == OUTSIDE)
			{
			newproc();
			startproc(PNULL, CLMAIN);
			}
		  if(parstate < INDATA) enddcl();

		  if( yystno != 0 && thislabel->labtype != LABFORMAT)
			if (optimflag)
				optbuff (SKLABEL, 0, thislabel->labelno, 1);
			else
				putlabel(thislabel->labelno);
		  yystno = 0;
		}







>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
end_spec:
		{ if(parstate == OUTSIDE)
			{
			newproc();
			startproc(PNULL, CLMAIN);
			}
		  if(parstate < INDATA) enddcl();
		  parstate = INEXEC;
		  if( yystno != 0 && thislabel->labtype != LABFORMAT)
			if (optimflag)
				optbuff (SKLABEL, 0, thislabel->labelno, 1);
			else
				putlabel(thislabel->labelno);
		  yystno = 0;
		}

Changes to usr.bin/f77/pass1.vax/gram.expr.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16







17
18
19
20
21
22
23
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gram.expr	5.1 (Berkeley) 06/07/85
 */

/*
 * gram.expr
 *
 * Grammar for expressions, f77 compiler pass 1, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	gram.expr,v $







 * Revision 3.2  85/02/15  19:08:53  donn
 * Put OPPAREN operators in trees when not optimizing as well as when
 * optimizing -- this allows '(1)' to produce a writable temporary instead
 * of a read-only constant when passed as an argument to a subroutine.
 * 
 * Revision 3.1  84/10/13  00:42:08  donn
 * Installed Jerry Berkman's version with cosmetic changes.





|










>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gram.expr	5.2 (Berkeley) 01/07/86
 */

/*
 * gram.expr
 *
 * Grammar for expressions, f77 compiler pass 1, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	gram.expr,v $
 * Revision 5.2  85/12/21  07:26:39  donn
 * Permit CHARACTER*(4) in function declarations by eliminating parentheses
 * more appropriately.
 * 
 * Revision 5.1  85/08/10  03:47:25  donn
 * 4.3 alpha
 * 
 * Revision 3.2  85/02/15  19:08:53  donn
 * Put OPPAREN operators in trees when not optimizing as well as when
 * optimizing -- this allows '(1)' to produce a writable temporary instead
 * of a read-only constant when passed as an argument to a subroutine.
 * 
 * Revision 3.1  84/10/13  00:42:08  donn
 * Installed Jerry Berkman's version with cosmetic changes.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	| funargs SCOMMA expr
		{ $$ = hookup($1, mkchain($3,CHNULL) ); }
	;


expr:	  uexpr
	| SLPAR expr SRPAR
		{ if (parstate != INDCL)
			$$ = mkexpr(OPPAREN, $2, ENULL);
		  else $$ = $2;
		}
	| complex_const
	;

uexpr:	  lhs







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	| funargs SCOMMA expr
		{ $$ = hookup($1, mkchain($3,CHNULL) ); }
	;


expr:	  uexpr
	| SLPAR expr SRPAR
		{ if (parstate > INDCL)
			$$ = mkexpr(OPPAREN, $2, ENULL);
		  else $$ = $2;
		}
	| complex_const
	;

uexpr:	  lhs
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
complex_const:  SLPAR uexpr SCOMMA uexpr SRPAR
		{ $$ = mkcxcon($2,$4); }
	;


fexpr:	  unpar_fexpr
	| SLPAR fexpr SRPAR
		{ if (optimflag && parstate != INDCL)
			$$ = mkexpr(OPPAREN, $2, ENULL);
		  else $$ = $2;
		}
	;

unpar_fexpr:	  lhs
	| simple_const







|







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
complex_const:  SLPAR uexpr SCOMMA uexpr SRPAR
		{ $$ = mkcxcon($2,$4); }
	;


fexpr:	  unpar_fexpr
	| SLPAR fexpr SRPAR
		{ if (optimflag && parstate > INDCL)
			$$ = mkexpr(OPPAREN, $2, ENULL);
		  else $$ = $2;
		}
	;

unpar_fexpr:	  lhs
	| simple_const

Changes to usr.bin/f77/pass1.vax/io.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20







21
22
23
24
25
26
27
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static	char *sccsid = "@(#)io.c	5.1 (Berkeley) 85/06/07";
#endif

/*
 * io.c
 *
 * Routines to generate code for I/O statements.
 * Some corrections and improvements due to David Wasley, U. C. Berkeley
 *
 * University of Utah CS Dept modification history:
 *
 * $Header: io.c,v 2.4 85/02/23 21:09:02 donn Exp $
 * $Log:	io.c,v $







 * Revision 2.4  85/02/23  21:09:02  donn
 * Jerry Berkman's compiled format fixes move setfmt into a separate file.
 * 
 * Revision 2.3  85/01/10  22:33:41  donn
 * Added some strategic cpexpr()s to prevent memory management bugs.
 * 
 * Revision 2.2  84/08/04  21:15:47  donn







|










|

>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static	char *sccsid = "@(#)io.c	5.2 (Berkeley) 01/07/86";
#endif

/*
 * io.c
 *
 * Routines to generate code for I/O statements.
 * Some corrections and improvements due to David Wasley, U. C. Berkeley
 *
 * University of Utah CS Dept modification history:
 *
 * $Header: io.c,v 5.2 85/12/19 17:22:35 donn Exp $
 * $Log:	io.c,v $
 * Revision 5.2  85/12/19  17:22:35  donn
 * Don't permit more than one 'positional iocontrol' parameter unless we
 * are doing a READ or a WRITE.
 * 
 * Revision 5.1  85/08/10  03:47:42  donn
 * 4.3 alpha
 * 
 * Revision 2.4  85/02/23  21:09:02  donn
 * Jerry Berkman's compiled format fixes move setfmt into a separate file.
 * 
 * Revision 2.3  85/01/10  22:33:41  donn
 * Added some strategic cpexpr()s to prevent memory management bugs.
 * 
 * Revision 2.2  84/08/04  21:15:47  donn
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
struct Ioclist *iocp;

++nioctl;
if(n == IOSBAD)
	return;
if(n == IOSPOSITIONAL)
	{
	if(nioctl > IOSFMT)

		{
		err("illegal positional iocontrol");
		return;
		}
	n = nioctl;
	}








|
>







364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
struct Ioclist *iocp;

++nioctl;
if(n == IOSBAD)
	return;
if(n == IOSPOSITIONAL)
	{
	if(nioctl > IOSFMT ||
	   nioctl > IOSUNIT && !(iostmt == IOREAD || iostmt == IOWRITE))
		{
		err("illegal positional iocontrol");
		return;
		}
	n = nioctl;
	}

Changes to usr.bin/f77/pass1.vax/lex.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18







19
20
21
22
23
24
25
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)lex.c	5.2 (Berkeley) 08/29/85";
#endif not lint

/*
 * lex.c
 *
 * Lexical scanner routines for the f77 compiler, pass 1, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	lex.c,v $







 * Revision 5.2  85/08/10  04:45:41  donn
 * Jerry Berkman's changes to ifdef 66 code and handle -r8/double flag.
 * 
 * Revision 5.1  85/08/10  03:48:20  donn
 * 4.3 alpha
 * 
 * Revision 1.2  84/10/27  02:20:09  donn







|










>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)lex.c	5.3 (Berkeley) 01/07/86";
#endif not lint

/*
 * lex.c
 *
 * Lexical scanner routines for the f77 compiler, pass 1, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	lex.c,v $
 * Revision 5.4  86/01/07  14:01:13  donn
 * Fix the scanning for character constants in gettok() so that it handles
 * the case when an error has occurred and there is no closing quote.
 * 
 * Revision 5.3  85/11/25  00:24:06  donn
 * 4.3 beta
 * 
 * Revision 5.2  85/08/10  04:45:41  donn
 * Jerry Berkman's changes to ifdef 66 code and handle -r8/double flag.
 * 
 * Revision 5.1  85/08/10  03:48:20  donn
 * 4.3 alpha
 * 
 * Revision 1.2  84/10/27  02:20:09  donn
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753

char *i, *j, *n1, *p;

	if(*nextch == (MYQUOTE))
		{
		++nextch;
		p = token;
		while(*nextch != MYQUOTE)
			*p++ = *nextch++;
		++nextch;
		toklen = p - token;
		*p = '\0';
		return (SHOLLERITH);
		}
/*







|







746
747
748
749
750
751
752
753
754
755
756
757
758
759
760

char *i, *j, *n1, *p;

	if(*nextch == (MYQUOTE))
		{
		++nextch;
		p = token;
		while(nextch <= lastch && *nextch != MYQUOTE)
			*p++ = *nextch++;
		++nextch;
		toklen = p - token;
		*p = '\0';
		return (SHOLLERITH);
		}
/*

Changes to usr.bin/f77/pass1.vax/misc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18






19
20
21
22
23
24
25
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)misc.c	5.1 (Berkeley) 06/07/85";
#endif not lint

/*
 * misc.c
 *
 * Miscellaneous routines for the f77 compiler, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	misc.c,v $






 * Revision 3.1  84/10/13  01:53:26  donn
 * Installed Jerry Berkman's version; added UofU comment header.
 * 
 */

#include "defs.h"








|










>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)misc.c	5.2 (Berkeley) 01/07/86";
#endif not lint

/*
 * misc.c
 *
 * Miscellaneous routines for the f77 compiler, 4.2 BSD.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	misc.c,v $
 * Revision 5.2  85/12/18  00:35:08  donn
 * Prevent core dumps for peculiar statement numbers.
 * 
 * Revision 5.1  85/08/10  03:48:29  donn
 * 4.3 alpha
 * 
 * Revision 3.1  84/10/13  01:53:26  donn
 * Installed Jerry Berkman's version; added UofU comment header.
 * 
 */

#include "defs.h"

351
352
353
354
355
356
357
358

359
360
361
362
363
364
365
struct Labelblock *mklabel(l)
ftnint l;
{
register struct Labelblock *lp;

if(l <= 0 || l > 99999 ) {
	errstr("illegal label %d", l);
	return(NULL);

	}

for(lp = labeltab ; lp < highlabtab ; ++lp)
	if(lp->stateno == l)
		return(lp);

if(++highlabtab > labtabend)







<
>







357
358
359
360
361
362
363

364
365
366
367
368
369
370
371
struct Labelblock *mklabel(l)
ftnint l;
{
register struct Labelblock *lp;

if(l <= 0 || l > 99999 ) {
	errstr("illegal label %d", l);

	l = 0;
	}

for(lp = labeltab ; lp < highlabtab ; ++lp)
	if(lp->stateno == l)
		return(lp);

if(++highlabtab > labtabend)

Changes to usr.bin/f77/pass1.vax/proc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
























20
21
22
23
24
25
26
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)proc.c	5.4 (Berkeley) 10/06/85";
#endif not lint

/*
 * proc.c
 *
 * Routines for handling procedures, f77 compiler, pass 1.
 *
 * University of Utah CS Dept modification history:
 *
 * $Header: proc.c,v 5.3 85/09/30 23:21:07 donn Exp $
 * $Log:	proc.c,v $
























 * Revision 5.3  85/09/30  23:21:07  donn
 * Print space with prspace() in outlocvars() so that alignment is preserved.
 * 
 * Revision 5.2  85/08/10  05:03:34  donn
 * Support for NAMELIST i/o from Jerry Berkman.
 * 
 * Revision 5.1  85/08/10  03:49:14  donn







|









<

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)proc.c	5.6 (Berkeley) 01/10/86";
#endif not lint

/*
 * proc.c
 *
 * Routines for handling procedures, f77 compiler, pass 1.
 *
 * University of Utah CS Dept modification history:
 *

 * $Log:	proc.c,v $
 * Revision 5.8  86/01/10  19:02:19  donn
 * More dbx hacking -- filter out incomplete declarations (with bogus types).
 * 
 * Revision 5.7  86/01/10  13:53:02  donn
 * Since we now postpone determination of the type of an argument, we must
 * make sure to emit stab information at the end of the routine when we
 * definitely have the type.  Notice some care was taken to make sure that
 * arguments appear in order in the output file since that's how dbx wants
 * them.  Also a minor change for dummy procedures.
 * 
 * Revision 5.6  86/01/06  16:28:06  donn
 * Sigh.  We can't commit to defining a symbol as a variable instead of a
 * function based only on what we have seen through the declaration section;
 * this was properly handled for normal variables but not for arguments.
 * 
 * Revision 5.5  86/01/01  21:59:17  donn
 * Pick up CHARACTER*(*) declarations for variables which aren't dummy
 * arguments, and complain about them.
 * 
 * Revision 5.4  85/12/20  19:18:35  donn
 * Don't assume that dummy procedures of unknown type are functions of type
 * undefined until the user (mis-)uses them that way -- they may also be
 * subroutines.
 * 
 * Revision 5.3  85/09/30  23:21:07  donn
 * Print space with prspace() in outlocvars() so that alignment is preserved.
 * 
 * Revision 5.2  85/08/10  05:03:34  donn
 * Support for NAMELIST i/o from Jerry Berkman.
 * 
 * Revision 5.1  85/08/10  03:49:14  donn
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
#endif

prendproc();
}


/*
   manipulate argument lists (allocate argument slot positions)
 * keep track of return types and labels
 */

LOCAL doentry(ep)
struct Entrypoint *ep;
{
register int type;







|







502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
#endif

prendproc();
}


/*
 * manipulate argument lists (allocate argument slot positions)
 * keep track of return types and labels
 */

LOCAL doentry(ep)
struct Entrypoint *ep;
{
register int type;
559
560
561
562
563
564
565


566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
for(p = ep->arglist ; p ; p = p->nextp)
	if(! (( q = (Namep) (p->datap) )->vdcldone) )
		q->vardesc.varno = nextarg(TYADDR);

for(p = ep->arglist ; p ; p = p->nextp)
	if(! (( q = (Namep) (p->datap) )->vdcldone) )
		{


		impldcl(q);
		q->vdcldone = YES;
		if(q->vtype == TYCHAR)
			{
			if(q->vleng == NULL)	/* character*(*) */
				q->vleng = (expptr)
						mkarg(TYLENG, nextarg(TYLENG) );
			else if(nentry == 1)
				nextarg(TYLENG);
			}
		else if(q->vclass==CLPROC && nentry==1)
			nextarg(TYLENG) ;
#ifdef SDB
		if(sdbflag) {
			namestab(q);
		}
#endif
		}

if (optimflag)
	optbuff (SKLABEL, 0, ep->entrylabel, 0);
else
	putlabel(ep->entrylabel);
}







>
>

<










<
<
<
<
<







582
583
584
585
586
587
588
589
590
591

592
593
594
595
596
597
598
599
600
601





602
603
604
605
606
607
608
for(p = ep->arglist ; p ; p = p->nextp)
	if(! (( q = (Namep) (p->datap) )->vdcldone) )
		q->vardesc.varno = nextarg(TYADDR);

for(p = ep->arglist ; p ; p = p->nextp)
	if(! (( q = (Namep) (p->datap) )->vdcldone) )
		{
		if(q->vclass == CLPROC && q->vtype == TYUNKNOWN)
			continue;
		impldcl(q);

		if(q->vtype == TYCHAR)
			{
			if(q->vleng == NULL)	/* character*(*) */
				q->vleng = (expptr)
						mkarg(TYLENG, nextarg(TYLENG) );
			else if(nentry == 1)
				nextarg(TYLENG);
			}
		else if(q->vclass==CLPROC && nentry==1)
			nextarg(TYLENG) ;





		}

if (optimflag)
	optbuff (SKLABEL, 0, ep->entrylabel, 0);
else
	putlabel(ep->entrylabel);
}
673
674
675
676
677
678
679









680


681
682

683
684

685
686
687
688
689
690
691
692
	prlocdata(memname(STGEQUIV, i), leng, TYDREAL, 
		  eqvclass[i].initoffset, &(eqvclass[i].inlcomm));
    }

  outlocvars();
#ifdef SDB
    if(sdbflag) {









      for(p = hashtab ; p<lasthash ; ++p) if(q = p->varp) {


	  qstg = q->vstg;
	  qclass = q->vclass;

          if( ONEOF(qclass, M(CLVAR))) {
	     if (! ONEOF(qstg,M(STGCOMMON)|M(STGARG) ) ) namestab(q);

	  } 
      }
    }
#endif

  close(vdatafile);
  close(vchkfile);
  unlink(vdatafname);







>
>
>
>
>
>
>
>
>
|
>
>
|
|
>
|
|
>
|







692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
	prlocdata(memname(STGEQUIV, i), leng, TYDREAL, 
		  eqvclass[i].initoffset, &(eqvclass[i].inlcomm));
    }

  outlocvars();
#ifdef SDB
    if(sdbflag) {
      register struct Entrypoint *ep;
      register chainp cp;

      for (ep = entries; ep; ep = ep->entnextp)
	for (cp = ep->arglist ; cp ; cp = cp->nextp)
	  if ((q = (Namep) cp->datap) && q->vstg == STGARG) {
	    q->vdcldone = YES;
	    namestab(q);
	  }
      for (p = hashtab ; p<lasthash ; ++p) if(q = p->varp) {
	if (q->vtype == TYUNKNOWN || q->vtype == TYERROR)
	  continue;
	qstg = q->vstg;
	qclass = q->vclass;
	q->vdcldone = YES;
	if ( ONEOF(qclass, M(CLVAR)|M(CLPARAM)|M(CLPROC)) ) {
	  if (! ONEOF(qstg,M(STGCOMMON)|M(STGARG) ) )
	    namestab(q);
	} 
      }
    }
#endif

  close(vdatafile);
  close(vchkfile);
  unlink(vdatafname);
1284
1285
1286
1287
1288
1289
1290
1291


1292



1293
1294
1295
1296
1297
1298
1299
	if(v->vstg == STGUNKNOWN)
		v->vstg = - type;
	else if(v->vstg != -type)
		dclerr("incompatible storage declarations", v);
	}
else if(v->vtype == TYUNKNOWN)
	{
	if( (v->vtype = lengtype(type, length))==TYCHAR && length>=0)


		v->vleng = ICON(length);



	}
else if(v->vtype!=type || (type==TYCHAR && v->vleng->constblock.const.ci!=length) )
	dclerr("incompatible type declarations", v);
}










|
>
>
|
>
>
>







1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
	if(v->vstg == STGUNKNOWN)
		v->vstg = - type;
	else if(v->vstg != -type)
		dclerr("incompatible storage declarations", v);
	}
else if(v->vtype == TYUNKNOWN)
	{
	if( (v->vtype = lengtype(type, length))==TYCHAR )
		{
		if(length >= 0)
			v->vleng = ICON(length);
		else if(v->vstg != STGARG)
			dclerr("adjustable length character variable that is not a dummy argument", v);
		}
	}
else if(v->vtype!=type || (type==TYCHAR && v->vleng->constblock.const.ci!=length) )
	dclerr("incompatible type declarations", v);
}



Changes to usr.bin/f77/pass1.vax/regalloc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19





















20
21
22
23
24
25
26
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)regalloc.c	5.3 (Berkeley) 10/06/85";
#endif not lint

/*
 * regalloc.c
 *
 * Register optimization routines for f77 compiler, pass 1
 *
 * University of Utah CS Dept modification history:
 *
 * $History$
 * $Log:	regalloc.c,v $





















 * Revision 5.3  85/09/27  19:58:16  root
 * Ended PCC confusion with sizes of objects in registers by forcing SHORT
 * values in registers to be converted to INT.
 * 
 * Revision 5.2  85/09/26  19:36:22  donn
 * Added a fix for a bug that allowed character variables which were
 * arguments to subroutines to be made eligible to be register variables.







|









<

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)regalloc.c	5.4 (Berkeley) 01/07/86";
#endif not lint

/*
 * regalloc.c
 *
 * Register optimization routines for f77 compiler, pass 1
 *
 * University of Utah CS Dept modification history:
 *

 * $Log:	regalloc.c,v $
 * Revision 5.6  86/01/04  22:35:44  donn
 * More hacking on GOTOs and loops.  Fixed a bug in rev 5.4.  Changed
 * regalloc() so that sibling loops behave like nested loops, eliminating
 * problems with GOTOs and different registers used for the same variable.
 * This decreases the flexibility of the allocator quite a bit, but it was
 * doing the job wrong before, so we come out ahead.
 * 
 * Revision 5.5  86/01/04  19:54:28  donn
 * Pick up redundant register moves when address registers (STGPREG) are
 * involved.
 * 
 * Revision 5.4  86/01/04  18:28:34  donn
 * Patching over some more design problems...  If there is a GOTO that jumps
 * from an inner loop into an outer loop and there is a variable which is set
 * in the inner loop and is in register in the outer loop but is not in
 * register in the inner loop (or is in a different register), we get into
 * trouble because the register version of the variable in the outer loop
 * is 'dead' and we don't maintain enough information to be able to restore
 * it.  The change causes a variable that is set in an inner loop but is not
 * put in register there to be ineligible for a register in the outer loop.
 * 
 * Revision 5.3  85/09/27  19:58:16  root
 * Ended PCC confusion with sizes of objects in registers by forcing SHORT
 * values in registers to be converted to INT.
 * 
 * Revision 5.2  85/09/26  19:36:22  donn
 * Added a fix for a bug that allowed character variables which were
 * arguments to subroutines to be made eligible to be register variables.
157
158
159
160
161
162
163

164
165
166
167
168
169
170
    {
      struct addrnode *link;
      field vtype;
      field vstg;
      int memno;
      unsigned istemp : 1;
      unsigned isset : 1;

      unsigned freeuse : 1;
      unsigned mixedtype : 1;
      unsigned fixed : 1;
      int refs;
      struct addrnode *commonlink;
      VARNODE *varlist;
    } ADDRNODE;







>







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
    {
      struct addrnode *link;
      field vtype;
      field vstg;
      int memno;
      unsigned istemp : 1;
      unsigned isset : 1;
      unsigned loopset : 1;
      unsigned freeuse : 1;
      unsigned mixedtype : 1;
      unsigned fixed : 1;
      int refs;
      struct addrnode *commonlink;
      VARNODE *varlist;
    } ADDRNODE;
207
208
209
210
211
212
213

214
215
216
217
218
219
220
LOCAL int allset;
LOCAL ADDRNODE *currentaddr;
LOCAL int loopcost;
LOCAL REGDATA *regtab[MAXREGVAR];
LOCAL REGDATA *rt[TABLELIMIT];
LOCAL int tabletop;
LOCAL int linearcode;

LOCAL int globalbranch;
LOCAL int commonunusable;
LOCAL int regdefined[MAXREGVAR];
LOCAL int memdefined[MAXREGVAR];
LOCAL int regaltered[MAXREGVAR];









>







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
LOCAL int allset;
LOCAL ADDRNODE *currentaddr;
LOCAL int loopcost;
LOCAL REGDATA *regtab[MAXREGVAR];
LOCAL REGDATA *rt[TABLELIMIT];
LOCAL int tabletop;
LOCAL int linearcode;
LOCAL int docount;
LOCAL int globalbranch;
LOCAL int commonunusable;
LOCAL int regdefined[MAXREGVAR];
LOCAL int memdefined[MAXREGVAR];
LOCAL int regaltered[MAXREGVAR];


507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525

526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545








546
547
548
549
550
551
552
553
554
555
556
557
  register Slotp sp;
  register int i;
  register ADDRNODE *p;
  register VARNODE *q;
  Slotp sp1, sp2;
  ADDRNODE *addrinfo;
  VARNODE *varinfo;
  int docount;
  struct Labelblock **lp;
  int toptrack;
  int track[MAXREGVAR];
  Addrp ap, ap1;
  DOQUEUE *dqp;
  REGDATA *rp;
  REGNODE *regp;

  if (nregvar >= maxregvar) return;

  commonvars = NULL;


  for (sp = dohead; sp != doend->next; sp = sp->next)
    switch (sp->type)
      {
      case SKLABEL:
	insertlabel(sp->label);
	break;

      case SKARIF:
      case SKASGOTO:
      case SKCALL:
      case SKCMGOTO:
      case SKEQ:
      case SKIFN:
      case SKIOIFN:
      case SKSTOP:
      case SKPAUSE:
      case SKRETURN:
	scanvars(sp->expr);
	break;









      case SKNULL:
      case SKGOTO:
      case SKDOHEAD:
      case SKENDDO:
      case SKASSIGN:
	break;

      default:
	badthing ("SKtype", "alreg-1", sp->type);
      }








<











>




















>
>
>
>
>
>
>
>



<
<







529
530
531
532
533
534
535

536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578


579
580
581
582
583
584
585
  register Slotp sp;
  register int i;
  register ADDRNODE *p;
  register VARNODE *q;
  Slotp sp1, sp2;
  ADDRNODE *addrinfo;
  VARNODE *varinfo;

  struct Labelblock **lp;
  int toptrack;
  int track[MAXREGVAR];
  Addrp ap, ap1;
  DOQUEUE *dqp;
  REGDATA *rp;
  REGNODE *regp;

  if (nregvar >= maxregvar) return;

  commonvars = NULL;
  docount = 0;

  for (sp = dohead; sp != doend->next; sp = sp->next)
    switch (sp->type)
      {
      case SKLABEL:
	insertlabel(sp->label);
	break;

      case SKARIF:
      case SKASGOTO:
      case SKCALL:
      case SKCMGOTO:
      case SKEQ:
      case SKIFN:
      case SKIOIFN:
      case SKSTOP:
      case SKPAUSE:
      case SKRETURN:
	scanvars(sp->expr);
	break;

      case SKDOHEAD:
	++docount;
	break;

      case SKENDDO:
	--docount;
	break;

      case SKNULL:
      case SKGOTO:


      case SKASSIGN:
	break;

      default:
	badthing ("SKtype", "alreg-1", sp->type);
      }

717
718
719
720
721
722
723

724
725
726
727
728
729
730
731

  tabletop = -1;
  if (topregvar < maxregvar - 1)
    for (i = 0; i < VARTABSIZE; i++)
      for (p = vartable[i]; p; p = p->link)
	{
	  entableaddr(p);

	  if ((!p->mixedtype) &&
	      (p->vstg != STGARG) &&
	      !((p->vstg == STGCOMMON) && ((!p->fixed) || commonunusable)))
	    for (q = p->varlist; q; q = q->link)
	      entablevar(q);
	}

  for (i = 0; (i <= tabletop) && (topregvar + 1 < maxregvar); i++)







>
|







745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760

  tabletop = -1;
  if (topregvar < maxregvar - 1)
    for (i = 0; i < VARTABSIZE; i++)
      for (p = vartable[i]; p; p = p->link)
	{
	  entableaddr(p);
	  if ((!p->loopset) &&
	      (!p->mixedtype) &&
	      (p->vstg != STGARG) &&
	      !((p->vstg == STGCOMMON) && ((!p->fixed) || commonunusable)))
	    for (q = p->varlist; q; q = q->link)
	      entablevar(q);
	}

  for (i = 0; (i <= tabletop) && (topregvar + 1 < maxregvar); i++)
1127
1128
1129
1130
1131
1132
1133


1134
1135
1136
1137
1138
1139
1140
      scanvars(lhs->memoffset);
      if ((lhs->vstg == STGREG) || (lhs->vstg == STGPREG))
	return;
      if (ISVAR(lhs))
	{
          addrinfo = getaddr(lhs);
          addrinfo->isset = YES;


          if (fixedaddress(lhs) && ISREGTYPE(lhs->vtype))
	    {
	      varinfo = getvar(addrinfo, lhs);
	      if (addrinfo->freeuse) varinfo->isused = YES;
	      varinfo->isset = YES;
	      if (!addrinfo->freeuse && !varinfo->isused)
	        varinfo->setfirst = YES;







>
>







1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
      scanvars(lhs->memoffset);
      if ((lhs->vstg == STGREG) || (lhs->vstg == STGPREG))
	return;
      if (ISVAR(lhs))
	{
          addrinfo = getaddr(lhs);
          addrinfo->isset = YES;
	  if (docount > 1)
	    addrinfo->loopset = YES;
          if (fixedaddress(lhs) && ISREGTYPE(lhs->vtype))
	    {
	      varinfo = getvar(addrinfo, lhs);
	      if (addrinfo->freeuse) varinfo->isused = YES;
	      varinfo->isset = YES;
	      if (!addrinfo->freeuse && !varinfo->isused)
	        varinfo->setfirst = YES;
1163
1164
1165
1166
1167
1168
1169


1170
1171
1172
1173
1174
1175
1176
      scanvars(lhs->memoffset);
      if ((lhs->vstg == STGREG) || (lhs->vstg == STGPREG))
	return;
      if (ISVAR(lhs))
	{
          addrinfo = getaddr(lhs);
          addrinfo->isset = YES;


          if (fixedaddress(lhs))
	    {
	      if (ISREGTYPE(lhs->vtype))
	        {
	          varinfo = getvar(addrinfo, lhs);
	          varinfo->isused = YES;
	          varinfo->isset = YES;







>
>







1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
      scanvars(lhs->memoffset);
      if ((lhs->vstg == STGREG) || (lhs->vstg == STGPREG))
	return;
      if (ISVAR(lhs))
	{
          addrinfo = getaddr(lhs);
          addrinfo->isset = YES;
	  if (docount > 1)
	    addrinfo->loopset = YES;
          if (fixedaddress(lhs))
	    {
	      if (ISREGTYPE(lhs->vtype))
	        {
	          varinfo = getvar(addrinfo, lhs);
	          varinfo->isused = YES;
	          varinfo->isset = YES;
1212
1213
1214
1215
1216
1217
1218


1219
1220
1221
1222
1223
1224
1225
	      ap = (Addrp) args->datap;
	      scanvars(ap->vleng);
	      scanvars(ap->memoffset);
	      if (!ISVAR(ap)) continue;

	      addrinfo = getaddr(ap);
	      addrinfo->isset = YES;


	      if (fixedaddress(ap) && ISREGTYPE(ap->vtype))
		{
		  varinfo = getvar(addrinfo, ap);
		  if (ap->vstg != STGCONST)
		    varinfo->isset = YES;
		  varinfo->isused = YES;
		}







>
>







1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
	      ap = (Addrp) args->datap;
	      scanvars(ap->vleng);
	      scanvars(ap->memoffset);
	      if (!ISVAR(ap)) continue;

	      addrinfo = getaddr(ap);
	      addrinfo->isset = YES;
	      if (docount > 1)
		addrinfo->loopset = YES;
	      if (fixedaddress(ap) && ISREGTYPE(ap->vtype))
		{
		  varinfo = getvar(addrinfo, ap);
		  if (ap->vstg != STGCONST)
		    varinfo->isset = YES;
		  varinfo->isused = YES;
		}
1946
1947
1948
1949
1950
1951
1952







1953
1954
1955
1956
1957
1958
1959

  r = p->exprblock.rightp;
  if ((r->tag == TADDR) &&
      (r->addrblock.vstg == STGREG) &&
      (r->addrblock.memno == l->addrblock.memno))
    return YES;








  return NO;
}



LOCAL deleteslot(sp)
Slotp sp;







>
>
>
>
>
>
>







1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001

  r = p->exprblock.rightp;
  if ((r->tag == TADDR) &&
      (r->addrblock.vstg == STGREG) &&
      (r->addrblock.memno == l->addrblock.memno))
    return YES;

  if ((r->tag == TEXPR) &&
      (r->exprblock.opcode == OPADDR) &&
      (r->exprblock.leftp->tag == TADDR) &&
      (r->exprblock.leftp->addrblock.vstg == STGPREG) &&
      (r->exprblock.leftp->addrblock.memno == l->addrblock.memno))
    return YES;

  return NO;
}



LOCAL deleteslot(sp)
Slotp sp;
2078
2079
2080
2081
2082
2083
2084

2085
2086
2087
2088
2089
2090
2091
int	match;
Slotp	nextslot;
Slotp	sl1,sl2;
Slotp	lastlabslot;

if (! optimflag) return;


lastlabslot = NULL;
for (sl1 = firstslot; sl1; sl1 = nextslot)
	{
	nextslot = sl1->next;
	switch (sl1->type)
	    {








>







2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
int	match;
Slotp	nextslot;
Slotp	sl1,sl2;
Slotp	lastlabslot;

if (! optimflag) return;

docount = 0;
lastlabslot = NULL;
for (sl1 = firstslot; sl1; sl1 = nextslot)
	{
	nextslot = sl1->next;
	switch (sl1->type)
	    {

2101
2102
2103
2104
2105
2106
2107

2108
2109
2110
2111

2112
2113
2114
2115
2116
2117
2118
			doend = sl1;
			alreg ();
			}
		break;
----- */

	    case SKDOHEAD:

		pushq (sl1);
		break;

	    case SKENDDO:

		match = 0;
		for (sl2 = sl1; sl2; sl2 = sl2->prev)
			{
			if (sl2->type == SKDOHEAD) match++;
			else if (sl2->type == SKENDDO) match--;
			if (match == 0) break;
			}







>




>







2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
			doend = sl1;
			alreg ();
			}
		break;
----- */

	    case SKDOHEAD:
		++docount;
		pushq (sl1);
		break;

	    case SKENDDO:
		--docount;
		match = 0;
		for (sl2 = sl1; sl2; sl2 = sl2->prev)
			{
			if (sl2->type == SKDOHEAD) match++;
			else if (sl2->type == SKENDDO) match--;
			if (match == 0) break;
			}
2131
2132
2133
2134
2135
2136
2137
2138
2139






2140





2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157

		if (!dqptr)
			fatal ("garbled doqueue in regalloc");

		/*  sl1 now points to the SKENDDO slot; the SKNULL slot
		 *  is reached through sl1->nullslot
		 */
		doend = (Slotp) sl1->nullslot;







		alreg ();





		break;

	    default:
		break;
	    }
	}

while (dqtop)
	popq (dqtop->dohead);

return;
}



LOCAL pushq(sp)
Slotp sp;







|

>
>
>
>
>
>
|
>
>
>
>
>







<
<
<







2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203



2204
2205
2206
2207
2208
2209
2210

		if (!dqptr)
			fatal ("garbled doqueue in regalloc");

		/*  sl1 now points to the SKENDDO slot; the SKNULL slot
		 *  is reached through sl1->nullslot
		 */
		dqptr->doend = (Slotp) sl1->nullslot;

		if (docount == 0)
			{
			for (dqptr = dqbottom; dqptr; dqptr = dqptr->up)
				{
				dohead = dqptr->dohead;
				doend = dqptr->doend;
				alreg();
				}
			while (dqtop)
				popq (dqtop->dohead);
			docount = 0;
			}
		break;

	    default:
		break;
	    }
	}




return;
}



LOCAL pushq(sp)
Slotp sp;

Changes to usr.bin/f77/pass1.vax/stab.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21










22
23
24
25
26
27
28
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)stab.c	5.1 (Berkeley) 06/07/85";
#endif not lint

/*
 * stab.c
 *
 * Symbolic debugging info interface for the f77 compiler.
 *
 * Here we generate pseudo-ops that cause the assembler to put
 * symbolic debugging information into the object file.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	stab.c,v $










 * Revision 1.2  85/02/02  01:30:09  donn
 * Don't put the 'program' name into the file; it only confuses dbx, sigh.
 * 
 */

#include "defs.h"








|













>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)stab.c	5.2 (Berkeley) 01/10/86";
#endif not lint

/*
 * stab.c
 *
 * Symbolic debugging info interface for the f77 compiler.
 *
 * Here we generate pseudo-ops that cause the assembler to put
 * symbolic debugging information into the object file.
 *
 * University of Utah CS Dept modification history:
 *
 * $Log:	stab.c,v $
 * Revision 5.3  86/01/10  17:12:58  donn
 * Add junk to handle PARAMETER variables.
 * 
 * Revision 5.2  86/01/10  13:51:31  donn
 * Changes to produce correct stab information for logical and logical*2 types
 * (from Jerry Berkman) plus changes for dummy procedures.
 * 
 * Revision 5.1  85/08/10  03:50:06  donn
 * 4.3 alpha
 * 
 * Revision 1.2  85/02/02  01:30:09  donn
 * Don't put the 'program' name into the file; it only confuses dbx, sigh.
 * 
 */

#include "defs.h"

121
122
123
124
125
126
127


128
129
130
131
132
133
134
135
136
137
138





















139
140
141
142
143
144
145
146






147
148
149
150
151
152
153
154
155
156
157
 */

public namestab(sym)
Namep sym;
{
    register Namep p;
    char *varname, *classname;


    Boolean ignore;
    int vartype;

	ignore = false;
	p = sym;
	if(!p->vdcldone) return;
	vartype = p->vtype;
	varname = varstr(VL, p->varname);
	switch (p->vclass) {
	    case CLPARAM:	/* parameter (constant) */
		classname = "c";





















		break;

	    case CLVAR:		/* variable */
	    case CLUNKNOWN:   
 		if(p->vstg == STGARG) classname = "v";
    		else classname = "V";
		break;







	    case CLMAIN:	/* main program */
	    case CLENTRY:	/* secondary entry point */
	    case CLBLOCK:       /* block data name*/
	    case CLPROC:	/* external or function or subroutine */
		ignore = true;  /* these are put out by entrystab */
		break;


	}
	if (not ignore) {
	    sprintf(asmline, "\t.stabs\t\"%s:%s", varname, classname);







>
>










|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








>
>
>
>
>
>



<







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

189
190
191
192
193
194
195
 */

public namestab(sym)
Namep sym;
{
    register Namep p;
    char *varname, *classname;
    expptr ep;
    char buf[100];
    Boolean ignore;
    int vartype;

	ignore = false;
	p = sym;
	if(!p->vdcldone) return;
	vartype = p->vtype;
	varname = varstr(VL, p->varname);
	switch (p->vclass) {
	    case CLPARAM:	/* parameter (constant) */
		classname = buf;
		if ((ep = ((struct Paramblock *) p)->paramval) &&
		    ep->tag == TCONST) {
		  switch(ep->constblock.vtype) {
		    case TYLONG:
		    case TYSHORT:
		    case TYLOGICAL:
		    case TYADDR:
		      sprintf(buf, "c=i%d", ep->constblock.const.ci);
		      break;
		    case TYREAL:
		    case TYDREAL:
		      sprintf(buf, "c=r%f", ep->constblock.const.cd[0]);
		      break;
		    default:
		      /* punt */
		      ignore = true;
		      break;
		  }
		} else {
		  ignore = true;
		}
		break;

	    case CLVAR:		/* variable */
	    case CLUNKNOWN:   
 		if(p->vstg == STGARG) classname = "v";
    		else classname = "V";
		break;

	    case CLPROC:	/* external or function or subroutine */
		if(p->vstg == STGARG) {
		    classname = "v";
		    break;
		}
		/* FALL THROUGH */
	    case CLMAIN:	/* main program */
	    case CLENTRY:	/* secondary entry point */
	    case CLBLOCK:       /* block data name*/

		ignore = true;  /* these are put out by entrystab */
		break;


	}
	if (not ignore) {
	    sprintf(asmline, "\t.stabs\t\"%s:%s", varname, classname);
165
166
167
168
169
170
171





172
173
174
175
176
177
178
	      case STGEXT :
	      case STGINTR :
	      case STGSTFUNCT :
	      case STGLENG :
	      case STGNULL :
	      case STGREG :
	      case STGINIT :





	          sprintf(asmline+len,
		  "\",0x%x,0,0,0 /* don't know how to calc loc for stg %d*/ \n",
			       N_LSYM,p->vstg);
		  break;

	      case STGARG :
		  sprintf(asmline+len,"\",0x%x,0,0,%d \n",







>
>
>
>
>







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
	      case STGEXT :
	      case STGINTR :
	      case STGSTFUNCT :
	      case STGLENG :
	      case STGNULL :
	      case STGREG :
	      case STGINIT :
		  if (p->vclass == CLPARAM) {
		      /* these have zero storage class for some reason */
		      sprintf(asmline+len, "\",0x%x,0,0,0\n", N_LSYM);
		      break;
		  }
	          sprintf(asmline+len,
		  "\",0x%x,0,0,0 /* don't know how to calc loc for stg %d*/ \n",
			       N_LSYM,p->vstg);
		  break;

	      case STGARG :
		  sprintf(asmline+len,"\",0x%x,0,0,%d \n",
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

233




234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249




250

251
252
253
254

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270


271
272
273
274
275
276
277
		     	N_LSYM, p->voffset);

	    }
	    p2pass(asmline);       
	}
}

static typenum[NTYPES]; /* has the given type already been defined ?*/

private writestabtype(type)
int type;
{
 char asmline[130];
 static char *typename[NTYPES] =
 { "unknown", "addr","integer*2", "integer", "real", "double precision",
   "complex", "double complex", "logical", "char", "void", "error" };

 static int typerange[NTYPES] = { 0, 3, 2, 3, 4, 5, 6, 7, 3, 9, 10, 11 };

 /* compare with typesize[] in init.c */
 static int typebounds[2] [NTYPES] ={
 /* "unknown", "addr","integer*2", "integer",    "real", "double precision", */
    { 0      ,   0   ,   -32768,    -2147483648,   4,       8,
 /* "complex", "double complex", "logical", "char", "void", "error" }; */
      8,         16,               0,        0,       0,          0 },
 /* "unknown", "addr","integer*2", "integer",    "real", "double precision", */
    { 0  ,       -1,      32767,    2147483647,   0,         0,
 /* "complex", "double complex", "logical", "char", "void", "error" }; */
      0,         0,               1,        127,       0,          0 }
 };
                    


 if( type < 0 || type > NTYPES) badtype("writestabtype",type);





    if (typenum[type]) return(typenum[type]);
    typenum[type] = type;
    sprintf(asmline, "\t.stabs\t\"%s:t%d=r%d;%ld;%ld;\",0x%x,0,0,0 \n", 
	typename[type], type, typerange[type], typebounds[0][type], 
        typebounds[1][type], N_GSYM) ;
    p2pass(asmline);
    return(typenum[type]);
}


private getbasenum(p)
Namep p;
{

  int t;




  t = p->vtype;

  if( t < TYSHORT || t > TYSUBR)
  dclerr("can't get dbx basetype information",p);

  if (p->vtype == TYCHAR || p->vdim != nil ) writestabtype(TYINT);

  return(writestabtype(t));
}

/*
 * Generate debugging information for the given type of the given symbol.
 */

private addtypeinfo(sym)
Namep sym;
{
    Namep p;
    int i,tnum;
    char lb[20],ub[20];

    p = sym;
    if (p->tag != TNAME) badtag("addtypeinfo",p->tag);



    tnum = getbasenum(p);
    if(p->vdim != (struct Dimblock *) ENULL) {
    
      for (i = p->vdim->ndim-1; i >=0 ; --i) { 
         if(p->vdim->dims[i].lbaddr == ENULL) {
	      sprintf(lb,"%d", p->vdim->dims[i].lb->constblock.const.ci);







|





|
|
|

|


|


|
|

|
|
|



>
|
>
>
>
>
















>
>
>
>
|
>
|
|

|
>
















>
>







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
		     	N_LSYM, p->voffset);

	    }
	    p2pass(asmline);       
	}
}

static typenum[NTYPES+1]; /* has the given type already been defined ?*/

private writestabtype(type)
int type;
{
 char asmline[130];
 static char *typename[NTYPES+1] = {
 "unknown", "addr", "integer*2", "integer", "real", "double precision",
 "complex", "double complex", "logical", "char", "void", "error", "logical*2" };

 static int typerange[NTYPES+1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };

 /* compare with typesize[] in init.c */
 static int typebounds[2] [NTYPES+1] ={
 /* "unknown", "addr","integer*2", "integer",    "real", "double precision", */
    { 0      ,   0   ,   -32768,    -2147483648,   4,       8,
 /* "complex", "d-complex", "logical", "char", "void", "error", "logical*2" */
      8,         16,          4,        0,       0,      0,       2 },
 /* "unknown", "addr","integer*2", "integer",    "real", "double precision", */
    { 0  ,       -1,      32767,    2147483647,    0,       0,
 /* "complex", "d-complex", "logical", "char", "void", "error", "logical*2" */
      0,         0,           0,        127,     0,      0,       0 }
 };
                    

    if (type < 0 || type > NTYPES)
	badtype("writestabtype",type);

    /* substitute "logical*2" for "logical" when "-i2" compiler flag used */
    if (type == TYLOGICAL && tylogical == TYSHORT)
	type = NTYPES;

    if (typenum[type]) return(typenum[type]);
    typenum[type] = type;
    sprintf(asmline, "\t.stabs\t\"%s:t%d=r%d;%ld;%ld;\",0x%x,0,0,0 \n", 
	typename[type], type, typerange[type], typebounds[0][type], 
        typebounds[1][type], N_GSYM) ;
    p2pass(asmline);
    return(typenum[type]);
}


private getbasenum(p)
Namep p;
{

  int t;

  if (p->vclass == CLPROC && p->vstg == STGARG)
    t = TYADDR;
  else
    t = p->vtype;

  if (t < TYADDR || t > TYSUBR)
    dclerr("can't get dbx basetype information",p);

  if (p->vtype == TYCHAR || p->vdim != nil)
    writestabtype(TYINT);
  return(writestabtype(t));
}

/*
 * Generate debugging information for the given type of the given symbol.
 */

private addtypeinfo(sym)
Namep sym;
{
    Namep p;
    int i,tnum;
    char lb[20],ub[20];

    p = sym;
    if (p->tag != TNAME) badtag("addtypeinfo",p->tag);
    if (p->vclass == CLPARAM)
	return;

    tnum = getbasenum(p);
    if(p->vdim != (struct Dimblock *) ENULL) {
    
      for (i = p->vdim->ndim-1; i >=0 ; --i) { 
         if(p->vdim->dims[i].lbaddr == ENULL) {
	      sprintf(lb,"%d", p->vdim->dims[i].lb->constblock.const.ci);

Changes to usr.bin/ftp/main.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	5.1 (Berkeley) 05/31/85";
#endif not lint

/*
 * FTP User Program -- Command Interface.
 */
#include <sys/param.h>
#include <sys/socket.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	5.2 (Berkeley) 01/10/86";
#endif not lint

/*
 * FTP User Program -- Command Interface.
 */
#include <sys/param.h>
#include <sys/socket.h>
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
		putchar('\n');
	for (;;) {
		if (fromatty) {
			printf("ftp> ");
			fflush(stdout);
		}
		if (gets(line) == 0) {
			if (feof(stdin)) {
				if (!fromatty)
					quit();
				clearerr(stdin);
				putchar('\n');
			}
			break;
		}
		if (line[0] == 0)
			break;
		makeargv();
		c = getcmd(margv[0]);
		if (c == (struct cmd *)-1) {







|
<
|
<
<
<







187
188
189
190
191
192
193
194

195



196
197
198
199
200
201
202
		putchar('\n');
	for (;;) {
		if (fromatty) {
			printf("ftp> ");
			fflush(stdout);
		}
		if (gets(line) == 0) {
			if (feof(stdin))

				quit();



			break;
		}
		if (line[0] == 0)
			break;
		makeargv();
		c = getcmd(margv[0]);
		if (c == (struct cmd *)-1) {

Changes to usr.bin/gprof/Makefile.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
#
# Copyright (c) 1983 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)Makefile	5.2 (Berkeley) 06/18/85
#
SCCSID = @(#)Makefile	5.2 (Berkeley) 06/18/85

DFLAGS = 
CFLAGS = -O ${DFLAGS}
LINTFLAGS = -x -a -n ${DFLAGS}

RM=	/bin/rm -f
INSTALL=install
PR=pr


GPROFHDRS =	gprof.h vax.h
GPROFSRCS =	gprof.c arcs.c dfn.c lookup.c calls.c hertz.c \
		printgprof.c printlist.c
GPROFOBJS =	gprof.o arcs.o dfn.o lookup.o calls.o hertz.o \
		printgprof.o printlist.o

gprof: ${GPROFOBJS}
	cc -o gprof ${CFLAGS} ${GPROFOBJS}

install: gprof gprof.flat gprof.callg
	install -s -g kmem -m 2755 gprof ${DESTDIR}/usr/ucb/gprof





|

<
|
|
|
|




|
>
|
|

|







1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# Copyright (c) 1983 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)Makefile	5.3 (Berkeley) 01/07/86
#

DESTDIR=
DFLAGS= 
CFLAGS=	-O ${DFLAGS}
LINTFLAGS= -x -a -n ${DFLAGS}

RM=	/bin/rm -f
INSTALL=install
PR=pr
#MACHINE=	${MACHINE}
MACHINE=	tahoe
GPROFHDRS=	gprof.h ${MACHINE}.h
GPROFSRCS=	gprof.c arcs.c dfn.c lookup.c ${MACHINE}.c hertz.c \
		printgprof.c printlist.c
GPROFOBJS=	gprof.o arcs.o dfn.o lookup.o ${MACHINE}.o hertz.o \
		printgprof.o printlist.o

gprof: ${GPROFOBJS}
	cc -o gprof ${CFLAGS} ${GPROFOBJS}

install: gprof gprof.flat gprof.callg
	install -s -g kmem -m 2755 gprof ${DESTDIR}/usr/ucb/gprof
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	@ ${PR} gcrt0.h
	@ ${PR} ${GPROFHDRS} ${GPROFSRCS}
	@ ${PR} gprof.flat gprof.callg

lint:
	lint ${LINTFLAGS} ${DFLAGS} ${GPROFSRCS}

gprof.o: gprof.c gprof.h vax.h gcrt0.h
arcs.o: arcs.c gprof.h vax.h gcrt0.h
lookup.o: lookup.c gprof.h vax.h gcrt0.h
dfn.o: dfn.c gprof.h vax.h gcrt0.h
calls.o: calls.c gprof.h vax.h gcrt0.h
hertz.o: gprof.h vax.h hertz.c
printgprof.o: printgprof.c gprof.h vax.h gcrt0.h
printlist.o: printlist.c gprof.h vax.h gcrt0.h







|
|
|
|
|
|
|
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	@ ${PR} gcrt0.h
	@ ${PR} ${GPROFHDRS} ${GPROFSRCS}
	@ ${PR} gprof.flat gprof.callg

lint:
	lint ${LINTFLAGS} ${DFLAGS} ${GPROFSRCS}

gprof.o: gprof.c gprof.h ${MACHINE}.h gcrt0.h
arcs.o: arcs.c gprof.h ${MACHINE}.h gcrt0.h
lookup.o: lookup.c gprof.h ${MACHINE}.h gcrt0.h
dfn.o: dfn.c gprof.h ${MACHINE}.h gcrt0.h
${MACHINE}.o: ${MACHINE}.c gprof.h ${MACHINE}.h gcrt0.h
hertz.o: gprof.h ${MACHINE}.h hertz.c
printgprof.o: printgprof.c gprof.h ${MACHINE}.h gcrt0.h
printlist.o: printlist.c gprof.h ${MACHINE}.h gcrt0.h

Changes to usr.bin/gprof/arcs.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)arcs.c	5.2 (Berkeley) 06/04/85";
#endif not lint

#include "gprof.h"

    /*
     *	add (or just increment) an arc
     */







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)arcs.c	5.3 (Berkeley) 01/07/86";
#endif not lint

#include "gprof.h"

    /*
     *	add (or just increment) an arc
     */
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	parentp -> propchild = 0.0;
	parentp -> printflag = FALSE;
	parentp -> toporder = DFN_NAN;
	parentp -> cycleno = 0;
	parentp -> cyclehead = parentp;
	parentp -> cnext = 0;
	if ( cflag ) {
	    findcalls( parentp , parentp -> value , (parentp+1) -> value );
	}
    }
	/*
	 *	topologically order things
	 *	if any node is unnumbered,
	 *	    number it and any of its descendents.
	 */







|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	parentp -> propchild = 0.0;
	parentp -> printflag = FALSE;
	parentp -> toporder = DFN_NAN;
	parentp -> cycleno = 0;
	parentp -> cyclehead = parentp;
	parentp -> cnext = 0;
	if ( cflag ) {
	    findcall( parentp , parentp -> value , (parentp+1) -> value );
	}
    }
	/*
	 *	topologically order things
	 *	if any node is unnumbered,
	 *	    number it and any of its descendents.
	 */

Changes to usr.bin/gprof/gprof.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



20
21
22
23
24
25
26
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gprof.h	5.1 (Berkeley) 06/04/85
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <a.out.h>
#include "gcrt0.h"

#if vax
#   include "vax.h"
#endif
#if sun
#    include "sun.h"



#endif


    /*
     *	who am i, for error messages.
     */
char	*whoami;





|












|
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)gprof.h	5.2 (Berkeley) 01/07/86
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <a.out.h>
#include "gcrt0.h"

#if vax
#   include "vax.h"
#endif
#if sun
#   include "sun.h"
#endif
#if tahoe
#   include "tahoe.h"
#endif


    /*
     *	who am i, for error messages.
     */
char	*whoami;
242
243
244
245
246
247
248
249
250
251
252
#define	DFNDEBUG	1
#define	CYCLEDEBUG	2
#define	ARCDEBUG	4
#define	TALLYDEBUG	8
#define	TIMEDEBUG	16
#define	SAMPLEDEBUG	32
#define	AOUTDEBUG	64
#define	CALLSDEBUG	128
#define	LOOKUPDEBUG	256
#define	PROPDEBUG	512
#define	ANYDEBUG	1024







|



245
246
247
248
249
250
251
252
253
254
255
#define	DFNDEBUG	1
#define	CYCLEDEBUG	2
#define	ARCDEBUG	4
#define	TALLYDEBUG	8
#define	TIMEDEBUG	16
#define	SAMPLEDEBUG	32
#define	AOUTDEBUG	64
#define	CALLDEBUG	128
#define	LOOKUPDEBUG	256
#define	PROPDEBUG	512
#define	ANYDEBUG	1024

Added usr.bin/gprof/tahoe.c.

























































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
#ifndef lint
static	char *sccsid = "@(#)tahoe.c	1.2 (Berkeley) 01/07/86";
#endif not lint

#include	"gprof.h"

    /*
     *	a namelist entry to be the child of indirect callf
     */
nltype	indirectchild = {
	"(*)" ,				/* the name */
	(unsigned long) 0 ,		/* the pc entry point */
	(unsigned long) 0 ,		/* entry point aligned to histogram */
	(double) 0.0 ,			/* ticks in this routine */
	(double) 0.0 ,			/* cumulative ticks in children */
	(long) 0 ,			/* how many times called */
	(long) 0 ,			/* how many calls to self */
	(double) 1.0 ,			/* propagation fraction */
	(double) 0.0 ,			/* self propagation time */
	(double) 0.0 ,			/* child propagation time */
	(bool) 0 ,			/* print flag */
	(int) 0 ,			/* index in the graph list */
	(int) 0 , 			/* graph call chain top-sort order */
	(int) 0 ,			/* internal number of cycle on */
	(struct nl *) &indirectchild ,	/* pointer to head of cycle */
	(struct nl *) 0 ,		/* pointer to next member of cycle */
	(arctype *) 0 ,			/* list of caller arcs */
	(arctype *) 0 			/* list of callee arcs */
    };

operandenum
operandmode( modep )
    unsigned char	*modep;
{
    long	usesreg = ((long)*modep) & 0xf;
    
    switch ( ((long)*modep) >> 4 ) {
	case 0:
	case 1:
	case 2:
	case 3:
	    return literal;
	case 4:
	    return indexed;
	case 5:
	    return reg;
	case 6:
	    return regdef;
	case 7:
	    return autodec;
	case 8:
	    return ( usesreg != 0xe ? autoinc : immediate );
	case 9:
	    return ( usesreg != PC ? autoincdef : absolute );
	case 10:
	    return ( usesreg != PC ? bytedisp : byterel );
	case 11:
	    return ( usesreg != PC ? bytedispdef : bytereldef );
	case 12:
	    return ( usesreg != PC ? worddisp : wordrel );
	case 13:
	    return ( usesreg != PC ? worddispdef : wordreldef );
	case 14:
	    return ( usesreg != PC ? longdisp : longrel );
	case 15:
	    return ( usesreg != PC ? longdispdef : longreldef );
    }
    /* NOTREACHED */
}

char *
operandname( mode )
    operandenum	mode;
{
    
    switch ( mode ) {
	case literal:
	    return "literal";
	case indexed:
	    return "indexed";
	case reg:
	    return "register";
	case regdef:
	    return "register deferred";
	case autodec:
	    return "autodecrement";
	case autoinc:
	    return "autoincrement";
	case autoincdef:
	    return "autoincrement deferred";
	case bytedisp:
	    return "byte displacement";
	case bytedispdef:
	    return "byte displacement deferred";
	case byterel:
	    return "byte relative";
	case bytereldef:
	    return "byte relative deferred";
	case worddisp:
	    return "word displacement";
	case worddispdef:
	    return "word displacement deferred";
	case wordrel:
	    return "word relative";
	case wordreldef:
	    return "word relative deferred";
	case immediate:
	    return "immediate";
	case absolute:
	    return "absolute";
	case longdisp:
	    return "long displacement";
	case longdispdef:
	    return "long displacement deferred";
	case longrel:
	    return "long relative";
	case longreldef:
	    return "long relative deferred";
    }
    /* NOTREACHED */
}

long
operandlength( modep )
    unsigned char	*modep;
{
    
    switch ( operandmode( modep ) ) {
	case literal:
	case reg:
	case regdef:
	case autodec:
	case autoinc:
	case autoincdef:
	    return 1;
	case bytedisp:
	case bytedispdef:
	case byterel:
	case bytereldef:
	    return 2;
	case worddisp:
	case worddispdef:
	case wordrel:
	case wordreldef:
	    return 3;
	case immediate:
	case absolute:
	case longdisp:
	case longdispdef:
	case longrel:
	case longreldef:
	    return 5;
	case indexed:
	    return 1+operandlength( modep + 1 );
    }
    /* NOTREACHED */
}

unsigned long
reladdr( modep )
    char	*modep;
{
    operandenum	mode = operandmode( modep );
    char	*cp;
    short	*sp;
    long	*lp;
    int		i;
    long	value = 0;

    cp = modep;
    cp += 1;			/* skip over the mode */
    switch ( mode ) {
	default:
	    fprintf( stderr , "[reladdr] not relative address\n" );
	    return (unsigned long) modep;
	case byterel:
	    return (unsigned long) ( cp + sizeof *cp + *cp );
	case wordrel:
	    for (i = 0; i < sizeof *sp; i++)
		value = (value << 8) + (cp[i] & 0xff);
	    return (unsigned long) ( cp + sizeof *sp + value );
	case longrel:
	    for (i = 0; i < sizeof *lp; i++)
		value = (value << 8) + (cp[i] & 0xff);
	    return (unsigned long) ( cp + sizeof *lp + value );
    }
}

findcall( parentp , p_lowpc , p_highpc )
    nltype		*parentp;
    unsigned long	p_lowpc;
    unsigned long	p_highpc;
{
    unsigned char	*instructp;
    long		length;
    nltype		*childp;
    operandenum		mode;
    operandenum		firstmode;
    unsigned long	destpc;

    if ( textspace == 0 ) {
	return;
    }
    if ( p_lowpc < s_lowpc ) {
	p_lowpc = s_lowpc;
    }
    if ( p_highpc > s_highpc ) {
	p_highpc = s_highpc;
    }
#   ifdef DEBUG
	if ( debug & CALLDEBUG ) {
	    printf( "[findcall] %s: 0x%x to 0x%x\n" ,
		    parentp -> name , p_lowpc , p_highpc );
	}
#   endif DEBUG
    for (   instructp = textspace + p_lowpc ;
	    instructp < textspace + p_highpc ;
	    instructp += length ) {
	length = 1;
	if ( *instructp == CALLF ) {
		/*
		 *	maybe a callf, better check it out.
		 *	skip the count of the number of arguments.
		 */
#	    ifdef DEBUG
		if ( debug & CALLDEBUG ) {
		    printf( "[findcall]\t0x%x:callf" , instructp - textspace );
		}
#	    endif DEBUG
	    firstmode = operandmode( instructp+length );
	    switch ( firstmode ) {
		case literal:
		case immediate:
		    break;
		default:
		    goto botched;
	    }
	    length += operandlength( instructp+length );
	    mode = operandmode( instructp + length );
#	    ifdef DEBUG
		if ( debug & CALLDEBUG ) {
		    printf( "\tfirst operand is %s", operandname( firstmode ) );
		    printf( "\tsecond operand is %s\n" , operandname( mode ) );
		}
#	    endif DEBUG
	    switch ( mode ) {
		case regdef:
		case bytedispdef:
		case worddispdef:
		case longdispdef:
		case bytereldef:
		case wordreldef:
		case longreldef:
			/*
			 *	indirect call: call through pointer
			 *	either	*d(r)	as a parameter or local
			 *		(r)	as a return value
			 *		*f	as a global pointer
			 *	[are there others that we miss?,
			 *	 e.g. arrays of pointers to functions???]
			 */
		    addarc( parentp , &indirectchild , (long) 0 );
		    length += operandlength( instructp + length );
		    continue;
		case byterel:
		case wordrel:
		case longrel:
			/*
			 *	regular pc relative addressing
			 *	check that this is the address of 
			 *	a function.
			 */
		    destpc = reladdr( instructp+length )
				- (unsigned long) textspace;
		    if ( destpc >= s_lowpc && destpc <= s_highpc ) {
			childp = nllookup( destpc );
#			ifdef DEBUG
			    if ( debug & CALLDEBUG ) {
				printf( "[findcall]\tdestpc 0x%x" , destpc );
				printf( " childp->name %s" , childp -> name );
				printf( " childp->value 0x%x\n" ,
					childp -> value );
			    }
#			endif DEBUG
			if ( childp -> value == destpc ) {
				/*
				 *	a hit
				 */
			    addarc( parentp , childp , (long) 0 );
			    length += operandlength( instructp + length );
			    continue;
			}
			goto botched;
		    }
			/*
			 *	else:
			 *	it looked like a callf,
			 *	but it wasn't to anywhere.
			 */
		    goto botched;
		default:
		botched:
			/*
			 *	something funny going on.
			 */
#		    ifdef DEBUG
			if ( debug & CALLDEBUG ) {
			    printf( "[findcall]\tbut it's a botch\n" );
			}
#		    endif DEBUG
		    length = 1;
		    continue;
	    }
	}
    }
}

Added usr.bin/gprof/tahoe.h.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*	tahoe.h	1.1	86/01/07	*/

    /*
     *	opcode of the `callf' instruction
     */
#define	CALLF	0xfe

    /*
     *	offset (in bytes) of the code from the entry address of a routine.
     *	(see asgnsamples for use and explanation.)
     */
#define OFFSET_OF_CODE	2
#define	UNITS_TO_CODE	(OFFSET_OF_CODE / sizeof(UNIT))

    /*
     *	register for pc relative addressing
     */
#define	PC	0xf

enum opermodes {
    literal, indexed, reg, regdef, autodec, autoinc, autoincdef, 
    bytedisp, bytedispdef, worddisp, worddispdef, longdisp, longdispdef,
    immediate, absolute, byterel, bytereldef, wordrel, wordreldef,
    longrel, longreldef
};
typedef enum opermodes	operandenum;

Changes to usr.bin/gprof/vax.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)vax.c	5.1 (Berkeley) 06/04/85";
#endif not lint

#include	"gprof.h"

    /*
     *	a namelist entry to be the child of indirect calls
     */







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
static char sccsid[] = "@(#)vax.c	5.3 (Berkeley) 01/07/86";
#endif not lint

#include	"gprof.h"

    /*
     *	a namelist entry to be the child of indirect calls
     */
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
	    return (unsigned long) ( cp + sizeof *sp + *sp );
	case longrel:
	    lp = (long *) cp;
	    return (unsigned long) ( cp + sizeof *lp + *lp );
    }
}

findcalls( parentp , p_lowpc , p_highpc )
    nltype		*parentp;
    unsigned long	p_lowpc;
    unsigned long	p_highpc;
{
    unsigned char	*instructp;
    long		length;
    nltype		*childp;







|







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
	    return (unsigned long) ( cp + sizeof *sp + *sp );
	case longrel:
	    lp = (long *) cp;
	    return (unsigned long) ( cp + sizeof *lp + *lp );
    }
}

findcall( parentp , p_lowpc , p_highpc )
    nltype		*parentp;
    unsigned long	p_lowpc;
    unsigned long	p_highpc;
{
    unsigned char	*instructp;
    long		length;
    nltype		*childp;
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
    if ( p_lowpc < s_lowpc ) {
	p_lowpc = s_lowpc;
    }
    if ( p_highpc > s_highpc ) {
	p_highpc = s_highpc;
    }
#   ifdef DEBUG
	if ( debug & CALLSDEBUG ) {
	    printf( "[findcalls] %s: 0x%x to 0x%x\n" ,
		    parentp -> name , p_lowpc , p_highpc );
	}
#   endif DEBUG
    for (   instructp = textspace + p_lowpc ;
	    instructp < textspace + p_highpc ;
	    instructp += length ) {
	length = 1;
	if ( *instructp == CALLS ) {
		/*
		 *	maybe a calls, better check it out.
		 *	skip the count of the number of arguments.
		 */
#	    ifdef DEBUG
		if ( debug & CALLSDEBUG ) {
		    printf( "[findcalls]\t0x%x:calls" , instructp - textspace );
		}
#	    endif DEBUG
	    firstmode = operandmode( (struct modebyte *) (instructp+length) );
	    switch ( firstmode ) {
		case literal:
		case immediate:
		    break;
		default:
		    goto botched;
	    }
	    length += operandlength( (struct modebyte *) (instructp+length) );
	    mode = operandmode( (struct modebyte *) ( instructp + length ) );
#	    ifdef DEBUG
		if ( debug & CALLSDEBUG ) {
		    printf( "\tfirst operand is %s", operandname( firstmode ) );
		    printf( "\tsecond operand is %s\n" , operandname( mode ) );
		}
#	    endif DEBUG
	    switch ( mode ) {
		case regdef:
		case bytedispdef:







|
|













|
|













|







206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
    if ( p_lowpc < s_lowpc ) {
	p_lowpc = s_lowpc;
    }
    if ( p_highpc > s_highpc ) {
	p_highpc = s_highpc;
    }
#   ifdef DEBUG
	if ( debug & CALLDEBUG ) {
	    printf( "[findcall] %s: 0x%x to 0x%x\n" ,
		    parentp -> name , p_lowpc , p_highpc );
	}
#   endif DEBUG
    for (   instructp = textspace + p_lowpc ;
	    instructp < textspace + p_highpc ;
	    instructp += length ) {
	length = 1;
	if ( *instructp == CALLS ) {
		/*
		 *	maybe a calls, better check it out.
		 *	skip the count of the number of arguments.
		 */
#	    ifdef DEBUG
		if ( debug & CALLDEBUG ) {
		    printf( "[findcall]\t0x%x:calls" , instructp - textspace );
		}
#	    endif DEBUG
	    firstmode = operandmode( (struct modebyte *) (instructp+length) );
	    switch ( firstmode ) {
		case literal:
		case immediate:
		    break;
		default:
		    goto botched;
	    }
	    length += operandlength( (struct modebyte *) (instructp+length) );
	    mode = operandmode( (struct modebyte *) ( instructp + length ) );
#	    ifdef DEBUG
		if ( debug & CALLDEBUG ) {
		    printf( "\tfirst operand is %s", operandname( firstmode ) );
		    printf( "\tsecond operand is %s\n" , operandname( mode ) );
		}
#	    endif DEBUG
	    switch ( mode ) {
		case regdef:
		case bytedispdef:
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
			 *	a function.
			 */
		    destpc = reladdr( (struct modebyte *) (instructp+length) )
				- (unsigned long) textspace;
		    if ( destpc >= s_lowpc && destpc <= s_highpc ) {
			childp = nllookup( destpc );
#			ifdef DEBUG
			    if ( debug & CALLSDEBUG ) {
				printf( "[findcalls]\tdestpc 0x%x" , destpc );
				printf( " childp->name %s" , childp -> name );
				printf( " childp->value 0x%x\n" ,
					childp -> value );
			    }
#			endif DEBUG
			if ( childp -> value == destpc ) {
				/*







|
|







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
			 *	a function.
			 */
		    destpc = reladdr( (struct modebyte *) (instructp+length) )
				- (unsigned long) textspace;
		    if ( destpc >= s_lowpc && destpc <= s_highpc ) {
			childp = nllookup( destpc );
#			ifdef DEBUG
			    if ( debug & CALLDEBUG ) {
				printf( "[findcall]\tdestpc 0x%x" , destpc );
				printf( " childp->name %s" , childp -> name );
				printf( " childp->value 0x%x\n" ,
					childp -> value );
			    }
#			endif DEBUG
			if ( childp -> value == destpc ) {
				/*
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
		    goto botched;
		default:
		botched:
			/*
			 *	something funny going on.
			 */
#		    ifdef DEBUG
			if ( debug & CALLSDEBUG ) {
			    printf( "[findcalls]\tbut it's a botch\n" );
			}
#		    endif DEBUG
		    length = 1;
		    continue;
	    }
	}
    }
}







|
|








304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
		    goto botched;
		default:
		botched:
			/*
			 *	something funny going on.
			 */
#		    ifdef DEBUG
			if ( debug & CALLDEBUG ) {
			    printf( "[findcall]\tbut it's a botch\n" );
			}
#		    endif DEBUG
		    length = 1;
		    continue;
	    }
	}
    }
}

Changes to usr.bin/lastcomm/lastcomm.1.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)lastcomm.1	6.1 (Berkeley) 04/29/85
.\"
.TH LASTCOMM 1 ""
.UC
.SH NAME
lastcomm \- show last commands executed in reverse order
.SH SYNOPSIS
.B lastcomm




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)lastcomm.1	6.2 (Berkeley) 01/05/86
.\"
.TH LASTCOMM 1 ""
.UC
.SH NAME
lastcomm \- show last commands executed in reverse order
.SH SYNOPSIS
.B lastcomm
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
executed by the super-user, ``F'' indicates the command ran after
a fork, but without a following 
.IR exec ,
``C'' indicates the command was run in PDP-11 compatibility mode
(VAX only),
``D'' indicates the command terminated with the generation of a
.I core
file, and ``X'' indicates the command was terminated with the signal
SIGTERM.
.SH FILES
/usr/adm/acct
.SH "SEE ALSO"
last(1),
sigvec(2),
acct(8),
core(5)







|
<







50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
executed by the super-user, ``F'' indicates the command ran after
a fork, but without a following 
.IR exec ,
``C'' indicates the command was run in PDP-11 compatibility mode
(VAX only),
``D'' indicates the command terminated with the generation of a
.I core
file, and ``X'' indicates the command was terminated with a signal.

.SH FILES
/usr/adm/acct
.SH "SEE ALSO"
last(1),
sigvec(2),
acct(8),
core(5)

Changes to usr.bin/login/login.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)login.c	5.10 (Berkeley) 11/08/85";
#endif not lint

/*
 * login [ name ]
 * login -r hostname (for rlogind)
 * login -h hostname (for telnetd, etc.)
 */













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)login.c	5.11 (Berkeley) 01/09/86";
#endif not lint

/*
 * login [ name ]
 * login -r hostname (for rlogind)
 * login -h hostname (for telnetd, etc.)
 */
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
		if (cp)
			*cp++ = '\0';
		for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++)
			if (strcmp(*cpp, speed) == 0) {
				tp->sg_ispeed = tp->sg_ospeed = cpp-speeds;
				break;
			}
		compatsiz(cp);
	}
	tp->sg_flags = ECHO|CRMOD|ANYP|XTABS;
}

/* BEGIN TRASH
 *
 * This is here only long enough to get us by to the revised rlogin
 */
compatsiz(cp)
	char *cp;
{
	struct winsize ws;

	ws.ws_row = ws.ws_col = -1;
	ws.ws_xpixel = ws.ws_ypixel = -1;
	if (cp) {
		ws.ws_row = atoi(cp);
		cp = index(cp, ',');
		if (cp == 0)
			goto done;
		ws.ws_col = atoi(++cp);
		cp = index(cp, ',');
		if (cp == 0)
			goto done;
		ws.ws_xpixel = atoi(++cp);
		cp = index(cp, ',');
		if (cp == 0)
			goto done;
		ws.ws_ypixel = atoi(++cp);
	}
done:
	if (ws.ws_row != -1 && ws.ws_col != -1 &&
	    ws.ws_xpixel != -1 && ws.ws_ypixel != -1)
		ioctl(0, TIOCSWINSZ, &ws);
}
/* END TRASH */

/*
 * Set the value of var to be arg in the Unix 4.2 BSD environment env.
 * Var should end with '='.
 * (bindings are of the form "var=value")
 * This procedure assumes the memory for the first level of environ
 * was allocated using malloc.
 */







<




<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







520
521
522
523
524
525
526

527
528
529
530

































531
532
533
534
535
536
537
		if (cp)
			*cp++ = '\0';
		for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++)
			if (strcmp(*cpp, speed) == 0) {
				tp->sg_ispeed = tp->sg_ospeed = cpp-speeds;
				break;
			}

	}
	tp->sg_flags = ECHO|CRMOD|ANYP|XTABS;
}


































/*
 * Set the value of var to be arg in the Unix 4.2 BSD environment env.
 * Var should end with '='.
 * (bindings are of the form "var=value")
 * This procedure assumes the memory for the first level of environ
 * was allocated using malloc.
 */

Changes to usr.bin/login/login.c.1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)login.c.1	5.10 (Berkeley) 11/08/85";
#endif not lint

/*
 * login [ name ]
 * login -r hostname (for rlogind)
 * login -h hostname (for telnetd, etc.)
 */













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)login.c.1	5.11 (Berkeley) 01/09/86";
#endif not lint

/*
 * login [ name ]
 * login -r hostname (for rlogind)
 * login -h hostname (for telnetd, etc.)
 */
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
		if (cp)
			*cp++ = '\0';
		for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++)
			if (strcmp(*cpp, speed) == 0) {
				tp->sg_ispeed = tp->sg_ospeed = cpp-speeds;
				break;
			}
		compatsiz(cp);
	}
	tp->sg_flags = ECHO|CRMOD|ANYP|XTABS;
}

/* BEGIN TRASH
 *
 * This is here only long enough to get us by to the revised rlogin
 */
compatsiz(cp)
	char *cp;
{
	struct winsize ws;

	ws.ws_row = ws.ws_col = -1;
	ws.ws_xpixel = ws.ws_ypixel = -1;
	if (cp) {
		ws.ws_row = atoi(cp);
		cp = index(cp, ',');
		if (cp == 0)
			goto done;
		ws.ws_col = atoi(++cp);
		cp = index(cp, ',');
		if (cp == 0)
			goto done;
		ws.ws_xpixel = atoi(++cp);
		cp = index(cp, ',');
		if (cp == 0)
			goto done;
		ws.ws_ypixel = atoi(++cp);
	}
done:
	if (ws.ws_row != -1 && ws.ws_col != -1 &&
	    ws.ws_xpixel != -1 && ws.ws_ypixel != -1)
		ioctl(0, TIOCSWINSZ, &ws);
}
/* END TRASH */

/*
 * Set the value of var to be arg in the Unix 4.2 BSD environment env.
 * Var should end with '='.
 * (bindings are of the form "var=value")
 * This procedure assumes the memory for the first level of environ
 * was allocated using malloc.
 */







<




<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







520
521
522
523
524
525
526

527
528
529
530

































531
532
533
534
535
536
537
		if (cp)
			*cp++ = '\0';
		for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++)
			if (strcmp(*cpp, speed) == 0) {
				tp->sg_ispeed = tp->sg_ospeed = cpp-speeds;
				break;
			}

	}
	tp->sg_flags = ECHO|CRMOD|ANYP|XTABS;
}


































/*
 * Set the value of var to be arg in the Unix 4.2 BSD environment env.
 * Var should end with '='.
 * (bindings are of the form "var=value")
 * This procedure assumes the memory for the first level of environ
 * was allocated using malloc.
 */

Changes to usr.bin/patch/patch.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)patch.c	5.4 (Berkeley) 11/25/85";
#endif not lint

/* patch - a program to apply diffs to original files
 *
 * $Header: patch.c,v 1.3 85/03/26 15:07:43 lwall Exp $
 *
 * Copyright 1984, Larry Wall

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)patch.c	5.5 (Berkeley) 01/09/86";
#endif not lint

/* patch - a program to apply diffs to original files
 *
 * $Header: patch.c,v 1.3 85/03/26 15:07:43 lwall Exp $
 *
 * Copyright 1984, Larry Wall
1434
1435
1436
1437
1438
1439
1440


1441
1442
1443
1444
1445
1446
1447
1448
	    case ' ':
		context++;
		p_line[p_end] = savestr(buf+2);
		break;
	    default:
		fatal("Malformed patch at line %d: %s",p_input_line,buf);
	    }


	    p_len[p_end] = strlen(p_line[p_end]);
					/* for strncmp() so we do not have */
					/* to assume null termination */
	}
	if (p_end >=0 && !p_ptrn_lines)
	    fatal("No --- found in patch at line %d\n", pch_hunk_beg());
	p_repl_lines = p_end - repl_beginning;
    }







>
>
|







1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
	    case ' ':
		context++;
		p_line[p_end] = savestr(buf+2);
		break;
	    default:
		fatal("Malformed patch at line %d: %s",p_input_line,buf);
	    }
	    p_len[p_end] = 0;
	    if (p_line[p_end] != 0)
		p_len[p_end] = strlen(p_line[p_end]);
					/* for strncmp() so we do not have */
					/* to assume null termination */
	}
	if (p_end >=0 && !p_ptrn_lines)
	    fatal("No --- found in patch at line %d\n", pch_hunk_beg());
	p_repl_lines = p_end - repl_beginning;
    }
1544
1545
1546
1547
1548
1549
1550


1551
1552
1553
1554
1555
1556
1557
1558
	    case ' ':
		context++;
		p_line[p_end] = savestr(buf+2);
		break;
	    default:
		fatal("Malformed patch at line %d: %s",p_input_line,buf);
	    }


	    p_len[p_end] = strlen(p_line[p_end]);
					/* for strncmp() so we do not have */
					/* to assume null termination */
	}
	if (p_end >=0 && !p_ptrn_lines)
	    fatal("No --- found in patch at line %d\n", pch_hunk_beg());

	/* if there were omitted context lines, fill them in */







>
>
|







1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
	    case ' ':
		context++;
		p_line[p_end] = savestr(buf+2);
		break;
	    default:
		fatal("Malformed patch at line %d: %s",p_input_line,buf);
	    }
	    p_len[p_end] = 0;
	    if (p_line[p_end] != 0)
		p_len[p_end] = strlen(p_line[p_end]);
					/* for strncmp() so we do not have */
					/* to assume null termination */
	}
	if (p_end >=0 && !p_ptrn_lines)
	    fatal("No --- found in patch at line %d\n", pch_hunk_beg());

	/* if there were omitted context lines, fill them in */
1613
1614
1615
1616
1617
1618
1619


1620
1621
1622
1623
1624
1625
1626
1627
	    p_input_line++;
	    if (ret == Nullch)
		fatal("Unexpected end of file in patch at line %d.\n",
		  p_input_line);
	    if (*buf != '<')
		fatal("< expected at line %d of patch.\n", p_input_line);
	    p_line[i] = savestr(buf+2);


	    p_len[i] = strlen(p_line[i]);
	    p_char[i] = '-';
	}
	if (hunk_type == 'c') {
	    ret = pgets(buf,sizeof buf, pfp);
	    p_input_line++;
	    if (ret == Nullch)
		fatal("Unexpected end of file in patch at line %d.\n",







>
>
|







1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
	    p_input_line++;
	    if (ret == Nullch)
		fatal("Unexpected end of file in patch at line %d.\n",
		  p_input_line);
	    if (*buf != '<')
		fatal("< expected at line %d of patch.\n", p_input_line);
	    p_line[i] = savestr(buf+2);
	    p_len[i] = 0;
	    if (p_line[i] != 0)
		p_len[i] = strlen(p_line[i]);
	    p_char[i] = '-';
	}
	if (hunk_type == 'c') {
	    ret = pgets(buf,sizeof buf, pfp);
	    p_input_line++;
	    if (ret == Nullch)
		fatal("Unexpected end of file in patch at line %d.\n",
1637
1638
1639
1640
1641
1642
1643


1644
1645
1646
1647
1648
1649
1650
1651
	    p_input_line++;
	    if (ret == Nullch)
		fatal("Unexpected end of file in patch at line %d.\n",
		    p_input_line);
	    if (*buf != '>')
		fatal("> expected at line %d of patch.\n", p_input_line);
	    p_line[i] = savestr(buf+2);


	    p_len[i] = strlen(p_line[i]);
	    p_char[i] = '+';
	}
    }
    if (reverse)			/* backwards patch? */
	pch_swap();
#ifdef DEBUGGING
    if (debug & 2) {







>
>
|







1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
	    p_input_line++;
	    if (ret == Nullch)
		fatal("Unexpected end of file in patch at line %d.\n",
		    p_input_line);
	    if (*buf != '>')
		fatal("> expected at line %d of patch.\n", p_input_line);
	    p_line[i] = savestr(buf+2);
	    p_len[i] = 0;
	    if (p_line[i] != 0)
		p_len[i] = strlen(p_line[i]);
	    p_char[i] = '+';
	}
    }
    if (reverse)			/* backwards patch? */
	pch_swap();
#ifdef DEBUGGING
    if (debug & 2) {

Changes to usr.bin/rlogin/rlogin.1.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)rlogin.1	6.3 (Berkeley) 10/30/85
.\"
.TH RLOGIN 1C ""
.UC 5
.SH NAME
rlogin \- remote login
.SH SYNOPSIS
.B rlogin




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)rlogin.1	6.4 (Berkeley) 01/09/86
.\"
.TH RLOGIN 1C ""
.UC 5
.SH NAME
rlogin \- remote login
.SH SYNOPSIS
.B rlogin
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
in his login directory.  Each line in this file should contain a \fIrhost\fP
and a \fIusername\fP separated by a space, giving additional cases
where logins without passwords are to be permitted.
If the originating user is not equivalent to the remote user, then
a login and password will be prompted for on the remote machine as in
.IR login (1).
To avoid some security problems, the \&.rhosts file must be owned by
either the remote user or root and may not be a symbolic link.
.PP
Your remote terminal type is the same as your local
terminal type (as given in your environment TERM variable).
All echoing takes place at the remote site, so that (except for
delays) the rlogin is transparent.  Flow control via ^S and ^Q and
flushing of input and output on interrupts are handled properly.
The optional argument







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
in his login directory.  Each line in this file should contain a \fIrhost\fP
and a \fIusername\fP separated by a space, giving additional cases
where logins without passwords are to be permitted.
If the originating user is not equivalent to the remote user, then
a login and password will be prompted for on the remote machine as in
.IR login (1).
To avoid some security problems, the \&.rhosts file must be owned by
either the remote user or root.
.PP
Your remote terminal type is the same as your local
terminal type (as given in your environment TERM variable).
All echoing takes place at the remote site, so that (except for
delays) the rlogin is transparent.  Flow control via ^S and ^Q and
flushing of input and output on interrupts are handled properly.
The optional argument

Changes to usr.bin/ruptime/ruptime.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)ruptime.c	5.2 (Berkeley) 06/18/85";
#endif not lint

#include <sys/param.h>
#include <stdio.h>
#include <sys/dir.h>
#include <protocols/rwhod.h>














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)ruptime.c	5.3 (Berkeley) 01/07/86";
#endif not lint

#include <sys/param.h>
#include <stdio.h>
#include <sys/dir.h>
#include <protocols/rwhod.h>

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
interval(time, updown)
	int time;
	char *updown;
{
	static char resbuf[32];
	int days, hours, minutes;

	if (time < 0 || time > 3*30*24*60*60) {
		(void) sprintf(resbuf, "   %s ??:??", updown);
		return (resbuf);
	}
	minutes = (time + 59) / 60;		/* round to minutes */
	hours = minutes / 60; minutes %= 60;
	days = hours / 24; hours %= 24;
	if (days)







|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
interval(time, updown)
	int time;
	char *updown;
{
	static char resbuf[32];
	int days, hours, minutes;

	if (time < 0 || time > 365*24*60*60) {
		(void) sprintf(resbuf, "   %s ??:??", updown);
		return (resbuf);
	}
	minutes = (time + 59) / 60;		/* round to minutes */
	hours = minutes / 60; minutes %= 60;
	days = hours / 24; hours %= 24;
	if (days)

Added usr.bin/spell/american.















































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
acknowledgment
aggrandize
aluminize
aluminum
amor
amorous
amphitheater
analog
analyze
anemia
anemic
anesthesia
anesthetic
anesthetize
anglicize
antagonize
apologize
appareled
appareling
appetize
arbor
archeology
Archeopteryx
ardor
arithmetize
armor
armory
axiomatize
baptize
barreled
barreling
behavior
behoove
belabor
beveled
beveler
beveling
canceled
canceler
canceling
candor
catalog
catalyze
catechize
categorize
cauterize
center
channeled
channeler
channeling
chiseled
chiseler
chiseling
clamor
clamorous
clangor
color
colorable
colorful
colorist
corbeled
corbeling
counseled
counseling
crystallize
cudgeled
cudgeler
cudgeling
decentralize
decriminalize
defense
dehumanize
deionize
demagnetize
demeanor
demineralize
demoralize
demythologize
depersonalize
depolarize
desensitize
destabilize
desynchronize
detribalize
dialyze
diarrhea
discolor
disemboweled
disemboweling
disfavor
disheveled
disheveler
disheveling
dishonor
dishonorable
disorganize
doweled
doweler
doweling
dramatize
dueled
dueler
dueling
duelist
economize
ecumenical
edema
emphasize
enameled
enameling
enamor
encyclopedia
endeavor
energize
eon
epicenter
esophagus
eulogize
favor
favorable
favorite
fervor
fiber
flavor
fraternize
fueled
fueler
fueling
funneled
funneler
funneling
furor
galvanize
gaveled
gaveler
gaveling
glamorize
gram
graveled
graveling
groveled
groveler
groveling
gynecology
harbor
harmonize
hiccup
hiccupped
hiccupping
homeopathy
homogenize
honor
honorable
humor
hydrolyze
hypnotize
hypostatize
hypothesize
jeweled
jeweler
jeweling
judgment
kilogram
kinesthetic
labeled
labeler
labeling
labor
laborite
legitimize
leveled
leveler
leveling
libeled
libeler
libeling
license
liter
logorrhea
louver
luster
marveled
marveler
marveling
mechanize
medieval
memorize
mesmerize
metallize
milligram
milliliter
millimeter
modeled
modeler
modeling
nanogram
naught
neighbor
neighborhood
notarize
ocher
odor
offense
optimize
orientation
ostracize
pajama
pallor
paneled
paneling
paralleled
paralleling
paralyze
parametrize
parceled
parceler
parceling
parenthesize
parlor
peptize
photolyze
photosynthesize
picogram
plagiarize
platinize
preprogram
program
proselytize
psychoanalyze
psycoanalyze
pulverize
pummeled
pummeler
pummeling
pyorrhea
pyrolyze
quantize
quarreled
quarreler
quarreling
radiosterilize
rancor
raveled
raveler
raveling
realize
recognize
reconnoiter
reveled
reveler
reveling
rigor
rumor
saber
saltpeter
savior
savor
savory
scepter
schematize
scrutinize
sensitize
sepulcher
shoveled
shoveler
shoveling
shriveled
shriveling
siphon
sniveled
sniveler
sniveling
soliloquize
specialty
specter
spirochete
splendor
squirreled
squirreling
stigmatize
succor
summarize
swiveled
swiveling
symmetrize
sympathize
synchronize
synthesize
systematize
tantalize
tasseled
tasseling
temporize
theater
theatergoer
theatergoing
theorize
tinseled
tinseling
titer
toweled
toweling
trammeled
traumatize
traveled
traveler
traveling
tricolor
tumor
tunneled
tunneler
tunneling
tyrannize
valor
vapor
varicolored
vigor
vulcanize
wagon
watercolor
watercolorist
weaseled
weaseling
whiskey
woolen
yodeled
yodeling

Added usr.bin/spell/british.























































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
aeon
aerodrome
aeroplane
aggrandise
alarum
aluminium
amour
amourous
amphitheatre
anaemia
anaemic
anaesthesia
anaesthetic
anaesthetise
analyse
anglicise
antagonise
apologise
apparelled
apparelling
appetise
arbour
archaeology
Archaeopteryx
ardour
arithmetise
armour
armoury
axiomatise
baptise
barrelled
barrelling
behaviour
behavioural
behove
belabour
bevelled
beveller
bevelling
cancelled
canceller
cancelling
candour
catalyse
catechise
categorise
cauterise
centimetre
centre
channelled
channeller
channelling
cheque
chequer
chiselled
chiseller
chiselling
clamour
clamourous
clangour
colour
colourable
colourist
connexion
corbelled
corbelling
counselled
counselling
crystallise
cudgelled
cudgeller
cudgelling
decentralise
decriminalise
defence
dehumanise
deionise
demagnetise
demeanour
demineralise
demoralise
demythologise
depersonalise
depolarise
desensitise
destabilise
desynchronise
detribalise
dialyse
diarrhoea
discolour
disembowelled
disembowelling
disfavour
dishevelled
disheveller
dishevelling
dishonour
dishonourable
disorganise
dowelled
doweller
dowelling
dramatise
draught
duelled
dueller
duelling
duellist
economise
emphasise
enamelled
enamelling
enamour
encyclopaedia
endeavour
energise
epicentre
eulogise
favour
favourable
favourite
fervour
fibre
flavour
fraternise
fuelled
fueller
fuelling
funnelled
funneller
funnelling
furore
fuze
galvanise
gaol
gavelled
gaveller
gavelling
glamourise
gramme
gravelled
gravelling
grovelled
groveller
grovelling
gynaecology
harbour
harmonise
homoeopathy
homogenise
honour
honourable
humour
hydrolyse
hypnotise
hypostatise
hypothesise
jewelled
jeweller
jewelling
kilogramme
kilometre
kinaesthetic
labelled
labeller
labelling
labour
labourite
legitimise
levelled
leveller
levelling
libelled
libeller
libelling
licence
litre
logorrhoea
lustre
marvelled
marveller
marvelling
mechanise
mediaeval
memorise
mesmerise
metallise
metre
milligramme
millilitre
millimetre
modelled
modeller
modelling
nanogramme
nanometre
neighbour
neighbourhood
notarise
nought
ochre
odour
oecumenical
oedema
oesophagus
offence
optimise
orientate
ostracise
pallour
panelled
panelling
parallelled
parallelling
paralyse
parametrise
parcelled
parceller
parcelling
parenthesise
parlour
peptise
photolyse
photosynthesise
picogramme
plagiarise
platinise
practise
preprogramme
programme
proselytise
psychoanalyse
pulverise
pummelled
pummeller
pummelling
pyjama
pyorrhoea
pyrolyse
quantise
quarrelled
quarreller
quarrelling
rancour
radiosterilise
ravelled
raveller
ravelling
realise
recognise
reconnoitre
revelled
reveller
revelling
rigour
rumour
sabre
saltpetre
saviour
savour
savoury
sceptre
schematise
scrutinise
sensitise
sepulchre
shovelled
shoveller
shovelling
shrivelled
shrivelling
snivelled
sniveller
snivelling
soliloquise
speciality
spectre
splendour
squirrelled
squirrelling
stigmatise
succour
summarise
millimetre
swivelled
swivelling
symmetrise
sympathise
synchronise
synthesise
syphon
systematise
tantalise
tasselled
tasselling
temporise
theatre
theorise
tinselled
tinselling
titre
towelled
towelling
trammelled
traumatise
travelled
traveller
travelling
tricolour
tumour
tunnelled
tunneller
tunnelling
tyrannise
tyre
valour
vapour
varicoloured
vigour
vulcanise
waggon
watercolour
watercolourist
weaselled
weaselling
whilst
whisky
woollen
yodelled
yodelling

Added usr.bin/spell/stop.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
abator
abeted
abeter
abeting
abuted
abuter
abuting
accessable
acquiter
acquiting
acter
addendums
adly
admitable
admited
admiter
admiting
ahly
allotable
alloted
alloter
alloting
amly
ams
animadvertion
anly
annulable
annuled
annuler
annuling
ans
arguement
arised
asly
ation
ative
atly
ator
ats
audable
auditer
avered
averer
avering
avertion
awared
axises
axly
baned
baning
beared
beated
bedimed
bedimer
bediming
befited
befiter
befiting
befoged
befoger
befoging
begeted
begeter
begeting
begined
beginer
begining
beholded
bely
bes
besetable
beseted
beseter
beseting
besoting
bespeaked
bestired
bestirer
bestiring
betted
bidded
bies
binded
bited
blader
bleeded
blowed
breaked
breeded
bringed
bursted
buyed
byly
Canadan
Carolinan
casted
catched
cheator
checksumable
checksumed
checksuming
choosed
clinged
collapsable
collectable
collecter
colourate
colourful
combustable
comed
commitable
commited
commiter
commiting
compeled
compeler
compeling
compositer
compositon
comprehensable
compressable
condensable
conducter
coner
conferable
confered
conferer
confering
coning
constricter
constructable
constructer
contemptable
contracter
controlable
controled
controler
controling
controvertable
convertable
convertion
corpuses
correcter
corrigendums
corrodable
corruptable
credable
crediter
creeped
currance
currancy
curriculas
cutted
datas
datums
dealed
debared
debarer
debaring
debator
debter
debuged
debuger
debuging
decontroled
decontroler
decontroling
deductable
defecter
defensable
deferable
defered
deferer
defering
deflator
deflecter
degased
degaser
degasing
degumed
degumer
deguming
demitable
demited
demiter
demiting
demured
demuring
depositer
depressable
desolator
destructer
detecter
deterable
detered
deterer
detering
detracter
diffusable
digestable
dimed
dimest
directer
discernable
discomfited
discomfiter
discomfiting
disintered
disinterer
disintering
dispelable
dispeled
dispeler
dispeling
dispence
dispersable
distributory
divertion
doged
doger
doging
doly
doned
doner
doning
drawed
drinked
drived
duely
dus
eated
eator
eavesdroped
eavesdroper
eavesdroping
edable
editer
effluvias
effluviums
ehly
ehs
ejecter
electer
elly
embedable
embeded
embeder
embeding
emitable
emited
emiter
emiting
emly
emphasises
enaction
enbalm
enbank
enbark
enbattle
enbay
enbed
enbit
enblaze
enblazon
enbody
enbolden
enboss
enbow
enbowel
enbrace
enbrittle
enbroil
encant
encur
endebted
enend
enflame
enform
enirate
enit
enly
enpanel
enpathetic
enplace
enplane
enploy
enpower
enpress
enpurple
enroad
entend
entone
entrapable
entraped
entraper
entraping
envoice
equilibriums
equipable
equiped
equiper
equiping
erodable
erosable
esophaguses
estoped
estoper
estoping
etly
ets
exasperator
exceled
exceler
exceling
exegesises
exhaustable
expansable
expection
expelable
expeled
expeler
expeling
expositer
expressable
extendable
extensable
extolable
extoled
extoler
extoling
extracter
extremums
extrovertion
facter
fadded
fadding
fallable
falled
feasable
feeded
feeled
fighted
finded
flexable
flinged
flirtion
Floridan
fluter
foable
forbeared
forbided
forebade
forebear
forebid
forebidden
forebidding
forebore
forefend
foregave
foreget
foregettable
foregetting
foregive
foregiven
foregot
foremat
foremate
foresake
foreswear
forety
foreward
forgetable
forgeted
forsaked
freezed
frustrator
fusable
gayly
genesises
genuses
getted
giddaped
giddaper
giddaping
gived
glomed
glumer
glumest
goly
gos
greator
grimer
grimest
grinded
growed
gullable
haly
heared
heator
hely
hes
hesitator
hily
holded
horrable
huggest
huging
hurted
idly
ifly
iily
iis
impartion
impelable
impeled
impeler
impeling
imperceptable
implausable
importion
impressable
inaccessable
inaudable
incombustable
incompatable
incomprehensable
incontrovertable
incorruptable
incredable
incured
incurer
incuring
indefensable
indelable
indestructable
indigestable
indiscernable
inducter
inexhaustable
inexpressable
infallable
infeasable
inferable
infered
inferer
infering
inflator
inflexable
infusable
ingestable
inheriter
inly
insensable
inspecter
instructer
intence
interable
intered
interer
intering
interruptable
intimator
inventer
invertable
invertion
invester
irresistable
irresponsable
irreversable
isly
itly
ivly
ivs
ixes
ixly
juter
keeped
kiloohm
knowed
lader
laly
lammest
lapeled
layed
lended
letted
loaned
loging
loly
losed
mader
madest
mading
maked
maly
maner
maning
manumitable
manumited
manumiter
manumiting
mared
meaned
meeted
mely
mies
mily
moter
myly
nely
nes
neurosises
noding
noly
notory
nuly
objecter
occured
occurer
occuring
offsetable
offseted
offseter
offseting
ofly
ofs
ohly
ons
opuses
ostensable
outgaser
ows
oxes
oxly
padable
paly
paner
paralysises
parenthesises
paster
payed
perceptable
perfectable
permitable
permited
permiter
permiting
pervertion
phenomenas
phenomenons
photosynthesises
pily
pipper
placator
plausable
plugable
predicter
preempter
prefered
preferer
prefering
preseter
preseting
presuably
programable
programed
programer
programing
projecter
propeled
propeler
propeling
prosecuter
prospecter
protecter
quitable
quiter
quiting
ratter
readed
reah
realter
rean
reas
reat
reax
rebat
rebe
rebeled
rebeler
rebeling
rebutable
rebuted
rebuter
rebuting
reby
recal
recapable
recaped
recaper
recaping
recloth
recommitable
recommited
recommiter
recommiting
recured
recurer
recuring
redacter
redu
reem
reen
reet
referable
refered
referer
refering
refited
refiter
refiting
reflecter
rego
regretable
regreted
regreter
regreting
reha
rehe
rehi
reho
reif
reii
reis
reit
reiv
reix
reknited
rekniter
rekniting
rela
relo
rema
remad
remaned
remaner
remaning
reme
remi
remitable
remited
remiter
remiting
remy
rended
renu
reof
reoh
reon
reor
reow
reox
repa
repelable
repeled
repeler
repeling
repi
reprehensable
rere
rerout
rerunable
reruned
reruner
reruning
resa
reshiped
reshiper
reshiping
resistable
reso
responsable
reti
reto
reup
reversable
revertion
revi
rewe
rewok
rexi
reye
rided
risable
rised
rocketed
rocketer
rocketing
ruber
rubing
runable
runed
runned
saging
saly
saturator
sayed
sculpter
secretory
secter
seeked
selecter
selled
senation
senative
sended
sensable
setable
setted
shaked
shedded
shipable
shooted
shrinked
shutted
siner
sining
sinked
siply
sitted
slayed
sleeped
slided
slinged
slinked
smited
soliciter
soly
speaked
spended
spinable
spiner
spining
spinned
spiting
splitted
spotable
spreaded
stagged
stagging
standed
stealed
sticked
stinked
stopable
stratas
strided
striked
subletable
subleted
subleter
subleting
submitable
submited
submiter
submiting
suggestable
suntaned
suntaning
suppressable
susceptable
sweared
sweeped
swimable
swinged
synopsises
synthesises
taked
teached
teching
telled
terrable
thesises
thier
thinked
thrombosises
throwed
thrusted
tiner
tining
toly
tracter
traiter
tranquility
transferable
transfered
transferer
transfering
transmitable
transmited
transmiter
transmiting
transportion
trivias
triviums
truely
typeseter
typeseting
unactivate
unadequacy
unattention
unboard
unbreed
uncant
uncapacity
uncompletion
uncorporate
uncrease
uncredulity
unculpable
uncur
uncurred
uncurrer
uncurring
undebt
undeed
undefinite
undelicate
undent
undenture
undermind
undices
undignity
undiscriminate
undisposition
undoor
unduct
undwell
unefficacy
unequity
unfamous
unfelicity
unfest
unfield
unfiltrate
unfinity
unflame
unflammable
unflow
unfluence
unflux
unformant
unformation
unfuse
unfusion
ungather
ungrate
ungratitude
unhabitant
unhabitation
unhale
unhere
unholding
unhumane
unhumanity
unjure
unjury
unnumerable
unoperable
unput
unquest
unscribe
unscription
unsect
unside
unspire
unstall
unstance
unstead
untact
untake
untemperance
untend
untestate
untill
untolerant
untuition
unvade
unvalidate
unvent
unverse
unversion
unvertebrate
unviolate
unvocate
unward
unwieldly
uply
upseter
upseting
usly
usses
vendable
vily
visable
visiter
warer
weared
weeped
wely
wetable
whitter
whitting
winable
winned
wringed
writed
xily
yiper

Changes to usr.bin/tail/tail.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)tail.c	5.1 (Berkeley) 05/31/85";
#endif not lint

/* tail command 
 *
 *	tail where [file]
 *	where is +/-n[type]
 *	- means n lines before end













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)tail.c	5.2 (Berkeley) 01/10/86";
#endif not lint

/* tail command 
 *
 *	tail where [file]
 *	where is +/-n[type]
 *	- means n lines before end
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include	<stdio.h>
#include	<ctype.h>
#include	<sys/types.h>
#include	<sys/stat.h>
#include	<sys/file.h>
#include	<errno.h>

#define LBIN 8193
#undef	BUFSIZ
#define	BUFSIZ	LBIN-1
struct	stat	statb;
int	follow;
int	piped;
char bin[LBIN];
int errno;

main(argc,argv)







|

|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include	<stdio.h>
#include	<ctype.h>
#include	<sys/types.h>
#include	<sys/stat.h>
#include	<sys/file.h>
#include	<errno.h>

#define LBIN 32769
#undef	BUFSIZ
#define	BUFSIZ	8192
struct	stat	statb;
int	follow;
int	piped;
char bin[LBIN];
int errno;

main(argc,argv)
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

keep:
	if(n <= 0)
		fexit();
	if(!piped) {
		(void)fstat(0,&statb);
		/* If by lines, back up 1 buffer: else back up as needed */
		di = bylines?BUFSIZ:n;
		if(statb.st_size > di)
			(void)lseek(0,(off_t)-di,L_XTND);
		if(!bylines)
			goto copy;
	}
	partial = 1;
	for(;;) {







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

keep:
	if(n <= 0)
		fexit();
	if(!piped) {
		(void)fstat(0,&statb);
		/* If by lines, back up 1 buffer: else back up as needed */
		di = bylines?LBIN-1:n;
		if(statb.st_size > di)
			(void)lseek(0,(off_t)-di,L_XTND);
		if(!bylines)
			goto copy;
	}
	partial = 1;
	for(;;) {

Changes to usr.bin/telnet/telnet.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)telnet.c	5.3 (Berkeley) 11/08/85";
#endif not lint

/*
 * User telnet program.
 */
#include <sys/types.h>
#include <sys/socket.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)telnet.c	5.4 (Berkeley) 01/10/86";
#endif not lint

/*
 * User telnet program.
 */
#include <sys/types.h>
#include <sys/socket.h>
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
	if (!top)
		putchar('\n');
	else
		signal(SIGINT, SIG_DFL);
	for (;;) {
		printf("%s> ", prompt);
		if (gets(line) == 0) {
			if (feof(stdin)) {
				clearerr(stdin);
				putchar('\n');
			}
			break;
		}
		if (line[0] == 0)
			break;
		makeargv();
		c = getcmd(margv[0]);
		if (c == (struct cmd *)-1) {







|
<
|
<







532
533
534
535
536
537
538
539

540

541
542
543
544
545
546
547
	if (!top)
		putchar('\n');
	else
		signal(SIGINT, SIG_DFL);
	for (;;) {
		printf("%s> ", prompt);
		if (gets(line) == 0) {
			if (feof(stdin))

				quit();

			break;
		}
		if (line[0] == 0)
			break;
		makeargv();
		c = getcmd(margv[0]);
		if (c == (struct cmd *)-1) {

Changes to usr.bin/tftp/main.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	5.1 (Berkeley) 06/06/85";
#endif not lint

/*
 * TFTP User Program -- Command Interface.
 */
#include <sys/types.h>
#include <sys/socket.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)main.c	5.2 (Berkeley) 01/10/86";
#endif not lint

/*
 * TFTP User Program -- Command Interface.
 */
#include <sys/types.h>
#include <sys/socket.h>
459
460
461
462
463
464
465
466



467

468
469
470
471
472
473
474
{
	register struct cmd *c;

	if (!top)
		putchar('\n');
	for (;;) {
		printf("%s> ", prompt);
		if (gets(line) == 0)



			continue;

		if (line[0] == 0)
			continue;
		makeargv();
		c = getcmd(margv[0]);
		if (c == (struct cmd *)-1) {
			printf("?Ambiguous command\n");
			continue;







|
>
>
>
|
>







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
{
	register struct cmd *c;

	if (!top)
		putchar('\n');
	for (;;) {
		printf("%s> ", prompt);
		if (gets(line) == 0) {
			if (feof(stdin))
				quit();
			else
				continue;
		}
		if (line[0] == 0)
			continue;
		makeargv();
		c = getcmd(margv[0]);
		if (c == (struct cmd *)-1) {
			printf("?Ambiguous command\n");
			continue;

Changes to usr.bin/uucp/DOC/CHANGES.

1
2
3
4
5
6
7
8
9
List of Changes to UUCP
CHANGES	5.4	85/10/09

Added support for Eunice.

Added new dialers:
	Racal Vadic 212
	Racal Vadic 811 dialer with 831 adaptor
	Racal Vadic 820 dialer with 831 adaptor

|







1
2
3
4
5
6
7
8
9
List of Changes to UUCP
CHANGES	5.5	86/01/06

Added support for Eunice.

Added new dialers:
	Racal Vadic 212
	Racal Vadic 811 dialer with 831 adaptor
	Racal Vadic 820 dialer with 831 adaptor
151
152
153
154
155
156
157






	fullname 7-char-name

You can specify a time for the expect send sequences with ~ instead
of getting the default MAXMSGTIME. E.g.
	system Any ACU 1200 1234567 ogin~20-\r-ogin~10-\b-ogin user password pw
will look for ogin for 20 seconds, send CR, look for ogin for 10
seconds, send a BREAK and look for ogin for MAXMSGTIME seconds













>
>
>
>
>
>
151
152
153
154
155
156
157
158
159
160
161
162
163
	fullname 7-char-name

You can specify a time for the expect send sequences with ~ instead
of getting the default MAXMSGTIME. E.g.
	system Any ACU 1200 1234567 ogin~20-\r-ogin~10-\b-ogin user password pw
will look for ogin for 20 seconds, send CR, look for ogin for 10
seconds, send a BREAK and look for ogin for MAXMSGTIME seconds

Added code to support GTEs PC Pursuit service. It's mainly the handling of the
dialback they use.

Added time "NonPeak" for Tymnet/Telenet services that charge lower
rates from 6pm-7am M-F and Sat & Sun.

Changes to usr.bin/uucp/includes/uucp.h.

1
2
3
4
5
6
7
8
/*	uucp.h	5.9	85/10/24	*/

#include <stdio.h>

/*
 * Determine local uucp name of this machine.
 * Define one of the following:
 *
|







1
2
3
4
5
6
7
8
/*	uucp.h	5.10	86/01/06	*/

#include <stdio.h>

/*
 * Determine local uucp name of this machine.
 * Define one of the following:
 *
78
79
80
81
82
83
84
85
86
87


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#define VENTEL		/* Ventel Dialer */
#define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */

#if defined(UNETTCP) || defined(BSDTCP)
#define TCPIP
#endif

#if defined(VENTEL) || defined(NOVATION) || defined(DF112) || defined(PENRIL)
/*
 * We need a timer to write slowly to ventels.


 * define INTERVALTIMER to use 4.[23] bsd interval timer.
 * define FASTTIMER if you have the nap() system call.
 * define FTIME if you have the ftime() system call.
 * define BUSYLOOP if you must do a busy loop.
 * Look at uucpdelay() in condevs.c for details.
 */
#define	INTERVALTIMER
/*#define FASTTIMER /**/
/*#define FTIME /**/
/*#define BUSYLOOP /**/
#endif VENTEL || NOVATION || DF112 || PENRIL

/*
 * If your site is using "ndir.h" to retrofit the Berkeley
 * directory reading routines, define NDIR.
 * You will probably also have to set LIBNDIR in Makefile.
 * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
 */







<

|
>
>










<







78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
#define VENTEL		/* Ventel Dialer */
#define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */

#if defined(UNETTCP) || defined(BSDTCP)
#define TCPIP
#endif


/*
 * We need a timer to write slowly to certain modems.
 * and for generating breaks.
 *
 * define INTERVALTIMER to use 4.[23] bsd interval timer.
 * define FASTTIMER if you have the nap() system call.
 * define FTIME if you have the ftime() system call.
 * define BUSYLOOP if you must do a busy loop.
 * Look at uucpdelay() in condevs.c for details.
 */
#define	INTERVALTIMER
/*#define FASTTIMER /**/
/*#define FTIME /**/
/*#define BUSYLOOP /**/


/*
 * If your site is using "ndir.h" to retrofit the Berkeley
 * directory reading routines, define NDIR.
 * You will probably also have to set LIBNDIR in Makefile.
 * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
 */

Changes to usr.bin/uucp/uucico/cico.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)cico.c	5.10 (Berkeley) 11/22/85";
#endif

#include <signal.h>
#include "uucp.h"
#include <setjmp.h>
#ifdef	USG
#include <termio.h>

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)cico.c	5.11 (Berkeley) 01/06/86";
#endif

#include <signal.h>
#include "uucp.h"
#include <setjmp.h>
#ifdef	USG
#include <termio.h>
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57




58
59
60
61
62
63

64

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
/*  call fail text  */
char *Stattext[] = {
	"",
	"BAD SYSTEM",
	"WRONG TIME TO CALL",
	"SYSTEM LOCKED",
	"NO DEVICE",
	"DIAL FAILED",
	"LOGIN FAILED",
	"BAD SEQUENCE"
};

/*  call fail codes  */
int Stattype[] = {
	0,
	0,
	SS_WRONGTIME,
	0,
	SS_NODEVICE,
	SS_FAIL,
	SS_FAIL,
	SS_BADSEQ
};






int ReverseRole = 0;
int StdErrIsTty = 0;
int Role = SLAVE;
int onesys = 0;
int turntime = 30 * 60;	/* 30 minutes expressed in seconds */

extern int LocalOnly;

extern char MaxGrade, DefMaxGrade;
extern char Myfullname[];

#ifdef	USG
struct termio Savettyb;
#endif
#ifndef	USG
struct sgttyb Savettyb;
#endif

/*******
 *	cico - this program is used  to place a call to a
 *	remote machine, login, and copy files between the two machines.
 */

main(argc, argv)

register char *argv[];
{
	register int ret;
	int seq;
	char wkpre[NAMESIZE], file[NAMESIZE];
	char msg[MAXFULLNAME], *q, **alias;
	register char *p;
	extern onintr(), timeout(), setdebug();
	extern char *pskip();
	char rflags[MAXFULLNAME];
	char *ttyn;
#ifdef NOGETPEER
	u_long Hostnumber = 0;
#endif NOGETPEER

	strcpy(Progname, "uucico");

	signal(SIGINT, onintr);
	signal(SIGHUP, onintr);
	signal(SIGQUIT, onintr);
	signal(SIGTERM, onintr);
	signal(SIGPIPE, onintr);	/* 4.1a tcp-ip stupidity */
	signal(SIGFPE, setdebug);
	ret = guinfo(getuid(), User, msg);
	strcpy(Loginuser, User);
	uucpname(Myname);
	ASSERT(ret == 0, "BAD UID", CNULL, ret);

#ifdef BSD4_2
	setlinebuf(stderr);
#endif

	umask(WFMASK);
	strcpy(Rmtname, Myname);
	Ifn = Ofn = -1;
	while(argc>1 && argv[1][0] == '-'){
		switch(argv[1][1]){
		case 'd':
			Spool = &argv[1][2];







|
















>
>
>
>


<



>

>










|
|


<

>





|

|


<











|





<
|
|
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
/*  call fail text  */
char *Stattext[] = {
	"",
	"BAD SYSTEM",
	"WRONG TIME TO CALL",
	"SYSTEM LOCKED",
	"NO DEVICE",
	"CALL FAILED",
	"LOGIN FAILED",
	"BAD SEQUENCE"
};

/*  call fail codes  */
int Stattype[] = {
	0,
	0,
	SS_WRONGTIME,
	0,
	SS_NODEVICE,
	SS_FAIL,
	SS_FAIL,
	SS_BADSEQ
};

				/* Arguments to setdebug():		     */
#define DBG_TEMP  0		/*   Create a temporary audit file	     */
#define DBG_PERM  1		/*   Create a permanent audit file	     */
#define DBG_CLEAN 2		/*   Cleanup, discard temp file		     */

int ReverseRole = 0;

int Role = SLAVE;
int onesys = 0;
int turntime = 30 * 60;	/* 30 minutes expressed in seconds */
char *ttyn = NULL;
extern int LocalOnly;
extern int errno;
extern char MaxGrade, DefMaxGrade;
extern char Myfullname[];

#ifdef	USG
struct termio Savettyb;
#endif
#ifndef	USG
struct sgttyb Savettyb;
#endif

/*
 *	this program is used  to place a call to a
 *	remote machine, login, and copy files between the two machines.
 */

main(argc, argv)
int argc;
register char *argv[];
{
	register int ret;
	int seq;
	char wkpre[NAMESIZE], file[NAMESIZE];
	char msg[MAXFULLNAME], *q;
	register char *p;
	extern onintr(), timeout(), dbg_signal();
	extern char *pskip();
	char rflags[MAXFULLNAME];

#ifdef NOGETPEER
	u_long Hostnumber = 0;
#endif NOGETPEER

	strcpy(Progname, "uucico");

	signal(SIGINT, onintr);
	signal(SIGHUP, onintr);
	signal(SIGQUIT, onintr);
	signal(SIGTERM, onintr);
	signal(SIGPIPE, onintr);	/* 4.1a tcp-ip stupidity */
	signal(SIGFPE, dbg_signal);
	ret = guinfo(getuid(), User, msg);
	strcpy(Loginuser, User);
	uucpname(Myname);
	ASSERT(ret == 0, "BAD UID", CNULL, ret);


	setbuf (stderr, CNULL);

	rflags[0] = '\0';
	umask(WFMASK);
	strcpy(Rmtname, Myname);
	Ifn = Ofn = -1;
	while(argc>1 && argv[1][0] == '-'){
		switch(argv[1][1]){
		case 'd':
			Spool = &argv[1][2];
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
		case 's':
			strncpy(Rmtname, &argv[1][2], MAXBASENAME);
			Rmtname[MAXBASENAME] = '\0';
			if (Rmtname[0] != '\0')
				onesys = 1;
			break;
		case 'x':
			chkdebug();
			Debug = atoi(&argv[1][2]);
			if (Debug <= 0)
				Debug = 1;
			logent("ENABLED", "DEBUG");
			break;
		case 't':
			turntime = atoi(&argv[1][2])*60;/* minutes to seconds */
			break;
		case 'L':	/* local calls only */
			LocalOnly++;
			break;
#ifdef NOGETPEER
		case 'h':
			Hostnumber = inet_addr(&argv[1][2]);
			break;
#endif NOGETPEER
		default:
			printf("unknown flag %s (ignored)\n", argv[1]);
			break;
		}
		--argc;  argv++;
	}

	while (argc > 1) {
		printf("unknown argument %s (ignored)\n", argv[1]);
		--argc; argv++;
	}

	/* Try to run as uucp */
	setgid(getegid());
	setuid(geteuid());
#ifdef	TIOCNOTTY







<



|




















|







135
136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
		case 's':
			strncpy(Rmtname, &argv[1][2], MAXBASENAME);
			Rmtname[MAXBASENAME] = '\0';
			if (Rmtname[0] != '\0')
				onesys = 1;
			break;
		case 'x':

			Debug = atoi(&argv[1][2]);
			if (Debug <= 0)
				Debug = 1;
			strcat(rflags, argv[1]);
			break;
		case 't':
			turntime = atoi(&argv[1][2])*60;/* minutes to seconds */
			break;
		case 'L':	/* local calls only */
			LocalOnly++;
			break;
#ifdef NOGETPEER
		case 'h':
			Hostnumber = inet_addr(&argv[1][2]);
			break;
#endif NOGETPEER
		default:
			printf("unknown flag %s (ignored)\n", argv[1]);
			break;
		}
		--argc;  argv++;
	}

	while (argc > 1) {
		fprintf(stderr, "unknown argument %s (ignored)\n", argv[1]);
		--argc; argv++;
	}

	/* Try to run as uucp */
	setgid(getegid());
	setuid(geteuid());
#ifdef	TIOCNOTTY
183
184
185
186
187
188
189











190
191
192
193
194
195
196
197
198


199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237


238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

276
277


278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
	}
#endif BSD4_2

	ret = subchdir(Spool);
	ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret);
	strcpy(Wrkdir, Spool);












	if (Role == SLAVE) {
		/* check for /etc/nologin */
		if (access(NOLOGIN, 0) == 0) {
			logent(NOLOGIN, "UUCICO SHUTDOWN");
			if (Debug > 4)
				logent("DEBUGGING", "continuing anyway");
			else
				cleanup(1);
		}


#ifdef	TCPIP
		/*
		 * Determine if we are on TCPIP
		 */
		if (isatty(0) ==  0) {
			IsTcpIp = 1;
			DEBUG(4, "TCPIP connection -- ioctl-s disabled\n", CNULL);
		} else
			IsTcpIp = 0;
#endif TCPIP
		/* initial handshake */
		onesys = 1;
		if (!IsTcpIp) {
#ifdef	USG
			ret = ioctl(0, TCGETA, &Savettyb);
			Savettyb.c_cflag = (Savettyb.c_cflag & ~CS8) | CS7;
			Savettyb.c_oflag |= OPOST;
			Savettyb.c_lflag |= (ISIG|ICANON|ECHO);
#else !USG
			ret = ioctl(0, TIOCGETP, &Savettyb);
			Savettyb.sg_flags |= ECHO;
			Savettyb.sg_flags &= ~RAW;
#endif !USG

		}
		Ifn = 0;
		Ofn = 1;
		fixmode(Ifn);
		getbaud(Ifn);
		sprintf(file,"%s/%d", RMTDEBUG, getpid());
#ifdef VMS
		/* hold the version number down */
		unlink(file);
#endif VMS
		freopen(file, "w", stderr);
#ifdef BSD4_2
		setlinebuf(stderr);
#else  !BSD4_2
		setbuf(stderr, NULL);
#endif !BSD4_2


		sprintf(msg, "here=%s", Myfullname);
		omsg('S', msg, Ofn);
		signal(SIGALRM, timeout);
		alarm(MAXMSGTIME);
		if (setjmp(Sjbuf)) {
			/* timed out */
			if (!IsTcpIp) {
#ifdef	USG
				ret = ioctl(0, TCSETA, &Savettyb);

#else	!USG
				ret = ioctl(0, TIOCSETP, &Savettyb);
#endif !USG
			}
			cleanup(0);
		}
		for (;;) {
			ret = imsg(msg, Ifn);
			if (ret != 0) {
				alarm(0);
				if (!IsTcpIp) {
#ifdef	USG
					ret = ioctl(0, TCSETA, &Savettyb);
#else	!USG
					ret = ioctl(0, TIOCSETP, &Savettyb);
#endif !USG
				}
				cleanup(0);
			}
			if (msg[0] == 'S')
				break;
		}
		alarm(0);
		q = &msg[1];
		p = pskip(q);
		strncpy(Rmtname, q, MAXBASENAME);
		Rmtname[MAXBASENAME] = '\0';
		sprintf(wkpre,"%s/%s", RMTDEBUG, Rmtname);
		unlink(wkpre);

		if (link(file, wkpre) == 0)
			unlink(file);


		DEBUG(4, "sys-%s\n", Rmtname);
		/* The versys will also do an alias on the incoming name */
		if (versys(&Rmtname)) {
			/* If we don't know them, we won't talk to them... */
#ifdef	NOSTRANGERS
			logent(Rmtname, "UNKNOWN HOST");
			omsg('R', "You are unknown to me", Ofn);
			cleanup(0);
#endif	NOSTRANGERS
		}
#ifdef BSDTCP
		/* we must make sure they are really who they say they
		 * are. We compare the hostnumber with the number in the hosts
		 * table for the site they claim to be.
		 */
		if (IsTcpIp) {
			struct hostent *hp;
			char *cpnt, *inet_ntoa();
			int len;
			struct sockaddr_in from;
			extern char PhoneNumber[];

#ifdef	NOGETPEER
			from.sin_addr.s_addr = Hostnumber;
			from.sin_family = AF_INET;
#else	!NOGETPEER
			len = sizeof(from);
			if (getpeername(0, &from, &len) < 0) {
				logent(Rmtname, "NOT A TCP CONNECTION");
				omsg('R', "NOT TCP", Ofn);
				cleanup(0);
			}
#endif	!NOGETPEER
			hp = gethostbyaddr(&from.sin_addr,
				sizeof (struct in_addr), from.sin_family);
			if (hp == 0) {
				/* security break or just old host table? */
				logent(Rmtname, "UNKNOWN IP-HOST Name =");
				cpnt = inet_ntoa(from.sin_addr),
				logent(cpnt, "UNKNOWN IP-HOST Number =");
				sprintf(wkpre, "%s/%s isn't in my host table",
					Rmtname, cpnt);
				omsg('R' ,wkpre ,Ofn);
				cleanup(0);
			}
			if (Debug>99)
				logent(Rmtname,"Request from IP-Host name =");
			/*
			 * The following is to determine if the name given us by
			 * the Remote uucico matches any of the names
			 * given its network number (remote machine) in our
			 * host table.
			 * We could check the aliases, but that won't work in







>
>
>
>
>
>
>
>
>
>
>









>
>




|









|




|



>

<
<


|
<
|
<
<
<
<
<
<
<
<
>
>








|
>

|






|



|

|












|
<
>
|
|
>
>


















|







|
|







|









|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239


240
241
242

243








244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283

284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
	}
#endif BSD4_2

	ret = subchdir(Spool);
	ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret);
	strcpy(Wrkdir, Spool);

	if (Debug) {
		if (Role == MASTER)
			chkdebug();
		setdebug ((Role == SLAVE) ? DBG_TEMP : DBG_PERM);
		if (Debug > 0)
			logent ("Local Enabled", "DEBUG");
	}

	/*
	 * First time through: If we're the slave, do initial checking.
	 */
	if (Role == SLAVE) {
		/* check for /etc/nologin */
		if (access(NOLOGIN, 0) == 0) {
			logent(NOLOGIN, "UUCICO SHUTDOWN");
			if (Debug > 4)
				logent("DEBUGGING", "continuing anyway");
			else
				cleanup(1);
		}
		Ifn = 0;
		Ofn = 1;
#ifdef	TCPIP
		/*
		 * Determine if we are on TCPIP
		 */
		if (isatty(Ifn) < 0) {
			IsTcpIp = 1;
			DEBUG(4, "TCPIP connection -- ioctl-s disabled\n", CNULL);
		} else
			IsTcpIp = 0;
#endif TCPIP
		/* initial handshake */
		onesys = 1;
		if (!IsTcpIp) {
#ifdef	USG
			ret = ioctl(Ifn, TCGETA, &Savettyb);
			Savettyb.c_cflag = (Savettyb.c_cflag & ~CS8) | CS7;
			Savettyb.c_oflag |= OPOST;
			Savettyb.c_lflag |= (ISIG|ICANON|ECHO);
#else !USG
			ret = ioctl(Ifn, TIOCGETP, &Savettyb);
			Savettyb.sg_flags |= ECHO;
			Savettyb.sg_flags &= ~RAW;
#endif !USG
			ttyn = ttyname(Ifn);
		}


		fixmode(Ifn);
		getbaud(Ifn);


		/*








		 * Initial Message -- tell them we're here, and who we are.
		 */
		sprintf(msg, "here=%s", Myfullname);
		omsg('S', msg, Ofn);
		signal(SIGALRM, timeout);
		alarm(MAXMSGTIME);
		if (setjmp(Sjbuf)) {
			/* timed out */
			if (!IsTcpIp) {
#ifdef	USG
				ret = ioctl(Ifn, TCSETA, &Savettyb);

#else	!USG
				ret = ioctl(Ifn, TIOCSETP, &Savettyb);
#endif !USG
			}
			cleanup(0);
		}
		for (;;) {
			ret = imsg(msg, Ifn);
			if (ret != SUCCESS) {
				alarm(0);
				if (!IsTcpIp) {
#ifdef	USG
					ret = ioctl(Ifn, TCSETA, &Savettyb);
#else	!USG
					ret = ioctl(Ifn, TIOCSETP, &Savettyb);
#endif !USG
				}
				cleanup(0);
			}
			if (msg[0] == 'S')
				break;
		}
		alarm(0);
		q = &msg[1];
		p = pskip(q);
		strncpy(Rmtname, q, MAXBASENAME);
		Rmtname[MAXBASENAME] = '\0';


		/*
		 * Now that we know who they are, give the audit file the right
		 * name.
		 */
		setdebug (DBG_PERM);
		DEBUG(4, "sys-%s\n", Rmtname);
		/* The versys will also do an alias on the incoming name */
		if (versys(&Rmtname)) {
			/* If we don't know them, we won't talk to them... */
#ifdef	NOSTRANGERS
			logent(Rmtname, "UNKNOWN HOST");
			omsg('R', "You are unknown to me", Ofn);
			cleanup(0);
#endif	NOSTRANGERS
		}
#ifdef BSDTCP
		/* we must make sure they are really who they say they
		 * are. We compare the hostnumber with the number in the hosts
		 * table for the site they claim to be.
		 */
		if (IsTcpIp) {
			struct hostent *hp;
			char *cpnt, *inet_ntoa();
			int fromlen;
			struct sockaddr_in from;
			extern char PhoneNumber[];

#ifdef	NOGETPEER
			from.sin_addr.s_addr = Hostnumber;
			from.sin_family = AF_INET;
#else	!NOGETPEER
			fromlen = sizeof(from);
			if (getpeername(Ifn, &from, &fromlen) < 0) {
				logent(Rmtname, "NOT A TCP CONNECTION");
				omsg('R', "NOT TCP", Ofn);
				cleanup(0);
			}
#endif	!NOGETPEER
			hp = gethostbyaddr(&from.sin_addr,
				sizeof (struct in_addr), from.sin_family);
			if (hp == NULL) {
				/* security break or just old host table? */
				logent(Rmtname, "UNKNOWN IP-HOST Name =");
				cpnt = inet_ntoa(from.sin_addr),
				logent(cpnt, "UNKNOWN IP-HOST Number =");
				sprintf(wkpre, "%s/%s isn't in my host table",
					Rmtname, cpnt);
				omsg('R' ,wkpre ,Ofn);
				cleanup(0);
			}
			if (Debug > 99)
				logent(Rmtname,"Request from IP-Host name =");
			/*
			 * The following is to determine if the name given us by
			 * the Remote uucico matches any of the names
			 * given its network number (remote machine) in our
			 * host table.
			 * We could check the aliases, but that won't work in
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

374
375
376







377
378
379
380
381
382
383
				sprintf(wkpre, "You're not who you claim to be: %s !=  %s", hp->h_name, PhoneNumber);
				omsg('R', wkpre, Ofn);
				cleanup(0);
			}
		}
#endif	BSDTCP

		if (mlock(Rmtname) == FAIL) {
			omsg('R', "LCK", Ofn);
			cleanup(0);
		}
		else if (callback(Loginuser)) {
			signal(SIGINT, SIG_IGN);
			signal(SIGHUP, SIG_IGN);
			omsg('R', "CB", Ofn);
			logent("CALLBACK", "REQUIRED");
			/*  set up for call back  */
			systat(Rmtname, SS_CALLBACK, "CALLING BACK");
			gename(CMDPRE, Rmtname, 'C', file);
			close(creat(subfile(file), 0666));
			xuucico(Rmtname);
			cleanup(0);
		}
		seq = 0;
		while (*p == '-') {
			q = pskip(p);
			switch(*(++p)) {
			case 'x':

				Debug = atoi(++p);
				if (Debug <= 0)
					Debug = 1;







				break;
			case 'Q':
				seq = atoi(++p);
				break;
			case 'p':
				MaxGrade = DefMaxGrade = *++p;
				DEBUG(4, "MaxGrade set to %c\n", MaxGrade);







|




















>
|
|
|
>
>
>
>
>
>
>







357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
				sprintf(wkpre, "You're not who you claim to be: %s !=  %s", hp->h_name, PhoneNumber);
				omsg('R', wkpre, Ofn);
				cleanup(0);
			}
		}
#endif	BSDTCP

		if (mlock(Rmtname)) {
			omsg('R', "LCK", Ofn);
			cleanup(0);
		}
		else if (callback(Loginuser)) {
			signal(SIGINT, SIG_IGN);
			signal(SIGHUP, SIG_IGN);
			omsg('R', "CB", Ofn);
			logent("CALLBACK", "REQUIRED");
			/*  set up for call back  */
			systat(Rmtname, SS_CALLBACK, "CALLING BACK");
			gename(CMDPRE, Rmtname, 'C', file);
			close(creat(subfile(file), 0666));
			xuucico(Rmtname);
			cleanup(0);
		}
		seq = 0;
		while (*p == '-') {
			q = pskip(p);
			switch(*(++p)) {
			case 'x':
				if (Debug == 0) {
					Debug = atoi(++p);
					if (Debug <= 0)
						Debug = 1;
					setdebug(DBG_PERM);
					if (Debug > 0)
						logent("Remote Enabled", "DEBUG");
				} else {
					DEBUG(1, "Remote debug request ignored\n",
					   CNULL);
				}
				break;
			case 'Q':
				seq = atoi(++p);
				break;
			case 'p':
				MaxGrade = DefMaxGrade = *++p;
				DEBUG(4, "MaxGrade set to %c\n", MaxGrade);
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
			logent("BAD SEQ", "FAILED HANDSHAKE");
#ifdef GNXSEQ
			ulkseq();
#endif GNXSEQ
			omsg('R', "BADSEQ", Ofn);
			cleanup(0);
		}
		ttyn = ttyname(Ifn);
		if (ttyn != NULL)
			chmod(ttyn, 0600);
	} else { /* Role == MASTER */
		struct stat stbuf;
		if (isatty(fileno(stderr)) || (fstat(fileno(stderr),&stbuf) == 0
		    && stbuf.st_mode&S_IFREG) )
			StdErrIsTty =  1;
		setdebug(0);
	}

loop:
	if(setjmp(Pipebuf)) {	/* come here on SIGPIPE	*/
		clsacu();
		close(Ofn);
		close(Ifn);
		Ifn = Ofn = -1;
		rmlock(CNULL);
		sleep(3);
	}
	if (!onesys) {
		struct stat sbuf;

		if (!StdErrIsTty) {
			sprintf(file, "%s/%s", RMTDEBUG, Rmtname);
			if (stat(file, &sbuf) == 0 && sbuf.st_size == 0)
				unlink(file);
		}
		ret = gnsys(Rmtname, Spool, CMDPRE);
		setdebug(0);
		if (ret == FAIL)
			cleanup(100);
		if (ret == SUCCESS)
			cleanup(0);
	} else if (Role == MASTER && callok(Rmtname) != 0) {
		logent("SYSTEM STATUS", "CAN NOT CALL");
		cleanup(0);







<


<
<
<
<
<
<












<
<
<
<
<
<
<

|







432
433
434
435
436
437
438

439
440






441
442
443
444
445
446
447
448
449
450
451
452







453
454
455
456
457
458
459
460
461
			logent("BAD SEQ", "FAILED HANDSHAKE");
#ifdef GNXSEQ
			ulkseq();
#endif GNXSEQ
			omsg('R', "BADSEQ", Ofn);
			cleanup(0);
		}

		if (ttyn != NULL)
			chmod(ttyn, 0600);






	}

loop:
	if(setjmp(Pipebuf)) {	/* come here on SIGPIPE	*/
		clsacu();
		close(Ofn);
		close(Ifn);
		Ifn = Ofn = -1;
		rmlock(CNULL);
		sleep(3);
	}
	if (!onesys) {







		ret = gnsys(Rmtname, Spool, CMDPRE);
		setdebug(DBG_PERM);
		if (ret == FAIL)
			cleanup(100);
		if (ret == SUCCESS)
			cleanup(0);
	} else if (Role == MASTER && callok(Rmtname) != 0) {
		logent("SYSTEM STATUS", "CAN NOT CALL");
		cleanup(0);
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
			US_SST(us_s_cok);
			UB_SST(ub_ok);
		}
#ifdef	TCPIP
		/*
		 * Determine if we are on TCPIP
		 */
		if (isatty(Ifn) ==  0) {
			IsTcpIp = 1;
			DEBUG(4, "TCPIP connection -- ioctl-s disabled\n", CNULL);
		} else
			IsTcpIp = 0;
#endif

		if (setjmp(Sjbuf))







|







507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
			US_SST(us_s_cok);
			UB_SST(ub_ok);
		}
#ifdef	TCPIP
		/*
		 * Determine if we are on TCPIP
		 */
		if (isatty(Ifn) == 0) {
			IsTcpIp = 1;
			DEBUG(4, "TCPIP connection -- ioctl-s disabled\n", CNULL);
		} else
			IsTcpIp = 0;
#endif

		if (setjmp(Sjbuf))
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
		}
		alarm(MAXMSGTIME);
#ifdef GNXSEQ
		seq = gnxseq(Rmtname);
#else !GNXSEQ
		seq = 0;
#endif !GNXSEQ
		if (Debug)
			sprintf(rflags, "-x%d", Debug);
		else
			rflags[0] = '\0';

		if (MaxGrade != '\177') {
			char buf[MAXFULLNAME];
			sprintf(buf, " -p%c -vgrade=%c", MaxGrade, MaxGrade);
			strcat(rflags, buf);
		}

		sprintf(msg, "%s -Q%d %s", Myname, seq, rflags);







<
<
<
<
<







534
535
536
537
538
539
540





541
542
543
544
545
546
547
		}
		alarm(MAXMSGTIME);
#ifdef GNXSEQ
		seq = gnxseq(Rmtname);
#else !GNXSEQ
		seq = 0;
#endif !GNXSEQ





		if (MaxGrade != '\177') {
			char buf[MAXFULLNAME];
			sprintf(buf, " -p%c -vgrade=%c", MaxGrade, MaxGrade);
			strcat(rflags, buf);
		}

		sprintf(msg, "%s -Q%d %s", Myname, seq, rflags);
589
590
591
592
593
594
595


596
597
598
599
600
601
602
603
604
605
606
607
608







609
610
611
612
613
614
615
616
#endif GNXSEQ
	}
	DEBUG(1, "Rmtname %s, ", Rmtname);
	DEBUG(1, "Role %s,  ", Role ? "MASTER" : "SLAVE");
	DEBUG(1, "Ifn - %d, ", Ifn);
	DEBUG(1, "Loginuser - %s\n", Loginuser);



	alarm(MAXMSGTIME);
	if (ret=setjmp(Sjbuf))
		goto Failure;
	ret = startup(Role);
	alarm(0);
	if (ret != SUCCESS) {
		logent("startup", _FAILED);
Failure:
		US_SST(us_s_start);
		systat(Rmtname, SS_FAIL, ret > 0 ? "CONVERSATION FAILED" :
			"STARTUP FAILED");
		goto next;
	} else {







		logent("startup", "OK");
		US_SST(us_s_gress);
		systat(Rmtname, SS_INPROGRESS, "TALKING");
		ret = cntrl(Role, wkpre);
		DEBUG(1, "cntrl - %d\n", ret);
		signal(SIGINT, SIG_IGN);
		signal(SIGHUP, SIG_IGN);
		signal(SIGALRM, timeout);







>
>













>
>
>
>
>
>
>
|







589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
#endif GNXSEQ
	}
	DEBUG(1, "Rmtname %s, ", Rmtname);
	DEBUG(1, "Role %s,  ", Role ? "MASTER" : "SLAVE");
	DEBUG(1, "Ifn - %d, ", Ifn);
	DEBUG(1, "Loginuser - %s\n", Loginuser);

	ttyn = ttyname(Ifn);

	alarm(MAXMSGTIME);
	if (ret=setjmp(Sjbuf))
		goto Failure;
	ret = startup(Role);
	alarm(0);
	if (ret != SUCCESS) {
		logent("startup", _FAILED);
Failure:
		US_SST(us_s_start);
		systat(Rmtname, SS_FAIL, ret > 0 ? "CONVERSATION FAILED" :
			"STARTUP FAILED");
		goto next;
	} else {
		if (ttyn != NULL) {
			char startupmsg[BUFSIZ];
			extern int linebaudrate;
			sprintf(startupmsg, "startup %s %d baud", &ttyn[5], 
				linebaudrate);
			logent(startupmsg, "OK");
		} else
			logent("startup", "OK");
		US_SST(us_s_gress);
		systat(Rmtname, SS_INPROGRESS, "TALKING");
		ret = cntrl(Role, wkpre);
		DEBUG(1, "cntrl - %d\n", ret);
		signal(SIGINT, SIG_IGN);
		signal(SIGHUP, SIG_IGN);
		signal(SIGALRM, timeout);
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668

669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687

688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
	cleanup(0);
}

#ifndef	USG
struct sgttyb Hupvec;
#endif

/***
 *	cleanup(code)	cleanup and exit with "code" status
 *	int code;
 */

cleanup(code)
register int code;
{
	register char *ttyn;
	char bfr[BUFSIZ];
	struct stat sbuf;

	signal(SIGINT, SIG_IGN);
	signal(SIGHUP, SIG_IGN);
	rmlock(CNULL);

	clsacu();
	logcls();
	if (Role == SLAVE) {
		if (!IsTcpIp) {
#ifdef USG
			Savettyb.c_cflag |= HUPCL;
			(void) ioctl(0, TCSETA, &Savettyb);
#else !USG
			(void) ioctl(0, TIOCHPCL, STBNULL);
#ifdef TIOCSDTR
			(void) ioctl(0, TIOCCDTR, STBNULL);
			sleep(2);
			(void) ioctl(0, TIOCSDTR, STBNULL);
#else !TIOCSDTR
			(void) ioctl(0, TIOCGETP, &Hupvec);
#endif !TIOCSDTR
			Hupvec.sg_ispeed = B0;
			Hupvec.sg_ospeed = B0;
			(void) ioctl(0, TIOCSETP, &Hupvec);

			sleep(2);
			(void) ioctl(0, TIOCSETP, &Savettyb);
			/* make *sure* exclusive access is off */
			(void) ioctl(0, TIOCNXCL, STBNULL);
#endif !USG
		}
		ttyn = ttyname(Ifn);
		if (ttyn != NULL)
			chmod(ttyn, 0600);
	}
	if (Ofn != -1) {
		if (Role == MASTER)
			write(Ofn, EOTMSG, strlen(EOTMSG));
		close(Ifn);
		close(Ofn);
	}
#ifdef DIALINOUT
	/* reenable logins on dialout */
	reenable();
#endif DIALINOUT
	if (code == 0)
		xuuxqt();
	else
		DEBUG(1, "exit code %d\n", code);
	sprintf(bfr, "%s/%s", RMTDEBUG, Rmtname);
	if (stat(bfr, &sbuf) == 0 && sbuf.st_size == 0)
		unlink(bfr);
	sprintf(bfr, "%s/%d", RMTDEBUG, getpid());
	unlink(bfr);
	exit(code);
}

/***
 *	onintr(inter)	interrupt - remove locks and exit
 */

onintr(inter)
register int inter;
{
	char str[30];
	signal(inter, SIG_IGN);







|
|
<

<



<
<
<
<



>















<



>






<

















|
<
<
<
<



|
|







656
657
658
659
660
661
662
663
664

665

666
667
668




669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687

688
689
690
691
692
693
694
695
696
697

698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715




716
717
718
719
720
721
722
723
724
725
726
727
	cleanup(0);
}

#ifndef	USG
struct sgttyb Hupvec;
#endif

/*
 *	cleanup and exit with "code" status

 */

cleanup(code)
register int code;
{




	signal(SIGINT, SIG_IGN);
	signal(SIGHUP, SIG_IGN);
	rmlock(CNULL);
	sleep(5);			/* Wait for any pending output	  */
	clsacu();
	logcls();
	if (Role == SLAVE) {
		if (!IsTcpIp) {
#ifdef USG
			Savettyb.c_cflag |= HUPCL;
			(void) ioctl(0, TCSETA, &Savettyb);
#else !USG
			(void) ioctl(0, TIOCHPCL, STBNULL);
#ifdef TIOCSDTR
			(void) ioctl(0, TIOCCDTR, STBNULL);
			sleep(2);
			(void) ioctl(0, TIOCSDTR, STBNULL);
#else !TIOCSDTR
			(void) ioctl(0, TIOCGETP, &Hupvec);

			Hupvec.sg_ispeed = B0;
			Hupvec.sg_ospeed = B0;
			(void) ioctl(0, TIOCSETP, &Hupvec);
#endif !TIOCSDTR
			sleep(2);
			(void) ioctl(0, TIOCSETP, &Savettyb);
			/* make *sure* exclusive access is off */
			(void) ioctl(0, TIOCNXCL, STBNULL);
#endif !USG
		}

		if (ttyn != NULL)
			chmod(ttyn, 0600);
	}
	if (Ofn != -1) {
		if (Role == MASTER)
			write(Ofn, EOTMSG, strlen(EOTMSG));
		close(Ifn);
		close(Ofn);
	}
#ifdef DIALINOUT
	/* reenable logins on dialout */
	reenable();
#endif DIALINOUT
	if (code == 0)
		xuuxqt();
	else
		DEBUG(1, "exit code %d\n", code);
	setdebug (DBG_CLEAN);




	exit(code);
}

/*
 *	on interrupt - remove locks and exit
 */

onintr(inter)
register int inter;
{
	char str[30];
	signal(inter, SIG_IGN);
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753

754
755
756







757



758

759
760
761




762
763
764
765











766

767








768


769



770
771





772
773



774


775
776

777


778





779
780
781
782











783
784



785

786


787
788
789
790
791
792



793
794

795
796

797
798

799
800
801
802
803


804
805
806
807
808
809
810
811
812
813
814
815
816
}

/*
 * Catch a special signal
 * (SIGFPE, ugh), and toggle debugging between 0 and 30.
 * Handy for looking in on long running uucicos.
 */
setdebug(code)
int code;
{
	char buf[BUFSIZ];

	if (code) {
		if (Debug == 0)
			Debug = 30;
		else
			Debug = 0;

	}
	if (Debug && !StdErrIsTty) {
		sprintf(buf,"%s/%s", RMTDEBUG, Rmtname);







		unlink(buf);



		freopen(buf, "w", stderr);

#ifdef BSD4_2
		setlinebuf(stderr);
#else  !BSD4_2




		setbuf(stderr, NULL);
#endif !BSD4_2
	}
}






















/***


 *	fixmode(tty)	fix kill/echo/raw on line



 *
 *	return codes:  none





 */




fixmode(tty)


register int tty;
{

#ifdef	USG


	struct termio ttbuf;





#endif
#ifndef	USG
	struct sgttyb ttbuf;
#endif












	if (IsTcpIp)



		return;

#ifdef	USG


	ioctl(tty, TCGETA, &ttbuf);
	ttbuf.c_iflag = ttbuf.c_oflag = ttbuf.c_lflag = (ushort)0;
	ttbuf.c_cflag &= (CBAUD);
	ttbuf.c_cflag |= (CS8|CREAD);
	ttbuf.c_cc[VMIN] = 6;
	ttbuf.c_cc[VTIME] = 1;



	ioctl(tty, TCSETA, &ttbuf);
#endif

#ifndef	USG
	ioctl(tty, TIOCGETP, &ttbuf);

	ttbuf.sg_flags = (ANYP | RAW);
	ioctl(tty, TIOCSETP, &ttbuf);

#endif
#ifndef	USG
	ioctl(tty, TIOCEXCL, STBNULL);
#endif
}




/*
 *	timeout()	catch SIGALRM routine
 */

timeout()
{
	extern int HaveSentHup;
	if (!HaveSentHup) {
		logent(Rmtname, "TIMEOUT");
		if (*Rmtname && strncmp(Rmtname, Myname, MAXBASENAME)) {
			US_SST(us_s_tmot);







<
|

<
<
<
|
|
<
|
>
|
|
|
>
>
>
>
>
>
>
|
>
>
>
|
>
|
|
<
>
>
>
>
|
<
|
<
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
|
<
>
>
>
>
>
|
|
>
>
>
|
>
>
|
<
>
|
>
>
|
>
>
>
>
>
|
<
<
|
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>

>
|
>
>
|
<
<
<
|
|
>
>
>
|
|
>
|
|
>
|
<
>
|
<
<
<
|
>
>
|


|

<







736
737
738
739
740
741
742

743
744



745
746

747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766

767
768
769
770
771

772

773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802

803
804
805
806
807
808
809
810
811
812
813
814
815
816

817
818
819
820
821
822
823
824
825
826
827


828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850



851
852
853
854
855
856
857
858
859
860
861
862

863
864



865
866
867
868
869
870
871
872

873
874
875
876
877
878
879
}

/*
 * Catch a special signal
 * (SIGFPE, ugh), and toggle debugging between 0 and 30.
 * Handy for looking in on long running uucicos.
 */

dbg_signal()
{



	Debug = (Debug == 0) ? 30 : 0;
	setdebug(DBG_PERM);

	if (Debug > 0)
		logent("Signal Enabled", "DEBUG");
}


/*
 * Check debugging requests, and open RMTDEBUG audit file if necessary. If an
 * audit file is needed, the parm argument indicates how to create the file:
 *
 *	DBG_TEMP  - Open a temporary file, with filename = RMTDEBUG/pid.
 *	DBG_PERM  - Open a permanent audit file, filename = RMTDEBUG/Rmtname.
 *		    If a temp file already exists, it is mv'ed to be permanent.
 *	DBG_CLEAN - Cleanup; unlink temp files.
 *
 * Restrictions - this code can only cope with one open debug file at a time.
 * Each call creates a new file; if an old one of the same name exists it will
 * be overwritten.
 */
setdebug(parm)
int parm;

{
	char buf[BUFSIZ];		/* Buffer for building filenames     */
	static char *temp = NULL;	/* Ptr to temporary file name	     */
	static int auditopen = 0;	/* Set to 1 when we open a file	     */
	struct stat stbuf;		/* File status buffer		     */



	/*
	 * If movement or cleanup of a temp file is indicated, we do it no
	 * matter what.
	 */
	if (temp != CNULL && parm == DBG_PERM) {
		sprintf(buf, "%s/%s", RMTDEBUG, Rmtname);
		unlink(buf);
		if (link(temp, buf) != 0) {
			Debug = 0;
			assert("RMTDEBUG LINK FAIL", temp, errno);
			cleanup(1);
		}
		parm = DBG_CLEAN;
	}
	if (parm == DBG_CLEAN) {
		if (temp != CNULL) {
			unlink(temp);
			free(temp);
			temp = CNULL;
		}
		return;
	}

	if (Debug == 0)
		return;		/* Gotta be in debug to come here.   */

	/*
	 * If we haven't opened a file already, we can just return if it's
	 * alright to use the stderr we came in with. We can if:
	 *

	 *	Role == MASTER, and Stderr is a regular file, a TTY or a pipe.
	 *
	 * Caution: Detecting when stderr is a pipe is tricky, because the 4.2
	 * man page for fstat(2) disagrees with reality, and System V leaves it
	 * undefined, which means different implementations act differently.
	 */
	if (!auditopen && Role == MASTER) {
		if (isatty(fileno(stderr)))
			return;
		else if (fstat(fileno(stderr), &stbuf) == 0) {
#ifdef USG
			/* Is Regular File or Fifo   */
			if ((stbuf.st_mode & 0060000) == 0)
				return;

#else !USG
#ifdef BSD4_2
					/* Is Regular File */
			if ((stbuf.st_mode & S_IFMT) == S_IFREG ||
			    stbuf.st_mode == 0)		/* Is a pipe */
				return;
#else !BSD4_2
					 /* Is Regular File or Pipe  */
			if ((stbuf.st_mode & S_IFMT) == S_IFREG)
				return;
#endif BSD4_2


#endif USG
		}
	}

	/*
	 * We need RMTDEBUG directory to do auditing. If the file doesn't exist,
	 * then we forget about debugging; if it exists but has improper owner-
	 * ship or modes, we gripe about it in ERRLOG. 
	 */
	if (stat(RMTDEBUG, &stbuf) != SUCCESS) {
		Debug = 0;
		return;
	}
	if ((geteuid() != stbuf.st_uid) ||	  	/* We must own it    */
	    ((stbuf.st_mode & 0170700) != 040700)) {	/* Directory, rwx    */
		Debug = 0;
		assert("INVALID RMTDEBUG DIRECTORY:", RMTDEBUG, stbuf.st_mode);
		return;
	}

	if (parm == DBG_TEMP) {
		sprintf(buf, "%s/%d", RMTDEBUG, getpid());
		temp = malloc(strlen (buf) + 1);



		if (temp == CNULL) {
			Debug = 0;
			assert("RMTDEBUG MALLOC ERROR:", temp, errno);
			cleanup(1);
		}
		strcpy(temp, buf);
	} else
		sprintf(buf, "%s/%s", RMTDEBUG, Rmtname);

	unlink(buf);
	if (freopen(buf, "w", stderr) != stderr) {
		Debug = 0;

		assert("FAILED RMTDEBUG FILE OPEN:", buf, errno);
		cleanup(1);



	}
	setbuf(stderr, CNULL);
	auditopen = 1;
}

/*
 *	catch SIGALRM routine
 */

timeout()
{
	extern int HaveSentHup;
	if (!HaveSentHup) {
		logent(Rmtname, "TIMEOUT");
		if (*Rmtname && strncmp(Rmtname, Myname, MAXBASENAME)) {
			US_SST(us_s_tmot);

Changes to usr.bin/uucp/uucico/condevs.c.

1
2
3
4



5
6
7
8
9
10
11
#ifndef lint
static char sccsid[] = "@(#)condevs.c	5.12 (Berkeley) 10/09/85";
#endif




/*
 * Here are various dialers to establish the machine-machine connection.
 * conn.c/condevs.c was glued together by Mike Mitchell.
 * The dialers were supplied by many people, to whom we are grateful.
 *
 * ---------------------------------------------------------------------
 * NOTE:

|


>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef lint
static char sccsid[] = "@(#)condevs.c	5.13 (Berkeley) 01/06/86";
#endif

extern int errno;
extern char *sys_errlist[];

/*
 * Here are various dialers to establish the machine-machine connection.
 * conn.c/condevs.c was glued together by Mike Mitchell.
 * The dialers were supplied by many people, to whom we are grateful.
 *
 * ---------------------------------------------------------------------
 * NOTE:
175
176
177
178
179
180
181

182
183
184
185

186
187
188
189
190
191
192
193
194
195
196
	if (status == FAIL) {
		logent("DEVICE", "NO");
		return CF_NODEV;
	}

	sprintf(dcname, "/dev/%s", dev.D_line);
	if (setjmp(Sjbuf)) {

		delock(dev.D_line);
		return CF_DIAL;
	}
	signal(SIGALRM, alarmtr);

	alarm(10);
	getnextfd();
	errno = 0;
        DEBUG(4,"Opening %s",dcname);
	dcr = open(dcname, 2); /* read/write */
#ifdef VMSDTR	/* Modem control on vms(works dtr) */
	fflush(stdout);
	if (modem_control) { /* Did we have MOD in the device type field ? */
		/* Sense the current terminal setup and save it */
		if ((ret = sys$qiow(_$EFN,(fd_fab_pointer[dcr]->fab).fab$l_stv,
			IO$_SENSEMODE,iosb,0,0,mode,8,0,0,0,0))







>




>
|


|







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
	if (status == FAIL) {
		logent("DEVICE", "NO");
		return CF_NODEV;
	}

	sprintf(dcname, "/dev/%s", dev.D_line);
	if (setjmp(Sjbuf)) {
		DEBUG(4, "Open timed out\n", CNULL);
		delock(dev.D_line);
		return CF_DIAL;
	}
	signal(SIGALRM, alarmtr);
	/* For PC Pursuit, it could take a while to call back */
	alarm( strcmp(flds[F_LINE], "PCP") ? 10 : MAXMSGTIME*4 );
	getnextfd();
	errno = 0;
        DEBUG(4,"Opening %s\n",dcname);
	dcr = open(dcname, 2); /* read/write */
#ifdef VMSDTR	/* Modem control on vms(works dtr) */
	fflush(stdout);
	if (modem_control) { /* Did we have MOD in the device type field ? */
		/* Sense the current terminal setup and save it */
		if ((ret = sys$qiow(_$EFN,(fd_fab_pointer[dcr]->fab).fab$l_stv,
			IO$_SENSEMODE,iosb,0,0,mode,8,0,0,0,0))
206
207
208
209
210
211
212
213
214
215
216



217
218
219
220
221

222

223
224
225
226
227
228
229
				!= SS$_NORMAL) {
			DEBUG(7, "ret status on sense failed on Modem setup=%x<", ret);
			return CF_DIAL;
		}
	}
#endif VMSDTR
	next_fd = -1;
	if (dcr < 0 && errno == EACCES)
		logent(dcname, "CAN'T OPEN");
	alarm(0);
	if (dcr < 0) {



		delock(dev.D_line);
		return CF_DIAL;
	}
	fflush(stdout);
	if (fixline(dcr, dev.D_speed) == FAIL)

		return CF_DIAL;

	strcpy(devSel, dev.D_line);	/* for latter unlock */
	CU_end = dircls;
	return dcr;
}

dircls(fd)
register int fd;







<
<


>
>
>




|
>

>







211
212
213
214
215
216
217


218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
				!= SS$_NORMAL) {
			DEBUG(7, "ret status on sense failed on Modem setup=%x<", ret);
			return CF_DIAL;
		}
	}
#endif VMSDTR
	next_fd = -1;


	alarm(0);
	if (dcr < 0) {
		if (errno == EACCES)
			logent(dev.D_line, "CANT OPEN");
		DEBUG(4, "OPEN FAILED: errno %d\n", errno);
		delock(dev.D_line);
		return CF_DIAL;
	}
	fflush(stdout);
	if (fixline(dcr, dev.D_speed) == FAIL) {
		DEBUG(4, "FIXLINE FAILED\n", CNULL);
		return CF_DIAL;
	}
	strcpy(devSel, dev.D_line);	/* for latter unlock */
	CU_end = dircls;
	return dcr;
}

dircls(fd)
register int fd;
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
			logent("L-devices", "No appropriate ACU");
	}
	if (acustatus == 1)
		logent("DEVICE", "NO");
	return retval;
}

#if defined(VENTEL) || defined(NOVATION) || defined(DF112)
/*
 * intervaldelay:  delay execution for numerator/denominator seconds.
 */

#ifdef INTERVALTIMER
#include <sys/time.h>
#define uucpdelay(num,denom) intervaldelay(num,denom)







<







343
344
345
346
347
348
349

350
351
352
353
354
355
356
			logent("L-devices", "No appropriate ACU");
	}
	if (acustatus == 1)
		logent("DEVICE", "NO");
	return retval;
}


/*
 * intervaldelay:  delay execution for numerator/denominator seconds.
 */

#ifdef INTERVALTIMER
#include <sys/time.h>
#define uucpdelay(num,denom) intervaldelay(num,denom)
397
398
399
400
401
402
403
404
405
406
407
408
409













































410


411
412
413
414
415
416
417

slowrite(fd, str)
register char *str;
{
	DEBUG(6, "slowrite ", CNULL);
	while (*str) {
		DEBUG(6, "%c", *str);
		uucpdelay(1,10);	/* delay 1/10 second */
		write(fd, str, 1);
		str++;
	}
	DEBUG(6, "\n", CNULL);
}













































#endif VENTEL || NOVATION || DF112



#ifdef DIALINOUT
/* DIALIN/OUT CODE (WLS) */
/*
 * disable and reenable:  allow a single line to be use for dialin/dialout
 *
 */







|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471

slowrite(fd, str)
register char *str;
{
	DEBUG(6, "slowrite ", CNULL);
	while (*str) {
		DEBUG(6, "%c", *str);
		uucpdelay(1, 10);	/* delay 1/10 second */
		write(fd, str, 1);
		str++;
	}
	DEBUG(6, "\n", CNULL);
}

#define BSPEED B150

/*
 *	send a break
 */
genbrk(fn, bnulls)
register int fn, bnulls;
{
#ifdef	USG
	if (ioctl(fn, TCSBRK, STBNULL) < 0)
		DEBUG(5, "break TCSBRK %s\n", sys_errlist[errno]);
#else	!USG
# ifdef	TIOCSBRK
	if (ioctl(fn, TIOCSBRK, STBNULL) < 0)
		DEBUG(5, "break TIOCSBRK %s\n", sys_errlist[errno]);
# ifdef	TIOCCBRK
	uucpdelay(bnulls, 10);
	if (ioctl(fn, TIOCCBRK, STBNULL) < 0)
		DEBUG(5, "break TIOCCBRK %s\n", sys_errlist[errno]);
# endif TIOCCBRK
	DEBUG(4, "ioctl %f second break\n", (float) bnulls/10 );
# else !TIOCSBRK
	struct sgttyb ttbuf;
	register int sospeed;

	if (ioctl(fn, TIOCGETP, &ttbuf) < 0)
		DEBUG(5, "break TIOCGETP %s\n", sys_errlist[errno]);
	sospeed = ttbuf.sg_ospeed;
	ttbuf.sg_ospeed = BSPEED;
	if (ioctl(fn, TIOCSETP, &ttbuf) < 0)
		DEBUG(5, "break TIOCSETP %s\n", sys_errlist[errno]);
	if (write(fn, "\0\0\0\0\0\0\0\0\0\0\0\0", bnulls) != bnulls) {
badbreak:
		logent(sys_errlist[errno], "BAD WRITE genbrk");
		alarm(0);
		longjmp(Sjbuf, 3);
	}
	ttbuf.sg_ospeed = sospeed;
	if (ioctl(fn, TIOCSETP, &ttbuf) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
	if (write(fn, "@", 1) != 1)
		goto badbreak;
	DEBUG(4, "sent BREAK nulls - %d\n", bnulls);
#endif !TIOCSBRK
#endif !USG
}


#ifdef DIALINOUT
/* DIALIN/OUT CODE (WLS) */
/*
 * disable and reenable:  allow a single line to be use for dialin/dialout
 *
 */

Changes to usr.bin/uucp/uucico/conn.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)conn.c	5.8 (Berkeley) 11/22/85";
#endif

#include <signal.h>
#include "uucp.h"
#include <setjmp.h>
#include <ctype.h>
#include <errno.h>

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static char sccsid[] = "@(#)conn.c	5.9 (Berkeley) 01/06/86";
#endif

#include <signal.h>
#include "uucp.h"
#include <setjmp.h>
#include <ctype.h>
#include <errno.h>
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56































57
58
59
60
61
62
63

#define ABORT -2

char 	*AbortOn = NULL;
char	par_tab[128];	/* must be power of two */
int	linebaudrate;	/* used for the sleep test in pk1.c */
int next_fd = -1;	/* predicted fd to close interrupted opens */
				/* rti!trt, courtesy unc!smb */

/*
 *	catch alarm routine for "expect".
 */
alarmtr()
{
	signal(SIGALRM, alarmtr);
	if (next_fd >= 0) {
		if (close(next_fd))
			logent("FAIL", "ACU LINE CLOSE");
		next_fd = -1;
	}
	longjmp(Sjbuf, 1);
}
































/*
 *	place a telephone call to system and login, etc.
 *
 *	return codes:
 *		CF_SYSTEM: don't know system
 *		CF_TIME: wrong time to call







|
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

#define ABORT -2

char 	*AbortOn = NULL;
char	par_tab[128];	/* must be power of two */
int	linebaudrate;	/* used for the sleep test in pk1.c */
int next_fd = -1;	/* predicted fd to close interrupted opens */

char *PCP = "PCP";	/* PC Pursuit device type */
/*
 *	catch alarm routine for "expect".
 */
alarmtr()
{
	signal(SIGALRM, alarmtr);
	if (next_fd >= 0) {
		if (close(next_fd))
			logent("FAIL", "ACU LINE CLOSE");
		next_fd = -1;
	}
	longjmp(Sjbuf, 1);
}

/* This template is for seismo to call ihnp4 
 * the 3 lines marked ---> will be overwritten for the appropriate city
 */
#define PCP_BAUD	3
#define PCP_PHONE	4
#define PCP_CALLBACK	8
#define PCP_CITY	10
#define PCP_RPHONE	12
#define NPCFIELDS	15

static char *PCFlds[] = {
	"PC-PURSUIT",
	"Any",
	"ACU",
	"1200",
	CNULL,	/* <--- **** Welcome to Telenet PC Pursuit ***** */
	"ABORT",
	"Good",	/* Abort of Good bye! */
	")", 	/* <--- Enter your 7-digit phone number (xxx-xxxx) */
	CNULL,	/* ---> 528-1234 */
	"call?", 	/* <--- Which city do you wish to call? */
	CNULL,	/* ---> CHICAGO */
	")", 	/* <--- Enter the phone number you wish to call (xxx-xxxx) */
	CNULL,	/* ---> 690-7171 */
	"R)?", 	/* <--- You are #1 in the queue. Do you want to wait, or Restart (Y/N/R)? */
	"Y",
	CNULL 	/* <--- .....Good Bye! */
};

static char PCP_brand[20];

/*
 *	place a telephone call to system and login, etc.
 *
 *	return codes:
 *		CF_SYSTEM: don't know system
 *		CF_TIME: wrong time to call
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96


97
98
99
100
101


























102

103




104
105


106



107
108
109
110
111
112
113











114
115

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
int Dcf = -1;
char *Flds[MAXC/10];
extern int LocalOnly;

conn(system)
char *system;
{
	int ret, nf;
	register int fn = 0;
	char info[MAXC], wkpre[NAMESIZE], file[NAMESIZE];
	register FILE *fsys;
	int fcode = 0;

	nf = 0;

	fsys = fopen(SYSFILE, "r");
	ASSERT(fsys != NULL, "CAN'T OPEN", SYSFILE, 0);

	DEBUG(4, "finds (%s) called\n", system);
keeplooking:
	while((nf = finds(fsys, system, info, Flds)) > 0) {
		if (LocalOnly) {
			if (strcmp("TCP", Flds[F_LINE])
				&& strcmp("DIR", Flds[F_LINE])
				&& strcmp("LOCAL", Flds[F_LINE]) )
					fn = CF_TIME;


		}
		sprintf(wkpre, "%c.%.*s", CMDPRE, SYSNSIZE, Rmtname);
		if (!onesys && MaxGrade != DefMaxGrade &&
			!iswrk(file, "chk", Spool, wkpre)) 
				fn = CF_TIME;


























		if (fn != CF_TIME && (fn = getto(Flds)) > 0) {

			Dcf = fn;




			break;
		}


		fcode = (fn == FAIL ? CF_DIAL : fn);



	}

	if (nf <= 0) {
		fclose(fsys);
		return fcode ? fcode : nf;
	}












	DEBUG(4, "login %s\n", "called");
	ret = login(nf, Flds, fn);

	if (ret != SUCCESS) {
		clsacu();
		if (ret == ABORT) {
			fcode = CF_DIAL;
			goto  keeplooking;
		} else {
			fclose(fsys);
			return CF_LOGIN;
		}
	}
	fclose(fsys);
	fioclex(fn);
	return fn;
}

/*
 *	connect to remote machine
 *
 *	return codes:
 *		>0  -  file number - ok







|
<















|
|
>
>



|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
|
|
>
>
|
>
>
>







>
>
>
>
>
>
>
>
>
>
>
|
|
>
|

|








|
|







103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
int Dcf = -1;
char *Flds[MAXC/10];
extern int LocalOnly;

conn(system)
char *system;
{
	int nf;

	char info[MAXC], wkpre[NAMESIZE], file[NAMESIZE];
	register FILE *fsys;
	int fcode = 0;

	nf = 0;

	fsys = fopen(SYSFILE, "r");
	ASSERT(fsys != NULL, "CAN'T OPEN", SYSFILE, 0);

	DEBUG(4, "finds (%s) called\n", system);
keeplooking:
	while((nf = finds(fsys, system, info, Flds)) > 0) {
		if (LocalOnly) {
			if (strcmp("TCP", Flds[F_LINE])
				&& strcmp("DIR", Flds[F_LINE])
				&& strcmp("LOCAL", Flds[F_LINE]) ) {
					fcode = CF_TIME;
					continue;
			}
		}
		sprintf(wkpre, "%c.%.*s", CMDPRE, SYSNSIZE, Rmtname);
		if (!onesys && MaxGrade != DefMaxGrade &&
			!iswrk(file, "chk", Spool, wkpre))  {
				fcode = CF_TIME;
				continue;
		}
		/* For GTE's PC Pursuit */
		if (snccmp(Flds[F_LINE], PCP) == SAME) {
			FILE *dfp;
			int status;
			static struct Devices dev;
			dfp = fopen(DEVFILE, "r");
			ASSERT(dfp != NULL, "Can't open", DEVFILE, 0);
			while ((status=rddev(dfp, &dev)) != FAIL
				&& strcmp(PCP, dev.D_type) != SAME)
					;
			fclose(dfp);
			if (status == FAIL)
				continue;
			if (mlock(PCP) == FAIL) {
				fcode = CF_NODEV;
				logent("DEVICE", "NO");
				continue;
			}
			PCFlds[PCP_BAUD] = dev.D_class;
			PCFlds[PCP_PHONE] = dev.D_calldev;
			PCFlds[PCP_CALLBACK] = dev.D_arg[D_CHAT];
			PCFlds[PCP_CITY] = Flds[F_CLASS];
			PCFlds[PCP_RPHONE] = Flds[F_PHONE];
			strncpy(PCP_brand, dev.D_brand, sizeof(PCP_brand));
			if ((fcode = getto(PCFlds)) < 0)
				continue;
			Dcf = fcode;
			fcode = login(NPCFIELDS, PCFlds, Dcf);
			clsacu(); /* Hang up, they'll call back */
			if (fcode != SUCCESS) {
				fcode = CF_DIAL;
				continue;
			}
			Flds[F_CLASS] = dev.D_class;
			Flds[F_PHONE] = dev.D_line;
			
		} /* end PC Pursuit */
		if ((fcode = getto(Flds)) > 0) 
			break;
	}

	if (nf <= 0) {
		fclose(fsys);
		return fcode ? fcode : nf;
	}

	Dcf = fcode;

	if (fcode >= 0 && snccmp(Flds[F_LINE], PCP) == SAME) {
		AbortOn = "Good";	/* .... Good Bye */
		fcode = expect("****~300", Dcf);
		if (fcode != SUCCESS) {
			DEBUG(4, "\nexpect timed out\n", CNULL);
			fcode = CF_DIAL;
		}
	}
	if (fcode >= 0) {
		DEBUG(4, "login %s\n", "called");
		fcode = login(nf, Flds, Dcf);
	}
	if (fcode < 0) {
		clsacu();
		if (fcode == ABORT) {
			fcode = CF_DIAL;
			goto  keeplooking;
		} else {
			fclose(fsys);
			return CF_LOGIN;
		}
	}
	fclose(fsys);
	fioclex(Dcf);
	return Dcf;
}

/*
 *	connect to remote machine
 *
 *	return codes:
 *		>0  -  file number - ok
151
152
153
154
155
156
157









158
159
160
161
162
163
164

165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
	else
		line = flds[F_LINE];
#ifdef DIALINOUT
	if (snccmp(line, "ACU") != SAME)
		reenable();
#endif DIALINOUT
	CU_end = nulldev;









	for (cd = condevs; cd->CU_meth != NULL; cd++) {
		if (snccmp(cd->CU_meth, line) == SAME) {
			DEBUG(4, "Using %s to call\n", cd->CU_meth);
			return (*(cd->CU_gen))(flds);
		}
	}
	DEBUG(1, "Can't find %s, assuming DIR\n", flds[F_LINE]);

	return diropn(flds);	/* search failed, so use direct */
}

/*
 *	close call unit
 *
 *	return codes:  none
 */

int (*CU_end)() = nulldev;
clsacu()
{
	/* make *sure* Dcf is no longer exclusive.
	 * Otherwise dual call-in/call-out modems could get stuck.
	 * Unfortunately, doing this here is not ideal, but it is the
	 * easiest place to put the call.
	 * Hopefully everyone honors the LCK protocol, of course
	 */
#ifndef	USG
	if (!IsTcpIp && Dcf >= 0 && ioctl(Dcf, TIOCNXCL, STBNULL) < 0)
		DEBUG(5, "clsacu ioctl %s\n", sys_errlist[errno]);
#endif
	if  (setjmp(Sjbuf))
		logent(Rmtname, "CLOSE TIMEOUT");
	else {
		signal(SIGALRM, alarmtr);







>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
>


















|







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
	else
		line = flds[F_LINE];
#ifdef DIALINOUT
	if (snccmp(line, "ACU") != SAME)
		reenable();
#endif DIALINOUT
	CU_end = nulldev;
	if (snccmp(line, PCP) == SAME) {
		for(cd = condevs; cd->CU_meth != NULL; cd++) {
			if (snccmp(PCP_brand, cd->CU_brand) == SAME) {
				CU_end = cd->CU_clos;
				return diropn(flds);
			}
		}
		logent(PCP_brand, "UNSUPPORTED ACU TYPE");
	} else {
		for (cd = condevs; cd->CU_meth != NULL; cd++) {
			if (snccmp(cd->CU_meth, line) == SAME) {
				DEBUG(4, "Using %s to call\n", cd->CU_meth);
				return (*(cd->CU_gen))(flds);
			}
		}
		DEBUG(1, "Can't find %s, assuming DIR\n", flds[F_LINE]);
	}
	return diropn(flds);	/* search failed, so use direct */
}

/*
 *	close call unit
 *
 *	return codes:  none
 */

int (*CU_end)() = nulldev;
clsacu()
{
	/* make *sure* Dcf is no longer exclusive.
	 * Otherwise dual call-in/call-out modems could get stuck.
	 * Unfortunately, doing this here is not ideal, but it is the
	 * easiest place to put the call.
	 * Hopefully everyone honors the LCK protocol, of course
	 */
#ifdef	TIOCNXCL
	if (!IsTcpIp && Dcf >= 0 && ioctl(Dcf, TIOCNXCL, STBNULL) < 0)
		DEBUG(5, "clsacu ioctl %s\n", sys_errlist[errno]);
#endif
	if  (setjmp(Sjbuf))
		logent(Rmtname, "CLOSE TIMEOUT");
	else {
		signal(SIGALRM, alarmtr);
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
			if (altern != NULL)
				*altern++ = '\0';
			if (strcmp(want, "ABORT") == 0) {
				AbortOn = flds[k+1];
				DEBUG(4, "ABORT ON: %s\n", AbortOn);
				goto nextfield;
			}
			DEBUG(4, "wanted: %s\n", want);
			ok = expect(want, fn);
			DEBUG(4, "got: %s\n", ok ? "?" : "that");
			if (ok == FAIL) {
				if (altern == NULL) {
					logent("LOGIN", _FAILED);
					return FAIL;
				}







|







423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
			if (altern != NULL)
				*altern++ = '\0';
			if (strcmp(want, "ABORT") == 0) {
				AbortOn = flds[k+1];
				DEBUG(4, "ABORT ON: %s\n", AbortOn);
				goto nextfield;
			}
			DEBUG(4, "wanted \"%s\"\n", want);
			ok = expect(want, fn);
			DEBUG(4, "got: %s\n", ok ? "?" : "that");
			if (ok == FAIL) {
				if (altern == NULL) {
					logent("LOGIN", _FAILED);
					return FAIL;
				}
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
	if (ioctl(tty, TIOCEXCL, STBNULL) < 0)
		return FAIL;
#endif
	linebaudrate = spwant;
	return SUCCESS;
}

/***
 *	getbaud(tty)	set linebaudrate variable
 *
 *	return codes:  none
 */

getbaud(tty)
int tty;







|







558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
	if (ioctl(tty, TIOCEXCL, STBNULL) < 0)
		return FAIL;
#endif
	linebaudrate = spwant;
	return SUCCESS;
}

/*
 *	getbaud(tty)	set linebaudrate variable
 *
 *	return codes:  none
 */

getbaud(tty)
int tty;
554
555
556
557
558
559
560

561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577

578
579
580
581
582
583
584
585
586
587
588

	if (setjmp(Sjbuf))
		return FAIL;
	signal(SIGALRM, alarmtr);
	alarm(timo);
	*rp = 0;
	while (notin(str, rdvec)) {

		if(AbortOn != NULL && !notin(AbortOn, rdvec)) {
			DEBUG(1, "Call aborted on '%s'\n", AbortOn);
			alarm(0);
			return ABORT;
		}
		kr = read(fn, &nextch, 1);
		if (kr <= 0) {
			alarm(0);
			DEBUG(4, "lost line kr - %d\n, ", kr);
			logent("LOGIN", "LOST LINE");
			return FAIL;
		}
		{
		int c;
		c = nextch & 0177;
		DEBUG(4, c >= 040 ? "%c" : "\\%03o", c);
		if (c == '\n')

			DEBUG(4,"\n", CNULL);
		}
		if ((*rp = nextch & 0177) != '\0')
			rp++;
		if (rp >= rdvec + MR) {
			register char *p;
			for (p = rdvec+MR/2; p < rp; p++)
				*(p-MR/2) = *p;
			rp -= MR/2;
		}
		*rp = '\0';







>












<
<

<
|
>
|
<
<
|







645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664


665

666
667
668


669
670
671
672
673
674
675
676

	if (setjmp(Sjbuf))
		return FAIL;
	signal(SIGALRM, alarmtr);
	alarm(timo);
	*rp = 0;
	while (notin(str, rdvec)) {
		int c;
		if(AbortOn != NULL && !notin(AbortOn, rdvec)) {
			DEBUG(1, "Call aborted on '%s'\n", AbortOn);
			alarm(0);
			return ABORT;
		}
		kr = read(fn, &nextch, 1);
		if (kr <= 0) {
			alarm(0);
			DEBUG(4, "lost line kr - %d\n, ", kr);
			logent("LOGIN", "LOST LINE");
			return FAIL;
		}


		c = nextch & 0177;

		if (c == '\0')
			continue;
		DEBUG(4, (isprint(c) || isspace(c)) ? "%c" : "\\%03o", c);


		*rp++ = c;
		if (rp >= rdvec + MR) {
			register char *p;
			for (p = rdvec+MR/2; p < rp; p++)
				*(p-MR/2) = *p;
			rp -= MR/2;
		}
		*rp = '\0';
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
int fn;
{
	register char *strptr;
	int i, n, cr = 1;
	register char c;
	static int p_init = 0;

	DEBUG(5, "send %s\n", str);

	if (!p_init) {
		p_init++;
		bld_partab(P_EVEN);
	}

	if (prefix("BREAK", str)) {







|







701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
int fn;
{
	register char *strptr;
	int i, n, cr = 1;
	register char c;
	static int p_init = 0;

	DEBUG(5, "send \"%s\"\n", str);

	if (!p_init) {
		p_init++;
		bld_partab(P_EVEN);
	}

	if (prefix("BREAK", str)) {
644
645
646
647
648
649
650
651
652

653

654
655
656


657
658
659
660
661
662
663

	if (strcmp(str, "EOT") == SAME) {
		p_chwrite(fn, '\04');
		return;
	}

	/* Send a '\n' */
	if (strcmp(str, "LF") == SAME)
		str = "\\n\\c";



	/* Send a '\r' */
	if (strcmp(str, "CR") == SAME)
		str = "\\r\\c";



	/* Set parity as needed */
	if (strcmp(str, "P_ZERO") == SAME) {
		bld_partab(P_ZERO);
		return;
	}
	if (strcmp(str, "P_ONE") == SAME) {







|
|
>
|
>

|
|
>
>







732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755

	if (strcmp(str, "EOT") == SAME) {
		p_chwrite(fn, '\04');
		return;
	}

	/* Send a '\n' */
	if (strcmp(str, "LF") == SAME) {
		p_chwrite(fn, '\n');
		return;
	}

	/* Send a '\r' */
	if (strcmp(str, "CR") == SAME) {
		p_chwrite(fn, '\r');
		return;
	}

	/* Set parity as needed */
	if (strcmp(str, "P_ZERO") == SAME) {
		bld_partab(P_ZERO);
		return;
	}
	if (strcmp(str, "P_ONE") == SAME) {
675
676
677
678
679
680
681
682

683
684




685
686
687
688
689
690
691
692




693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716

717
718
719
720

721
722

723
724
725
726
727
728
729

730
731
732
733
734
735
736
737

	/* If "", just send '\r' */
	if (strcmp(str, "\"\"") == SAME) {
		p_chwrite(fn, '\r');
		return;
	}

	for (strptr = str; c = *strptr++;) {

		if (c == '\\') {
			switch(*strptr++) {




			case 's':
				DEBUG(5, "BLANK\n", CNULL);
				p_chwrite(fn, ' ');
				break;
			case 'd':
				DEBUG(5, "DELAY\n", CNULL);
				sleep(1);
				continue;




			case 'r':
				DEBUG(5, "RETURN\n", CNULL);
				p_chwrite(fn, '\r');
				break;
			case 'b':
				if (isdigit(*strptr)) {
					i = (*strptr++ - '0');
					if (i <= 0 || i > 10)
						i = 3;
				} else
					i = 3;
				/* send break */
				genbrk(fn, i);
				if (*strptr == '\0')
					cr = 0;
				continue;
			case 'c':
				if (*strptr == '\0') {
					DEBUG(5, "NO CR\n", CNULL);
					cr = 0;
					continue;
				}
				DEBUG(5, "NO CR - MIDDLE IGNORED\n", CNULL);
				continue;

			default:
				if (isdigit(*strptr)) {
					i = 0;
					n = 0;

					while (isdigit(*strptr) && ++n <= 3)
						i = i*8 + (*strptr++ - '0');

					p_chwrite(fn, (char)i);
					continue;
				}
				DEBUG(5, "BACKSLASH\n", CNULL);
				--strptr;
			}
		} else

			p_chwrite(fn, c);
	}

	if (cr)
		p_chwrite(fn, '\r');
	return;
}








|
>


>
>
>
>


|





>
>
>
>


|

















<
|
|

>

|


>
|
|
>



<
<

<
>
|







767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813

814
815
816
817
818
819
820
821
822
823
824
825
826
827
828


829

830
831
832
833
834
835
836
837
838

	/* If "", just send '\r' */
	if (strcmp(str, "\"\"") == SAME) {
		p_chwrite(fn, '\r');
		return;
	}

	strptr = str;
	while ((c = *strptr++) != '\0') {
		if (c == '\\') {
			switch(*strptr++) {
			case '\0':
				DEBUG(5, "TRAILING BACKSLASH IGNORED\n", CNULL);
				--strptr;
				continue;
			case 's':
				DEBUG(5, "BLANK\n", CNULL);
				c = ' ';
				break;
			case 'd':
				DEBUG(5, "DELAY\n", CNULL);
				sleep(1);
				continue;
			case 'n':
				DEBUG(5, "NEW LINE\n", CNULL);
				c = '\n';
				break;
			case 'r':
				DEBUG(5, "RETURN\n", CNULL);
				c = '\r';
				break;
			case 'b':
				if (isdigit(*strptr)) {
					i = (*strptr++ - '0');
					if (i <= 0 || i > 10)
						i = 3;
				} else
					i = 3;
				/* send break */
				genbrk(fn, i);
				if (*strptr == '\0')
					cr = 0;
				continue;
			case 'c':
				if (*strptr == '\0') {
					DEBUG(5, "NO CR\n", CNULL);
					cr = 0;

				} else
					DEBUG(5, "NO CR - IGNORED NOT EOL\n", CNULL);
				continue;
#define isoctal(x)	((x >= '0') && (x <= '7'))
			default:
				if (isoctal(strptr[-1])) {
					i = 0;
					n = 0;
					--strptr;
					while (isoctal(*strptr) && ++n <= 3)
						i = i * 8 + (*strptr++ - '0');
					DEBUG(5, "\\%o\n", i);
					p_chwrite(fn, (char)i);
					continue;
				}


			}

		}
		p_chwrite(fn, c);
	}

	if (cr)
		p_chwrite(fn, '\r');
	return;
}

762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
		if (type == P_ONE
		 || (type == P_EVEN && (n&01) != 0)
		 || (type == P_ODD && (n&01) == 0))
			par_tab[i] |= sizeof(par_tab);
	}
}

#define BSPEED B150

/*
 *	send a break
 */
genbrk(fn, bnulls)
register int fn, bnulls;
{
#ifdef	USG
	if (ioctl(fn, TCSBRK, STBNULL) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
#else	!USG
	struct sgttyb ttbuf;
	register int sospeed;
# ifdef	TIOCSBRK
	if (ioctl(fn, TIOCSBRK, STBNULL) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
# ifdef	TIOCCBRK
	sleep(1);
	if (ioctl(fn, TIOCCBRK, STBNULL) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
# endif TIOCCBRK
	DEBUG(4, "ioctl %d second break\n", bnulls );
# else !TIOCSBRK

	if (ioctl(fn, TIOCGETP, &ttbuf) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
	sospeed = ttbuf.sg_ospeed;
	ttbuf.sg_ospeed = BSPEED;
	if (ioctl(fn, TIOCSETP, &ttbuf) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
	if (write(fn, "\0\0\0\0\0\0\0\0\0\0\0\0", bnulls) != bnulls) {
badbreak:
		logent(sys_errlist[errno], "BAD WRITE genbrk");
		alarm(0);
		longjmp(Sjbuf, 3);
	}
	ttbuf.sg_ospeed = sospeed;
	if (ioctl(fn, TIOCSETP, &ttbuf) < 0)
		DEBUG(5, "break ioctl %s\n", sys_errlist[errno]);
	if (write(fn, "@", 1) != 1)
		goto badbreak;
	DEBUG(4, "sent BREAK nulls - %d\n", bnulls);
#endif !TIOCSBRK
#endif !USG
}

/*
 *	check for occurrence of substring "sh"
 *
 *	return codes:
 *		0  -  found the string
 *		1  -  not in the string
 */







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







863
864
865
866
867
868
869















































870
871
872
873
874
875
876
		if (type == P_ONE
		 || (type == P_EVEN && (n&01) != 0)
		 || (type == P_ODD && (n&01) == 0))
			par_tab[i] |= sizeof(par_tab);
	}
}
















































/*
 *	check for occurrence of substring "sh"
 *
 *	return codes:
 *		0  -  found the string
 *		1  -  not in the string
 */
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848

/*
 *	Allow multiple date specifications separated by ','.
 */
ifdate(p)
register char *p;
{
	register char *np, c;
	register int ret, g;
	int rtime, i;

	/*  pick up retry time for failures  */
	/*  global variable Retrytime is set here  */
	if ((np = index(p, ';')) == NULL) {
		Retrytime = RETRYTIME;







|







888
889
890
891
892
893
894
895
896
897
898
899
900
901
902

/*
 *	Allow multiple date specifications separated by ','.
 */
ifdate(p)
register char *p;
{
	register char *np;
	register int ret, g;
	int rtime, i;

	/*  pick up retry time for failures  */
	/*  global variable Retrytime is set here  */
	if ((np = index(p, ';')) == NULL) {
		Retrytime = RETRYTIME;
926
927
928
929
930
931
932






933
934
935
936
937
938
939
		}
		if (prefix("Night", s)) {
			if (tp->tm_wday == 6  /* Sat */
				|| tp->tm_hour >= 23 || tp->tm_hour < 8
					/* Sunday before 5pm */
				|| (tp->tm_wday == 0 && tp->tm_hour < 17))
					dayok = 1;






		}
		s++;
	}

	if (dayok == 0 && s != string)
		return FAIL;
	i = sscanf(s, "%d-%d", &tl, &th);







>
>
>
>
>
>







980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
		}
		if (prefix("Night", s)) {
			if (tp->tm_wday == 6  /* Sat */
				|| tp->tm_hour >= 23 || tp->tm_hour < 8
					/* Sunday before 5pm */
				|| (tp->tm_wday == 0 && tp->tm_hour < 17))
					dayok = 1;
		}
		if (prefix("NonPeak", s)) { /* For Tymnet and PC Pursuit */
			/* Sat or Sun */
			if (tp->tm_wday == 6 || tp->tm_wday == 0
				|| tp->tm_hour >= 18 || tp->tm_hour < 7)
					dayok = 1;
		}
		s++;
	}

	if (dayok == 0 && s != string)
		return FAIL;
	i = sscanf(s, "%d-%d", &tl, &th);
1074
1075
1076
1077
1078
1079
1080












































	 * If login() last did a sendthem(), must pause so things can settle.
	 * But don't bother if chat failed.
	 */
	if (i == 0 && (dev->D_numargs&01))
		sleep(2);
	return(i);
}



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
	 * If login() last did a sendthem(), must pause so things can settle.
	 * But don't bother if chat failed.
	 */
	if (i == 0 && (dev->D_numargs&01))
		sleep(2);
	return(i);
}

/*
 *	fix kill/echo/raw on line
 *
 *	return codes:  none
 */
fixmode(tty)
register int tty;
{
#ifdef	USG
	struct termio ttbuf;
#else	!USG
	struct sgttyb ttbuf;
#endif	!USG
	register struct sg_spds *ps;
	int speed;

	if (IsTcpIp)
		return;
#ifdef	USG
	ioctl(tty, TCGETA, &ttbuf);
	ttbuf.c_iflag = ttbuf.c_oflag = ttbuf.c_lflag = (ushort)0;
	speed = ttbuf.c_cflag &= (CBAUD);
	ttbuf.c_cflag |= (CS8|CREAD);
	ttbuf.c_cc[VMIN] = 6;
	ttbuf.c_cc[VTIME] = 1;
	ioctl(tty, TCSETA, &ttbuf);
#else	!USG
	ioctl(tty, TIOCGETP, &ttbuf);
	ttbuf.sg_flags = (ANYP | RAW);
	ioctl(tty, TIOCSETP, &ttbuf);
	speed = ttbuf.sg_ispeed;
	ioctl(tty, TIOCEXCL, STBNULL);
#endif	!USG

	for (ps = spds; ps->sp_val; ps++)
		if (ps->sp_name == speed) {
			linebaudrate = ps->sp_val;
			DEBUG(9,"Incoming baudrate is %d\n", linebaudrate);
			return;
		}
	ASSERT(linebaudrate >= 0, "BAD SPEED", CNULL, speed);
}

Changes to usr.bin/uucp/uucico/imsg.c.

1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36

37

38
39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
55
56
57



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef lint
static char sccsid[] = "@(#)imsg.c	5.2 (Berkeley) 01/22/85";
#endif

#include "uucp.h"


char Msync[2] = "\020";

/* to talk to both eunice and x.25 without also screwing up tcp/ip
 * we must adaptively  choose what character to end the msg with
 * 
 * The idea is that initially we send ....\000\n
 * Then, after they have sent us a message, we use the first character
 * they send.
 */

int seenend = 0;
char Mend = '\0';

/*
 *	this is the initial read message routine -
 *	used before a protocol is agreed upon.
 *
 *	return codes:
 *		EOF - no more messages
 *		0 - message returned
 */

imsg(msg, fn)
register char *msg;
register int fn;
{
	register int ret;

	char *amsg;

	DEBUG(5, "imsg %s<", "sync");

	while ((ret = read(fn, msg, 1)) == 1) {

		*msg &= 0177;
		DEBUG(5, (*msg>037 && *msg<0177) ? "%c" : "\\%03o", *msg & 0377);
		if (*msg == Msync[0])
			break;
		fflush(stderr);
	}
	DEBUG(5, ">got %s\n", ret == 1 ? "it" : "EOF");
	if (ret < 1)
		return EOF;

	amsg = msg;
resync:
	DEBUG(5, "imsg %s<", "input");
	while (read(fn, msg, 1) == 1) {
		*msg &= 0177;
		DEBUG(5, (*msg>037 && *msg<0177) ? "%c" : "\\%03o", *msg & 0377);
		if (*msg == Msync[0]) {
			DEBUG(5, "%s\n", ">found sync");
			msg = amsg;
			goto resync;
		}



		if (*msg == '\n' || *msg == '\0') {
			if (!seenend) {
				Mend = *msg;
				seenend++;
				DEBUG(6,"\nUsing \\%o as End of message char\n", Mend);
			}
			break;
		}
		msg++;
		fflush(stderr);
	}
	*msg = '\0';
	DEBUG(5, ">got %d\n", strlen(amsg));
	return 0;
}


/*
 *	this is the initial write message routine -
 *	used before a protocol is agreed upon.
 *

|



>



















|
|


|
|


|
>
|

|
>
|
>
|
<
|
<
<
<
|
<
|
>
|
<
<
<
<
<
|
|

|
<
>
>
>
|

|

|



|



|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43



44

45
46
47





48
49
50
51

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef lint
static char sccsid[] = "@(#)imsg.c	5.3 (Berkeley) 01/06/86";
#endif

#include "uucp.h"
#include <ctype.h>

char Msync[2] = "\020";

/* to talk to both eunice and x.25 without also screwing up tcp/ip
 * we must adaptively  choose what character to end the msg with
 * 
 * The idea is that initially we send ....\000\n
 * Then, after they have sent us a message, we use the first character
 * they send.
 */

int seenend = 0;
char Mend = '\0';

/*
 *	this is the initial read message routine -
 *	used before a protocol is agreed upon.
 *
 *	return codes:
 *		FAIL - no more messages
 *		SUCCESS - message returned
 */

imsg(amsg, fn)
char *amsg;
register int fn;
{
	register char *msg = amsg;
	int foundsync = FAIL;
	char c;

	DEBUG(5, "imsg looking for SYNC<", CNULL);
	for (;;) {
		if (read(fn, &c, 1) != 1)
			return FAIL;
		c &= 0177;

		if (c == '\n' || c == '\r')



			DEBUG(5, "%c", c);

		else 
			DEBUG(5, (isprint(c) || isspace(c)) ? "%c" : "\\%o",
				c & 0377);





		if (c == Msync[0]) {
			DEBUG(5, ">\nimsg input<", CNULL);
			msg = amsg;
			foundsync = SUCCESS;

			continue;
		} else if (foundsync != SUCCESS)
				continue;
		if (c == '\n' || c == '\0') {
			if (!seenend) {
				Mend = c;
				seenend++;
				DEBUG(9, "\nUsing \\%o as End of message char\n", Mend);
			}
			break;
		}
		*msg++ = c;
		fflush(stderr);
	}
	*msg = '\0';
	DEBUG(5, ">got %d characters\n", strlen(amsg));
	return foundsync;
}


/*
 *	this is the initial write message routine -
 *	used before a protocol is agreed upon.
 *

Changes to usr.bin/uucp/uucico/pk.h.

1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
/*	pk.h	5.3	85/04/10	*/

struct header {
	char	sync;
	char	ksize;
	unsigned short sum;
	char	cntl;
	char	ccntl;
};

#define	HDRSIZ	6
#define	PACKSIZE	64
#define WINDOWS	3



struct pack {
	short	p_state;	/* line state */
	short	p_bits;		/* mask for getepack */
	short	p_rsize;	/* input packet size */
	short	p_xsize;	/* output packet size */
	struct	header p_ihbuf;	/* input header */
|









|
|
|
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*	pk.h	5.4	86/01/06	*/

struct header {
	char	sync;
	char	ksize;
	unsigned short sum;
	char	cntl;
	char	ccntl;
};

#define	HDRSIZ		6	/* Packet header size */
#define	PACKSIZE	64	/* Standard packet size */
#define WINDOWS		3

#define TAILSIZE	2	/* Number of trailing nulls after packet    */

struct pack {
	short	p_state;	/* line state */
	short	p_bits;		/* mask for getepack */
	short	p_rsize;	/* input packet size */
	short	p_xsize;	/* output packet size */
	struct	header p_ihbuf;	/* input header */
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
	short	p_isum[8];	/* input checksums */
	int p_ifn, p_ofn;
};

#define	CHECK	0125252
#define	SYN	020
#define	MOD8	7
#define	PKASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);pkfail();} else
#define	ISCNTL(a)	((a & 0300)==0)
/* MIN may have been defined in <sys/param.h> */
#undef	MIN
#define	MIN(a,b)	((a<b)? a:b)

extern char	next[8];
extern char	mask[8];
extern int	npbits;
extern int	pkactive;

/*
 * driver state
 */
#define	DEAD	0
#define	INITa	1
#define	INITb	2







<







<
<







48
49
50
51
52
53
54

55
56
57
58
59
60
61


62
63
64
65
66
67
68
	short	p_isum[8];	/* input checksums */
	int p_ifn, p_ofn;
};

#define	CHECK	0125252
#define	SYN	020
#define	MOD8	7

#define	ISCNTL(a)	((a & 0300)==0)
/* MIN may have been defined in <sys/param.h> */
#undef	MIN
#define	MIN(a,b)	((a<b)? a:b)

extern char	next[8];
extern char	mask[8];



/*
 * driver state
 */
#define	DEAD	0
#define	INITa	1
#define	INITb	2
101
102
103
104
105
106
107
108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#define	RJ	2
#define	SRJ	3
#define	RR	4
#define	INITC	5
#define	INITB	6
#define	INITA	7

#define	M_RJ	4

#define	M_SRJ	010
#define	M_RR	020
#define	M_INITC	040
#define	M_CLOSE	2
#define	M_INITA	0200
#define	M_INITB	0100

#define	PKOPRI	31
#define	PKIPRI	30
#define	NPLINES	20

/*
 * packet ioctl buf
 */
struct	piocb {
	unsigned t;
	short	psize;
	short	mode;
	short	state;
	char	window;
};

extern int pkdebug;
extern int pksizes[];







|
>



<



<
<













<

100
101
102
103
104
105
106
107
108
109
110
111

112
113
114


115
116
117
118
119
120
121
122
123
124
125
126
127

128
#define	RJ	2
#define	SRJ	3
#define	RR	4
#define	INITC	5
#define	INITB	6
#define	INITA	7

#define	M_CLOSE	002
#define	M_RJ	004
#define	M_SRJ	010
#define	M_RR	020
#define	M_INITC	040

#define	M_INITA	0200
#define	M_INITB	0100



#define	NPLINES	20

/*
 * packet ioctl buf
 */
struct	piocb {
	unsigned t;
	short	psize;
	short	mode;
	short	state;
	char	window;
};


extern int pksizes[];

Changes to usr.bin/uucp/uucico/pk0.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


17
18
19
20
21
22
23
#ifndef lint
static char sccsid[] = "@(#)pk0.c	5.4 (Berkeley) 06/20/85";
#endif

#include "uucp.h"
#include "pk.h"

/*
 * packet driver
 */

char next[8] = { 1, 2, 3, 4, 5, 6, 7, 0};	/* packet sequence numbers */
char mask[8] = { 1, 2, 4, 010, 020, 040, 0100, 0200 };

struct pack *pklines[NPLINES];
int	pkactive;



/*
 * receive control messages
 */
pkcntl(c, pk)
register struct pack *pk;
{

|













|
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef lint
static char sccsid[] = "@(#)pk0.c	5.5 (Berkeley) 01/06/86";
#endif

#include "uucp.h"
#include "pk.h"

/*
 * packet driver
 */

char next[8] = { 1, 2, 3, 4, 5, 6, 7, 0};	/* packet sequence numbers */
char mask[8] = { 1, 2, 4, 010, 020, 040, 0100, 0200 };

struct pack *pklines[NPLINES];

#define PKTIME 4
extern int pktimeout, Ntimeout;

/*
 * receive control messages
 */
pkcntl(c, pk)
register struct pack *pk;
{
216
217
218
219
220
221
222


223
224
225
226
227
228
229
{
	register x;
	int is, cc, xfr, count;
	char *cp, **bp;

	xfr = 0;
	count = 0;


	while (pkaccept(pk) == 0)
		;

	while (icount) {
		x = next[pk->p_pr];
		is = pk->p_is[x];








>
>







218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
{
	register x;
	int is, cc, xfr, count;
	char *cp, **bp;

	xfr = 0;
	count = 0;
	pktimeout = PKTIME;
	Ntimeout = 0;
	while (pkaccept(pk) == 0)
		;

	while (icount) {
		x = next[pk->p_pr];
		is = pk->p_is[x];

279
280
281
282
283
284
285


286
287
288
289
290
291
292
	caddr_t cp;
	int cc, fc, count;

	if (pk->p_state&DOWN || !pk->p_state&LIVE) {
		return -1;
	}



	count = icount;
	do {
		while (pk->p_xcount>=pk->p_swindow)  {
			pkoutput(pk);
			pkgetpack(pk);
		}
		x = next[pk->p_pscopy];







>
>







283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
	caddr_t cp;
	int cc, fc, count;

	if (pk->p_state&DOWN || !pk->p_state&LIVE) {
		return -1;
	}

	pktimeout = PKTIME;
	Ntimeout = 0;
	count = icount;
	do {
		while (pk->p_xcount>=pk->p_swindow)  {
			pkoutput(pk);
			pkgetpack(pk);
		}
		x = next[pk->p_pscopy];

Changes to usr.bin/uucp/uucico/pk1.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

69

70
71
72
73
74
75
76
77
78
79
80

81

82
83
84
85
86
87
88
89

90

91
92
93
94
95
96
97
#ifndef lint
static char sccsid[] = "@(#)pk1.c	5.6 (Berkeley) 10/09/85";
#endif

#include <signal.h>
#include "uucp.h"
#include "pk.h"
#include <setjmp.h>
#ifdef BSD4_2
#include <sys/time.h>
#endif BSD4_2

#ifdef VMS
#include <eunice/eunice.h>
#include <vms/iodef.h>
#include <vms/ssdef.h>
int iomask[2];
#endif VMS

#define PKMAXSTMSG 40
#define	PKTIME	25
#define CONNODATA 10
#define NTIMEOUT 10

extern int errno;
extern int Retries;
extern char *sys_errlist[];
extern jmp_buf Sjbuf;
extern	char *malloc();

int Connodata = 0;
int Ntimeout = 0;

/*
 * packet driver support routines
 *
 */

extern struct pack *pklines[];

/*
 * start initial synchronization.
 */

struct pack *
pkopen(ifn, ofn)
int ifn, ofn;
{
	register struct pack *pk;
	register char **bp;
	register int i;

	if (++pkactive >= NPLINES)
		return NULL;
	if ((pk = (struct pack *) malloc(sizeof (struct pack))) == NULL)
		return NULL;
	bzero((caddr_t) pk, sizeof (struct pack));
	pk->p_ifn = ifn;
	pk->p_ofn = ofn;
	pk->p_xsize = pk->p_rsize = PACKSIZE;
	pk->p_rwindow = pk->p_swindow = WINDOWS;
	/*  allocate input windows */
	for (i = 0; i < pk->p_rwindow; i++) {
		if ((bp = (char **) malloc((unsigned)pk->p_xsize)) == NULL)
			break;
		*bp = (char *) pk->p_ipool;
		pk->p_ipool = bp;
	}
	if (i == 0)

		return NULL;

	pk->p_rwindow = i;

	/* start synchronization */
	pk->p_msg = pk->p_rmsg = M_INITA;
	for (i = 0; i < NPLINES; i++) {
		if (pklines[i] == NULL) {
			pklines[i] = pk;
			break;
		}
	}
	if (i >= NPLINES)

		return NULL;

	pkoutput(pk);

	for (i = 0; i < PKMAXSTMSG; i++) {
		pkgetpack(pk);
		if ((pk->p_state & LIVE) != 0)
			break;
	}
	if (i >= PKMAXSTMSG)

		return NULL;


	pkreset(pk);
	return pk;
}


/*

|


















|

|









>



















<
<














|
>

>










|
>

>







|
>

>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef lint
static char sccsid[] = "@(#)pk1.c	5.7 (Berkeley) 01/06/86";
#endif

#include <signal.h>
#include "uucp.h"
#include "pk.h"
#include <setjmp.h>
#ifdef BSD4_2
#include <sys/time.h>
#endif BSD4_2

#ifdef VMS
#include <eunice/eunice.h>
#include <vms/iodef.h>
#include <vms/ssdef.h>
int iomask[2];
#endif VMS

#define PKMAXSTMSG 40
#define	MAXPKTIME 32	/* was 16 */
#define CONNODATA 10
#define MAXTIMEOUT 32

extern int errno;
extern int Retries;
extern char *sys_errlist[];
extern jmp_buf Sjbuf;
extern	char *malloc();

int Connodata = 0;
int Ntimeout = 0;
int pktimeout = 4;
/*
 * packet driver support routines
 *
 */

extern struct pack *pklines[];

/*
 * start initial synchronization.
 */

struct pack *
pkopen(ifn, ofn)
int ifn, ofn;
{
	register struct pack *pk;
	register char **bp;
	register int i;



	if ((pk = (struct pack *) malloc(sizeof (struct pack))) == NULL)
		return NULL;
	bzero((caddr_t) pk, sizeof (struct pack));
	pk->p_ifn = ifn;
	pk->p_ofn = ofn;
	pk->p_xsize = pk->p_rsize = PACKSIZE;
	pk->p_rwindow = pk->p_swindow = WINDOWS;
	/*  allocate input windows */
	for (i = 0; i < pk->p_rwindow; i++) {
		if ((bp = (char **) malloc((unsigned)pk->p_xsize)) == NULL)
			break;
		*bp = (char *) pk->p_ipool;
		pk->p_ipool = bp;
	}
	if (i == 0) {
		DEBUG(1, "pkopen: can't malloc i = 0\n", CNULL);
		return NULL;
	}
	pk->p_rwindow = i;

	/* start synchronization */
	pk->p_msg = pk->p_rmsg = M_INITA;
	for (i = 0; i < NPLINES; i++) {
		if (pklines[i] == NULL) {
			pklines[i] = pk;
			break;
		}
	}
	if (i >= NPLINES) {
		DEBUG(1,"pkopen: i>=NPLINES\n", CNULL);
		return NULL;
	}
	pkoutput(pk);

	for (i = 0; i < PKMAXSTMSG; i++) {
		pkgetpack(pk);
		if ((pk->p_state & LIVE) != 0)
			break;
	}
	if (i >= PKMAXSTMSG) {
		DEBUG(1, "pkopen: i>= PKMAXSTMSG\n", CNULL);
		return NULL;
	}

	pkreset(pk);
	return pk;
}


/*
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
 *
 */

int pksizes[] = {
	1, 32, 64, 128, 256, 512, 1024, 2048, 4096, 1
};

#define GETRIES 5
/*
 * Pseudo-dma byte collection.
 */

pkgetpack(ipk)
struct pack *ipk;
{
	int k, tries, noise;
	register char *p;
	register struct pack *pk;
	register struct header *h;
	unsigned short sum;
	int ifn;
	char **bp;
	char hdchk;

	pk = ipk;
	if ((pk->p_state & DOWN) || Connodata > CONNODATA || Ntimeout > NTIMEOUT)
		pkfail();
	ifn = pk->p_ifn;

	/* find HEADER */
	for (tries = 0, noise = 0; tries < GETRIES; ) {
		p = (caddr_t) &pk->p_ihbuf;
		if (pkcget(ifn, p, 1) == SUCCESS) {
			if (*p++ == SYN) {
				if (pkcget(ifn, p, HDRSIZ-1) == SUCCESS)
					break;
			} else
				if (noise++ < (3*pk->p_rsize))
					continue;

			DEBUG(4, "Noisy line - set up RXMIT", "");
			noise = 0;
		}
		/* set up retransmit or REJ */
		tries++;
		Retries++;
		pk->p_msg |= pk->p_rmsg;
		if (pk->p_msg == 0)
			pk->p_msg |= M_RR;
		if ((pk->p_state & LIVE) == LIVE)
			pk->p_state |= RXMIT;
		pkoutput(pk);

		if (*p != SYN)
			continue;
		p++;
		if (pkcget(ifn, p, HDRSIZ - 1) == SUCCESS)
			break;
	}
	if (tries >= GETRIES) {
		DEBUG(4, "tries = %d\n", tries);
		pkfail();
	}

	Connodata++;
	h = (struct header * ) &pk->p_ihbuf;
	p = (caddr_t) h;
	hdchk = p[1] ^ p[2] ^ p[3] ^ p[4];
	p += 2;
	sum = (unsigned) *p++ & 0377;
	sum |= (unsigned) *p << 8;
	h->sum = sum;
	DEBUG(7, "rec h->cntl 0%o\n", h->cntl&0xff);







|




|
|



<






<
|










|
|

>
|











<
<
<
<
<
<







|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

131
132
133
134
135
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163






164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
 *
 */

int pksizes[] = {
	1, 32, 64, 128, 256, 512, 1024, 2048, 4096, 1
};

#define GETRIES 10
/*
 * Pseudo-dma byte collection.
 */

pkgetpack(pk)
register struct pack *pk;
{
	int k, tries, noise;
	register char *p;

	register struct header *h;
	unsigned short sum;
	int ifn;
	char **bp;
	char hdchk;


	if ((pk->p_state & DOWN) || Connodata > CONNODATA || Ntimeout > MAXTIMEOUT)
		pkfail();
	ifn = pk->p_ifn;

	/* find HEADER */
	for (tries = 0, noise = 0; tries < GETRIES; ) {
		p = (caddr_t) &pk->p_ihbuf;
		if (pkcget(ifn, p, 1) == SUCCESS) {
			if (*p++ == SYN) {
				if (pkcget(ifn, p, HDRSIZ-1) == SUCCESS)
					break;
			} else {
				if (noise++ < 10 || noise < (3*pk->p_rsize))
					continue;
			}
			DEBUG(4, "Noisy line - set up RXMIT\n", CNULL);
			noise = 0;
		}
		/* set up retransmit or REJ */
		tries++;
		Retries++;
		pk->p_msg |= pk->p_rmsg;
		if (pk->p_msg == 0)
			pk->p_msg |= M_RR;
		if ((pk->p_state & LIVE) == LIVE)
			pk->p_state |= RXMIT;
		pkoutput(pk);






	}
	if (tries >= GETRIES) {
		DEBUG(4, "tries = %d\n", tries);
		pkfail();
	}

	Connodata++;
	h = (struct header *) &pk->p_ihbuf;
	p = (caddr_t) h;
	hdchk = p[1] ^ p[2] ^ p[3] ^ p[4];
	p += 2;
	sum = (unsigned) *p++ & 0377;
	sum |= (unsigned) *p << 8;
	h->sum = sum;
	DEBUG(7, "rec h->cntl 0%o\n", h->cntl&0xff);
195
196
197
198
199
200
201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
216
217
218
219
220
221
			DEBUG(7, "bad header (k==9) 0%o\n", h->cntl&0xff);
		}
		return;
	}
	if (k && pksizes[k] == pk->p_rsize) {
		pk->p_rpr = h->cntl & MOD8;
		pksack(pk);
		Connodata = 0;
		bp = pk->p_ipool;
		if (bp == NULL) {
			DEBUG(7, "bp NULL %s\n", "");
			return;
		}
		pk->p_ipool = (char **) *bp;

	} else {
		return;
	}
	if (pkcget(pk->p_ifn, (char *) bp, pk->p_rsize) == SUCCESS)
		pkdata(h->cntl, h->sum, pk, (char **) bp);
	Ntimeout = 0;
}

pkdata(c, sum, pk, bp)
char c;
unsigned short sum;
register struct pack *pk;
char **bp;







<






>
|

|


<







193
194
195
196
197
198
199

200
201
202
203
204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
			DEBUG(7, "bad header (k==9) 0%o\n", h->cntl&0xff);
		}
		return;
	}
	if (k && pksizes[k] == pk->p_rsize) {
		pk->p_rpr = h->cntl & MOD8;
		pksack(pk);

		bp = pk->p_ipool;
		if (bp == NULL) {
			DEBUG(7, "bp NULL %s\n", "");
			return;
		}
		pk->p_ipool = (char **) *bp;
		Connodata = 0;
	} else
		return;

	if (pkcget(pk->p_ifn, (char *) bp, pk->p_rsize) == SUCCESS)
		pkdata(h->cntl, h->sum, pk, (char **) bp);

}

pkdata(c, sum, pk, bp)
char c;
unsigned short sum;
register struct pack *pk;
char **bp;
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
	m = mask[x];
	pk->p_imap |= m;
	pk->p_is[x] = c;
	pk->p_isum[x] = sum;
	pk->p_ib[x] = (char *)bp;
}



/*
 * setup input transfers
 */
#define PKMAXBUF 128
/*
 * Start transmission on output device associated with pk.
 * For asynch devices (t_line==1) framing is







<
<







240
241
242
243
244
245
246


247
248
249
250
251
252
253
	m = mask[x];
	pk->p_imap |= m;
	pk->p_is[x] = c;
	pk->p_isum[x] = sum;
	pk->p_ib[x] = (char *)bp;
}



/*
 * setup input transfers
 */
#define PKMAXBUF 128
/*
 * Start transmission on output device associated with pk.
 * For asynch devices (t_line==1) framing is
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306




307

308
309
310
311
312
313
314
	char hdchk;

	p = (caddr_t) &pk->p_ohbuf;
	*p++ = SYN;
	if (x < 0) {
		*p++ = hdchk = 9;
		checkword = cntl;
	}
	else {
		*p++ = hdchk = pk->p_lpsize;
		checkword = pk->p_osum[x] ^ (unsigned)(cntl & 0377);
	}
	checkword = CHECK - checkword;
	*p = checkword;
	hdchk ^= *p++;
	*p = checkword>>8;
	hdchk ^= *p++;
	*p = cntl;
	hdchk ^= *p++;
	*p = hdchk;
	/*  writes  */
	DEBUG(7, "send 0%o\n", cntl&0xff);
	p = (caddr_t) & pk->p_ohbuf;
	if (x < 0) {
		if(write(pk->p_ofn, p, HDRSIZ) != HDRSIZ) {
			alarm(0);
			logent("PKXSTART write failed", sys_errlist[errno]);
			longjmp(Sjbuf, 4);
		}
	}
	else {
		char buf[PKMAXBUF + HDRSIZ], *b;
		int i;
		for (i = 0, b = buf; i < HDRSIZ; i++)
			*b++ = *p++;
		for (i = 0, p = pk->p_ob[x]; i < pk->p_xsize; i++)
			*b++ = *p++;




		if (write(pk->p_ofn, buf, pk->p_xsize + HDRSIZ) != (HDRSIZ + pk->p_xsize)) {

			alarm(0);
			logent("PKXSTART write failed", sys_errlist[errno]);
			longjmp(Sjbuf, 5);
		}
		Connodata = 0;
	}
	if (pk->p_msg)







<
|




















<
|
|





>
>
>
>
|
>







265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
	char hdchk;

	p = (caddr_t) &pk->p_ohbuf;
	*p++ = SYN;
	if (x < 0) {
		*p++ = hdchk = 9;
		checkword = cntl;

	} else {
		*p++ = hdchk = pk->p_lpsize;
		checkword = pk->p_osum[x] ^ (unsigned)(cntl & 0377);
	}
	checkword = CHECK - checkword;
	*p = checkword;
	hdchk ^= *p++;
	*p = checkword>>8;
	hdchk ^= *p++;
	*p = cntl;
	hdchk ^= *p++;
	*p = hdchk;
	/*  writes  */
	DEBUG(7, "send 0%o\n", cntl&0xff);
	p = (caddr_t) & pk->p_ohbuf;
	if (x < 0) {
		if(write(pk->p_ofn, p, HDRSIZ) != HDRSIZ) {
			alarm(0);
			logent("PKXSTART write failed", sys_errlist[errno]);
			longjmp(Sjbuf, 4);
		}

	} else {
		char buf[PKMAXBUF + HDRSIZ + TAILSIZE], *b;
		int i;
		for (i = 0, b = buf; i < HDRSIZ; i++)
			*b++ = *p++;
		for (i = 0, p = pk->p_ob[x]; i < pk->p_xsize; i++)
			*b++ = *p++;
#if TAILSIZE != 0
		for (i = 0; i < TAILSIZE; i++)
			*b++ = '\0';
#endif TAILSIZE
		if (write(pk->p_ofn, buf, pk->p_xsize + HDRSIZ + TAILSIZE)
		    != (HDRSIZ + TAILSIZE + pk->p_xsize)) {
			alarm(0);
			logent("PKXSTART write failed", sys_errlist[errno]);
			longjmp(Sjbuf, 5);
		}
		Connodata = 0;
	}
	if (pk->p_msg)
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373



374
375
376
377
378
379
380
381
382
383
384
385
386
		d = p2;
	}
	for (i = 0; i < count; i++)
		*d++ = *s++;
}


/***
 *	pkcget(fn, b, n)	get n characters from input
 *	char *b;		- buffer for characters
 *	int fn;			- file descriptor
 *	int n;			- requested number of characters
 *
 *	return codes:
 *		n - number of characters returned
 *		0 - end of file
 */

jmp_buf Getjbuf;
cgalarm()
{
	longjmp(Getjbuf, 1);
}

pkcget(fn, b, n)
int fn;
register int n;
register char *b;
{
	register int ret;
	extern int linebaudrate;
#ifdef BSD4_2
	long r, itime = 100000L; /* guess it's been 1/10th second since we
				    last read the line */
	struct timeval tv;
#endif BSD4_2
#ifdef VMS
	short iosb[4];
	int SYS$QioW();	/* use this for long reads on vms */
#endif VMS

	if (setjmp(Getjbuf)) {
		Ntimeout++;



		DEBUG(4, "pkcget: alarm %d\n", Ntimeout);
		return FAIL;
	}
	signal(SIGALRM, cgalarm);

	alarm(PKTIME);
	while (n > 0) {
#ifdef BSD4_2
		if (linebaudrate > 0) {
			r = n  * 100000L;
			r = r / linebaudrate;
			r = (r * 100) - itime;
			itime = 0;







|
|
<
<
<














|
|















>
>
>





|







329
330
331
332
333
334
335
336
337



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
		d = p2;
	}
	for (i = 0; i < count; i++)
		*d++ = *s++;
}


/*
 *	get n characters from input



 *
 *	return codes:
 *		n - number of characters returned
 *		0 - end of file
 */

jmp_buf Getjbuf;
cgalarm()
{
	longjmp(Getjbuf, 1);
}

pkcget(fn, b, n)
int fn;
register char *b;
register int n;
{
	register int ret;
	extern int linebaudrate;
#ifdef BSD4_2
	long r, itime = 100000L; /* guess it's been 1/10th second since we
				    last read the line */
	struct timeval tv;
#endif BSD4_2
#ifdef VMS
	short iosb[4];
	int SYS$QioW();	/* use this for long reads on vms */
#endif VMS

	if (setjmp(Getjbuf)) {
		Ntimeout++;
		pktimeout += 2;
		if (pktimeout > MAXPKTIME)
			pktimeout = MAXPKTIME;
		DEBUG(4, "pkcget: alarm %d\n", Ntimeout);
		return FAIL;
	}
	signal(SIGALRM, cgalarm);

	alarm(pktimeout);
	while (n > 0) {
#ifdef BSD4_2
		if (linebaudrate > 0) {
			r = n  * 100000L;
			r = r / linebaudrate;
			r = (r * 100) - itime;
			itime = 0;

Changes to usr.bin/vmstat/vmstat.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)vmstat.c	5.3 (Berkeley) 11/20/85";
#endif not lint

#include <stdio.h>
#include <ctype.h>
#include <nlist.h>

#include <sys/param.h>
#include <sys/file.h>
#include <sys/vm.h>
#include <sys/dk.h>
#include <sys/buf.h>
#include <sys/dir.h>
#include <sys/inode.h>
#include <sys/namei.h>


struct nlist nl[] = {
#define	X_CPTIME	0
	{ "_cp_time" },
#define	X_RATE		1
	{ "_rate" },
#define X_TOTAL		2













|














>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)vmstat.c	5.4 (Berkeley) 01/06/86";
#endif not lint

#include <stdio.h>
#include <ctype.h>
#include <nlist.h>

#include <sys/param.h>
#include <sys/file.h>
#include <sys/vm.h>
#include <sys/dk.h>
#include <sys/buf.h>
#include <sys/dir.h>
#include <sys/inode.h>
#include <sys/namei.h>
#include <sys/text.h>

struct nlist nl[] = {
#define	X_CPTIME	0
	{ "_cp_time" },
#define	X_RATE		1
	{ "_rate" },
#define X_TOTAL		2
67
68
69
70
71
72
73
74
75
76
77
78








79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#define	X_EINTRCNT	18
	{ "_eintrcnt" },
#define	X_DK_NDRIVE	19
	{ "_dk_ndrive" },
#define	X_XSTATS	20
	{ "_xstats" },
#ifdef vax
#define X_MBDINIT	21
	{ "_mbdinit" },
#define X_UBDINIT	22
	{ "_ubdinit" },
#endif








	{ "" },
};

char	**dr_name;
int	*dr_select;
int	dk_ndrive;
int	ndrives = 0;
#ifdef vax
char	*defdrives[] = { "hp0", "hp1", "hp2",  0 };
#else
char	*defdrives[] = { 0 };
#endif
double	stat1();
int	firstfree, maxfree;
int	hz;
int	phz;
int	HZ;

#ifdef vax
#define	INTS(x)	((x) - (hz + phz))
#endif

struct {
	int	busy;
	long	time[CPUSTATES];
	long	*xfer;
	struct	vmmeter Rate;
	struct	vmtotal	Total;
	struct	vmmeter Sum;







|

|


>
>
>
>
>
>
>
>


















<
<
<
<







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105




106
107
108
109
110
111
112
#define	X_EINTRCNT	18
	{ "_eintrcnt" },
#define	X_DK_NDRIVE	19
	{ "_dk_ndrive" },
#define	X_XSTATS	20
	{ "_xstats" },
#ifdef vax
#define X_MBDINIT	(X_XSTATS+1)
	{ "_mbdinit" },
#define X_UBDINIT	(X_XSTATS+2)
	{ "_ubdinit" },
#endif
#ifdef sun
#define X_MBDINIT	(X_XSTATS+1)
	{ "_mbdinit" },
#endif
#ifdef tahoe
#define	X_VBDINIT	(X_XSTATS+1)
	{ "_vbdinit" },
#endif
	{ "" },
};

char	**dr_name;
int	*dr_select;
int	dk_ndrive;
int	ndrives = 0;
#ifdef vax
char	*defdrives[] = { "hp0", "hp1", "hp2",  0 };
#else
char	*defdrives[] = { 0 };
#endif
double	stat1();
int	firstfree, maxfree;
int	hz;
int	phz;
int	HZ;





struct {
	int	busy;
	long	time[CPUSTATES];
	long	*xfer;
	struct	vmmeter Rate;
	struct	vmtotal	Total;
	struct	vmmeter Sum;
302
303
304
305
306
307
308

309
310
311
312
313
314
315
	printf("%4d", pgtok(rate.v_pgpgin)/nintv);
	printf("%4d%4d%4d%4d", pgtok(rate.v_pgpgout)/nintv,
	    pgtok(rate.v_dfree)/nintv, pgtok(deficit), rate.v_scan/nintv);
	etime /= (float)HZ;
	for (i = 0; i < dk_ndrive; i++)
		if (dr_select[i])
			stats(i);

	printf("%4d%4d%4d", INTS(rate.v_intr/nintv), rate.v_syscall/nintv,
	    rate.v_swtch/nintv);
	for(i=0; i<CPUSTATES; i++) {
		float f = stat1(i);
		if (i == 0) {		/* US+NI */
			i++;
			f += stat1(i);







>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
	printf("%4d", pgtok(rate.v_pgpgin)/nintv);
	printf("%4d%4d%4d%4d", pgtok(rate.v_pgpgout)/nintv,
	    pgtok(rate.v_dfree)/nintv, pgtok(deficit), rate.v_scan/nintv);
	etime /= (float)HZ;
	for (i = 0; i < dk_ndrive; i++)
		if (dr_select[i])
			stats(i);
#define	INTS(x)	((x) - (hz + phz))
	printf("%4d%4d%4d", INTS(rate.v_intr/nintv), rate.v_syscall/nintv,
	    rate.v_swtch/nintv);
	for(i=0; i<CPUSTATES; i++) {
		float f = stat1(i);
		if (i == 0) {		/* US+NI */
			i++;
			f += stat1(i);
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402

403
404
405
406
407
408
409
410
411
	printf("%d reclaims, %d total time (usec)\n", sum.v_pgrec, s.rectime);
	printf("average: %d usec / reclaim\n", s.rectime/sum.v_pgrec);
	printf("\n");
	printf("%d page ins, %d total time (msec)\n",sum.v_pgin, s.pgintime/10);
	printf("average: %8.1f msec / page in\n", s.pgintime/(sum.v_pgin*10.0));
}

/* SHOULD BE AVAILABLE IN <sys/text.h> */
/*
 * Statistics
 */
struct xstats {
	u_long	alloc;			/* calls to xalloc */
	u_long	alloc_inuse;		/*	found in use/sticky */
	u_long	alloc_cachehit;		/*	found in cache */
	u_long	alloc_cacheflush;	/*	flushed cached text */
	u_long	alloc_unused;		/*	flushed unused cached text */
	u_long	free;			/* calls to xfree */
	u_long	free_inuse;		/*	still in use/sticky */
	u_long	free_cache;		/*	placed in cache */
	u_long	free_cacheswap;		/*	swapped out to place in cache */
};
/* END SHOULD BE AVAILABLE... */

dosum()
{
	struct nchstats nchstats;
	struct xstats  xstats;
	long nchtotal;

	lseek(mf, (long)nl[X_SUM].n_value, L_SET);
	read(mf, &sum, sizeof sum);
	printf("%9d swap ins\n", sum.v_swpin);
	printf("%9d swap outs\n", sum.v_swpout);
	printf("%9d pages swapped in\n", sum.v_pswpin / CLSIZE);
	printf("%9d pages swapped out\n", sum.v_pswpout / CLSIZE);
	printf("%9d total address trans. faults taken\n", sum.v_faults);
	printf("%9d page ins\n", sum.v_pgin);
	printf("%9d page outs\n", sum.v_pgout);
	printf("%9d pages paged in\n", sum.v_pgpgin);
	printf("%9d pages paged out\n", sum.v_pgpgout);
	printf("%9d sequential process pages freed\n", sum.v_seqfree);

	printf("%9d total reclaims (%d%% fast)\n", sum.v_pgrec,
	    (sum.v_fastpgrec * 100) / (sum.v_pgrec == 0 ? 1 : sum.v_pgrec));
	printf("%9d reclaims from free list\n", sum.v_pgfrec);
	printf("%9d intransit blocking page faults\n", sum.v_intrans);
	printf("%9d zero fill pages created\n", sum.v_nzfod / CLSIZE);
	printf("%9d zero fill page faults\n", sum.v_zfod / CLSIZE);
	printf("%9d executable fill pages created\n", sum.v_nexfod / CLSIZE);
	printf("%9d executable fill page faults\n", sum.v_exfod / CLSIZE);
	printf("%9d swap text pages found in free list\n", sum.v_xsfrec);







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















>

|







367
368
369
370
371
372
373

















374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
	printf("%d reclaims, %d total time (usec)\n", sum.v_pgrec, s.rectime);
	printf("average: %d usec / reclaim\n", s.rectime/sum.v_pgrec);
	printf("\n");
	printf("%d page ins, %d total time (msec)\n",sum.v_pgin, s.pgintime/10);
	printf("average: %8.1f msec / page in\n", s.pgintime/(sum.v_pgin*10.0));
}


















dosum()
{
	struct nchstats nchstats;
	struct xstats  xstats;
	long nchtotal;

	lseek(mf, (long)nl[X_SUM].n_value, L_SET);
	read(mf, &sum, sizeof sum);
	printf("%9d swap ins\n", sum.v_swpin);
	printf("%9d swap outs\n", sum.v_swpout);
	printf("%9d pages swapped in\n", sum.v_pswpin / CLSIZE);
	printf("%9d pages swapped out\n", sum.v_pswpout / CLSIZE);
	printf("%9d total address trans. faults taken\n", sum.v_faults);
	printf("%9d page ins\n", sum.v_pgin);
	printf("%9d page outs\n", sum.v_pgout);
	printf("%9d pages paged in\n", sum.v_pgpgin);
	printf("%9d pages paged out\n", sum.v_pgpgout);
	printf("%9d sequential process pages freed\n", sum.v_seqfree);
#define	nz(x)	((x) ? (x) : 1)
	printf("%9d total reclaims (%d%% fast)\n", sum.v_pgrec,
	    (sum.v_fastpgrec * 100) / nz(sum.v_pgrec));
	printf("%9d reclaims from free list\n", sum.v_pgfrec);
	printf("%9d intransit blocking page faults\n", sum.v_intrans);
	printf("%9d zero fill pages created\n", sum.v_nzfod / CLSIZE);
	printf("%9d zero fill page faults\n", sum.v_zfod / CLSIZE);
	printf("%9d executable fill pages created\n", sum.v_nexfod / CLSIZE);
	printf("%9d executable fill page faults\n", sum.v_exfod / CLSIZE);
	printf("%9d swap text pages found in free list\n", sum.v_xsfrec);
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
	printf("%9d traps\n", sum.v_trap);
	printf("%9d system calls\n", sum.v_syscall);
	lseek(mf, (long)nl[X_NCHSTATS].n_value, 0);
	read(mf, &nchstats, sizeof nchstats);
	nchtotal = nchstats.ncs_goodhits + nchstats.ncs_badhits +
	    nchstats.ncs_falsehits + nchstats.ncs_miss + nchstats.ncs_long;
	printf("%9d total name lookups", nchtotal);
#define	nz(x)	((x) ? (x) : 1)
	printf(" (cache hits %d%% system %d%% per-process)\n",
	    nchstats.ncs_goodhits * 100 / nz(nchtotal),
	    nchstats.ncs_pass2 * 100 / nz(nchtotal));
	printf("%9s badhits %d, falsehits %d, toolong %d\n", "",
	    nchstats.ncs_badhits, nchstats.ncs_falsehits, nchstats.ncs_long);
	lseek(mf, (long)nl[X_XSTATS].n_value, 0);
	read(mf, &xstats, sizeof xstats);







<







414
415
416
417
418
419
420

421
422
423
424
425
426
427
	printf("%9d traps\n", sum.v_trap);
	printf("%9d system calls\n", sum.v_syscall);
	lseek(mf, (long)nl[X_NCHSTATS].n_value, 0);
	read(mf, &nchstats, sizeof nchstats);
	nchtotal = nchstats.ncs_goodhits + nchstats.ncs_badhits +
	    nchstats.ncs_falsehits + nchstats.ncs_miss + nchstats.ncs_long;
	printf("%9d total name lookups", nchtotal);

	printf(" (cache hits %d%% system %d%% per-process)\n",
	    nchstats.ncs_goodhits * 100 / nz(nchtotal),
	    nchstats.ncs_pass2 * 100 / nz(nchtotal));
	printf("%9s badhits %d, falsehits %d, toolong %d\n", "",
	    nchstats.ncs_badhits, nchstats.ncs_falsehits, nchstats.ncs_long);
	lseek(mf, (long)nl[X_XSTATS].n_value, 0);
	read(mf, &xstats, sizeof xstats);
563
564
565
566
567
568
569
570
571






























































		if (udev.ui_dk < 0 || udev.ui_alive == 0)
			continue;
		steal(udev.ui_driver, udrv);
		steal(udrv.ud_dname, two_char);
		sprintf(dr_name[udev.ui_dk], "%c%c%d",
		    cp[0], cp[1], udev.ui_unit);
	}
}
#endif







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
		if (udev.ui_dk < 0 || udev.ui_alive == 0)
			continue;
		steal(udev.ui_driver, udrv);
		steal(udrv.ud_dname, two_char);
		sprintf(dr_name[udev.ui_dk], "%c%c%d",
		    cp[0], cp[1], udev.ui_unit);
	}
}
#endif

#ifdef sun
#include <sundev/mbvar.h>

read_names()
{
	struct mb_device mdev;
	register struct mb_device *mp;
	struct mb_driver mdrv;
	short two_char;
	char *cp = (char *) &two_char;

	mp = (struct mb_device *) nl[X_MBDINIT].n_value;
	if (mp == 0) {
		fprintf(stderr, "vmstat: Disk init info not in namelist\n");
		exit(1);
	}
	for (;;) {
		steal(mp++, mdev);
		if (mdev.md_driver == 0)
			break;
		if (mdev.md_dk < 0 || mdev.md_alive == 0)
			continue;
		steal(mdev.md_driver, mdrv);
		steal(mdrv.mdr_dname, two_char);
		sprintf(dr_name[mdev.md_dk], "%c%c%d",
		     cp[0], cp[1], mdev.md_unit);
	}
}
#endif

#ifdef tahoe
#include <tahoevba/vbavar.h>

/*
 * Read the drive names out of kmem.
 */
read_names()
{
	struct vba_device udev, *up;
	struct vba_driver udrv;
	short two_char;
	char *cp = (char *)&two_char;

	up = (struct vba_device *) nl[X_VBDINIT].n_value;
	if (up == 0) {
		fprintf(stderr, "vmstat: Disk init info not in namelist\n");
		exit(1);
	}
	for (;;) {
		steal(up++, udev);
		if (udev.ui_driver == 0)
			break;
		if (udev.ui_dk < 0 || udev.ui_alive == 0)
			continue;
		steal(udev.ui_driver, udrv);
		steal(udrv.ud_dname, two_char);
		sprintf(dr_name[udev.ui_dk], "%c%c%d",
		     cp[0], cp[1], udev.ui_unit);
	}
}
#endif

Changes to usr.bin/whatis/whatis.1.

1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)whatis.1	6.1 (Berkeley) 04/29/85
.\"
.TH WHATIS 1 ""
.UC 4
.SH NAME
whatis \- describe what a command is
.SH SYNOPSIS
.B whatis




|







1
2
3
4
5
6
7
8
9
10
11
12
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)whatis.1	6.2 (Berkeley) 01/08/86
.\"
.TH WHATIS 1 ""
.UC 4
.SH NAME
whatis \- describe what a command is
.SH SYNOPSIS
.B whatis
25
26
27
28
29
30
31
32
33
34
35
36
is actually just the
.B \-f
option to the
.IR man (1)
command.
.SH FILES
.DT
/usr/lib/whatis	Data base
.SH "SEE ALSO"
man(1), catman(8)
.SH AUTHOR
William Joy







|




25
26
27
28
29
30
31
32
33
34
35
36
is actually just the
.B \-f
option to the
.IR man (1)
command.
.SH FILES
.DT
/usr/man/whatis	Data base
.SH "SEE ALSO"
man(1), catman(8)
.SH AUTHOR
William Joy

Changes to usr.sbin/arp/arp.c.

1
2
3
4
5
6
7
8
9
#ifndef lint
static	char *sccsid = "@(#)arp.c	1.3 (Berkeley) 10/09/85";
#endif

/*
 * arp - display, set, and delete arp table entries
 */

#include <stdio.h>

|







1
2
3
4
5
6
7
8
9
#ifndef lint
static	char *sccsid = "@(#)arp.c	1.4 (Berkeley) 01/09/86";
#endif

/*
 * arp - display, set, and delete arp table entries
 */

#include <stdio.h>
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74

75
76
77
78
79
80
81
 * Process a file to set standard arp entries
 */
file(name)
	char *name;
{
	FILE *fp;
	int i;
	char line[100], arg[4][50], *args[4];

	if ((fp = fopen(name, "r")) == NULL) {
		fprintf(stderr, "arp: cannot open %s\n", name);
		exit(1);
	}
	args[0] = &arg[0][0];
	args[1] = &arg[1][0];
	args[2] = &arg[2][0];
	args[3] = &arg[3][0];

	while(fgets(line, 100, fp) != NULL) {
		i = sscanf(line, "%s %s %s %s", arg[0], arg[1], arg[2], arg[3]);

		if (i < 2) {
			fprintf(stderr, "arp: bad line: %s\n", line);
			continue;
		}
		set(i, args);
	}
	fclose(fp);







|









>

|
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 * Process a file to set standard arp entries
 */
file(name)
	char *name;
{
	FILE *fp;
	int i;
	char line[100], arg[5][50], *args[5];

	if ((fp = fopen(name, "r")) == NULL) {
		fprintf(stderr, "arp: cannot open %s\n", name);
		exit(1);
	}
	args[0] = &arg[0][0];
	args[1] = &arg[1][0];
	args[2] = &arg[2][0];
	args[3] = &arg[3][0];
	args[4] = &arg[4][0];
	while(fgets(line, 100, fp) != NULL) {
		i = sscanf(line, "%s %s %s %s", arg[0], arg[1], arg[2], arg[3],
			arg[4]);
		if (i < 2) {
			fprintf(stderr, "arp: bad line: %s\n", line);
			continue;
		}
		set(i, args);
	}
	fclose(fp);
110
111
112
113
114
115
116


117
118
119
120
121
122
123
		return;
	ar.arp_flags = ATF_PERM;
	while(argc-- > 0) {
		if (strncmp(argv[0], "temp", 4) == 0)
			ar.arp_flags &= ~ATF_PERM;
		if (strncmp(argv[0], "pub", 3) == 0)
			ar.arp_flags |= ATF_PUBL;


		argv++;
	}
	
	s = socket(AF_INET, SOCK_DGRAM, 0);
	if (s < 0) {
                perror("arp: socket");
                exit(1);







>
>







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
		return;
	ar.arp_flags = ATF_PERM;
	while(argc-- > 0) {
		if (strncmp(argv[0], "temp", 4) == 0)
			ar.arp_flags &= ~ATF_PERM;
		if (strncmp(argv[0], "pub", 3) == 0)
			ar.arp_flags |= ATF_PUBL;
		if (strncmp(argv[0], "trail", 5) == 0)
			ar.arp_flags |= ATF_USETRAILERS;
		argv++;
	}
	
	s = socket(AF_INET, SOCK_DGRAM, 0);
	if (s < 0) {
                perror("arp: socket");
                exit(1);
167
168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
	close(s);
	ea = (u_char *)ar.arp_ha.sa_data;
	printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr));
	if (ar.arp_flags & ATF_COM)
		ether_print(ea);
	else
		printf("(incomplete)");
	if (!(ar.arp_flags & ATF_PERM)) printf(" temporary");
	if (ar.arp_flags & ATF_PUBL) printf(" published");

	printf("\n");
}

/*
 * Delete an arp entry 
 */
delete(host)







|

>







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
	close(s);
	ea = (u_char *)ar.arp_ha.sa_data;
	printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr));
	if (ar.arp_flags & ATF_COM)
		ether_print(ea);
	else
		printf("(incomplete)");
	if (ar.arp_flags & ATF_PERM) printf(" permanent");
	if (ar.arp_flags & ATF_PUBL) printf(" published");
	if (ar.arp_flags & ATF_USETRAILERS) printf(" trailers");
	printf("\n");
}

/*
 * Delete an arp entry 
 */
delete(host)
270
271
272
273
274
275
276
277
278

279
280
281
282
283
284
285
		else
			host = "?";
		printf("%s (%s) at ", host, inet_ntoa(at->at_iaddr));
		if (at->at_flags & ATF_COM)
			ether_print(at->at_enaddr);
		else
			printf("(incomplete)");
		if (!(at->at_flags & ATF_PERM)) printf(" temporary");
		if (at->at_flags & ATF_PUBL) printf(" published");

		printf("\n");
	}
}

ether_print(cp)
	u_char *cp;
{







|

>







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
		else
			host = "?";
		printf("%s (%s) at ", host, inet_ntoa(at->at_iaddr));
		if (at->at_flags & ATF_COM)
			ether_print(at->at_enaddr);
		else
			printf("(incomplete)");
		if (at->at_flags & ATF_PERM) printf(" permanent");
		if (at->at_flags & ATF_PUBL) printf(" published");
		if (at->at_flags & ATF_USETRAILERS) printf(" trailers");
		printf("\n");
	}
}

ether_print(cp)
	u_char *cp;
{

Changes to usr.sbin/cron/cron.8.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44


45
46
47
48
49
50
51
52
53
54

55
56
57
58
59


.\"	@(#)cron.8	6.1 (Berkeley) 04/27/85
.\"
.TH CRON 8 ""
.AT 3
.SH NAME
cron \- clock daemon
.SH SYNOPSIS
.B /etc/cron
.SH DESCRIPTION
.I Cron
executes commands at specified dates and times
according to the instructions in the file
/usr/lib/crontab.

Since
.I cron
never exits,
it should only be executed once.
This is best done by running
.I cron
from the initialization
process through the file
/etc/rc;
see
.IR init (8).
.PP

Crontab
consists of lines of six fields each.
The fields are separated by spaces or tabs.
The first five are integer patterns to
specify the
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
and day of the week (1-7 with 1=Monday).
Each of these patterns may
contain a number in the range above;
two numbers separated by
a minus
meaning a range inclusive;
a list of numbers separated by
commas meaning any of the numbers;
or an asterisk meaning all legal values.
The sixth field is a string


that is executed by the Shell at the
specified times.
A percent character
in this field is translated to a new-line
character.
Only the first line (up to a % or end of line)
of the command field is executed by the Shell.
The other lines are made available to the
command as standard input.
.PP

Crontab is examined by
.I cron
every minute.
.SH FILES
/usr/lib/crontab


|










|
|
>












>
|
|
















|
>
>










>
|

|


>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.\"	@(#)cron.8	6.2 (Berkeley) 01/10/86
.\"
.TH CRON 8 ""
.AT 3
.SH NAME
cron \- clock daemon
.SH SYNOPSIS
.B /etc/cron
.SH DESCRIPTION
.I Cron
executes commands at specified dates and times
according to the instructions in the files
/usr/lib/crontab and /usr/lib/crontab.local.
None, either one, or both of these files may be present.
Since
.I cron
never exits,
it should only be executed once.
This is best done by running
.I cron
from the initialization
process through the file
/etc/rc;
see
.IR init (8).
.PP
The
crontab files
consist of lines of seven fields each.
The fields are separated by spaces or tabs.
The first five are integer patterns to
specify the
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
and day of the week (1-7 with 1=Monday).
Each of these patterns may
contain a number in the range above;
two numbers separated by
a minus
meaning a range inclusive;
a list of numbers separated by
commas meaning any of the numbers;
or an asterisk meaning all legal values.
The sixth field is a user name: the
command will be run ``as'' that user.
The seventh field is a string
that is executed by the Shell at the
specified times.
A percent character
in this field is translated to a new-line
character.
Only the first line (up to a % or end of line)
of the command field is executed by the Shell.
The other lines are made available to the
command as standard input.
.PP
Both
crontab files are checked by
.I cron
every minute, on the minute.
.SH FILES
/usr/lib/crontab
.br
/usr/lib/crontab.local

Changes to usr.sbin/cron/cron.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21




22
23
24
25
26
27

28

29
30
31
32
33
34
35
36

37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

60

61
62
63
64












65




66

67
68
69
70
71
72
73
#ifndef lint
static char *sccsid = "@(#)cron.c	4.10 (Berkeley) 10/31/85";
#endif

#include <sys/types.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <pwd.h>

#define	LISTS	(2*BUFSIZ)
#define	MAXLIN	BUFSIZ

#ifndef CRONTAB
#define CRONTAB "/usr/lib/crontab"
#endif





#define	EXACT	100
#define	ANY	101
#define	LIST	102
#define	RANGE	103
#define	EOS	104

char	crontab[]	= CRONTAB;

time_t	itime;
struct	tm *loct;
struct	tm *localtime();
char	*malloc();
char	*realloc();
int	reapchild();
int	flag;
char	*list;

unsigned listsize;

main()
{
	register char *cp;
	char *cmp();
	time_t filetime = 0;


	if (fork())
		exit(0);
	chdir("/");
	freopen("/", "r", stdout);
	freopen("/", "r", stderr);
	untty();
	signal(SIGHUP, SIG_IGN);
	signal(SIGINT, SIG_IGN);
	signal(SIGQUIT, SIG_IGN);
	signal(SIGCHLD, reapchild);
	time(&itime);
	itime -= localtime(&itime)->tm_sec;

	for (;; itime+=60, slp()) {
		struct stat cstat;



		if (stat(crontab, &cstat) == -1)
			continue;
		if (cstat.st_mtime > filetime) {
			filetime = cstat.st_mtime;












			init();




		}

		loct = localtime(&itime);
		loct->tm_mon++;		 /* 1-12 for month */
		if (loct->tm_wday == 0)
			loct->tm_wday = 7;	/* sunday is 7, not 0 */
		for(cp = list; *cp != EOS;) {
			flag = 0;
			cp = cmp(cp, loct->tm_min);

|



















>
>
>
>






>

>








>







>















|
>
|
>
|
|
|

>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>

>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef lint
static char *sccsid = "@(#)cron.c	4.11 (Berkeley) 01/10/86";
#endif

#include <sys/types.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <pwd.h>

#define	LISTS	(2*BUFSIZ)
#define	MAXLIN	BUFSIZ

#ifndef CRONTAB
#define CRONTAB "/usr/lib/crontab"
#endif

#ifndef CRONTABLOC
#define CRONTABLOC  "/usr/lib/crontab.local"
#endif

#define	EXACT	100
#define	ANY	101
#define	LIST	102
#define	RANGE	103
#define	EOS	104

char	crontab[]	= CRONTAB;
char	loc_crontab[]   = CRONTABLOC;
time_t	itime;
struct	tm *loct;
struct	tm *localtime();
char	*malloc();
char	*realloc();
int	reapchild();
int	flag;
char	*list;
char	*listend;
unsigned listsize;

main()
{
	register char *cp;
	char *cmp();
	time_t filetime = 0;
	time_t lfiletime = 0;

	if (fork())
		exit(0);
	chdir("/");
	freopen("/", "r", stdout);
	freopen("/", "r", stderr);
	untty();
	signal(SIGHUP, SIG_IGN);
	signal(SIGINT, SIG_IGN);
	signal(SIGQUIT, SIG_IGN);
	signal(SIGCHLD, reapchild);
	time(&itime);
	itime -= localtime(&itime)->tm_sec;

	for (;; itime+=60, slp()) {
		struct stat cstat, lcstat;
		int newcron, newloc;
		
		newcron = 0;
		if (stat(crontab, &cstat) < 0)
		    cstat.st_mtime = 1;
		if (cstat.st_mtime != filetime) {
			filetime = cstat.st_mtime;
			newcron++;
		}

		newloc  = 0;
		if (stat(loc_crontab, &lcstat) < 0)
		    lcstat.st_mtime = 1;
		if (lcstat.st_mtime != lfiletime) {
			lfiletime = lcstat.st_mtime;
			newloc++;
		}

		if (newcron || newloc) {
			init();
			append(crontab);
			append(loc_crontab);
			*listend++ = EOS;
			*listend++ = EOS;
		}

		loct = localtime(&itime);
		loct->tm_mon++;		 /* 1-12 for month */
		if (loct->tm_wday == 0)
			loct->tm_wday = 7;	/* sunday is 7, not 0 */
		for(cp = list; *cp != EOS;) {
			flag = 0;
			cp = cmp(cp, loct->tm_min);
160
161
162
163
164
165
166















167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
190
191
192
193
	freopen("/", "r", stdin);
	execl("/bin/sh", "sh", "-c", ++s, 0);
	exit(0);
}

init()
{















	register i, c;
	register char *cp;
	register char *ocp;
	register int n;

	freopen(crontab, "r", stdin);
	if (list) {
		list = realloc(list, LISTS);
	} else
		list = malloc(LISTS);
	listsize = LISTS;
	cp = list;

loop:
	if(cp > list+listsize-MAXLIN) {

		char *olist;
		listsize += LISTS;
		olist = list;
		list = realloc(list, listsize);
		cp = list + (cp - olist);
	}
	ocp = cp;
	for(i=0;; i++) {
		do
			c = getchar();
		while(c == ' ' || c == '\t')
			;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|
<
<
|
<
<
|
<


>
|

<

|







187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214


215


216

217
218
219
220
221

222
223
224
225
226
227
228
229
230
	freopen("/", "r", stdin);
	execl("/bin/sh", "sh", "-c", ++s, 0);
	exit(0);
}

init()
{
	/*
	 * Don't free in case was longer than LISTS.  Trades off
	 * the rare case of crontab shrinking vs. the common case of
	 * extra realloc's needed in append() for a large crontab.
	 */
	if (list == 0) {
		list = malloc(LISTS);
		listsize = LISTS;
	}
	listend = list;
}

append(fn)
char *fn;
{
	register i, c;
	register char *cp;
	register char *ocp;
	register int n;

	if (freopen(fn, "r", stdin) == NULL)


		return;


	cp = listend;

loop:
	if(cp > list+listsize-MAXLIN) {
		int length = cp - list;

		listsize += LISTS;

		list = realloc(list, listsize);
		cp = list + length;
	}
	ocp = cp;
	for(i=0;; i++) {
		do
			c = getchar();
		while(c == ' ' || c == '\t')
			;
248
249
250
251
252
253
254
255
256
257

258
259
260
261
262
263
264
	*cp++ = 0;
	goto loop;

ignore:
	cp = ocp;
	while(c != '\n') {
		if(c == EOF) {
			*cp++ = EOS;
			*cp++ = EOS;
			fclose(stdin);

			return;
		}
		c = getchar();
	}
	goto loop;
}








<
<

>







285
286
287
288
289
290
291


292
293
294
295
296
297
298
299
300
	*cp++ = 0;
	goto loop;

ignore:
	cp = ocp;
	while(c != '\n') {
		if(c == EOF) {


			fclose(stdin);
			listend = cp;
			return;
		}
		c = getchar();
	}
	goto loop;
}

Changes to usr.sbin/rmt/rmt.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)rmt.c	5.1 (Berkeley) 05/28/85";
#endif not lint

/*
 * rmt
 */
#include <stdio.h>
#include <sgtty.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
 All rights reserved.\n";
#endif not lint

#ifndef lint
static char sccsid[] = "@(#)rmt.c	5.2 (Berkeley) 01/07/86";
#endif not lint

/*
 * rmt
 */
#include <stdio.h>
#include <sgtty.h>
189
190
191
192
193
194
195

196
197
198
199
200
201
202
	if (record != 0)
		free(record);
	record = malloc(size);
	if (record == 0) {
		DEBUG("rmtd: cannot allocate buffer space\n");
		exit(4);
	}

	while (size > 1024 &&
	       setsockopt(0, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) < 0)
		size -= 1024;
	return (record);
}

error(num)







>







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
	if (record != 0)
		free(record);
	record = malloc(size);
	if (record == 0) {
		DEBUG("rmtd: cannot allocate buffer space\n");
		exit(4);
	}
	maxrecsize = size;
	while (size > 1024 &&
	       setsockopt(0, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) < 0)
		size -= 1024;
	return (record);
}

error(num)

Changes to usr.sbin/sendmail/doc/op/op.me.

1
2
3
4
5
6
7
8
9
10
11
.\" eqn % | troff -me
.\"if n .ls 2
.he 'Sendmail Installation and Operation Guide''%'
.fo 'Version 5.3''Last Mod 12/26/85'
.nr si 3n
.de $0
.(x
.in \\$3u*3n
.ti -3n
\\$2.  \\$1
.)x



|







1
2
3
4
5
6
7
8
9
10
11
.\" eqn % | troff -me
.\"if n .ls 2
.he 'Sendmail Installation and Operation Guide''%'
.fo 'Version 5.4''Last Mod 01/07/86'
.nr si 3n
.de $0
.(x
.in \\$3u*3n
.ti -3n
\\$2.  \\$1
.)x
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.b "INSTALLATION AND OPERATION GUIDE"
.sz 10
.sp
.r
Eric Allman
Britton-Lee, Inc.
.sp
Version 5.3
.)l
.sp 2
.pp
.i Sendmail
implements a general purpose internetwork mail routing facility
under the UNIX*
.(f







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.b "INSTALLATION AND OPERATION GUIDE"
.sz 10
.sp
.r
Eric Allman
Britton-Lee, Inc.
.sp
Version 5.4
.)l
.sp 2
.pp
.i Sendmail
implements a general purpose internetwork mail routing facility
under the UNIX*
.(f
590
591
592
593
594
595
596




597
598
599
600
601
602
603
This will normally be completely aliased,
but is actually realiased when the job is processed.
There will be one line
for each recipient.
.ip S
The sender address.
There may only be one of these lines.




.ip T
The job creation time.
This is used to compute when to time out the job.
.ip P
The current message priority.
This is used to order the queue.
Higher numbers mean lower priorities.







>
>
>
>







590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
This will normally be completely aliased,
but is actually realiased when the job is processed.
There will be one line
for each recipient.
.ip S
The sender address.
There may only be one of these lines.
.ip E
An error address.
If any such lines exist,
they represent the addresses that should receive error messages.
.ip T
The job creation time.
This is used to compute when to time out the job.
.ip P
The current message priority.
This is used to order the queue.
Higher numbers mean lower priorities.
3449
3450
3451
3452
3453
3454
3455



3456
3457
3458
3459
3460
3461
3462
3463
3464


3465
3466
3467






3468
3469
3470
3471
3472
3473
3474
The maximum number of trusted users that may be defined
(using the
.b T
line in sendmail.cf).
.ip "MAXUSERENVIRON [40]"
The maximum number of items in the user environment
that will be passed to subordinate mailers.



.lp
A number of other compilation options exist.
These specify whether or not specific code should be compiled in.
.nr ii 1i
.ip DBM
If set,
the
.q DBM
package in UNIX is used


(see DBM(3X) in [UNIX80]).
If not set,
a much less efficient algorithm for processing aliases is used.






.ip DEBUG
If set, debugging information is compiled in.
To actually get the debugging output,
the
.b \-d
flag must be used.
.ip LOG







>
>
>









>
>
|


>
>
>
>
>
>







3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
The maximum number of trusted users that may be defined
(using the
.b T
line in sendmail.cf).
.ip "MAXUSERENVIRON [40]"
The maximum number of items in the user environment
that will be passed to subordinate mailers.
.ip "QUEUESIZE [600]"
The maximum number of entries that will be processed
in a single queue run.
.lp
A number of other compilation options exist.
These specify whether or not specific code should be compiled in.
.nr ii 1i
.ip DBM
If set,
the
.q DBM
package in UNIX is used
(see
.i dbm(3X)
in [UNIX80]).
If not set,
a much less efficient algorithm for processing aliases is used.
.ip NDBM
If set,
the new version of the DBM library
that allows multiple databases will be used.
.q DBM
must also be set.
.ip DEBUG
If set, debugging information is compiled in.
To actually get the debugging output,
the
.b \-d
flag must be used.
.ip LOG
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
If set,
the code to handle user and server SMTP will be compiled in.
This is only necessary if your machine has some mailer
that speaks SMTP.
.ip DAEMON
If set,
code to run a daemon is compiled in.
This code is for 4.2BSD
if the
NVMUNIX
flag is specified;
otherwise,
4.1a BSD code is used.
Beware however
that there are bugs in the 4.1a code
that make it impossible for
.b sendmail
to work correctly
under heavy load.
.ip UGLYUUCP
If you have a UUCP host adjacent to you which is not running
a reasonable version of
.i rmail ,
you will have to set this flag to include the
.q "remote from sysname"
info on the from line.







|
<
<
<
<
<
<
<
<
<
<
<







3504
3505
3506
3507
3508
3509
3510
3511











3512
3513
3514
3515
3516
3517
3518
If set,
the code to handle user and server SMTP will be compiled in.
This is only necessary if your machine has some mailer
that speaks SMTP.
.ip DAEMON
If set,
code to run a daemon is compiled in.
This code is for 4.2 or 4.3BSD.











.ip UGLYUUCP
If you have a UUCP host adjacent to you which is not running
a reasonable version of
.i rmail ,
you will have to set this flag to include the
.q "remote from sysname"
info on the from line.
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
.sp
INSTALLATION AND OPERATION GUIDE
.sp
.sz 10
Eric Allman
Britton-Lee, Inc.
.sp
Version 5.3
.ce 0
.bp 1
.ce
.sz 12
TABLE OF CONTENTS
.sz 10
.sp 2







|







3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
.sp
INSTALLATION AND OPERATION GUIDE
.sp
.sz 10
Eric Allman
Britton-Lee, Inc.
.sp
Version 5.4
.ce 0
.bp 1
.ce
.sz 12
TABLE OF CONTENTS
.sz 10
.sp 2

Changes to usr.sbin/sendmail/src/alias.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
# ifdef DBM
static char	SccsId[] = "@(#)alias.c	5.8 (Berkeley) 12/17/85	(with DBM)";
# else DBM
static char	SccsId[] = "@(#)alias.c	5.8 (Berkeley) 12/17/85	(without DBM)";
# endif DBM
#endif not lint

# include <pwd.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <signal.h>












|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
# ifdef DBM
static char	SccsId[] = "@(#)alias.c	5.10 (Berkeley) 01/11/86	(with DBM)";
# else DBM
static char	SccsId[] = "@(#)alias.c	5.10 (Berkeley) 01/11/86	(without DBM)";
# endif DBM
#endif not lint

# include <pwd.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <signal.h>
190
191
192
193
194
195
196

197
198
199
200
201











202




203
204
205
206
207
208
209
# ifdef DBM
	/*
	**  Check to see that the alias file is complete.
	**	If not, we will assume that someone died, and it is up
	**	to us to rebuild it.
	*/


	dbminit(aliasfile);
	atcnt = SafeAlias * 2;
	if (atcnt > 0)
	{
		while (!init && atcnt-- >= 0 && aliaslookup("@") == NULL)











			sleep(30);




	}
	else
		atcnt = 1;

	/*
	**  See if the DBM version of the file is out of date with
	**  the text version.  If so, go into 'init' mode automatically.







>
|




>
>
>
>
>
>
>
>
>
>
>

>
>
>
>







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# ifdef DBM
	/*
	**  Check to see that the alias file is complete.
	**	If not, we will assume that someone died, and it is up
	**	to us to rebuild it.
	*/

	if (!init)
		dbminit(aliasfile);
	atcnt = SafeAlias * 2;
	if (atcnt > 0)
	{
		while (!init && atcnt-- >= 0 && aliaslookup("@") == NULL)
		{
			/*
			**  Reinitialize alias file in case the new
			**  one is mv'ed in instead of cp'ed in.
			**
			**	Only works with new DBM -- old one will
			**	just consume file descriptors forever.
			**	If you have a dbmclose() it can be
			**	added before the sleep(30).
			*/

			sleep(30);
# ifdef NDBM
			dbminit(aliasfile);
# endif NDBM
		}
	}
	else
		atcnt = 1;

	/*
	**  See if the DBM version of the file is out of date with
	**  the text version.  If so, go into 'init' mode automatically.
338
339
340
341
342
343
344

345
346
347
348
349
350
351
		(void) strcat(line, ".dir");
		if (close(creat(line, DBMMODE)) < 0)
		{
			syserr("cannot make %s", line);
			(void) signal(SIGINT, oldsigint);
			return;
		}

		(void) strcpy(line, aliasfile);
		(void) strcat(line, ".pag");
		if (close(creat(line, DBMMODE)) < 0)
		{
			syserr("cannot make %s", line);
			(void) signal(SIGINT, oldsigint);
			return;







>







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
		(void) strcat(line, ".dir");
		if (close(creat(line, DBMMODE)) < 0)
		{
			syserr("cannot make %s", line);
			(void) signal(SIGINT, oldsigint);
			return;
		}
		dbminit(aliasfile);
		(void) strcpy(line, aliasfile);
		(void) strcat(line, ".pag");
		if (close(creat(line, DBMMODE)) < 0)
		{
			syserr("cannot make %s", line);
			(void) signal(SIGINT, oldsigint);
			return;
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
		*/

		rhs = p;
		for (;;)
		{
			register char c;

			if (init)
			{
				/* do parsing & compression of addresses */
				while (*p != '\0')
				{
					extern char *DelimChar;

					while (isspace(*p) || *p == ',')







|







431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
		*/

		rhs = p;
		for (;;)
		{
			register char c;

			if (init && CheckAliases)
			{
				/* do parsing & compression of addresses */
				while (*p != '\0')
				{
					extern char *DelimChar;

					while (isspace(*p) || *p == ',')

Changes to usr.sbin/sendmail/src/arpadate.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)arpadate.c	5.3 (Berkeley) 06/08/85";
#endif not lint

# include "conf.h"
# ifdef USG
# include <time.h>
# else
# include <sys/time.h>











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)arpadate.c	5.4 (Berkeley) 01/09/86";
#endif not lint

# include "conf.h"
# ifdef USG
# include <time.h>
# else
# include <sys/time.h>
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
238
/* UNIX to arpa conversion table */
struct foreign
{
	char *f_from; 
	char *f_to; 
};

static struct foreign Foreign[] =
{
	{ "EET",	" -0200" },	/* eastern europe */
	{ "MET",	" -0100" },	/* middle europe */
	{ "WET",	" GMT"   },	/* western europe */
	{ "EET DST",	" -0300" },	/* daylight saving times */
	{ "MET DST",	" -0200" },
	{ "WET DST",	" -0100" },
	{ NULL,		NULL	 }
};

bool
fconvert(a, b)
	register char *a;
	char *b;
{
	register struct foreign *euptr;
	register char *p;

	for (euptr = Foreign; euptr->f_from != NULL; euptr++)
	{
		extern bool sameword();

		if (sameword(euptr->f_from, a))
		{
			p = euptr->f_to;

			while (*p)
				*b++ = *p++;
			*b = '\0';
			return (TRUE);
		}
	}
	return (FALSE);
}







|

|
|
|
|
|
|


















>
|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/* UNIX to arpa conversion table */
struct foreign
{
	char *f_from; 
	char *f_to; 
};

static struct foreign	Foreign[] =
{
	{ "EET",	"+0200" },	/* eastern europe */
	{ "MET",	"+0100" },	/* middle europe */
	{ "WET",	"GMT"   },	/* western europe */
	{ "EET DST",	"+0300" },	/* daylight saving times */
	{ "MET DST",	"+0200" },
	{ "WET DST",	"+0100" },
	{ NULL,		NULL	 }
};

bool
fconvert(a, b)
	register char *a;
	char *b;
{
	register struct foreign *euptr;
	register char *p;

	for (euptr = Foreign; euptr->f_from != NULL; euptr++)
	{
		extern bool sameword();

		if (sameword(euptr->f_from, a))
		{
			p = euptr->f_to;
			*b++ = ' ';
			while (*p != '\0')
				*b++ = *p++;
			*b = '\0';
			return (TRUE);
		}
	}
	return (FALSE);
}

Changes to usr.sbin/sendmail/src/conf.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)conf.c	5.11 (Berkeley) 12/17/85";
#endif not lint

# include <pwd.h>
# include <sys/ioctl.h>
# ifdef sun
# include <sys/param.h>
# endif sun











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)conf.c	5.14 (Berkeley) 01/10/86";
#endif not lint

# include <pwd.h>
# include <sys/ioctl.h>
# ifdef sun
# include <sys/param.h>
# endif sun
62
63
64
65
66
67
68

69
70

71
72
73
74
75
76
77
*/

struct hdrinfo	HdrInfo[] =
{
		/* originator fields, most to least significant  */
	"resent-sender",	H_FROM|H_RESENT,
	"resent-from",		H_FROM|H_RESENT,

	"sender",		H_FROM,
	"from",			H_FROM,

	"full-name",		H_ACHECK,
	"return-receipt-to",	H_FROM,
	"errors-to",		H_FROM,
		/* destination fields */
	"to",			H_RCPT,
	"resent-to",		H_RCPT|H_RESENT,
	"cc",			H_RCPT,







>


>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
*/

struct hdrinfo	HdrInfo[] =
{
		/* originator fields, most to least significant  */
	"resent-sender",	H_FROM|H_RESENT,
	"resent-from",		H_FROM|H_RESENT,
	"resent-reply-to",	H_FROM|H_RESENT,
	"sender",		H_FROM,
	"from",			H_FROM,
	"reply-to",		H_FROM,
	"full-name",		H_ACHECK,
	"return-receipt-to",	H_FROM,
	"errors-to",		H_FROM,
		/* destination fields */
	"to",			H_RCPT,
	"resent-to",		H_RCPT|H_RESENT,
	"cc",			H_RCPT,
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{
	QueueLA = 8;
	QueueFactor = 10000;
	RefuseLA = 12;
	SpaceSub = ' ';
	WkRecipFact = 1000;
	WkClassFact = 1800;
	WkTimeFact = 600;
	FileMode = 0644;
	DefUid = 1;
	DefGid = 1;
}

# ifdef V6
/*







|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
	QueueLA = 8;
	QueueFactor = 10000;
	RefuseLA = 12;
	SpaceSub = ' ';
	WkRecipFact = 1000;
	WkClassFact = 1800;
	WkTimeFact = 9000;
	FileMode = 0644;
	DefUid = 1;
	DefGid = 1;
}

# ifdef V6
/*
664
665
666
667
668
669
670































	}
	(void) strcpy(p, buf);
	p += i;
	while (p < LastArgv)
		*p++ = ' ';
# endif SETPROCTITLE
}






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
	}
	(void) strcpy(p, buf);
	p += i;
	while (p < LastArgv)
		*p++ = ' ';
# endif SETPROCTITLE
}
/*
**  REAPCHILD -- pick up the body of my child, lest it become a zombie
**
**	Parameters:
**		none.
**
**	Returns:
**		none.
**
**	Side Effects:
**		Picks up extant zombies.
*/

# ifdef VMUNIX
# include <sys/wait.h>
# endif VMUNIX

reapchild()
{
# ifdef WNOHANG
	union wait status;

	while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
		continue;
# else WNOHANG
	auto int status;

	while (wait(&status) > 0)
		continue;
# endif WNOHANG
}

Changes to usr.sbin/sendmail/src/conf.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
**
**	@(#)conf.h	5.4 (Berkeley) 09/24/85
*/

/*
**  CONF.H -- All user-configurable parameters for sendmail
*/











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
**
**	@(#)conf.h	5.7 (Berkeley) 01/05/86
*/

/*
**  CONF.H -- All user-configurable parameters for sendmail
*/


28
29
30
31
32
33
34

35
36
37


38
39
40

41
42
43
44
45
46
47
48

# define MAXHOP		17		/* max value of HopCount */
# define MAXATOM	100		/* max atoms per address */
# define MAXMAILERS	25		/* maximum mailers known to system */
# define MAXRWSETS	30		/* max # of sets of rewriting rules */
# define MAXPRIORITIES	25		/* max values for Precedence: field */
# define MAXTRUST	30		/* maximum number of trusted users */
# define MAXUSERENVIRON	40		/* max # of items in user environ */


/*
**  Compilation options.


*/

#define DBM		1	/* use DBM library (requires -ldbm) */

#define DEBUG		1	/* enable debugging */
#define LOG		1	/* enable logging */
#define SMTP		1	/* enable user and server SMTP */
#define QUEUE		1	/* enable queueing */
#define UGLYUUCP	1	/* output ugly UUCP From lines */
#define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
#define FLOCK		1	/* use flock file locking */
#define SETPROCTITLE	1	/* munge argv to display current status */








>



>
>


|
>
|
|
|
|
|
|
|
|
>
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# define MAXHOP		17		/* max value of HopCount */
# define MAXATOM	100		/* max atoms per address */
# define MAXMAILERS	25		/* maximum mailers known to system */
# define MAXRWSETS	30		/* max # of sets of rewriting rules */
# define MAXPRIORITIES	25		/* max values for Precedence: field */
# define MAXTRUST	30		/* maximum number of trusted users */
# define MAXUSERENVIRON	40		/* max # of items in user environ */
# define QUEUESIZE	600		/* max # of jobs per queue run */

/*
**  Compilation options.
**
**	#define these if they are available; comment them out otherwise.
*/

# define DBM		1	/* use DBM library (requires -ldbm) */
# define NDBM		1	/* new DBM library available (requires DBM) */
# define DEBUG		1	/* enable debugging */
# define LOG		1	/* enable logging */
# define SMTP		1	/* enable user and server SMTP */
# define QUEUE		1	/* enable queueing */
# define UGLYUUCP	1	/* output ugly UUCP From lines */
# define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
# define FLOCK		1	/* use flock file locking */
# define SETPROCTITLE	1	/* munge argv to display current status */
/* # define WIZ		1	/* allow wizard mode */

Changes to usr.sbin/sendmail/src/daemon.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35


# include <errno.h>
# include "sendmail.h"

# ifndef DAEMON
# ifndef lint
static char	SccsId[] = "@(#)daemon.c	5.16 (Berkeley) 12/26/85	(w/o daemon mode)";
# endif not lint
# else

# include <netdb.h>
# include <sys/signal.h>
# include <sys/wait.h>
# include <sys/time.h>
# include <sys/resource.h>

# ifndef lint
static char	SccsId[] = "@(#)daemon.c	5.16 (Berkeley) 12/26/85 (with daemon mode)";
# endif not lint

/*
**  DAEMON.C -- routines to use when running as a daemon.
**
**	This entire file is highly dependent on the 4.2 BSD
**	interprocess communication primitives.  No attempt has







|










|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35


# include <errno.h>
# include "sendmail.h"

# ifndef DAEMON
# ifndef lint
static char	SccsId[] = "@(#)daemon.c	5.17 (Berkeley) 01/05/86	(w/o daemon mode)";
# endif not lint
# else

# include <netdb.h>
# include <sys/signal.h>
# include <sys/wait.h>
# include <sys/time.h>
# include <sys/resource.h>

# ifndef lint
static char	SccsId[] = "@(#)daemon.c	5.17 (Berkeley) 01/05/86 (with daemon mode)";
# endif not lint

/*
**  DAEMON.C -- routines to use when running as a daemon.
**
**	This entire file is highly dependent on the 4.2 BSD
**	interprocess communication primitives.  No attempt has
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
**		code (if it cares).
**	makeconnection(host, port, outfile, infile)
**		Make a connection to the named host on the given
**		port.  Set *outfile and *infile to the files
**		appropriate for communication.  Returns zero on
**		success, else an exit status describing the
**		error.
**
**	The semantics of both of these should be clean.

*/
/*
**  GETREQUESTS -- open mail IPC port and get requests.
**
**	Parameters:
**		none.
**







|
|
>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
**		code (if it cares).
**	makeconnection(host, port, outfile, infile)
**		Make a connection to the named host on the given
**		port.  Set *outfile and *infile to the files
**		appropriate for communication.  Returns zero on
**		success, else an exit status describing the
**		error.
**	maphostname(hbuf, hbufsize)
**		Convert the entry in hbuf into a canonical form.  It
**		may not be larger than hbufsize.
*/
/*
**  GETREQUESTS -- open mail IPC port and get requests.
**
**	Parameters:
**		none.
**
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
		}

		/* close the port so that others will hang (for a while) */
		(void) close(t);
	}
	/*NOTREACHED*/
}
/*
**  REAPCHILD -- pick up the body of my child, lest it become a zombie
**
**	Parameters:
**		none.
**
**	Returns:
**		none.
**
**	Side Effects:
**		Picks up zombies.
*/

reapchild()
{
	union wait status;

	while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
		continue;
}
/*
**  CLRDAEMON -- reset the daemon connection
**
**	Parameters:
**		none.
**
**	Returns:







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







251
252
253
254
255
256
257




















258
259
260
261
262
263
264
		}

		/* close the port so that others will hang (for a while) */
		(void) close(t);
	}
	/*NOTREACHED*/
}




















/*
**  CLRDAEMON -- reset the daemon connection
**
**	Parameters:
**		none.
**
**	Returns:
601
602
603
604
605
606
607
608
609
610
/*ARGSUSED*/
maphostname(hbuf, hbsize)
	char *hbuf;
	int hbsize;
{
	return;
}


#endif DAEMON








<

582
583
584
585
586
587
588
589

590
/*ARGSUSED*/
maphostname(hbuf, hbsize)
	char *hbuf;
	int hbsize;
{
	return;
}


#endif DAEMON

Changes to usr.sbin/sendmail/src/queue.c.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# include <sys/stat.h>
# include <sys/dir.h>
# include <signal.h>
# include <errno.h>

# ifndef QUEUE
# ifndef lint
static char	SccsId[] = "@(#)queue.c	5.18 (Berkeley) 12/17/85	(no queueing)";
# endif not lint
# else QUEUE

# ifndef lint
static char	SccsId[] = "@(#)queue.c	5.18 (Berkeley) 12/17/85";
# endif not lint

/*
**  Work queue.
*/

struct work







|




|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# include <sys/stat.h>
# include <sys/dir.h>
# include <signal.h>
# include <errno.h>

# ifndef QUEUE
# ifndef lint
static char	SccsId[] = "@(#)queue.c	5.19 (Berkeley) 01/05/86	(no queueing)";
# endif not lint
# else QUEUE

# ifndef lint
static char	SccsId[] = "@(#)queue.c	5.19 (Berkeley) 01/05/86";
# endif not lint

/*
**  Work queue.
*/

struct work
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
		(*e->e_putbody)(dfp, ProgMailer, e);
		(void) fclose(dfp);
		e->e_putbody = putbody;
	}

	/*
	**  Output future work requests.
	**	Priority should be first, since it is read by orderq.

	*/

	/* output message priority */
	fprintf(tfp, "P%ld\n", e->e_msgpriority);

	/* output creation time */
	fprintf(tfp, "T%ld\n", e->e_ctime);







|
>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
		(*e->e_putbody)(dfp, ProgMailer, e);
		(void) fclose(dfp);
		e->e_putbody = putbody;
	}

	/*
	**  Output future work requests.
	**	Priority and creation time should be first, since
	**	they are required by orderq.
	*/

	/* output message priority */
	fprintf(tfp, "P%ld\n", e->e_msgpriority);

	/* output creation time */
	fprintf(tfp, "T%ld\n", e->e_ctime);
151
152
153
154
155
156
157






158
159
160
161
162
163
164
			{
				printf("queueing ");
				printaddr(q, FALSE);
			}
#endif DEBUG
		}
	}







	/*
	**  Output headers for this message.
	**	Expand macros completely here.  Queue run will deal with
	**	everything as absolute headers.
	**		All headers that must be relative to the recipient
	**		can be cracked later.







>
>
>
>
>
>







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
			{
				printf("queueing ");
				printaddr(q, FALSE);
			}
#endif DEBUG
		}
	}

	/* output list of error recipients */
	for (q = e->e_errorqueue; q != NULL; q = q->q_next)
	{
		fprintf(tfp, "E%s\n", q->q_paddr);
	}

	/*
	**  Output headers for this message.
	**	Expand macros completely here.  Queue run will deal with
	**	everything as absolute headers.
	**		All headers that must be relative to the recipient
	**		can be cracked later.
353
354
355
356
357
358
359
360

361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
**		The number of request in the queue (not necessarily
**		the number of requests in WorkQ however).
**
**	Side Effects:
**		Sets WorkQ to the queue of available work, in order.
*/

# define WLSIZE		120	/* max size of worklist per sort */


orderq(doall)
	bool doall;
{
	register struct direct *d;
	register WORK *w;
	DIR *f;
	register int i;
	WORK wlist[WLSIZE+1];
	int wn = -1;
	extern workcmpf();

	/* clear out old WorkQ */
	for (w = WorkQ; w != NULL; )
	{
		register WORK *nw = w->w_next;







|
>








|







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
**		The number of request in the queue (not necessarily
**		the number of requests in WorkQ however).
**
**	Side Effects:
**		Sets WorkQ to the queue of available work, in order.
*/

# define NEED_P		001
# define NEED_T		002

orderq(doall)
	bool doall;
{
	register struct direct *d;
	register WORK *w;
	DIR *f;
	register int i;
	WORK wlist[QUEUESIZE+1];
	int wn = -1;
	extern workcmpf();

	/* clear out old WorkQ */
	for (w = WorkQ; w != NULL; )
	{
		register WORK *nw = w->w_next;
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421

422
423
424
425
426
427
428

429
430
431
432
433
434
435
436

437
438
439
440

441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
		char lbuf[MAXNAME];

		/* is this an interesting entry? */
		if (d->d_name[0] != 'q' || d->d_name[1] != 'f')
			continue;

		/* yes -- open control file (if not too many files) */
		if (++wn >= WLSIZE)
			continue;
		cf = fopen(d->d_name, "r");
		if (cf == NULL)
		{
			/* this may be some random person sending hir msgs */
			/* syserr("orderq: cannot open %s", cbuf); */
#ifdef DEBUG
			if (tTd(41, 2))
				printf("orderq: cannot open %s (%d)\n",
					d->d_name, errno);
#endif DEBUG
			errno = 0;
			wn--;
			continue;
		}

		wlist[wn].w_name = newstr(d->d_name);

		/* make sure jobs in creation don't clog queue */
		wlist[wn].w_pri = 0x7fffffff;
		wlist[wn].w_ctime = 0;

		/* extract useful information */

		while (fgets(lbuf, sizeof lbuf, cf) != NULL)
		{
			extern long atol();

			switch (lbuf[0])
			{
			  case 'P':
				wlist[wn].w_pri = atol(&lbuf[1]);

				break;

			  case 'T':
				wlist[wn].w_ctime = atol(&lbuf[1]);

				break;
			}
		}
		(void) fclose(cf);

		if (!doall && shouldqueue(wlist[wn].w_pri))
		{
			/* don't even bother sorting this job in */
			wn--;
		}
	}
	(void) closedir(f);
	wn++;

	/*
	**  Sort the work directory.
	*/

	qsort((char *) wlist, min(wn, WLSIZE), sizeof *wlist, workcmpf);

	/*
	**  Convert the work list into canonical form.
	**	Should be turning it into a list of envelopes here perhaps.
	*/

	WorkQ = NULL;
	for (i = min(wn, WLSIZE); --i >= 0; )
	{
		w = (WORK *) xalloc(sizeof *w);
		w->w_name = wlist[i].w_name;
		w->w_pri = wlist[i].w_pri;
		w->w_ctime = wlist[i].w_ctime;
		w->w_next = WorkQ;
		WorkQ = w;







|















>
|


|
|


>
|






|
>



|
>





|












|







|







407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
		char lbuf[MAXNAME];

		/* is this an interesting entry? */
		if (d->d_name[0] != 'q' || d->d_name[1] != 'f')
			continue;

		/* yes -- open control file (if not too many files) */
		if (++wn >= QUEUESIZE)
			continue;
		cf = fopen(d->d_name, "r");
		if (cf == NULL)
		{
			/* this may be some random person sending hir msgs */
			/* syserr("orderq: cannot open %s", cbuf); */
#ifdef DEBUG
			if (tTd(41, 2))
				printf("orderq: cannot open %s (%d)\n",
					d->d_name, errno);
#endif DEBUG
			errno = 0;
			wn--;
			continue;
		}
		w = &wlist[wn];
		w->w_name = newstr(d->d_name);

		/* make sure jobs in creation don't clog queue */
		w->w_pri = 0x7fffffff;
		w->w_ctime = 0;

		/* extract useful information */
		i = NEED_P | NEED_T;
		while (i != 0 && fgets(lbuf, sizeof lbuf, cf) != NULL)
		{
			extern long atol();

			switch (lbuf[0])
			{
			  case 'P':
				w->w_pri = atol(&lbuf[1]);
				i &= ~NEED_P;
				break;

			  case 'T':
				w->w_ctime = atol(&lbuf[1]);
				i &= ~NEED_T;
				break;
			}
		}
		(void) fclose(cf);

		if (!doall && shouldqueue(w->w_pri))
		{
			/* don't even bother sorting this job in */
			wn--;
		}
	}
	(void) closedir(f);
	wn++;

	/*
	**  Sort the work directory.
	*/

	qsort((char *) wlist, min(wn, QUEUESIZE), sizeof *wlist, workcmpf);

	/*
	**  Convert the work list into canonical form.
	**	Should be turning it into a list of envelopes here perhaps.
	*/

	WorkQ = NULL;
	for (i = min(wn, QUEUESIZE); --i >= 0; )
	{
		w = (WORK *) xalloc(sizeof *w);
		w->w_name = wlist[i].w_name;
		w->w_pri = wlist[i].w_pri;
		w->w_ctime = wlist[i].w_ctime;
		w->w_next = WorkQ;
		WorkQ = w;
678
679
680
681
682
683
684




685
686
687
688
689
690
691
	while (fgetfolded(buf, sizeof buf, qfp) != NULL)
	{
		switch (buf[0])
		{
		  case 'R':		/* specify recipient */
			sendtolist(&buf[1], (ADDRESS *) NULL, &e->e_sendqueue);
			break;





		  case 'H':		/* header */
			if (full)
				(void) chompheader(&buf[1], FALSE);
			break;

		  case 'M':		/* message */







>
>
>
>







690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
	while (fgetfolded(buf, sizeof buf, qfp) != NULL)
	{
		switch (buf[0])
		{
		  case 'R':		/* specify recipient */
			sendtolist(&buf[1], (ADDRESS *) NULL, &e->e_sendqueue);
			break;

		  case 'E':		/* specify error recipient */
			sendtolist(&buf[1], (ADDRESS *) NULL, &e->e_errorqueue);
			break;

		  case 'H':		/* header */
			if (full)
				(void) chompheader(&buf[1], FALSE);
			break;

		  case 'M':		/* message */
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
	if (nrequests <= 0)
	{
		printf("Mail queue is empty\n");
		return;
	}

	printf("\t\tMail Queue (%d request%s", nrequests, nrequests == 1 ? "" : "s");
	if (nrequests > WLSIZE)
		printf(", only %d printed", WLSIZE);
	if (Verbose)
		printf(")\n--QID-- --Size-- -Priority- ---Q-Time--- -----------Sender/Recipient-----------\n");
	else
		printf(")\n--QID-- --Size-- -----Q-Time----- ------------Sender/Recipient------------\n");
	for (w = WorkQ; w != NULL; w = w->w_next)
	{
		struct stat st;







|
|







787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
	if (nrequests <= 0)
	{
		printf("Mail queue is empty\n");
		return;
	}

	printf("\t\tMail Queue (%d request%s", nrequests, nrequests == 1 ? "" : "s");
	if (nrequests > QUEUESIZE)
		printf(", only %d printed", QUEUESIZE);
	if (Verbose)
		printf(")\n--QID-- --Size-- -Priority- ---Q-Time--- -----------Sender/Recipient-----------\n");
	else
		printf(")\n--QID-- --Size-- -----Q-Time----- ------------Sender/Recipient------------\n");
	for (w = WorkQ; w != NULL; w = w->w_next)
	{
		struct stat st;

Changes to usr.sbin/sendmail/src/readcf.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)readcf.c	5.7 (Berkeley) 12/07/85";
#endif not lint

# include "sendmail.h"

/*
**  READCF -- read control file.
**











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)readcf.c	5.10 (Berkeley) 01/11/86";
#endif not lint

# include "sendmail.h"

/*
**  READCF -- read control file.
**
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315


316
317
318
319



























320
321

322
323
324
325
326
327
328
*/

fileclass(class, filename, fmt)
	int class;
	char *filename;
	char *fmt;
{
	register FILE *f;
	char buf[MAXLINE];

	f = fopen(filename, "r");
	if (f == NULL)
	{
		syserr("cannot open %s", filename);
		return;
	}

	while (fgets(buf, sizeof buf, f) != NULL)
	{
		register STAB *s;


		char wordbuf[MAXNAME+1];

		if (sscanf(buf, fmt, wordbuf) != 1)
			continue;



























		s = stab(wordbuf, ST_CLASS, ST_ENTER);
		setbitn(class, s->s_class);

	}

	(void) fclose(f);
}
/*
**  MAKEMAILER -- define a new mailer.
**







|












>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>







296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
*/

fileclass(class, filename, fmt)
	int class;
	char *filename;
	char *fmt;
{
	FILE *f;
	char buf[MAXLINE];

	f = fopen(filename, "r");
	if (f == NULL)
	{
		syserr("cannot open %s", filename);
		return;
	}

	while (fgets(buf, sizeof buf, f) != NULL)
	{
		register STAB *s;
		register char *p;
# ifdef SCANF
		char wordbuf[MAXNAME+1];

		if (sscanf(buf, fmt, wordbuf) != 1)
			continue;
		p = wordbuf;
# else SCANF
		p = buf;
# endif SCANF

		/*
		**  Break up the match into words.
		*/

		while (*p != '\0')
		{
			register char *q;

			/* strip leading spaces */
			while (isspace(*p))
				p++;
			if (*p == '\0')
				break;

			/* find the end of the word */
			q = p;
			while (*p != '\0' && !isspace(*p))
				p++;
			if (*p != '\0')
				*p++ = '\0';

			/* enter the word in the symbol table */
			s = stab(q, ST_CLASS, ST_ENTER);
			setbitn(class, s->s_class);
		}
	}

	(void) fclose(f);
}
/*
**  MAKEMAILER -- define a new mailer.
**
605
606
607
608
609
610
611
612
613





614
615
616
617
618
619
620
**		none.
**
**	Side Effects:
**		Sets options as implied by the arguments.
*/

static BITMAP	StickyOpt;		/* set if option is stuck */
extern char	*WizWord;		/* the stored wizard password */
extern char	*NetName;		/* name of home (local) network */






setoption(opt, val, safe, sticky)
	char opt;
	char *val;
	bool safe;
	bool sticky;
{







<

>
>
>
>
>







635
636
637
638
639
640
641

642
643
644
645
646
647
648
649
650
651
652
653
654
**		none.
**
**	Side Effects:
**		Sets options as implied by the arguments.
*/

static BITMAP	StickyOpt;		/* set if option is stuck */

extern char	*NetName;		/* name of home (local) network */
# ifdef SMTP
# ifdef WIZ
extern char	*WizWord;		/* the stored wizard password */
# endif WIZ
# endif SMTP

setoption(opt, val, safe, sticky)
	char opt;
	char *val;
	bool safe;
	bool sticky;
{
772
773
774
775
776
777
778




779
780
781
782
783
784
785
		define(val[0], newstr(&val[1]), CurEnv);
		sticky = FALSE;
		break;

	  case 'm':		/* send to me too */
		MeToo = atobool(val);
		break;





# ifdef DAEMON
	  case 'N':		/* home (local?) network name */
		NetName = newstr(val);
		break;
# endif DAEMON








>
>
>
>







806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
		define(val[0], newstr(&val[1]), CurEnv);
		sticky = FALSE;
		break;

	  case 'm':		/* send to me too */
		MeToo = atobool(val);
		break;

	  case 'n':		/* validate RHS in newaliases */
		CheckAliases = atobool(val);
		break;

# ifdef DAEMON
	  case 'N':		/* home (local?) network name */
		NetName = newstr(val);
		break;
# endif DAEMON

839
840
841
842
843
844
845
846

847
848
849
850

851
852
853
854
855
856
857
		DefUid = atoi(val);
		break;

	  case 'v':		/* run in verbose mode */
		Verbose = atobool(val);
		break;

# ifdef DEBUG

	  case 'W':		/* set the wizards password */
		WizWord = newstr(val);
		break;
# endif DEBUG


	  case 'x':		/* load avg at which to auto-queue msgs */
		QueueLA = atoi(val);
		break;

	  case 'X':		/* load avg at which to auto-reject connections */
		RefuseLA = atoi(val);







|
>



|
>







877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
		DefUid = atoi(val);
		break;

	  case 'v':		/* run in verbose mode */
		Verbose = atobool(val);
		break;

# ifdef SMTP
# ifdef WIZ
	  case 'W':		/* set the wizards password */
		WizWord = newstr(val);
		break;
# endif WIZ
# endif SMTP

	  case 'x':		/* load avg at which to auto-queue msgs */
		QueueLA = atoi(val);
		break;

	  case 'X':		/* load avg at which to auto-reject connections */
		RefuseLA = atoi(val);

Changes to usr.sbin/sendmail/src/recipient.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)recipient.c	5.6 (Berkeley) 12/07/85";
#endif not lint

# include <pwd.h>
# include "sendmail.h"
# include <sys/stat.h>

/*











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)recipient.c	5.7 (Berkeley) 01/09/86";
#endif not lint

# include <pwd.h>
# include "sendmail.h"
# include <sys/stat.h>

/*
347
348
349
350
351
352
353
354
355




356



357

358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
	char *name;
{
	register struct passwd *pw;
	register char *p;
	extern struct passwd *getpwent();
	extern struct passwd *getpwnam();

	/*
	**  Make name canonical.




	*/





	for (p = name; *p != '\0'; p++)
	{
		if (*p == (SpaceSub & 0177) || *p == '_')
			*p = ' ';
		else if (isascii(*p) && isupper(*p))
			*p = tolower(*p);
	}

	/* look up this login name */
	if ((pw = getpwnam(name)) != NULL)
		return (pw);

	/* search for a matching full name instead */
	(void) setpwent();
	while ((pw = getpwent()) != NULL)
	{
		char buf[MAXNAME];
		extern bool sameword();

		if (strcmp(pw->pw_name, name) == 0)
			return (pw);
		buildfname(pw->pw_gecos, pw->pw_name, buf);
		if (index(buf, ' ') != NULL && sameword(buf, name))
		{
			message(Arpa_Info, "sending to login name %s", pw->pw_name);
			return (pw);
		}
	}







|
|
>
>
>
>
|
>
>
>

>




<
<

<
<
<
<
<
<






<
<







347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369


370






371
372
373
374
375
376


377
378
379
380
381
382
383
	char *name;
{
	register struct passwd *pw;
	register char *p;
	extern struct passwd *getpwent();
	extern struct passwd *getpwnam();

	/* map upper => lower case */
	for (p = name; *p != '\0'; p++)
	{
		if (isascii(*p) && isupper(*p))
			*p = tolower(*p);
	}

	/* look up this login name using fast path */
	if ((pw = getpwnam(name)) != NULL)
		return (pw);

	/* search for a matching full name instead */
	for (p = name; *p != '\0'; p++)
	{
		if (*p == (SpaceSub & 0177) || *p == '_')
			*p = ' ';


	}






	(void) setpwent();
	while ((pw = getpwent()) != NULL)
	{
		char buf[MAXNAME];
		extern bool sameword();



		buildfname(pw->pw_gecos, pw->pw_name, buf);
		if (index(buf, ' ') != NULL && sameword(buf, name))
		{
			message(Arpa_Info, "sending to login name %s", pw->pw_name);
			return (pw);
		}
	}

Changes to usr.sbin/sendmail/src/sendmail.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
**
**	@(#)sendmail.h	5.7 (Berkeley) 11/22/85
*/

/*
**  SENDMAIL.H -- Global definitions for sendmail.
*/



# ifdef _DEFINE
# define EXTERN
# ifndef lint
static char SmailSccsId[] =	"@(#)sendmail.h	5.7		11/22/85";
# endif lint
# else  _DEFINE
# define EXTERN extern
# endif _DEFINE

# include <stdio.h>
# include <ctype.h>









|











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
**
**	@(#)sendmail.h	5.8 (Berkeley) 01/10/86
*/

/*
**  SENDMAIL.H -- Global definitions for sendmail.
*/



# ifdef _DEFINE
# define EXTERN
# ifndef lint
static char SmailSccsId[] =	"@(#)sendmail.h	5.8		01/10/86";
# endif lint
# else  _DEFINE
# define EXTERN extern
# endif _DEFINE

# include <stdio.h>
# include <ctype.h>
480
481
482
483
484
485
486

487
488
489
490
491
492
493
EXTERN bool	SuprErrs;	/* set if we are suppressing errors */
EXTERN bool	QueueRun;	/* currently running message from the queue */
EXTERN bool	HoldErrs;	/* only output errors to transcript */
EXTERN bool	NoConnect;	/* don't connect to non-local mailers */
EXTERN bool	SuperSafe;	/* be extra careful, even if expensive */
EXTERN bool	ForkQueueRuns;	/* fork for each job when running the queue */
EXTERN bool	AutoRebuild;	/* auto-rebuild the alias database as needed */

EXTERN int	SafeAlias;	/* minutes to wait until @:@ in alias file */
EXTERN time_t	TimeOut;	/* time until timeout */
EXTERN FILE	*InChannel;	/* input connection */
EXTERN FILE	*OutChannel;	/* output connection */
EXTERN int	RealUid;	/* when Daemon, real uid of caller */
EXTERN int	RealGid;	/* when Daemon, real gid of caller */
EXTERN int	DefUid;		/* default uid to run as */







>







480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
EXTERN bool	SuprErrs;	/* set if we are suppressing errors */
EXTERN bool	QueueRun;	/* currently running message from the queue */
EXTERN bool	HoldErrs;	/* only output errors to transcript */
EXTERN bool	NoConnect;	/* don't connect to non-local mailers */
EXTERN bool	SuperSafe;	/* be extra careful, even if expensive */
EXTERN bool	ForkQueueRuns;	/* fork for each job when running the queue */
EXTERN bool	AutoRebuild;	/* auto-rebuild the alias database as needed */
EXTERN bool	CheckAliases;	/* parse addresses during newaliases */
EXTERN int	SafeAlias;	/* minutes to wait until @:@ in alias file */
EXTERN time_t	TimeOut;	/* time until timeout */
EXTERN FILE	*InChannel;	/* input connection */
EXTERN FILE	*OutChannel;	/* output connection */
EXTERN int	RealUid;	/* when Daemon, real uid of caller */
EXTERN int	RealGid;	/* when Daemon, real gid of caller */
EXTERN int	DefUid;		/* default uid to run as */

Changes to usr.sbin/sendmail/src/srvrsmtp.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

# include <errno.h>
# include "sendmail.h"
# include <signal.h>

# ifndef SMTP
# ifndef lint
static char	SccsId[] = "@(#)srvrsmtp.c	5.17 (Berkeley) 12/17/85	(no SMTP)";
# endif not lint
# else SMTP

# ifndef lint
static char	SccsId[] = "@(#)srvrsmtp.c	5.17 (Berkeley) 12/17/85";
# endif not lint

/*
**  SMTP -- run the SMTP protocol.
**
**	Parameters:
**		none.







|




|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

# include <errno.h>
# include "sendmail.h"
# include <signal.h>

# ifndef SMTP
# ifndef lint
static char	SccsId[] = "@(#)srvrsmtp.c	5.18 (Berkeley) 01/05/86	(no SMTP)";
# endif not lint
# else SMTP

# ifndef lint
static char	SccsId[] = "@(#)srvrsmtp.c	5.18 (Berkeley) 01/05/86";
# endif not lint

/*
**  SMTP -- run the SMTP protocol.
**
**	Parameters:
**		none.
172
173
174
175
176
177
178




179
180
181
182
183
184
185
		/* break off command */
		for (p = inp; isspace(*p); p++)
			continue;
		cmd = p;
		for (cmd = cmdbuf; *p != '\0' && !isspace(*p); )
			*cmd++ = *p++;
		*cmd = '\0';





		/* decode command */
		for (c = CmdTab; c->cmdname != NULL; c++)
		{
			if (sameword(c->cmdname, cmdbuf))
				break;
		}







>
>
>
>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
		/* break off command */
		for (p = inp; isspace(*p); p++)
			continue;
		cmd = p;
		for (cmd = cmdbuf; *p != '\0' && !isspace(*p); )
			*cmd++ = *p++;
		*cmd = '\0';

		/* throw away leading whitespace */
		while (isspace(*p))
			p++;

		/* decode command */
		for (c = CmdTab; c->cmdname != NULL; c++)
		{
			if (sameword(c->cmdname, cmdbuf))
				break;
		}

Changes to usr.sbin/sendmail/src/stats.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)stats.c	5.6 (Berkeley) 09/19/85";
#endif not lint

# include "sendmail.h"

/*
**  Statistics structure.
*/











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)stats.c	5.7 (Berkeley) 01/05/86";
#endif not lint

# include "sendmail.h"

/*
**  Statistics structure.
*/
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

markstats(e, to)
	register ENVELOPE *e;
	register ADDRESS *to;
{
	if (to == NULL)
	{
		Stat.stat_bf[e->e_from.q_mailer->m_mno] += KBYTES(CurEnv->e_msgsize);

		/*
		**  If is possible to get mail from an unparseable address,
		**  in this case, the q_mailer field is null, so that the
		**  indirection below causes a dereference of a NULL pointer.
		*/

		if (e->e_from.q_mailer != NULL )
		{
			Stat.stat_nf[e->e_from.q_mailer->m_mno]++;
			Stat.stat_bf[e->e_from.q_mailer->m_mno] +=
				KBYTES(CurEnv->e_msgsize);
		}
	}
	else







<
<
<
<
<
<
<
<
|







38
39
40
41
42
43
44








45
46
47
48
49
50
51
52

markstats(e, to)
	register ENVELOPE *e;
	register ADDRESS *to;
{
	if (to == NULL)
	{








		if (e->e_from.q_mailer != NULL)
		{
			Stat.stat_nf[e->e_from.q_mailer->m_mno]++;
			Stat.stat_bf[e->e_from.q_mailer->m_mno] +=
				KBYTES(CurEnv->e_msgsize);
		}
	}
	else

Changes to usr.sbin/sendmail/src/version.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)version.c	5.38 (Berkeley) 12/17/85";
#endif not lint

char	Version[] = "5.38";











|


|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
**  Sendmail
**  Copyright (c) 1983  Eric P. Allman
**  Berkeley, California
**
**  Copyright (c) 1983 Regents of the University of California.
**  All rights reserved.  The Berkeley software License Agreement
**  specifies the terms and conditions for redistribution.
*/

#ifndef lint
static char	SccsId[] = "@(#)version.c	5.44 (Berkeley) 01/11/86";
#endif not lint

char	Version[] = "5.44";