From 389452ec3f1a19db43b8c36ad4885c5027e8694d Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Fri, 17 May 2019 09:57:14 +0200 Subject: [PATCH] printf: also write on serial --- core/klibc.c | 2 ++ drivers/serial.c | 4 ++-- drivers/serial.h | 2 +- tests/test.c | 10 +++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/klibc.c b/core/klibc.c index 50ca096..fcd64f3 100644 --- a/core/klibc.c +++ b/core/klibc.c @@ -1,4 +1,5 @@ #include "klibc.h" +#include "serial.h" #include "vga.h" int memcmp(const void *aptr, const void *bptr, size_t size) @@ -116,6 +117,7 @@ void puts(const char *str) void putc(const char str){ VGAputc(str); + serialPutc(str); } void printInt(int integer) diff --git a/drivers/serial.c b/drivers/serial.c index a431b5e..bc9b11e 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -39,7 +39,7 @@ int isTransmitEmpty() return (inb(PORT + 5) & 0x20); } -void serialWrite(char a) +void serialPutc(char a) { while (isTransmitEmpty() == 0) ; @@ -51,5 +51,5 @@ void serialDoIrq(struct interrupt_frame *level) { (void)level; char c = inb(PORT); - serialWrite(c); + serialPutc(c); } diff --git a/drivers/serial.h b/drivers/serial.h index 15db74a..0a129e3 100644 --- a/drivers/serial.h +++ b/drivers/serial.h @@ -2,5 +2,5 @@ #include "irq.h" void serialSetup(int speed); -void serialWrite(char a); +void serialPutc(char a); void serialDoIrq(struct interrupt_frame *frame); diff --git a/tests/test.c b/tests/test.c index 7442d23..17ffc57 100644 --- a/tests/test.c +++ b/tests/test.c @@ -221,11 +221,11 @@ void run_test(void) { testPaging(); printf("Testing Serial\n"); - serialWrite('h'); - serialWrite('e'); - serialWrite('l'); - serialWrite('l'); - serialWrite('o'); + serialPutc('h'); + serialPutc('e'); + serialPutc('l'); + serialPutc('l'); + serialPutc('o'); testAlloc(); printf("Testing backtrace\n"); test_backtrace();