From dbdaa77fb5924b4b9e6b374a44ef76481a38d3d2 Mon Sep 17 00:00:00 2001 From: aqua Date: Tue, 8 Nov 2022 17:19:45 +0200 Subject: Add FILE struct --- src/kernel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/kernel.c') diff --git a/src/kernel.c b/src/kernel.c index 2777f72..a315f3b 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -15,11 +15,16 @@ #include #include +FILE *stdin; +FILE *stdout; +FILE *stderr; + void kmain() { - vga_init(vmm_map(0xb8000, 0xc03ff000)); - if (uart_init(COM1) != 0) printf("UART self-test failed.\r\n"); + stderr = uart_init(COM1); + stdout = vga_init(vmm_map(0xb8000, 0xc03ff000)); printf("glitch [version " VERSION "] [" CC "]\n"); + fprintf(stderr, "glitch [version " VERSION "] [" CC "]\n"); { char vendor[13] = {'\0'}; unsigned int eax; @@ -27,6 +32,7 @@ void kmain() { struct CPUVersion v; __get_cpuid(1, (unsigned int *)&v, &eax, &eax, &eax); printf("CPU: %s family %u model %u stepping %u\n", vendor, family(v), model(v), v.stepping); + fprintf(stderr, "CPU: %s family %u model %u stepping %u\n", vendor, family(v), model(v), v.stepping); } pic_init(); @@ -46,6 +52,5 @@ void kmain() { // asm volatile("int $0x80"); - while (1) - ; + while (1) {} } -- cgit v1.2.1