efi loader: implement simple in-memory log
This lets us see the bootloader log from the boot menu, which is very helpful on machines with no serial port or other way to debug.
This commit is contained in:
parent
835e7239d0
commit
cc55d41273
@ -14,6 +14,18 @@
|
||||
#include "serial.h"
|
||||
|
||||
|
||||
static char sBuffer[16384];
|
||||
static uint32 sBufferPosition;
|
||||
|
||||
|
||||
static void
|
||||
syslog_write(const char* buffer, size_t length)
|
||||
{
|
||||
memcpy(sBuffer + sBufferPosition, buffer, length);
|
||||
sBufferPosition += length;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dprintf_args(const char *format, va_list args)
|
||||
{
|
||||
@ -22,6 +34,7 @@ dprintf_args(const char *format, va_list args)
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
syslog_write(buffer, length);
|
||||
serial_puts(buffer, length);
|
||||
}
|
||||
|
||||
@ -58,5 +71,8 @@ panic(const char *format, ...)
|
||||
char*
|
||||
platform_debug_get_log_buffer(size_t *_size)
|
||||
{
|
||||
return NULL;
|
||||
if (_size != NULL)
|
||||
*_size = sizeof(sBuffer);
|
||||
|
||||
return sBuffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user