source: mainline/kernel/generic/src/console/kconsole.c@ 0116f21

Last change on this file since 0116f21 was 2cc569a3, checked in by Matthieu Riolo <matthieu.riolo@…>, 6 years ago

Removing inclusion of halt.h

Several files used to include halt.h even though
this was not necessary. The inclusion has therefore
been removed

  • Property mode set to 100644
File size: 19.1 KB
Line 
1/*
2 * Copyright (c) 2005 Jakub Jermar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup kernel_generic_console
30 * @{
31 */
32
33/**
34 * @file kconsole.c
35 * @brief Kernel console.
36 *
37 * This file contains kernel thread managing the kernel console.
38 *
39 */
40
41#include <assert.h>
42#include <console/kconsole.h>
43#include <console/console.h>
44#include <console/chardev.h>
45#include <console/cmd.h>
46#include <console/prompt.h>
47#include <stdio.h>
48#include <panic.h>
49#include <typedefs.h>
50#include <adt/list.h>
51#include <arch.h>
52#include <macros.h>
53#include <debug.h>
54#include <str.h>
55#include <sysinfo/sysinfo.h>
56#include <symtab.h>
57#include <errno.h>
58#include <putchar.h>
59#include <stdlib.h>
60
61/** Simple kernel console.
62 *
63 * The console is realized by kernel thread kconsole.
64 * It doesn't understand any useful command on its own,
65 * but makes it possible for other kernel subsystems to
66 * register their own commands.
67 */
68
69/** Locking.
70 *
71 * There is a list of cmd_info_t structures. This list
72 * is protected by cmd_lock spinlock. Note that specially
73 * the link elements of cmd_info_t are protected by
74 * this lock.
75 *
76 * Each cmd_info_t also has its own lock, which protects
77 * all elements thereof except the link element.
78 *
79 * cmd_lock must be acquired before any cmd_info lock.
80 * When locking two cmd info structures, structure with
81 * lower address must be locked first.
82 */
83
84SPINLOCK_INITIALIZE(cmd_lock); /**< Lock protecting command list. */
85LIST_INITIALIZE(cmd_list); /**< Command list. */
86
87static wchar_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { };
88static size_t history_pos = 0;
89
90/** Initialize kconsole data structures
91 *
92 * This is the most basic initialization, almost no
93 * other kernel subsystem is ready yet.
94 *
95 */
96void kconsole_init(void)
97{
98 unsigned int i;
99
100 cmd_init();
101 for (i = 0; i < KCONSOLE_HISTORY; i++)
102 history[i][0] = 0;
103}
104
105/** Register kconsole command.
106 *
107 * @param cmd Structure describing the command.
108 *
109 * @return False on failure, true on success.
110 *
111 */
112bool cmd_register(cmd_info_t *cmd)
113{
114 spinlock_lock(&cmd_lock);
115
116 /*
117 * Make sure the command is not already listed.
118 */
119 list_foreach(cmd_list, link, cmd_info_t, hlp) {
120 if (hlp == cmd) {
121 /* The command is already there. */
122 spinlock_unlock(&cmd_lock);
123 return false;
124 }
125
126 /* Avoid deadlock. */
127 if (hlp < cmd) {
128 spinlock_lock(&hlp->lock);
129 spinlock_lock(&cmd->lock);
130 } else {
131 spinlock_lock(&cmd->lock);
132 spinlock_lock(&hlp->lock);
133 }
134
135 if (str_cmp(hlp->name, cmd->name) == 0) {
136 /* The command is already there. */
137 spinlock_unlock(&hlp->lock);
138 spinlock_unlock(&cmd->lock);
139 spinlock_unlock(&cmd_lock);
140 return false;
141 }
142
143 spinlock_unlock(&hlp->lock);
144 spinlock_unlock(&cmd->lock);
145 }
146
147 /*
148 * Now the command can be added.
149 */
150 list_append(&cmd->link, &cmd_list);
151
152 spinlock_unlock(&cmd_lock);
153 return true;
154}
155
156/** Print count times a character */
157_NO_TRACE static void print_cc(wchar_t ch, size_t count)
158{
159 size_t i;
160 for (i = 0; i < count; i++)
161 putwchar(ch);
162}
163
164/** Try to find a command beginning with prefix */
165const char *cmdtab_enum(const char *name, const char **h, void **ctx)
166{
167 link_t **startpos = (link_t **) ctx;
168 size_t namelen = str_length(name);
169
170 spinlock_lock(&cmd_lock);
171
172 if (*startpos == NULL)
173 *startpos = cmd_list.head.next;
174
175 for (; *startpos != &cmd_list.head; *startpos = (*startpos)->next) {
176 cmd_info_t *hlp = list_get_instance(*startpos, cmd_info_t, link);
177
178 const char *curname = hlp->name;
179 if (str_length(curname) < namelen)
180 continue;
181
182 if (str_lcmp(curname, name, namelen) == 0) {
183 *startpos = (*startpos)->next;
184 if (h)
185 *h = hlp->description;
186
187 spinlock_unlock(&cmd_lock);
188 return (curname + str_lsize(curname, namelen));
189 }
190 }
191
192 spinlock_unlock(&cmd_lock);
193 return NULL;
194}
195
196/** Command completion of the commands
197 *
198 * @param name String to match, changed to hint on exit
199 * @param size Input buffer size
200 *
201 * @return Number of found matches
202 *
203 */
204_NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t *indev,
205 hints_enum_func_t hints_enum)
206{
207 const char *name = input;
208
209 size_t found = 0;
210
211 /*
212 * Maximum Match Length: Length of longest matching common
213 * substring in case more than one match is found.
214 */
215 size_t max_match_len = size;
216 size_t max_match_len_tmp = size;
217 void *pos = NULL;
218 const char *hint;
219 const char *help;
220 size_t hints_to_show = MAX_TAB_HINTS - 1;
221 size_t total_hints_shown = 0;
222 bool continue_showing_hints = true;
223
224 char *output = malloc(MAX_CMDLINE);
225 if (!output) {
226 // TODO: fix the function so that it does not need allocation
227 printf("Can't complete command, out of memory.\n");
228 return 0;
229 }
230
231 output[0] = 0;
232
233 while ((hint = hints_enum(name, NULL, &pos))) {
234 if ((found == 0) || (str_length(hint) > str_length(output)))
235 str_cpy(output, MAX_CMDLINE, hint);
236
237 found++;
238 }
239
240 /*
241 * If the number of possible completions is more than MAX_TAB_HINTS,
242 * ask the user whether to display them or not.
243 */
244 if (found > MAX_TAB_HINTS) {
245 printf("\n");
246 continue_showing_hints =
247 console_prompt_display_all_hints(indev, found);
248 }
249
250 if ((found > 1) && (str_length(output) != 0)) {
251 printf("\n");
252 pos = NULL;
253 while ((hint = hints_enum(name, &help, &pos))) {
254
255 if (continue_showing_hints) {
256 if (help)
257 printf("%s%s (%s)\n", name, hint, help);
258 else
259 printf("%s%s\n", name, hint);
260
261 --hints_to_show;
262 ++total_hints_shown;
263
264 if ((hints_to_show == 0) && (total_hints_shown != found)) {
265 /* Ask user to continue */
266 continue_showing_hints =
267 console_prompt_more_hints(indev, &hints_to_show);
268 }
269 }
270
271 max_match_len_tmp = 0;
272 while ((output[max_match_len_tmp] ==
273 hint[max_match_len_tmp]) &&
274 (max_match_len_tmp < max_match_len))
275 ++max_match_len_tmp;
276
277 max_match_len = max_match_len_tmp;
278 }
279
280 /* Keep only the characters common in all completions */
281 output[max_match_len] = 0;
282 }
283
284 if (found > 0)
285 str_cpy(input, size, output);
286
287 free(output);
288 return found;
289}
290
291_NO_TRACE static cmd_info_t *parse_cmd(const wchar_t *cmdline)
292{
293 size_t start = 0;
294 size_t end;
295 char *tmp;
296
297 while (isspace(cmdline[start]))
298 start++;
299
300 end = start + 1;
301
302 while (!isspace(cmdline[end]))
303 end++;
304
305 tmp = malloc(STR_BOUNDS(end - start + 1));
306 if (!tmp)
307 return NULL;
308
309 wstr_to_str(tmp, end - start + 1, &cmdline[start]);
310
311 spinlock_lock(&cmd_lock);
312
313 list_foreach(cmd_list, link, cmd_info_t, hlp) {
314 spinlock_lock(&hlp->lock);
315
316 if (str_cmp(hlp->name, tmp) == 0) {
317 spinlock_unlock(&hlp->lock);
318 spinlock_unlock(&cmd_lock);
319 free(tmp);
320 return hlp;
321 }
322
323 spinlock_unlock(&hlp->lock);
324 }
325
326 free(tmp);
327 spinlock_unlock(&cmd_lock);
328
329 return NULL;
330}
331
332_NO_TRACE static wchar_t *clever_readline(const char *prompt, indev_t *indev,
333 char *tmp)
334{
335 printf("%s> ", prompt);
336
337 size_t position = 0;
338 wchar_t *current = history[history_pos];
339 current[0] = 0;
340
341 while (true) {
342 wchar_t ch = indev_pop_character(indev);
343
344 if (ch == '\n') {
345 /* Enter */
346 putwchar(ch);
347 break;
348 }
349
350 if (ch == '\b') {
351 /* Backspace */
352 if (position == 0)
353 continue;
354
355 if (wstr_remove(current, position - 1)) {
356 position--;
357 putwchar('\b');
358 printf("%ls ", current + position);
359 print_cc('\b', wstr_length(current) - position + 1);
360 continue;
361 }
362 }
363
364 if (ch == '\t') {
365 /* Tab completion */
366
367 /* Move to the end of the word */
368 for (; (current[position] != 0) && (!isspace(current[position]));
369 position++)
370 putwchar(current[position]);
371
372 /*
373 * Find the beginning of the word
374 * and copy it to tmp
375 */
376 size_t beg;
377 unsigned narg = 0;
378 if (position == 0) {
379 tmp[0] = '\0';
380 beg = 0;
381 } else {
382 beg = position - 1;
383 while ((beg > 0) && (!isspace(current[beg])))
384 beg--;
385
386 if (isspace(current[beg]))
387 beg++;
388
389 wstr_to_str(tmp, position - beg + 1, current + beg);
390 }
391
392 /* Count which argument number are we tabbing (narg=0 is cmd) */
393 bool sp = false;
394 for (; beg > 0; beg--) {
395 if (isspace(current[beg])) {
396 if (!sp) {
397 narg++;
398 sp = true;
399 }
400 } else
401 sp = false;
402 }
403
404 if (narg && isspace(current[0]))
405 narg--;
406
407 int found;
408 if (narg == 0) {
409 /* Command completion */
410 found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev,
411 cmdtab_enum);
412 } else {
413 /* Arguments completion */
414 cmd_info_t *cmd = parse_cmd(current);
415 if (!cmd || !cmd->hints_enum || cmd->argc < narg)
416 continue;
417 found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev,
418 cmd->hints_enum);
419 }
420
421 if (found == 0)
422 continue;
423
424 /*
425 * We have hints, possibly many. In case of more than one hint,
426 * tmp will contain the common prefix.
427 */
428 size_t off = 0;
429 size_t i = 0;
430 while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) {
431 if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
432 break;
433
434 i++;
435 }
436
437 if (found > 1) {
438 /* No unique hint, list was printed */
439 printf("%s> ", prompt);
440 printf("%ls", current);
441 position += str_length(tmp);
442 print_cc('\b', wstr_length(current) - position);
443 continue;
444 }
445
446 /* We have a hint */
447
448 printf("%ls", current + position);
449 position += str_length(tmp);
450 print_cc('\b', wstr_length(current) - position);
451
452 if (position == wstr_length(current)) {
453 /* Insert a space after the last completed argument */
454 if (wstr_linsert(current, ' ', position, MAX_CMDLINE)) {
455 printf("%ls", current + position);
456 position++;
457 }
458 }
459 continue;
460 }
461
462 if (ch == U_LEFT_ARROW) {
463 /* Left */
464 if (position > 0) {
465 putwchar('\b');
466 position--;
467 }
468 continue;
469 }
470
471 if (ch == U_RIGHT_ARROW) {
472 /* Right */
473 if (position < wstr_length(current)) {
474 putwchar(current[position]);
475 position++;
476 }
477 continue;
478 }
479
480 if ((ch == U_UP_ARROW) || (ch == U_DOWN_ARROW)) {
481 /* Up, down */
482 print_cc('\b', position);
483 print_cc(' ', wstr_length(current));
484 print_cc('\b', wstr_length(current));
485
486 if (ch == U_UP_ARROW) {
487 /* Up */
488 if (history_pos == 0)
489 history_pos = KCONSOLE_HISTORY - 1;
490 else
491 history_pos--;
492 } else {
493 /* Down */
494 history_pos++;
495 history_pos = history_pos % KCONSOLE_HISTORY;
496 }
497 current = history[history_pos];
498 printf("%ls", current);
499 position = wstr_length(current);
500 continue;
501 }
502
503 if (ch == U_HOME_ARROW) {
504 /* Home */
505 print_cc('\b', position);
506 position = 0;
507 continue;
508 }
509
510 if (ch == U_END_ARROW) {
511 /* End */
512 printf("%ls", current + position);
513 position = wstr_length(current);
514 continue;
515 }
516
517 if (ch == U_DELETE) {
518 /* Delete */
519 if (position == wstr_length(current))
520 continue;
521
522 if (wstr_remove(current, position)) {
523 printf("%ls ", current + position);
524 print_cc('\b', wstr_length(current) - position + 1);
525 }
526 continue;
527 }
528
529 if (wstr_linsert(current, ch, position, MAX_CMDLINE)) {
530 printf("%ls", current + position);
531 position++;
532 print_cc('\b', wstr_length(current) - position);
533 }
534 }
535
536 if (wstr_length(current) > 0) {
537 history_pos++;
538 history_pos = history_pos % KCONSOLE_HISTORY;
539 }
540
541 return current;
542}
543
544bool kconsole_check_poll(void)
545{
546 return check_poll(stdin);
547}
548
549_NO_TRACE static bool parse_int_arg(const char *text, size_t len,
550 sysarg_t *result)
551{
552 bool isaddr = false;
553 bool isptr = false;
554
555 /* If we get a name, try to find it in symbol table */
556 if (text[0] == '&') {
557 isaddr = true;
558 text++;
559 len--;
560 } else if (text[0] == '*') {
561 isptr = true;
562 text++;
563 len--;
564 }
565
566 if ((text[0] < '0') || (text[0] > '9')) {
567 char symname[MAX_SYMBOL_NAME];
568 str_ncpy(symname, MAX_SYMBOL_NAME, text, len + 1);
569
570 uintptr_t symaddr;
571 errno_t rc = symtab_addr_lookup(symname, &symaddr);
572 switch (rc) {
573 case ENOENT:
574 printf("Symbol %s not found.\n", symname);
575 return false;
576 case EOVERFLOW:
577 printf("Duplicate symbol %s.\n", symname);
578 symtab_print_search(symname);
579 return false;
580 case ENOTSUP:
581 printf("No symbol information available.\n");
582 return false;
583 case EOK:
584 if (isaddr)
585 *result = (sysarg_t) symaddr;
586 else if (isptr)
587 *result = **((sysarg_t **) symaddr);
588 else
589 *result = *((sysarg_t *) symaddr);
590 break;
591 default:
592 printf("Unknown error.\n");
593 return false;
594 }
595 } else {
596 /* It's a number - convert it */
597 uint64_t value;
598 char *end;
599 errno_t rc = str_uint64_t(text, &end, 0, false, &value);
600 if (end != text + len)
601 rc = EINVAL;
602 switch (rc) {
603 case EINVAL:
604 printf("Invalid number '%s'.\n", text);
605 return false;
606 case EOVERFLOW:
607 printf("Integer overflow in '%s'.\n", text);
608 return false;
609 case EOK:
610 *result = (sysarg_t) value;
611 if (isptr)
612 *result = *((sysarg_t *) *result);
613 break;
614 default:
615 printf("Unknown error parsing '%s'.\n", text);
616 return false;
617 }
618 }
619
620 return true;
621}
622
623/** Parse argument.
624 *
625 * Find start and end positions of command line argument.
626 *
627 * @param cmdline Command line as read from the input device.
628 * @param size Size (in bytes) of the string.
629 * @param start On entry, 'start' contains pointer to the offset
630 * of the first unprocessed character of cmdline.
631 * On successful exit, it marks beginning of the next argument.
632 * @param end Undefined on entry. On exit, 'end' is the offset of the first
633 * character behind the next argument.
634 *
635 * @return False on failure, true on success.
636 *
637 */
638_NO_TRACE static bool parse_argument(const char *cmdline, size_t size,
639 size_t *start, size_t *end)
640{
641 assert(start != NULL);
642 assert(end != NULL);
643
644 bool found_start = false;
645 size_t offset = *start;
646 size_t prev = *start;
647 wchar_t ch;
648
649 while ((ch = str_decode(cmdline, &offset, size)) != 0) {
650 if (!found_start) {
651 if (!isspace(ch)) {
652 *start = prev;
653 found_start = true;
654 }
655 } else {
656 if (isspace(ch))
657 break;
658 }
659
660 prev = offset;
661 }
662 *end = prev;
663
664 return found_start;
665}
666
667/** Parse command line.
668 *
669 * @param cmdline Command line as read from input device.
670 * @param size Size (in bytes) of the string.
671 *
672 * @return Structure describing the command.
673 *
674 */
675_NO_TRACE static cmd_info_t *parse_cmdline(const char *cmdline, size_t size)
676{
677 size_t start = 0;
678 size_t end = 0;
679 if (!parse_argument(cmdline, size, &start, &end)) {
680 /* Command line did not contain alphanumeric word. */
681 return NULL;
682 }
683 spinlock_lock(&cmd_lock);
684
685 cmd_info_t *cmd = NULL;
686
687 list_foreach(cmd_list, link, cmd_info_t, hlp) {
688 spinlock_lock(&hlp->lock);
689
690 if (str_lcmp(hlp->name, cmdline + start,
691 max(str_length(hlp->name),
692 str_nlength(cmdline + start, (size_t) (end - start)))) == 0) {
693 cmd = hlp;
694 break;
695 }
696
697 spinlock_unlock(&hlp->lock);
698 }
699
700 spinlock_unlock(&cmd_lock);
701
702 if (!cmd) {
703 /* Unknown command. */
704 printf("Unknown command.\n");
705 return NULL;
706 }
707
708 /* cmd == hlp is locked */
709
710 /*
711 * The command line must be further analyzed and
712 * the parameters therefrom must be matched and
713 * converted to those specified in the cmd info
714 * structure.
715 */
716
717 bool error = false;
718 size_t i;
719 for (i = 0; i < cmd->argc; i++) {
720 char *buf;
721
722 start = end;
723 if (!parse_argument(cmdline, size, &start, &end)) {
724 if (cmd->argv[i].type == ARG_TYPE_STRING_OPTIONAL) {
725 buf = (char *) cmd->argv[i].buffer;
726 str_cpy(buf, cmd->argv[i].len, "");
727 continue;
728 }
729
730 printf("Too few arguments.\n");
731 spinlock_unlock(&cmd->lock);
732 return NULL;
733 }
734
735 switch (cmd->argv[i].type) {
736 case ARG_TYPE_STRING:
737 case ARG_TYPE_STRING_OPTIONAL:
738 buf = (char *) cmd->argv[i].buffer;
739 str_ncpy(buf, cmd->argv[i].len, cmdline + start,
740 end - start);
741 break;
742 case ARG_TYPE_INT:
743 if (!parse_int_arg(cmdline + start, end - start,
744 &cmd->argv[i].intval))
745 error = true;
746 break;
747 case ARG_TYPE_VAR:
748 if ((start < end - 1) && (cmdline[start] == '"')) {
749 if (cmdline[end - 1] == '"') {
750 buf = (char *) cmd->argv[i].buffer;
751 str_ncpy(buf, cmd->argv[i].len,
752 cmdline + start + 1,
753 (end - start) - 1);
754 cmd->argv[i].intval = (sysarg_t) buf;
755 cmd->argv[i].vartype = ARG_TYPE_STRING;
756 } else {
757 printf("Wrong syntax.\n");
758 error = true;
759 }
760 } else if (parse_int_arg(cmdline + start,
761 end - start, &cmd->argv[i].intval)) {
762 cmd->argv[i].vartype = ARG_TYPE_INT;
763 } else {
764 printf("Unrecognized variable argument.\n");
765 error = true;
766 }
767 break;
768 case ARG_TYPE_INVALID:
769 default:
770 printf("Invalid argument type\n");
771 error = true;
772 break;
773 }
774 }
775
776 if (error) {
777 spinlock_unlock(&cmd->lock);
778 return NULL;
779 }
780
781 start = end;
782 if (parse_argument(cmdline, size, &start, &end)) {
783 printf("Too many arguments.\n");
784 spinlock_unlock(&cmd->lock);
785 return NULL;
786 }
787
788 spinlock_unlock(&cmd->lock);
789 return cmd;
790}
791
792/** Kernel console prompt.
793 *
794 * @param prompt Kernel console prompt (e.g kconsole/panic).
795 * @param msg Message to display in the beginning.
796 * @param kcon Wait for keypress to show the prompt
797 * and never exit.
798 *
799 */
800void kconsole(const char *prompt, const char *msg, bool kcon)
801{
802 if (!stdin) {
803 LOG("No stdin for kernel console");
804 return;
805 }
806
807 if (msg)
808 printf("%s", msg);
809
810 if (kcon)
811 indev_pop_character(stdin);
812 else
813 printf("Type \"exit\" to leave the console.\n");
814
815 char *buffer = malloc(STR_BOUNDS(MAX_CMDLINE));
816 char *cmdline = malloc(STR_BOUNDS(MAX_CMDLINE));
817 if (!buffer || !cmdline) {
818 // TODO: fix the function so that it does not need allocations
819 printf("Can't start console, out of memory.\n");
820 free(buffer);
821 free(cmdline);
822 return;
823 }
824
825 while (true) {
826 wchar_t *tmp = clever_readline((char *) prompt, stdin, buffer);
827 size_t len = wstr_length(tmp);
828 if (!len)
829 continue;
830
831 wstr_to_str(cmdline, STR_BOUNDS(MAX_CMDLINE), tmp);
832
833 if ((!kcon) && (len == 4) && (str_lcmp(cmdline, "exit", 4) == 0))
834 break;
835
836 cmd_info_t *cmd_info = parse_cmdline(cmdline, STR_BOUNDS(MAX_CMDLINE));
837 if (!cmd_info)
838 continue;
839
840 (void) cmd_info->func(cmd_info->argv);
841 }
842 free(buffer);
843 free(cmdline);
844}
845
846/** Kernel console managing thread.
847 *
848 */
849void kconsole_thread(void *data)
850{
851 kconsole("kconsole", "Kernel console ready (press any key to activate)\n", true);
852}
853
854/** @}
855 */
Note: See TracBrowser for help on using the repository browser.