From 126b85a0346053a2156290d90260209d27e26d5f Mon Sep 17 00:00:00 2001 From: sbosse Date: Sun, 12 Jan 2025 19:30:22 +0100 Subject: [PATCH] Sun 12 Jan 19:29:58 CET 2025 --- kernel/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel/main.c b/kernel/main.c index b4cc7f2..b893116 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -45,9 +45,12 @@ int kernel_main() page_init(); kmalloc_init((char *) KMALLOC_START, KMALLOC_LENGTH); interrupt_init(); + serial_init(); mouse_init(); keyboard_init(); - serial_init(); +#ifdef KSHELL_SERIAL + console_serial=0; +#endif rtc_init(); clock_init(); process_init(); @@ -61,13 +64,13 @@ int kernel_main() current->ktable[KNO_STDWIN] = kobject_create_window(&window_root); current->ktable[KNO_STDDIR] = 0; // No current dir until something is mounted. - printf("kernel initialization is done.\n"); -// #define KSHELL_SERIAL #ifndef KSHELL_SERIAL kshell_launch(); // never reached! #else + // serial_device_write(0,"Hello.\n",7,0); + // main IO loop, from kshell_launch char line[100]; int lineIndex=0; @@ -75,8 +78,8 @@ int kernel_main() while(1) { // console_putchar(console,console_getchar(console)); char c; - while ((c = serial_read_nonblock(0))<0) clock_wait(10); - console_putchar(console,c); + c=(char)serial_getchar(0); + // console_putchar(console,c); if (c=='\n') { // End of line const char *argv[100]; int argc;