summaryrefslogtreecommitdiff
path: root/kernel/console.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2020-07-20 06:59:26 -0400
committerFrans Kaashoek <[email protected]>2020-08-10 11:19:10 -0400
commit27057bc9b467db64a3de600f27d6fa3239a04c88 (patch)
tree51f344b42031f0a5a41fcf08d00694bb13f10997 /kernel/console.c
parent1e72d5ca087985938589ce509ace4914039860d3 (diff)
downloadxv6-labs-27057bc9b467db64a3de600f27d6fa3239a04c88.tar.gz
xv6-labs-27057bc9b467db64a3de600f27d6fa3239a04c88.tar.bz2
xv6-labs-27057bc9b467db64a3de600f27d6fa3239a04c88.zip
interrupt-driven uart output, hopefully a nice example for teaching.
Diffstat (limited to 'kernel/console.c')
-rw-r--r--kernel/console.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/console.c b/kernel/console.c
index 87a83ff..a97ef30 100644
--- a/kernel/console.c
+++ b/kernel/console.c
@@ -27,6 +27,8 @@
//
// send one character to the uart.
+// called by printf, and to echo input characters,
+// but not from write().
//
void
consputc(int c)
@@ -40,9 +42,9 @@ consputc(int c)
if(c == BACKSPACE){
// if the user typed backspace, overwrite with a space.
- uartputc('\b'); uartputc(' '); uartputc('\b');
+ uartputc('\b', 0); uartputc(' ', 0); uartputc('\b', 0);
} else {
- uartputc(c);
+ uartputc(c, 0);
}
}
@@ -70,7 +72,7 @@ consolewrite(int user_src, uint64 src, int n)
char c;
if(either_copyin(&c, user_src, src+i, 1) == -1)
break;
- consputc(c);
+ uartputc(c, 1);
}
release(&cons.lock);