aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorTravis Geiselbrecht <travisg@gmail.com>2021-05-28 18:43:47 -0700
committerTravis Geiselbrecht <travisg@gmail.com>2021-05-29 00:52:47 -0700
commit89f980527746c6f6d282cfa5c5f464485797fe5b (patch)
tree814dcb43bfd43c92ac2f379011daf16091d0322a /kernel
parentc49e63e62c8a9fdced5cfaca2d01b1faec82f954 (diff)
downloadlk-89f980527746c6f6d282cfa5c5f464485797fe5b.tar.gz
[lib][console] move the state of the console into an object
This will allow in the future multiple instances of it to be active at at a time. Place the current console in a new TLS slot per thread so threads created as a side effect of console commands can properly run commands.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/include/kernel/thread.h3
-rw-r--r--kernel/thread.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/kernel/include/kernel/thread.h b/kernel/include/kernel/thread.h
index 5d7d1561..14f32704 100644
--- a/kernel/include/kernel/thread.h
+++ b/kernel/include/kernel/thread.h
@@ -48,6 +48,9 @@ typedef int (*thread_start_routine)(void *arg);
/* thread local storage */
enum thread_tls_list {
+#ifdef WITH_LIB_CONSOLE
+ TLS_ENTRY_CONSOLE, // current console
+#endif
#ifdef WITH_LIB_UTHREAD
TLS_ENTRY_UTHREAD,
#endif
diff --git a/kernel/thread.c b/kernel/thread.c
index 58f57ec6..ed13be7e 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -202,7 +202,7 @@ thread_t *thread_create_etc(thread_t *t, const char *name, thread_start_routine
/* save whether or not we need to free the thread struct and/or stack */
t->flags = flags;
- /* inheirit thread local storage from the parent */
+ /* inherit thread local storage from the parent */
thread_t *current_thread = get_current_thread();
int i;
for (i=0; i < MAX_TLS_ENTRY; i++)