summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-09-02 23:03:40 +0200
committerRichard Braun <rbraun@sceen.net>2017-09-02 23:03:40 +0200
commit608cf884efd9bb0ef6a308814fd22b1c8688fabf (patch)
tree67a64a116aae6e3ca49e7eaf9a31a90f9e9ef51f
parentca45d38bbf535f1dd23df9b71f85cd9c820e0e69 (diff)
Rework the build system
-rw-r--r--INSTALL39
-rw-r--r--Makefrag.am44
-rw-r--r--arch/x86/Makefrag.am14
-rw-r--r--arch/x86/configfrag.ac56
-rw-r--r--arch/x86/machine/boot.c2
-rw-r--r--configure.ac182
-rw-r--r--kern/kmem.c4
-rw-r--r--kern/log.c4
-rw-r--r--kern/mutex.h14
-rw-r--r--kern/mutex_types.h10
-rw-r--r--kern/shell.h6
-rw-r--r--kern/shutdown.c4
-rw-r--r--kern/syscnt.c4
-rw-r--r--kern/task.c4
-rw-r--r--kern/thread.c4
-rw-r--r--vm/vm_map.c4
-rw-r--r--vm/vm_page.c4
17 files changed, 204 insertions, 195 deletions
diff --git a/INSTALL b/INSTALL
index 6777e7ac..4dec35a3 100644
--- a/INSTALL
+++ b/INSTALL
@@ -236,6 +236,13 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
X15 Options
===========
+`--enable-64bits'
+ Build for a 64-bits target processor.
+
+`--enable-shell'
+ Enable the diagnostics shell. Note that some shell commands may have
+ a real-time unsafe behaviour.
+
`--enable-test-module=TEST_MODULE'
Run a test module instead of booting the system. Test module source
files can be found in the test directory, and test module names
@@ -243,41 +250,25 @@ X15 Options
in a file named `test_pmap_update_mp.c' would be selected with the
option `--enable-test-module=pmap_update_mp'.
-`--enable-mutex-adaptive'
- Enable the adaptive spinning mutex implementation for regular mutexes.
- Adaptive spinning mutexes optimistically spin instead of sleep if the
- owner of a mutex is found running, in the hope the mutex is unlocked
- soon. This optimization increases performance by avoiding some sleeps
- and wakeups, but it makes the system globally non real-time.
-
-`--enable-mutex-pi'
- Enable priority inheritance for regular mutexes (note that priority
- inheritance is always enabled for real-time mutexes). This option is
- likely to measurably reduce overall performance. It should only be
- enabled if you know what you're doing.
-
-`--enable-shell'
- Enable the diagnostics shell. Note that some shell commands may have
- a real-time unsafe behaviour.
-
`--enable-thread-stack-guard'
Enable the use of guard pages around kernel thread stacks to catch
overflows. Note that this feature wastes precious kernel virtual
memory and has some overhead during thread creation and destruction.
+`--with-clock-freq=CLOCK_FREQ
+ Set the low resolution clock frequency.
+
`--with-max-cpus=MAX_CPUS'
Set the maximum number of supported processors.
+`--with-mutex-impl=MUTEX_IMPL'
+ Select the mutex implementation (adaptive, pi, or plain)
+
+TODO Improve descriptions
x86 options
-----------
-`--with-i386'
- Build for a 32-bit IA-32 machine.
-
-`--with-amd64'
- Build for a 64-bit AMD64 machine.
-
-`--enable-pae'
+`--enable-x86-pae'
Use the PAE (Physical Address Extension) processor feature to address
physical memory beyond 4 GiB (i386 only).
diff --git a/Makefrag.am b/Makefrag.am
index d799bb86..2a918099 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -123,19 +123,19 @@ x15_SOURCES += \
kern/xcall.c \
kern/xcall.h
-if MUTEX_ADAPTIVE
+if USE_MUTEX_ADAPTIVE
x15_SOURCES += kern/mutex/mutex_adaptive.c
else
-if !MUTEX_PI
+if USE_MUTEX_PLAIN
x15_SOURCES += kern/mutex/mutex_plain.c
endif
endif
-if X15_SHELL
+if ENABLE_SHELL
x15_SOURCES += \
kern/shell.c \
kern/shell.h
-endif X15_SHELL
+endif ENABLE_SHELL
x15_SOURCES += \
vm/vm_adv.h \
@@ -154,38 +154,38 @@ x15_SOURCES += \
x15_SOURCES += \
test/test.h
-if TEST_LLSYNC_DEFER
+if ENABLE_TEST_LLSYNC_DEFER
x15_SOURCES += test/test_llsync_defer.c
-endif TEST_LLSYNC_DEFER
+endif ENABLE_TEST_LLSYNC_DEFER
-if TEST_MUTEX
+if ENABLE_TEST_MUTEX
x15_SOURCES += test/test_mutex.c
-endif TEST_MUTEX
+endif ENABLE_TEST_MUTEX
-if TEST_MUTEX_PI
+if ENABLE_TEST_MUTEX_PI
x15_SOURCES += test/test_mutex_pi.c
-endif TEST_MUTEX_PI
+endif ENABLE_TEST_MUTEX_PI
-if TEST_PMAP_UPDATE_MP
+if ENABLE_TEST_PMAP_UPDATE_MP
x15_SOURCES += test/test_pmap_update_mp.c
-endif TEST_PMAP_UPDATE_MP
+endif ENABLE_TEST_PMAP_UPDATE_MP
-if TEST_SREF_DIRTY_ZEROES
+if ENABLE_TEST_SREF_DIRTY_ZEROES
x15_SOURCES += test/test_sref_dirty_zeroes.c
-endif TEST_SREF_DIRTY_ZEROES
+endif ENABLE_TEST_SREF_DIRTY_ZEROES
-if TEST_SREF_NOREF
+if ENABLE_TEST_SREF_NOREF
x15_SOURCES += test/test_sref_noref.c
-endif TEST_SREF_NOREF
+endif ENABLE_TEST_SREF_NOREF
-if TEST_SREF_WEAKREF
+if ENABLE_TEST_SREF_WEAKREF
x15_SOURCES += test/test_sref_weakref.c
-endif TEST_SREF_WEAKREF
+endif ENABLE_TEST_SREF_WEAKREF
-if TEST_VM_PAGE_FILL
+if ENABLE_TEST_VM_PAGE_FILL
x15_SOURCES += test/test_vm_page_fill.c
-endif TEST_VM_PAGE_FILL
+endif ENABLE_TEST_VM_PAGE_FILL
-if TEST_XCALL
+if ENABLE_TEST_XCALL
x15_SOURCES += test/test_xcall.c
-endif TEST_XCALL
+endif ENABLE_TEST_XCALL
diff --git a/arch/x86/Makefrag.am b/arch/x86/Makefrag.am
index cf536987..016e31c8 100644
--- a/arch/x86/Makefrag.am
+++ b/arch/x86/Makefrag.am
@@ -12,16 +12,18 @@ AM_CFLAGS += -fno-omit-frame-pointer
x15_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
-if I386
-AM_CPPFLAGS += -m32
-x15_LDFLAGS += -m32
-endif I386
+if X86_64
-if AMD64
AM_CPPFLAGS += -m64
AM_CFLAGS += -mcmodel=kernel -mno-red-zone
x15_LDFLAGS += -m64
-endif AMD64
+
+else !X86_64
+
+AM_CPPFLAGS += -m32
+x15_LDFLAGS += -m32
+
+endif !X86_64
x15_SOURCES += \
arch/x86/machine/acpi.c \
diff --git a/arch/x86/configfrag.ac b/arch/x86/configfrag.ac
index 1d37a0e7..0857368a 100644
--- a/arch/x86/configfrag.ac
+++ b/arch/x86/configfrag.ac
@@ -2,43 +2,28 @@ m4_define([x86_ENABLE_PAE],
[AC_DEFINE([X15_X86_PAE], [1], [use PAE page translation])])
m4_define([x86_SELECT_I386],
- [machine=i386
- AS_IF([test x"$enable_pae" = xyes], [x86_ENABLE_PAE])])
+ [subarch=i386
+ AS_IF([test x"$enable_x86_pae" = xyes], [x86_ENABLE_PAE])])
m4_define([x86_SELECT_AMD64],
- [machine=amd64
- AS_IF([test x"$enable_pae" = xyes],
- [AC_MSG_WARN([pae option available for i386 only, ignoring])])])
+ [subarch=amd64
+ AS_IF([test x"$enable_x86_pae" = xyes],
+ [AC_MSG_WARN([pae option available for 32-bits builds only, ignoring])])])
m4_define([x86_SELECT],
[arch=x86
- AC_ARG_WITH([i386],
- [AS_HELP_STRING([--with-i386],
- [build for a 32-bit IA-32 machine])],
- [opt_i386=$withval],
- [opt_i386=no])
-
- AC_ARG_WITH([amd64],
- [AS_HELP_STRING([--with-amd64],
- [build for a 64-bit AMD64 machine])],
- [opt_amd64=$withval],
- [opt_amd64=no])
-
- AC_ARG_ENABLE([pae],
- [AS_HELP_STRING([--enable-pae],
- [enable physical address extension (i386 only)])],
+ AC_ARG_ENABLE([x86-pae],
+ [AS_HELP_STRING([--enable-x86-pae],
+ [enable physical address extension (32-bits only)])],
[],
- [enable_pae=no])
+ [enable_x86_pae=no])
- AS_IF([test x"$opt_i386$opt_amd64" = xyesyes],
- [AC_MSG_ERROR([select only one of i386 or amd64])],
- [test x"$opt_i386$opt_amd64" = xnono],
+ AS_IF([test -z "$enable_64bits"],
[AS_CASE(["$host_cpu"],
- [i?86], [opt_i386=yes],
- [x86_64], [opt_amd64=yes])])
+ [i?86], [enable_64bits=no],
+ [x86_64], [enable_64bits=yes])])
- AS_IF([test x"$opt_i386" = xyes], [x86_SELECT_I386],
- [test x"$opt_amd64" = xyes], [x86_SELECT_AMD64])
+ AS_IF([test x"$enable_64bits" = xyes], [x86_SELECT_AMD64], [x86_SELECT_I386])
# Never generate instructions that are unhandled in kernel mode
AX_APPEND_COMPILE_FLAGS([ \
@@ -48,14 +33,15 @@ m4_define([x86_SELECT],
-mno-sse2 \
-mno-avx])
- AC_DEFINE_UNQUOTED([X15_X86_MACHINE], [$machine], [machine])
- AC_MSG_NOTICE([machine type: $arch ($machine)])
- AS_IF([test x"$machine" = xi386],
- [AC_MSG_NOTICE([physical address extension: $enable_pae])])])
+ AC_DEFINE_UNQUOTED([X15_X86_SUBARCH], [$subarch], [subarch])
+
+ AS_ECHO
+ AC_MSG_NOTICE([target: $arch ($subarch)])
+ AS_IF([test x"$subarch" = xi386],
+ [AC_MSG_NOTICE([x86: physical address extension: $enable_x86_pae])])])
AS_CASE(["$host_cpu"],
[i?86|x86_64], [x86_SELECT])
-AM_CONDITIONAL([X86], [test "$arch" = x86])
-AM_CONDITIONAL([I386], [test x"$opt_i386" = xyes])
-AM_CONDITIONAL([AMD64], [test x"$opt_amd64" = xyes])
+AM_CONDITIONAL([X86], [test x"$arch" = xx86])
+AM_CONDITIONAL([X86_64], [test x"$arch" = xx86 -a x"$enable_64bits" = xyes])
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c
index 82b5330a..47055c87 100644
--- a/arch/x86/machine/boot.c
+++ b/arch/x86/machine/boot.c
@@ -353,7 +353,7 @@ boot_setup_paging(struct multiboot_raw_info *mbi, unsigned long eax)
void __init
boot_log_info(void)
{
- log_info(KERNEL_NAME "/" QUOTE(X15_X86_MACHINE) " " KERNEL_VERSION
+ log_info(KERNEL_NAME "/" QUOTE(X15_X86_SUBARCH) " " KERNEL_VERSION
#ifdef X15_X86_PAE
" PAE"
#endif /* X15_X86_PAE */
diff --git a/configure.ac b/configure.ac
index 20d81564..60776969 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,10 +30,19 @@ AX_APPEND_COMPILE_FLAGS([-no-pie -fno-pie])
AC_HEADER_ASSERT()
-m4_include([arch/x86/configfrag.ac])
+# --enable options
-AS_IF([test x"$arch" = x], [AC_MSG_ERROR([unsupported architecture])])
-AC_SUBST([arch])
+AC_ARG_ENABLE([64bits],
+ [AS_HELP_STRING([--enable-64bits],
+ [build for a 64-bits target processor])],
+ [],
+ [enable_64bits=default])
+
+AC_ARG_ENABLE([shell],
+ [AS_HELP_STRING([--enable-shell],
+ [enable the diagnostics shell])],
+ [],
+ [enable_shell=no])
AC_ARG_ENABLE([test-module],
[AS_HELP_STRING([--enable-test-module=TEST_MODULE],
@@ -41,44 +50,56 @@ AC_ARG_ENABLE([test-module],
[enable_test_module=$enableval],
[enable_test_module=no])
+AC_ARG_ENABLE([thread-stack-guard],
+ [AS_HELP_STRING([--enable-thread-stack-guard],
+ [enable kernel thread stack guard pages])],
+ [],
+ [enable_thread_stack_guard=no])
+
+# --with options
+
+AC_ARG_WITH([clock-freq],
+ [AS_HELP_STRING([--with-clock-freq=CLOCK_FREQ],
+ [set the low resolution clock frequency (100-1000 Hz)])],
+ [opt_clock_freq=$withval],
+ [opt_clock_freq=200])
+
AC_ARG_WITH([max-cpus],
[AS_HELP_STRING([--with-max-cpus=MAX_CPUS],
[set the maximum number of supported processors])],
[opt_max_cpus=$withval],
[opt_max_cpus=128])
-AC_ARG_WITH([clock-freq],
- [AS_HELP_STRING([--with-clock-freq=CLOCK_FREQ],
- [set the low resolution clock frequency])],
- [opt_clock_freq=$withval],
- [opt_clock_freq=200])
+AC_ARG_WITH([mutex-impl],
+ [AS_HELP_STRING([--with-mutex-impl=MUTEX_IMPL],
+ [select the mutex implementation (adaptive, pi, or plain)])],
+ [opt_mutex_impl=$withval],
+ [opt_mutex_impl=plain])
-AC_ARG_ENABLE([mutex-adaptive],
- [AS_HELP_STRING([--enable-mutex-adaptive],
- [enable adaptive spinning mutexes])])
+# 32/64-bits processor selection
-AC_ARG_ENABLE([mutex-pi],
- [AS_HELP_STRING([--enable-mutex-pi],
- [enable priority inheritance for regular mutexes
- (note that priority inheritance is always
- enabled for real-time mutexes)])],
- [],
- [enable_mutex_pi=no])
+AS_IF([test -z "$enable_64bits"], [enable_64bits=yes],
+ [test x"$enable_64bits" = x"default"], [enable_64bits=],
+ [test x"$enable_64bits" != xyes -a x"$enable_64bits" != xno],
+ [AC_MSG_ERROR([target processor must be either 32-bits or 64-bits])])
-AC_ARG_ENABLE([shell],
- [AS_HELP_STRING([--enable-shell],
- [enable the diagnostics shell])],
- [],
- [enable_shell=no])
+# Architecture-specific configuration
-AC_ARG_ENABLE([thread-stack-guard],
- [AS_HELP_STRING([--enable-thread-stack-guard],
- [enable kernel thread stack guard pages])],
- [],
- [enable_thread_stack_guard=no])
+m4_include([arch/x86/configfrag.ac])
-AC_DEFINE([__KERNEL__], [1], [kernel code])
-AC_DEFINE_UNQUOTED([X15_ARCH], [$arch], [arch])
+AS_IF([test x"$arch" = x], [AC_MSG_ERROR([unsupported architecture])])
+AC_SUBST([arch])
+
+# Shell selection
+
+AS_IF([test x"$enable_shell" = xyes],
+ [AC_DEFINE_UNQUOTED([X15_ENABLE_SHELL], [],
+ [Enable the diagnostics shell])])
+AM_CONDITIONAL([ENABLE_SHELL],
+ [test x"$enable_shell" = xyes])
+AC_MSG_NOTICE([diagnostics shell: $enable_shell])
+
+# Test module selection
m4_define([ENABLE_TEST_MODULE],
[AS_CASE(["$enable_test_module"],
@@ -92,70 +113,79 @@ m4_define([ENABLE_TEST_MODULE],
[vm_page_fill], [test_vm_page_fill=yes],
[xcall], [test_xcall=yes],
[AC_MSG_ERROR([invalid test module])])
- AC_DEFINE([X15_RUN_TEST_MODULE], [1],
- [run test module instead of booting])
+ AC_DEFINE_UNQUOTED([X15_RUN_TEST_MODULE], [],
+ [run test module instead of booting])
AC_MSG_NOTICE([test module enabled: $enable_test_module])])
AS_IF([test x"$enable_test_module" != xno], [ENABLE_TEST_MODULE])
-AM_CONDITIONAL([TEST_LLSYNC_DEFER],
+AM_CONDITIONAL([ENABLE_TEST_LLSYNC_DEFER],
[test x"$test_llsync_defer" = xyes])
-AM_CONDITIONAL([TEST_MUTEX],
+AM_CONDITIONAL([ENABLE_TEST_MUTEX],
[test x"$test_mutex" = xyes])
-AM_CONDITIONAL([TEST_MUTEX_PI],
+AM_CONDITIONAL([ENABLE_TEST_MUTEX_PI],
[test x"$test_mutex_pi" = xyes])
-AM_CONDITIONAL([TEST_PMAP_UPDATE_MP],
+AM_CONDITIONAL([ENABLE_TEST_PMAP_UPDATE_MP],
[test x"$test_pmap_update_mp" = xyes])
-AM_CONDITIONAL([TEST_SREF_DIRTY_ZEROES],
+AM_CONDITIONAL([ENABLE_TEST_SREF_DIRTY_ZEROES],
[test x"$test_sref_dirty_zeroes" = xyes])
-AM_CONDITIONAL([TEST_SREF_NOREF],
+AM_CONDITIONAL([ENABLE_TEST_SREF_NOREF],
[test x"$test_sref_noref" = xyes])
-AM_CONDITIONAL([TEST_SREF_WEAKREF],
+AM_CONDITIONAL([ENABLE_TEST_SREF_WEAKREF],
[test x"$test_sref_weakref" = xyes])
-AM_CONDITIONAL([TEST_VM_PAGE_FILL],
+AM_CONDITIONAL([ENABLE_TEST_VM_PAGE_FILL],
[test x"$test_vm_page_fill" = xyes])
-AM_CONDITIONAL([TEST_XCALL],
+AM_CONDITIONAL([ENABLE_TEST_XCALL],
[test x"$test_xcall" = xyes])
-AC_DEFINE_UNQUOTED([X15_MAX_CPUS], [$opt_max_cpus],
- [maximum number of supported processors])
+# Thread stack guard selection
+
+AS_IF([test x"$enable_thread_stack_guard" = xyes],
+ [AC_DEFINE_UNQUOTED([X15_ENABLE_THREAD_STACK_GUARD], [],
+ [Enable the use of guard pages for thread stacks])])
+AC_MSG_NOTICE([thread stack guard pages: $enable_thread_stack_guard])
+
+# Low resolution clock frequency
+
AC_DEFINE_UNQUOTED([X15_CLOCK_FREQ], [$opt_clock_freq],
[low resolution clock frequency])
-AC_MSG_NOTICE([maximum number of supported processors: $opt_max_cpus])
AC_MSG_NOTICE([low resolution clock frequency: $opt_clock_freq Hz])
-AS_IF([test x"$enable_mutex_adaptive" = xyes -a x"$enable_mutex_pi" = xyes],
- [AC_MSG_ERROR([--enable-mutex-adaptive and --enable-mutex-pi are mutually exclusive])])
-
-AS_IF([test x"$enable_mutex_adaptive" = xyes],
- [mutex_impl="adaptive spinning"],
- [test x"$enable_mutex_pi" = xyes],
- [mutex_impl="priority inheritance"],
- [mutex_impl=plain])
-AC_MSG_NOTICE([mutex implementation: $mutex_impl])
-
-AS_IF([test x"$enable_mutex_adaptive" = xyes],
- [AC_DEFINE_UNQUOTED([X15_MUTEX_ADAPTIVE], [],
- [Enable adaptive mutexes])])
-AM_CONDITIONAL([MUTEX_ADAPTIVE],
- [test x"$enable_mutex_adaptive" = xyes])
-
-AS_IF([test x"$enable_mutex_pi" = xyes],
- [AC_DEFINE_UNQUOTED([X15_MUTEX_PI], [],
- [Enable priority inheritance for regular mutexes])])
-AM_CONDITIONAL([MUTEX_PI],
- [test x"$enable_mutex_pi" = xyes])
-
-AM_CONDITIONAL([X15_SHELL],
- [test x"$enable_shell" = xyes])
-AS_IF([test x"$enable_shell" = xyes],
- [AC_DEFINE_UNQUOTED([X15_SHELL], [],
- [Enable the diagnostics shell])])
-AC_MSG_NOTICE([diagnostics shell: $enable_shell])
+# Maximum number of supported processors
-AS_IF([test x"$enable_thread_stack_guard" = xyes],
- [AC_DEFINE_UNQUOTED([X15_THREAD_STACK_GUARD], [],
- [Enable the use of guard pages for thread stacks])])
-AC_MSG_NOTICE([thread stack guard pages: $enable_thread_stack_guard])
+AC_DEFINE_UNQUOTED([X15_MAX_CPUS], [$opt_max_cpus],
+ [maximum number of supported processors])
+AC_MSG_NOTICE([maximum number of supported processors: $opt_max_cpus])
+
+# Mutex implementation selection
+
+m4_define([SELECT_MUTEX_IMPL],
+ [mutex_impl_desc="$2"
+ AC_DEFINE_UNQUOTED([$1], [], [$3])])
+
+AS_IF([test x"$opt_mutex_impl" = xadaptive],
+ [SELECT_MUTEX_IMPL([X15_USE_MUTEX_ADAPTIVE],
+ [adaptive spinning],
+ [Use adaptive spinning mutex implementation])],
+ [test x"$opt_mutex_impl" = xpi],
+ [SELECT_MUTEX_IMPL([X15_USE_MUTEX_PI],
+ [priority inheritance],
+ [Use priority inheritance mutex implementation])],
+ [test x"$opt_mutex_impl" = xplain],
+ [SELECT_MUTEX_IMPL([X15_USE_MUTEX_PLAIN],
+ [plain],
+ [Use plain mutex implementation])],
+ [AC_MSG_ERROR([invalid mutex implementation])])
+AM_CONDITIONAL([USE_MUTEX_ADAPTIVE],
+ [test x"$opt_mutex_impl" = xadaptive])
+AM_CONDITIONAL([USE_MUTEX_PI],
+ [test x"$opt_mutex_impl" = xpi])
+AM_CONDITIONAL([USE_MUTEX_PLAIN],
+ [test x"$opt_mutex_impl" = xplain])
+AC_MSG_NOTICE([mutex implementation: $mutex_impl_desc])
+
+# Output generation
+
+AS_ECHO
AH_BOTTOM([#include <kern/config.h>])
AC_CONFIG_HEADER([config.h])
diff --git a/kern/kmem.c b/kern/kmem.c
index 5423c0a0..a811cc56 100644
--- a/kern/kmem.c
+++ b/kern/kmem.c
@@ -1123,7 +1123,7 @@ kmem_cache_info(struct kmem_cache *cache)
mutex_unlock(&cache->lock);
}
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static struct kmem_cache *
kmem_lookup_cache(const char *name)
@@ -1184,7 +1184,7 @@ INIT_OP_DEFINE(kmem_setup_shell,
INIT_OP_DEP(shell_setup, true),
INIT_OP_DEP(thread_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
kmem_bootstrap(void)
diff --git a/kern/log.c b/kern/log.c
index 10131d12..83562206 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -334,7 +334,7 @@ log_run(void *arg)
}
}
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static void
log_dump(unsigned int level)
@@ -412,7 +412,7 @@ INIT_OP_DEFINE(log_setup_shell,
INIT_OP_DEP(log_setup, true),
INIT_OP_DEP(shell_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
log_setup(void)
diff --git a/kern/mutex.h b/kern/mutex.h
index 8cb7aaca..c0a2c6e5 100644
--- a/kern/mutex.h
+++ b/kern/mutex.h
@@ -23,18 +23,16 @@
#ifndef _KERN_MUTEX_H
#define _KERN_MUTEX_H
-#if defined(X15_MUTEX_PI) && defined(X15_MUTEX_ADAPTIVE)
-#error "only one of X15_MUTEX_PI and X15_MUTEX_ADAPTIVE may be defined"
-#endif
-
#include <stdint.h>
-#if defined(X15_MUTEX_PI)
-#include <kern/mutex/mutex_pi_i.h>
-#elif defined(X15_MUTEX_ADAPTIVE)
+#if defined(X15_USE_MUTEX_ADAPTIVE)
#include <kern/mutex/mutex_adaptive_i.h>
-#else
+#elif defined(X15_USE_MUTEX_PI)
+#include <kern/mutex/mutex_pi_i.h>
+#elif defined(X15_USE_MUTEX_PLAIN)
#include <kern/mutex/mutex_plain_i.h>
+#else
+#error "unknown mutex implementation"
#endif
#include <kern/init.h>
diff --git a/kern/mutex_types.h b/kern/mutex_types.h
index eb2bc339..f0f8240c 100644
--- a/kern/mutex_types.h
+++ b/kern/mutex_types.h
@@ -21,12 +21,14 @@
#ifndef _KERN_MUTEX_TYPES_H
#define _KERN_MUTEX_TYPES_H
-#if defined(X15_MUTEX_PI)
-#include <kern/mutex/mutex_pi_types.h>
-#elif defined(X15_MUTEX_ADAPTIVE)
+#if defined(X15_USE_MUTEX_ADAPTIVE)
#include <kern/mutex/mutex_adaptive_types.h>
-#else
+#elif defined(X15_USE_MUTEX_PI)
+#include <kern/mutex/mutex_pi_types.h>
+#elif defined(X15_USE_MUTEX_PLAIN)
#include <kern/mutex/mutex_plain_types.h>
+#else
+#error "unknown mutex implementation"
#endif
#endif /* _KERN_MUTEX_TYPES_H */
diff --git a/kern/shell.h b/kern/shell.h
index cf56cebf..f6377f07 100644
--- a/kern/shell.h
+++ b/kern/shell.h
@@ -25,7 +25,7 @@
#include <kern/error.h>
#include <kern/macros.h>
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
#define SHELL_REGISTER_CMDS(cmds) \
MACRO_BEGIN \
@@ -81,11 +81,11 @@ void shell_start(void);
*/
int shell_cmd_register(struct shell_cmd *cmd);
-#else /* X15_SHELL */
+#else /* X15_ENABLE_SHELL */
#define SHELL_REGISTER_CMDS(cmds)
#define shell_setup()
#define shell_start()
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
/*
* This init operation provides :
diff --git a/kern/shutdown.c b/kern/shutdown.c
index 1c950415..b85cb1cb 100644
--- a/kern/shutdown.c
+++ b/kern/shutdown.c
@@ -26,7 +26,7 @@
static struct plist shutdown_ops_list;
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static void
shutdown_shell_halt(int argc, char **argv)
@@ -66,7 +66,7 @@ INIT_OP_DEFINE(shutdown_setup_shell,
INIT_OP_DEP(shell_setup, true),
INIT_OP_DEP(shutdown_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
shutdown_bootstrap(void)
diff --git a/kern/syscnt.c b/kern/syscnt.c
index 0e3aff70..f1cc95a9 100644
--- a/kern/syscnt.c
+++ b/kern/syscnt.c
@@ -33,7 +33,7 @@
static struct list syscnt_list;
static struct mutex syscnt_lock;
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static void
syscnt_shell_info(int argc, char **argv)
@@ -61,7 +61,7 @@ INIT_OP_DEFINE(syscnt_setup_shell,
INIT_OP_DEP(shell_setup, true),
INIT_OP_DEP(syscnt_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
syscnt_setup(void)
diff --git a/kern/task.c b/kern/task.c
index ab82ad83..16210560 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -64,7 +64,7 @@ task_init(struct task *task, const char *name, struct vm_map *map)
strlcpy(task->name, name, sizeof(task->name));
}
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static void
task_shell_info(int argc, char *argv[])
@@ -112,7 +112,7 @@ INIT_OP_DEFINE(task_setup_shell,
INIT_OP_DEP(task_setup, true),
INIT_OP_DEP(thread_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
task_setup(void)
diff --git a/kern/thread.c b/kern/thread.c
index 9ee9b99e..b6a44bb8 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -2185,7 +2185,7 @@ thread_setup_runq(struct thread_runq *runq)
thread_setup_idler(runq);
}
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
/*
* This function is meant for debugging only. As a result, it uses a weak
@@ -2261,7 +2261,7 @@ INIT_OP_DEFINE(thread_setup_shell,
INIT_OP_DEP(task_setup, true),
INIT_OP_DEP(thread_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static void __init
thread_setup_common(unsigned int cpu)
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 01e0ed5d..da0b2cfd 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -697,7 +697,7 @@ vm_map_init(struct vm_map *map, struct pmap *pmap,
map->pmap = pmap;
}
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static void
vm_map_shell_info(int argc, char **argv)
@@ -742,7 +742,7 @@ INIT_OP_DEFINE(vm_map_setup_shell,
INIT_OP_DEP(task_setup, true),
INIT_OP_DEP(vm_map_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
vm_map_bootstrap(void)
diff --git a/vm/vm_page.c b/vm/vm_page.c
index 19f6f4be..cc6963fc 100644
--- a/vm/vm_page.c
+++ b/vm/vm_page.c
@@ -657,7 +657,7 @@ vm_page_info_common(int (*print_fn)(const char *format, ...))
}
}
-#ifdef X15_SHELL
+#ifdef X15_ENABLE_SHELL
static void
vm_page_info(void)
@@ -691,7 +691,7 @@ INIT_OP_DEFINE(vm_page_setup_shell,
INIT_OP_DEP(shell_setup, true),
INIT_OP_DEP(vm_page_setup, true));
-#endif /* X15_SHELL */
+#endif /* X15_ENABLE_SHELL */
static int __init
vm_page_setup(void)