summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefrag.am8
-rw-r--r--configure.ac10
-rw-r--r--kern/log.c20
-rw-r--r--kern/shell.h8
-rw-r--r--kern/task.c4
-rw-r--r--kern/thread.c4
6 files changed, 44 insertions, 10 deletions
diff --git a/Makefrag.am b/Makefrag.am
index 8718a94d..1607f3cc 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -75,8 +75,6 @@ x15_SOURCES += \
kern/semaphore.c \
kern/semaphore.h \
kern/semaphore_i.h \
- kern/shell.c \
- kern/shell.h \
kern/sleepq.c \
kern/sleepq.h \
kern/spinlock.c \
@@ -105,6 +103,12 @@ x15_SOURCES += \
kern/xcall.c \
kern/xcall.h
+if X15_SHELL
+x15_SOURCES += \
+ kern/shell.c \
+ kern/shell.h
+endif X15_SHELL
+
x15_SOURCES += \
vm/vm_adv.h \
vm/vm_inherit.h \
diff --git a/configure.ac b/configure.ac
index be21f3d2..5412c000 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,10 @@ AC_ARG_ENABLE([mutex-pi],
(note that priority inheritance is always
enabled for real-time mutexes)])])
+AC_ARG_ENABLE([shell],
+ [AS_HELP_STRING([--enable-shell],
+ [enable the diagnostics shell])])
+
AC_ARG_ENABLE([thread-stack-guard],
[AS_HELP_STRING([--enable-thread-stack-guard],
[enable kernel thread stack guard pages])])
@@ -104,6 +108,12 @@ AS_IF([test x"$enable_mutex_pi" = xyes],
[AC_DEFINE_UNQUOTED([X15_MUTEX_PI], [],
[Enable priority inheritance for regular mutexes])])
+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])])
+
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])])
diff --git a/kern/log.c b/kern/log.c
index b8029095..6adc378b 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -267,6 +267,8 @@ log_run(void *arg)
}
}
+#ifdef X15_SHELL
+
static void
log_dump(unsigned int level)
{
@@ -315,14 +317,6 @@ log_shell_dump(int argc, char **argv)
log_dump(level);
}
-void __init
-log_setup(void)
-{
- cbuf_init(&log_cbuf, log_buffer, sizeof(log_buffer));
- spinlock_init(&log_lock);
- log_print_level = LOG_INFO;
-}
-
static struct shell_cmd log_shell_cmds[] = {
SHELL_CMD_INITIALIZER2("log_dump", log_shell_dump,
"log_dump [<level>]",
@@ -339,6 +333,16 @@ static struct shell_cmd log_shell_cmds[] = {
" 7: debug"),
};
+#endif /* X15_SHELL */
+
+void __init
+log_setup(void)
+{
+ cbuf_init(&log_cbuf, log_buffer, sizeof(log_buffer));
+ spinlock_init(&log_lock);
+ log_print_level = LOG_INFO;
+}
+
void __init
log_start(void)
{
diff --git a/kern/shell.h b/kern/shell.h
index 10bc8a38..81be314b 100644
--- a/kern/shell.h
+++ b/kern/shell.h
@@ -24,6 +24,8 @@
#include <kern/error.h>
#include <kern/macros.h>
+#ifdef X15_SHELL
+
#define SHELL_REGISTER_CMDS(cmds) \
MACRO_BEGIN \
size_t ___i; \
@@ -85,4 +87,10 @@ void shell_start(void);
*/
int shell_cmd_register(struct shell_cmd *cmd);
+#else /* X15_SHELL */
+#define SHELL_REGISTER_CMDS(cmds)
+#define shell_setup()
+#define shell_start()
+#endif /* X15_SHELL */
+
#endif /* _KERN_SHELL_H */
diff --git a/kern/task.c b/kern/task.c
index d9c9f115..a5281994 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -64,6 +64,8 @@ task_init(struct task *task, const char *name, struct vm_map *map)
strlcpy(task->name, name, sizeof(task->name));
}
+#ifdef X15_SHELL
+
static void
task_shell_info(int argc, char *argv[])
{
@@ -97,6 +99,8 @@ static struct shell_cmd task_shell_cmds[] = {
"print tasks and threads"),
};
+#endif /* X15_SHELL */
+
void __init
task_setup(void)
{
diff --git a/kern/thread.c b/kern/thread.c
index a753eb59..dd0d709f 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -2229,6 +2229,8 @@ thread_setup_runq(struct thread_runq *runq)
thread_setup_idler(runq);
}
+#ifdef X15_SHELL
+
/*
* This function is meant for debugging only. As a result, it uses a weak
* locking policy which allows tracing threads which state may mutate during
@@ -2279,6 +2281,8 @@ static struct shell_cmd thread_shell_cmds[] = {
"print the stack trace of a given thread"),
};
+#endif /* X15_SHELL */
+
void __init
thread_setup(void)
{