summaryrefslogtreecommitdiff
path: root/uart.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-06-03 17:59:17 -0400
committerRobert Morris <[email protected]>2019-06-03 17:59:17 -0400
commitcefe223bf5e4b68e5c1202f2f089a164ad656621 (patch)
treeb2bf9fdb2c94e3159ce595c6b4a88daf5c35e878 /uart.c
parentefecbee7c0c265b0b2fe956f308e1a73cc63eda6 (diff)
downloadxv6-labs-cefe223bf5e4b68e5c1202f2f089a164ad656621.tar.gz
xv6-labs-cefe223bf5e4b68e5c1202f2f089a164ad656621.tar.bz2
xv6-labs-cefe223bf5e4b68e5c1202f2f089a164ad656621.zip
console input and sbrk
Diffstat (limited to 'uart.c')
-rw-r--r--uart.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/uart.c b/uart.c
index b6271c1..29f6df4 100644
--- a/uart.c
+++ b/uart.c
@@ -52,17 +52,21 @@ uartputc(int c)
int
uartgetc(void)
{
- if(*(5) & 0x01){
+ if(*R(5) & 0x01){
// input data is ready.
return *R(0);
} else {
return -1;
- };
+ }
}
void
uartintr(void)
{
- int c = uartgetc();
- printf("%x ", c & 0xff);
+ while(1){
+ int c = uartgetc();
+ if(c == -1)
+ break;
+ consoleintr(c);
+ }
}