|
Kernelite 0.1.0
Kernelite is a minimalist, educational operating system kernel built from scratch. The project aims to recreate core components of the Linux architecture to explore the fundamentals of operating system design and hardware-software interaction.
|
Implementation of formatted print functions for kernel debugging. More...

Functions | |
| static void | itoa (unsigned long num, int base, char *buf) |
| Convert an unsigned integer to a string using the given base. | |
| int | vprintf (const char *format, va_list args) |
| Variadic print function. | |
| void | set_kprintf_console (serial_t con) |
| Configures the global serial console used by kprintf. | |
| int | kprintf (const char *format,...) |
| Standard formatted print to the serial console. | |
Variables | |
| static serial_t | serial_console |
| Global serial console. | |
Implementation of formatted print functions for kernel debugging.
Implements variadic print helpers and serial output wiring for the in-kernel diagnostic console.
|
static |
Convert an unsigned integer to a string using the given base.
This helper writes the string representation of num into buf. The resulting string is always null-terminated.
| num | Number to convert. |
| base | Numerical base for conversion (e.g. 10 for decimal, 16 for hex). |
| buf | Buffer to receive the converted string. Must be large enough to hold the result. |
| int kprintf | ( | const char * | format, |
| ... | |||
| ) |
Standard formatted print to the serial console.
A wrapper around vprintf that handles variadic argument initialization and cleanup.
| format | Formatting string containing plain text and specifiers. |
| ... | Variable arguments matching the specifiers in the format string. |
| void set_kprintf_console | ( | serial_t | console | ) |
Configures the global serial console used by kprintf.
Sets the function pointers that kprintf will use to output characters.
| console | A serial_t structure containing initialized function pointers. |
| int vprintf | ( | const char * | format, |
| va_list | args | ||
| ) |
Variadic print function.
Processes the format string and arguments, outputting characters via the configured serial console.
Supports: %c, %s, %d, %u, %x, %p. A leading 'l' length modifier (e.g. lx) is accepted, but the character after 'l' is consumed and ignored — any l followed by any character is always printed as unsigned hex, regardless of what that character actually is.
| format | Formatting string containing plain text and specifiers. |
| args | An initialized va_list containing the arguments to be formatted. |