system/boot/debug.c
/*
 * KLog();
 *
 * Used by the macros KPRINTF, KLOG, KASSERT and KPANIC to
 * print with printf formatting to the kernel's debug log buffer.
 * The buffer is a fixed size circular buffer, Once it is full
 * the oldest entry is overwritten with the newest entry.
 *
 * Cannot be used during interrupt handlers or with interrupts
 * disabled s the dbg_slock must be acquired.  Same applies
 * to KPRINTF, KLOG, KASSERT and KPANIC.
 *
 * We can get away with using KLog() and above macros before
 * multitasking is enabled due to MutexLock() and MutexUnlock()
 * having a test to see if initialization is complete.
 */


Used by the macros KPRINTF, KLOG, KASSERT and KPANIC to
print with printf formatting to the kernel's debug log buffer.
The buffer is a fixed size circular buffer, Once it is full
the oldest entry is overwritten with the newest entry.

Cannot be used during interrupt handlers or with interrupts
disabled s the dbg_slock must be acquired.  Same applies
to KPRINTF, KLOG, KASSERT and KPANIC.

We can get away with using KLog() and above macros before
multitasking is enabled due to MutexLock() and MutexUnlock()
having a test to see if initialization is complete.
Used by the macros KPRINTF KLOG KASSERT and KPANIC to print with printf formatting to the kernel ' s debug log buffer . The buffer is a fixed size circular buffer Once it is full the oldest entry is overwritten with the newest entry . Cannot be used during interrupt handlers or with interrupts disabled s the dbg_slock must be acquired . Same applies to KPRINTF KLOG KASSERT and KPANIC . We can get away with using KLog () and above macros before multitasking is enabled due to MutexLock () and MutexUnlock () having a test to see if initialization is complete .
void KLog(const char *format, ...) {
  va_list ap;
  va_start(ap, format);
  if (__bdebug_enabled) {
    if (__bdebug_kernel_started) {
    } else {
      Vsnprintf(&klog_entry[current_log][0], KLOG_WIDTH, format, ap);
      if (klog_to_screen == TRUE)
        KPrintString(&klog_entry[current_log][0]);
      current_log++;
      current_log %= KLOG_ENTRIES;
    }
  }
  va_end(ap);
}
void KLog ( const char * format , ... ) { va_list ap ; va_start ( ap , format ) ; if ( __bdebug_enabled ) { if ( __bdebug_kernel_started ) { } else { Vsnprintf ( & klog_entry [ current_log ] [ 0 ] , KLOG_WIDTH , format , ap ) ; if ( klog_to_screen == TRUE ) KPrintString ( & klog_entry [ current_log ] [ 0 ] ) ; current_log ++ ; current_log %= KLOG_ENTRIES ; } } va_end ( ap ) ; }
KLog();
KLog () ;
//      Vsnprintf(&klog_entry[0][0], KLOG_WIDTH, format, ap);
 //      Debug(&klog_entry[0][0]);
