Optionally disable kernel debug code

This commit is contained in:
Arun Thomas 2011-08-16 17:18:55 +02:00
parent 4c3e216cbd
commit 40592de32d
9 changed files with 33 additions and 6 deletions

View file

@ -6,7 +6,7 @@ PROG= kernel
# first-stage, arch-dependent startup code # first-stage, arch-dependent startup code
SRCS= mpx.S SRCS= mpx.S
SRCS+= start.c table.c main.c proc.c \ SRCS+= start.c table.c main.c proc.c \
system.c clock.c utility.c debug.c interrupt.c \ system.c clock.c utility.c interrupt.c \
cpulocals.c cpulocals.c
.ifdef CONFIG_SMP .ifdef CONFIG_SMP
@ -63,6 +63,14 @@ SRCS+= do_mcontext.c
CPPFLAGS+= -DUSE_MCONTEXT CPPFLAGS+= -DUSE_MCONTEXT
.endif .endif
.if ${USE_DEBUGREG} != "no"
SRCS+= breakpoints.c debugreg.S
.endif
# Extra debugging routines
.if ${USE_DEBUG} != "no"
SRCS+= debug.c
.endif
# These come last, so the profiling buffer is at the end of the data segment # These come last, so the profiling buffer is at the end of the data segment
SRCS+= profile.c do_sprofile.c SRCS+= profile.c do_sprofile.c

View file

@ -4,9 +4,7 @@
.PATH: ${.CURDIR}/arch/${ARCH} .PATH: ${.CURDIR}/arch/${ARCH}
SRCS+= arch_do_vmctl.c \ SRCS+= arch_do_vmctl.c \
breakpoints.c \
arch_clock.c \ arch_clock.c \
debugreg.S \
do_int86.c \ do_int86.c \
do_iopenable.c \ do_iopenable.c \
do_readbios.c \ do_readbios.c \

View file

@ -395,6 +395,7 @@ PUBLIC void arch_init(void)
#endif #endif
} }
#if DEBUG_SERIAL
PUBLIC void ser_putc(char c) PUBLIC void ser_putc(char c)
{ {
int i; int i;
@ -414,6 +415,7 @@ PUBLIC void ser_putc(char c)
#endif #endif
} }
/*===========================================================================* /*===========================================================================*
* do_ser_debug * * do_ser_debug *
*===========================================================================*/ *===========================================================================*/
@ -597,6 +599,8 @@ PRIVATE void ser_dump_proc_cpu(void)
} }
#endif #endif
#endif /* DEBUG_SERIAL */
#if SPROFILE #if SPROFILE
PUBLIC int arch_init_profile_clock(const u32_t freq) PUBLIC int arch_init_profile_clock(const u32_t freq)

View file

@ -140,8 +140,11 @@ PUBLIC int timer_int_handler(void)
TMR_NEVER : clock_timers->tmr_exp_time; TMR_NEVER : clock_timers->tmr_exp_time;
} }
#if DEBUG_SERIAL
if (do_serial_debug) if (do_serial_debug)
do_ser_debug(); do_ser_debug();
#endif
} }
return(1); /* reenable interrupts */ return(1); /* reenable interrupts */

View file

@ -13,6 +13,9 @@
#include "config.h" #include "config.h"
#endif #endif
/* Debug info via serial (see ser_debug()) */
#define DEBUG_SERIAL 1
/* Enable prints such as /* Enable prints such as
* . send/receive failed due to deadlock or dead source or dead destination * . send/receive failed due to deadlock or dead source or dead destination
* . trap not allowed * . trap not allowed
@ -47,6 +50,11 @@
/* DEBUG_IPCSTATS collects information on who sends messages to whom. */ /* DEBUG_IPCSTATS collects information on who sends messages to whom. */
#define DEBUG_IPCSTATS 0 #define DEBUG_IPCSTATS 0
#if USE_SMALL
#undef DEBUG_SERIAL
#undef DEBUG_ENABLE_IPC_WARNINGS
#endif
#if DEBUG_DUMPIPC || DEBUG_IPCSTATS /* either of these needs the hook */ #if DEBUG_DUMPIPC || DEBUG_IPCSTATS /* either of these needs the hook */
#define DEBUG_IPC_HOOK 1 #define DEBUG_IPC_HOOK 1
#endif #endif

View file

@ -84,6 +84,7 @@ PUBLIC void cstart(
if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */ if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */
system_hz = DEFAULT_HZ; system_hz = DEFAULT_HZ;
#if DEBUG_SERIAL
/* Intitialize serial debugging */ /* Intitialize serial debugging */
value = env_get(SERVARNAME); value = env_get(SERVARNAME);
if(value && atoi(value) == 0) { if(value && atoi(value) == 0) {
@ -92,6 +93,7 @@ PUBLIC void cstart(
value = env_get(SERBAUDVARNAME); value = env_get(SERBAUDVARNAME);
if (value) serial_debug_baud = atoi(value); if (value) serial_debug_baud = atoi(value);
} }
#endif
#ifdef USE_APIC #ifdef USE_APIC
value = env_get("no_apic"); value = env_get("no_apic");

View file

@ -50,11 +50,13 @@ int c; /* character to append */
* to the output driver if an END_OF_KMESS is encountered. * to the output driver if an END_OF_KMESS is encountered.
*/ */
if (c != END_OF_KMESS) { if (c != END_OF_KMESS) {
#if DEBUG_SERIAL
if (do_serial_debug) { if (do_serial_debug) {
if(c == '\n') if(c == '\n')
ser_putc('\r'); ser_putc('\r');
ser_putc(c); ser_putc(c);
} }
#endif
kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */ kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */
if (kmess.km_size < sizeof(kmess.km_buf)) if (kmess.km_size < sizeof(kmess.km_buf))
kmess.km_size += 1; kmess.km_size += 1;

View file

@ -757,7 +757,7 @@ _MKVARS.yes= \
MKYP MKYP
#MINIX-specific vars #MINIX-specific vars
_MKVARS.yes+= \ _MKVARS.yes+= \
MKWATCHDOG MKACPI MKAPIC MKMCONTEXT MKWATCHDOG MKACPI MKAPIC MKMCONTEXT MKDEBUGREG MKDEBUG
.for var in ${_MKVARS.yes} .for var in ${_MKVARS.yes}
${var}?= yes ${var}?= yes
.endfor .endfor
@ -822,6 +822,8 @@ MKACPI:= no
MKAPIC:= no MKAPIC:= no
MKMCONTEXT:= no MKMCONTEXT:= no
MKCOVERAGE:= no MKCOVERAGE:= no
MKDEBUGREG:= no
MKDEBUG:= no
.endif .endif
# #
@ -883,7 +885,7 @@ ${var}?= no
# variable is set to "no". # variable is set to "no".
# #
.for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP \ .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP \
USE_WATCHDOG USE_ACPI USE_APIC USE_MCONTEXT USE_WATCHDOG USE_ACPI USE_APIC USE_MCONTEXT USE_DEBUGREG USE_DEBUG
.if (${${var:S/USE_/MK/}} == "no") .if (${${var:S/USE_/MK/}} == "no")
${var}:= no ${var}:= no
.else .else

View file

@ -247,5 +247,5 @@ NBSD_LIBC= yes
.if ${COMPILER_TYPE} == "gnu" && defined(MKSMALL) && ${MKSMALL} == "yes" .if ${COMPILER_TYPE} == "gnu" && defined(MKSMALL) && ${MKSMALL} == "yes"
DBG= -Os DBG= -Os
CFLAGS+= -DNDEBUG=1 CFLAGS+= -DNDEBUG=1 -DUSE_SMALL=1
.endif .endif