mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
only the multi-kernel version supports the kernel message buffer
=> remove dumping messages for the single-kernel version
This commit is contained in:
parent
f11c948347
commit
c5ecc2beec
1 changed files with 18 additions and 14 deletions
|
@ -52,34 +52,38 @@ spinlock_irqsave_t stdio_lock = SPINLOCK_IRQSAVE_INIT;
|
|||
|
||||
int kputchar(int c)
|
||||
{
|
||||
int pos;
|
||||
|
||||
/* add place holder for end of string */
|
||||
if (BUILTIN_EXPECT(!c, 0))
|
||||
c = '?';
|
||||
|
||||
pos = atomic_int32_inc(&kmsg_counter);
|
||||
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
|
||||
|
||||
if (is_single_kernel())
|
||||
if (is_single_kernel()) {
|
||||
uart_putchar(c);
|
||||
} else {
|
||||
int pos = atomic_int32_inc(&kmsg_counter);
|
||||
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int kputs(const char *str)
|
||||
{
|
||||
int pos, i, len = strlen(str);
|
||||
int len;
|
||||
|
||||
spinlock_irqsave_lock(&stdio_lock);
|
||||
|
||||
for(i=0; i<len; i++) {
|
||||
if (is_single_kernel()) {
|
||||
len = uart_puts(str);
|
||||
} else {
|
||||
int pos;
|
||||
|
||||
len = strlen(str);
|
||||
|
||||
for(int i=0; i<len; i++) {
|
||||
pos = atomic_int32_inc(&kmsg_counter);
|
||||
kmessages[pos % KMSG_SIZE] = str[i];
|
||||
}
|
||||
|
||||
if (is_single_kernel())
|
||||
uart_puts(str);
|
||||
}
|
||||
|
||||
spinlock_irqsave_unlock(&stdio_lock);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue