summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrtm <rtm>2006-06-22 15:51:57 +0000
committerrtm <rtm>2006-06-22 15:51:57 +0000
commitbf49aedbed02cdbf40430178847d34c48c36c693 (patch)
tree3c82a52750289dea1fc030cc207521174c4959e5
parent8352b998019565946b8f5b3b8f72175c5076efec (diff)
downloadxv6-labs-bf49aedbed02cdbf40430178847d34c48c36c693.tar.gz
xv6-labs-bf49aedbed02cdbf40430178847d34c48c36c693.tar.bz2
xv6-labs-bf49aedbed02cdbf40430178847d34c48c36c693.zip
send console output to parallel port
-rw-r--r--Notes3
-rw-r--r--console.c19
2 files changed, 22 insertions, 0 deletions
diff --git a/Notes b/Notes
index 06a9696..88b725c 100644
--- a/Notes
+++ b/Notes
@@ -1,3 +1,6 @@
+bochs 2.2.6:
+./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae --disable-reset-on-triple-fault
+
bootmain.c doesn't work right if the ELF sections aren't
sector-aligned. so you can't use ld -N. and the sections may also need
to be non-zero length, only really matters for tiny "kernels".
diff --git a/console.c b/console.c
index 2035611..e6203e2 100644
--- a/console.c
+++ b/console.c
@@ -2,6 +2,23 @@
#include <x86.h>
#include "defs.h"
+/*
+ * copy console output to parallel port, which you can tell
+ * .bochsrc to copy to the stdout:
+ * parport1: enabled=1, file="/dev/stdout"
+ */
+static void
+lpt_putc(int c)
+{
+ int i;
+
+ for (i = 0; !(inb(0x378+1) & 0x80) && i < 12800; i++)
+ ;
+ outb(0x378+0, c);
+ outb(0x378+2, 0x08|0x04|0x01);
+ outb(0x378+2, 0x08);
+}
+
void
cons_putc(int c)
{
@@ -9,6 +26,8 @@ cons_putc(int c)
unsigned short *crt = (unsigned short *) 0xB8000; // base of CGA memory
int ind;
+ lpt_putc(c);
+
// cursor position, 16 bits, col + 80*row
outb(crtport, 14);
ind = inb(crtport + 1) << 8;