From 1a8cf59d041f8b6ae49c9b0f2d2449f9723f93e1 Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Fri, 29 Jul 2011 20:36:42 +0200 Subject: [PATCH] Add MKWATCHDOG option --- kernel/Makefile | 7 ++++++- kernel/arch/i386/Makefile.inc | 1 - kernel/arch/i386/apic.c | 2 +- kernel/arch/i386/memory.c | 4 ++-- kernel/arch/i386/mpx.S | 2 +- kernel/clock.c | 4 ++-- kernel/kernel.h | 5 ----- kernel/main.c | 2 +- kernel/start.c | 4 ++-- share/mk/bsd.own.mk | 11 ++++++++++- share/mk/sys.mk | 11 +++++------ 11 files changed, 30 insertions(+), 23 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index ee76ca38a..b098f1772 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -7,7 +7,7 @@ PROG= kernel SRCS= mpx.S SRCS+= start.c table.c main.c proc.c \ system.c clock.c utility.c debug.c interrupt.c \ - watchdog.c cpulocals.c + cpulocals.c .ifdef CONFIG_SMP SRCS += smp.c @@ -44,6 +44,11 @@ MAN= .include "system/Makefile.inc" .include "arch/${ARCH}/Makefile.inc" +.if ${USE_WATCHDOG} != "no" +SRCS+= watchdog.c arch_watchdog.c +CPPFLAGS+= -DUSE_WATCHDOG +.endif + # These come last, so the profiling buffer is at the end of the data segment SRCS+= profile.c do_sprofile.c diff --git a/kernel/arch/i386/Makefile.inc b/kernel/arch/i386/Makefile.inc index 5e6972e3e..f64341bbe 100644 --- a/kernel/arch/i386/Makefile.inc +++ b/kernel/arch/i386/Makefile.inc @@ -29,7 +29,6 @@ SRCS+= arch_do_vmctl.c \ arch_system.c \ apic.c \ apic_asm.S \ - arch_watchdog.c \ pre_init.c \ acpi.c diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 01eb9e2bd..a7f921818 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -24,7 +24,7 @@ #include "acpi.h" -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG #include "kernel/watchdog.h" #endif diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 66beddfef..fd49ff270 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -22,7 +22,7 @@ #ifdef CONFIG_APIC #include "apic.h" -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG #include "kernel/watchdog.h" #endif #endif @@ -1046,7 +1046,7 @@ PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr) #endif #endif -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG /* * We make sure that we don't enable the watchdog until paging is turned * on as we might get an NMI while switching and we might still use wrong diff --git a/kernel/arch/i386/mpx.S b/kernel/arch/i386/mpx.S index deab7175b..c5cccea38 100644 --- a/kernel/arch/i386/mpx.S +++ b/kernel/arch/i386/mpx.S @@ -507,7 +507,7 @@ LABEL(single_step_exception) EXCEPTION_NO_ERR_CODE(DEBUG_VECTOR) LABEL(nmi) -#ifndef CONFIG_WATCHDOG +#ifndef USE_WATCHDOG EXCEPTION_NO_ERR_CODE(NMI_VECTOR) #else /* diff --git a/kernel/clock.c b/kernel/clock.c index 4f2b3464c..cb41aed29 100644 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -36,7 +36,7 @@ #include "clock.h" -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG #include "watchdog.h" #endif @@ -74,7 +74,7 @@ PUBLIC int timer_int_handler(void) struct proc * p, * billp; /* FIXME watchdog for slave cpus! */ -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG /* * we need to know whether local timer ticks are happening or whether * the kernel is locked up. We don't care about overflows as we only diff --git a/kernel/kernel.h b/kernel/kernel.h index 0e1e62192..030f60860 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -7,11 +7,6 @@ #endif /* boot verbose */ #define CONFIG_BOOT_VERBOSE -/* - * compile in the nmi watchdog by default. It is not enabled until watchdog=1 - * (non-zero) is set in monitor - */ -#define CONFIG_WATCHDOG #ifndef CONFIG_MAX_CPUS #define CONFIG_MAX_CPUS 1 diff --git a/kernel/main.c b/kernel/main.c index e7d767e96..8eed78dc8 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -25,7 +25,7 @@ #ifdef CONFIG_SMP #include "smp.h" #endif -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG #include "watchdog.h" #endif #include "spinlock.h" diff --git a/kernel/start.c b/kernel/start.c index 3c73c23d9..8b2e0eb3a 100644 --- a/kernel/start.c +++ b/kernel/start.c @@ -7,7 +7,7 @@ #include #include "proto.h" -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG #include "watchdog.h" #endif @@ -106,7 +106,7 @@ PUBLIC void cstart( config_apic_timer_x = 1; #endif -#ifdef CONFIG_WATCHDOG +#ifdef USE_WATCHDOG value = env_get("watchdog"); if (value) watchdog_enabled = atoi(value); diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 55814d340..46a1928c7 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -756,6 +756,9 @@ _MKVARS.yes= \ MKSHARE MKSKEY MKSTATICLIB \ MKX11FONTS \ MKYP +#MINIX-specific vars +_MKVARS.yes+= \ + MKWATCHDOG .for var in ${_MKVARS.yes} ${var}?= yes .endfor @@ -813,6 +816,11 @@ MKMAN:= no MKNLS:= no .endif +# MINIX +.if ${MKEMBED} == "yes" +MKWATCHDOG:= no +.endif + # # install(1) parameters. # @@ -871,7 +879,8 @@ ${var}?= no # USE_* options which default to "yes" unless their corresponding MK* # 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 .if (${${var:S/USE_/MK/}} == "no") ${var}:= no .else diff --git a/share/mk/sys.mk b/share/mk/sys.mk index e0aa8e7c4..a2c32966f 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -236,12 +236,6 @@ AR?= aal .elif !empty(CC:M*gcc) || !empty(CC:M*clang) || !empty(CC:M*pcc) COMPILER_TYPE=gnu AR?= ar - -.if defined(MKEMBED) && ${MKEMBED} == "yes" -DBG= -Os -CFLAGS+= -DNDEBUG=1 -.endif - .endif # Set NBSD_LIBC to either "yes" or "no". @@ -250,3 +244,8 @@ NBSD_LIBC= no .else NBSD_LIBC= yes .endif + +.if ${COMPILER_TYPE} == "gnu" && defined(MKEMBED) && ${MKEMBED} == "yes" +DBG= -Os +CFLAGS+= -DNDEBUG=1 +.endif -- 2.44.0