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
SRCS= mpx.S
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
.ifdef CONFIG_SMP
@ -63,6 +63,14 @@ SRCS+= do_mcontext.c
CPPFLAGS+= -DUSE_MCONTEXT
.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
SRCS+= profile.c do_sprofile.c

View file

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

View file

@ -395,6 +395,7 @@ PUBLIC void arch_init(void)
#endif
}
#if DEBUG_SERIAL
PUBLIC void ser_putc(char c)
{
int i;
@ -414,6 +415,7 @@ PUBLIC void ser_putc(char c)
#endif
}
/*===========================================================================*
* do_ser_debug *
*===========================================================================*/
@ -597,6 +599,8 @@ PRIVATE void ser_dump_proc_cpu(void)
}
#endif
#endif /* DEBUG_SERIAL */
#if SPROFILE
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;
}
#if DEBUG_SERIAL
if (do_serial_debug)
do_ser_debug();
#endif
}
return(1); /* reenable interrupts */

View file

@ -13,6 +13,9 @@
#include "config.h"
#endif
/* Debug info via serial (see ser_debug()) */
#define DEBUG_SERIAL 1
/* Enable prints such as
* . send/receive failed due to deadlock or dead source or dead destination
* . trap not allowed
@ -47,6 +50,11 @@
/* DEBUG_IPCSTATS collects information on who sends messages to whom. */
#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 */
#define DEBUG_IPC_HOOK 1
#endif

View file

@ -84,6 +84,7 @@ PUBLIC void cstart(
if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */
system_hz = DEFAULT_HZ;
#if DEBUG_SERIAL
/* Intitialize serial debugging */
value = env_get(SERVARNAME);
if(value && atoi(value) == 0) {
@ -92,6 +93,7 @@ PUBLIC void cstart(
value = env_get(SERBAUDVARNAME);
if (value) serial_debug_baud = atoi(value);
}
#endif
#ifdef USE_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.
*/
if (c != END_OF_KMESS) {
#if DEBUG_SERIAL
if (do_serial_debug) {
if(c == '\n')
ser_putc('\r');
ser_putc(c);
}
#endif
kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */
if (kmess.km_size < sizeof(kmess.km_buf))
kmess.km_size += 1;

View file

@ -757,7 +757,7 @@ _MKVARS.yes= \
MKYP
#MINIX-specific vars
_MKVARS.yes+= \
MKWATCHDOG MKACPI MKAPIC MKMCONTEXT
MKWATCHDOG MKACPI MKAPIC MKMCONTEXT MKDEBUGREG MKDEBUG
.for var in ${_MKVARS.yes}
${var}?= yes
.endfor
@ -822,6 +822,8 @@ MKACPI:= no
MKAPIC:= no
MKMCONTEXT:= no
MKCOVERAGE:= no
MKDEBUGREG:= no
MKDEBUG:= no
.endif
#
@ -883,7 +885,7 @@ ${var}?= no
# variable is set to "no".
#
.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")
${var}:= no
.else

View file

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