The ring buffer has a fixed capacity of 16 KiB. When it is full, the oldest entries are silently overwritten. If you need a persistent log, copy the buffer to stable storage with
klog_copy before it wraps.Suggested Level Strings
The kernel log API accepts arbitrary level strings, but the following values are used by convention throughout MVH Kernel itself:Functions
klog_init
klog_write
const char *
required
A null-terminated severity string such as
"INFO", "WARN", "ERROR", or "DEBUG". The string is copied into the entry, so you do not need to keep the pointer alive after the call.const char *
required
A null-terminated log message. The message is copied into the ring buffer along with the level and a kernel-generated timestamp.
klog_write_category
"ACPI", "PCI", "VMM").
const char *
required
A null-terminated severity string. See
klog_write for suggested values.const char *
required
A null-terminated subsystem or component name. The
dmesg shell command can filter by category, so choosing consistent category names makes log inspection easier.const char *
required
A null-terminated log message.
klog_set_console
uint8_t
required
Pass
1 to enable VGA console mirroring, or 0 to disable it. This setting affects only entries written after the call — it does not replay previously buffered entries.klog_copy
char *
required
Pointer to a buffer that will receive the log data. The buffer must be at least
capacity bytes long. The copied data is not null-terminated automatically — add a null terminator yourself if you intend to treat the result as a C string.uint32_t
required
The maximum number of bytes to copy. To guarantee a complete snapshot, pass a value of at least 16 384 (16 KiB).
uint32_t
The number of bytes written to
output. This is min(klog_size(), capacity).klog_size
uint32_t
The current occupancy of the ring buffer in bytes, in the range
[0, 16384].Shell Command
The built-indmesg shell command dumps the full contents of the kernel log ring buffer to the console: