1
0
Fork 0
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:
Stefan Lankes 2018-04-28 10:21:53 +02:00
parent f11c948347
commit c5ecc2beec

View file

@ -42,7 +42,7 @@ spinlock_irqsave_t stdio_lock = SPINLOCK_IRQSAVE_INIT;
the binary. => no valid kernel messages */ the binary. => no valid kernel messages */
/* static */ unsigned char kmessages[KMSG_SIZE+1] __attribute__ ((section(".kmsg"))) = {[0 ... KMSG_SIZE] = 0x00}; /* static */ unsigned char kmessages[KMSG_SIZE+1] __attribute__ ((section(".kmsg"))) = {[0 ... KMSG_SIZE] = 0x00};
int koutput_init(void) int koutput_init(void)
{ {
if (is_single_kernel()) if (is_single_kernel())
uart_init(); uart_init();
@ -52,34 +52,38 @@ spinlock_irqsave_t stdio_lock = SPINLOCK_IRQSAVE_INIT;
int kputchar(int c) int kputchar(int c)
{ {
int pos;
/* add place holder for end of string */ /* add place holder for end of string */
if (BUILTIN_EXPECT(!c, 0)) if (BUILTIN_EXPECT(!c, 0))
c = '?'; c = '?';
pos = atomic_int32_inc(&kmsg_counter); if (is_single_kernel()) {
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
if (is_single_kernel())
uart_putchar(c); uart_putchar(c);
} else {
int pos = atomic_int32_inc(&kmsg_counter);
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
}
return 1; return 1;
} }
int kputs(const char *str) int kputs(const char *str)
{ {
int pos, i, len = strlen(str); int len;
spinlock_irqsave_lock(&stdio_lock); spinlock_irqsave_lock(&stdio_lock);
for(i=0; i<len; i++) { if (is_single_kernel()) {
pos = atomic_int32_inc(&kmsg_counter); len = uart_puts(str);
kmessages[pos % KMSG_SIZE] = str[i]; } else {
} int pos;
if (is_single_kernel()) len = strlen(str);
uart_puts(str);
for(int i=0; i<len; i++) {
pos = atomic_int32_inc(&kmsg_counter);
kmessages[pos % KMSG_SIZE] = str[i];
}
}
spinlock_irqsave_unlock(&stdio_lock); spinlock_irqsave_unlock(&stdio_lock);