summaryrefslogtreecommitdiff
path: root/i386/i386at/immc.c
diff options
context:
space:
mode:
Diffstat (limited to 'i386/i386at/immc.c')
-rw-r--r--i386/i386at/immc.c74
1 files changed, 61 insertions, 13 deletions
diff --git a/i386/i386at/immc.c b/i386/i386at/immc.c
index e0837f2..ea95169 100644
--- a/i386/i386at/immc.c
+++ b/i386/i386at/immc.c
@@ -21,8 +21,11 @@
* Author: Bryan Ford, University of Utah CSL
*/
-#ifdef ENABLE_IMMEDIATE_CONSOLE
+#if ENABLE_IMMEDIATE_CONSOLE
+#include <device/cons.h>
+#include <mach/boolean.h>
+#include <i386/vm_param.h>
#include <string.h>
/* This is a special "feature" (read: kludge)
@@ -35,22 +38,65 @@
boolean_t immediate_console_enable = TRUE;
-void
-immc_cnputc(unsigned char c)
+/*
+ * XXX we assume that pcs *always* have a console
+ */
+int
+immc_cnprobe(struct consdev *cp)
+{
+ int maj, unit, pri;
+
+ maj = 0;
+ unit = 0;
+ pri = CN_INTERNAL;
+
+ cp->cn_dev = makedev(maj, unit);
+ cp->cn_pri = pri;
+ return 0;
+}
+
+int
+immc_cninit(struct consdev *cp)
+{
+ return 0;
+}
+
+int immc_cnmaygetc(void)
+{
+ return -1;
+}
+
+int
+immc_cngetc(dev_t dev, int wait)
+{
+ if (wait) {
+ int c;
+ while ((c = immc_cnmaygetc()) < 0)
+ continue;
+ return c;
+ }
+ else
+ return immc_cnmaygetc();
+}
+
+int
+immc_cnputc(dev_t dev, int c)
{
static int ofs = -1;
if (!immediate_console_enable)
- return;
+ return -1;
if (ofs < 0)
{
ofs = 0;
- immc_cnputc('\n');
+ immc_cnputc(dev, '\n');
}
- else if (c == '\n')
+
+ if (c == '\n')
{
- memmove((void *)0xb8000, (void *)0xb8000+80*2, 80*2*24);
- memset((void *)(0xb8000+80*2*24), 0, 80*2);
+ memmove((void *) phystokv(0xb8000),
+ (void *) phystokv(0xb8000+80*2), 80*2*24);
+ memset((void *) phystokv((0xb8000+80*2*24)), 0, 80*2);
ofs = 0;
}
else
@@ -59,20 +105,22 @@ immc_cnputc(unsigned char c)
if (ofs >= 80)
{
- immc_cnputc('\r');
- immc_cnputc('\n');
+ immc_cnputc(dev, '\r');
+ immc_cnputc(dev, '\n');
}
- p = (void*)0xb8000 + 80*2*24 + ofs*2;
+ p = (void *) phystokv(0xb8000 + 80*2*24 + ofs*2);
p[0] = c;
p[1] = 0x0f;
ofs++;
}
+ return 0;
}
-int immc_cnmaygetc(void)
+void
+immc_romputc(char c)
{
- return -1;
+ immc_cnputc (0, c);
}
#endif /* ENABLE_IMMEDIATE_CONSOLE */