xref: /csrg-svn/sys/pmax/pmax/cons.c (revision 52118)
1*52118Smckusick /*
2*52118Smckusick  * Copyright (c) 1988 University of Utah.
3*52118Smckusick  * Copyright (c) 1992 The Regents of the University of California.
4*52118Smckusick  * All rights reserved.
5*52118Smckusick  *
6*52118Smckusick  * This code is derived from software contributed to Berkeley by
7*52118Smckusick  * the Systems Programming Group of the University of Utah Computer
8*52118Smckusick  * Science Department and Ralph Campbell.
9*52118Smckusick  *
10*52118Smckusick  * %sccs.include.redist.c%
11*52118Smckusick  *
12*52118Smckusick  * from: Utah $Hdr: cons.c 1.1 90/07/09$
13*52118Smckusick  *
14*52118Smckusick  *	@(#)cons.c	7.1 (Berkeley) 01/07/92
15*52118Smckusick  */
16*52118Smckusick 
17*52118Smckusick #include "param.h"
18*52118Smckusick #include "proc.h"
19*52118Smckusick #include "systm.h"
20*52118Smckusick #include "buf.h"
21*52118Smckusick #include "ioctl.h"
22*52118Smckusick #include "tty.h"
23*52118Smckusick #include "file.h"
24*52118Smckusick #include "conf.h"
25*52118Smckusick 
26*52118Smckusick #include "../include/machMon.h"
27*52118Smckusick 
28*52118Smckusick /*
29*52118Smckusick  * Console output may be redirected to another tty
30*52118Smckusick  * (e.g. a window); if so, constty will point to the current
31*52118Smckusick  * virtual console.
32*52118Smckusick  */
33*52118Smckusick struct	tty *constty;		/* virtual console output device */
34*52118Smckusick 
35*52118Smckusick /*
36*52118Smckusick  * Get character from console.
37*52118Smckusick  */
38*52118Smckusick cngetc()
39*52118Smckusick {
40*52118Smckusick 	int (*f)() = (int (*)())MACH_MON_GETCHAR;
41*52118Smckusick 
42*52118Smckusick 	return (*f)();
43*52118Smckusick }
44*52118Smckusick 
45*52118Smckusick #include "pm.h"
46*52118Smckusick 
47*52118Smckusick /*
48*52118Smckusick  * Print a character on console.
49*52118Smckusick  */
50*52118Smckusick cnputc(c)
51*52118Smckusick 	register int c;
52*52118Smckusick {
53*52118Smckusick #if NPM > 0
54*52118Smckusick 	pmPutc(c);
55*52118Smckusick #else
56*52118Smckusick 	int s;
57*52118Smckusick 	void (*f)() = (void (*)())MACH_MON_PUTCHAR;
58*52118Smckusick 
59*52118Smckusick 	s = splhigh();
60*52118Smckusick 	(*f)(c);
61*52118Smckusick 	splx(s);
62*52118Smckusick #endif
63*52118Smckusick }
64