diff options
author | Richard Braun <rbraun@sceen.net> | 2017-05-31 23:51:54 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-05-31 23:53:01 +0200 |
commit | 0890cc62c32ad48118bc0731ad07df226fb60431 (patch) | |
tree | 68739bd47e2920b103ffc52138a676332ed3d01f /kern/console.c | |
parent | e4d73f8405441ab7a09003773664a16e10b40fed (diff) |
kern/console: optimize interrupt handling
Diffstat (limited to 'kern/console.c')
-rw-r--r-- | kern/console.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/kern/console.c b/kern/console.c index e8c0c28a..d7104e47 100644 --- a/kern/console.c +++ b/kern/console.c @@ -136,17 +136,24 @@ console_register(struct console *console) } void -console_intr(struct console *console, char c) +console_intr(struct console *console, const char *s) { assert(!cpu_intr_enabled()); + if (*s == '\0') { + return; + } + spinlock_lock(&console->lock); - if (cbuf_size(&console->recvbuf) == cbuf_capacity(&console->recvbuf)) { - goto out; - } + while (*s != '\0') { + if (cbuf_size(&console->recvbuf) == cbuf_capacity(&console->recvbuf)) { + goto out; + } - cbuf_push(&console->recvbuf, c); + cbuf_push(&console->recvbuf, *s); + s++; + } if ((console->waiter != NULL) && (console->waiter != thread_self())) { thread_wakeup(console->waiter); |