From b7b61e7913edfd4bca947c0de9703a72c7d4a336 Mon Sep 17 00:00:00 2001 From: Jan Stoess Date: Fri, 7 Dec 2007 19:00:49 +0100 Subject: [PATCH] - halt the processor during getc if config option is enabled --- kernel/kdb/platform/pc99/io.cc | 36 ++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/kernel/kdb/platform/pc99/io.cc b/kernel/kdb/platform/pc99/io.cc index 852e7e7c..729d0dbc 100644 --- a/kernel/kdb/platform/pc99/io.cc +++ b/kernel/kdb/platform/pc99/io.cc @@ -31,6 +31,7 @@ ********************************************************************/ #include INC_ARCH(cpu.h) #include INC_ARCH(ioport.h) +#include INC_GLUE(schedule.h) #include INC_API(tcb.h) #include #include @@ -327,6 +328,7 @@ static void putc_serial (const char c) if (c == '\n') putc_serial('\r'); } +bool getc_blocked = false; static char getc_serial (bool block) { @@ -334,30 +336,48 @@ static char getc_serial (bool block) { if (!block) return -1; - while ((in_u8(COMPORT+5) & 0x01) == 0); + + getc_blocked = true; + while ((in_u8(COMPORT+5) & 0x01) == 0) + { +#if defined(CONFIG_KDB_INPUT_HLT) + processor_sleep(); + memory_barrier(); +#endif + } + getc_blocked = false; + } return in_u8(COMPORT); } -#if defined(CONFIG_KDB_BREAKIN) +#if defined(CONFIG_KDB_BREAKIN) void kdebug_check_breakin (void) { + if (getc_blocked) + return; + +#if defined(CONFIG_KDB_BREAKIN_BREAK) || defined(CONFIG_KDB_BREAKIN_ESCAPE) + u8_t c = in_u8(COMPORT+5); +#endif + #if defined(CONFIG_KDB_BREAKIN_BREAK) // Check for a break interrupt, or for breaks pending in the FIFO. // This also catches parity and framing errors contained in the FIFO. - if (in_u8(COMPORT+5) & 0x90) - enter_kdebug("break"); + if (c & 0x90) + { + enter_kdebug("break"); + return; + } #endif #if defined(CONFIG_KDB_BREAKIN_ESCAPE) - if ((in_u8(COMPORT+5) & 0x01)) - if (in_u8(COMPORT) == 0x1b) + if ((c & 0x01) && (in_u8(COMPORT) == 0x1b)) enter_kdebug("breakin"); #endif + return; } #endif - - DECLARE_CMD (cmd_dumpvga, arch, 'V', "screendump", "dump VGA screen contents"); CMD(cmd_dumpvga, cg)