|
My Kernel v0.1.0
|

Macros | |
| #define | PANIC(...) |
| Call the panic function with the appropriate parameters. | |
| #define | log_array_fmt(_arr, _len, _fmt) |
| Print the content of an array. More... | |
Enumerations | |
| enum | log_level { } |
| The different available logging levels. More... | |
Functions | |
| void | log (enum log_level, const char *domain, const char *msg,...) |
| Print a log message onto the terminal. More... | |
| void | panic (u32 esp, const char *msg,...) __attribute__((__noreturn__)) |
| Completely stop the kernel's execution. More... | |
| void | stack_trace (void) |
| Print the callstack to the kernel's console. | |
| void | log_set_level (enum log_level) |
| Change the maximum log level to display. | |
| #define | log_err(format, ...) log(LOG_LEVEL_ERR, LOG_DOMAIN, format __VA_OPT__(, ) __VA_ARGS__) |
| Print a log message to the kernel's console. | |
| #define | log_warn(format, ...) log(LOG_LEVEL_WARN, LOG_DOMAIN, format __VA_OPT__(, ) __VA_ARGS__) |
| Print a log message to the kernel's console. | |
| #define | log_info(format, ...) log(LOG_LEVEL_INFO, LOG_DOMAIN, format __VA_OPT__(, ) __VA_ARGS__) |
| Print a log message to the kernel's console. | |
| #define | log_dbg(format, ...) log(LOG_LEVEL_DEBUG, LOG_DOMAIN, format __VA_OPT__(, ) __VA_ARGS__) |
| Print a log message to the kernel's console. | |
| #define | log_variable(_var) log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT32, stringify(_var), _var) |
| Print the content of a variable to the kernel's terminal. More... | |
| #define | log_variable_8(_var) log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT8, stringify(_var), _var) |
| Print the content of a variable to the kernel's terminal. More... | |
| #define | log_variable_16(_var) log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT16, stringify(_var), _var) |
| Print the content of a variable to the kernel's terminal. More... | |
| #define | log_variable_64(_var) log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT64, stringify(_var), _var) |
| Print the content of a variable to the kernel's terminal. More... | |
| #define | log_variable_str(_var) log(LOG_LEVEL_DEBUG, "variable", "%s=%s", stringify(_var), _var) |
| Print the content of a variable to the kernel's terminal. More... | |
| #define | log_array(_arr, _len) log_array_fmt(_arr, _len, FMT32) |
| Print the content of an array. More... | |
| #define | log_array_8(_arr, _len) log_array_fmt(_arr, _len, FMT8) |
| Print the content of an array. More... | |
| #define | log_array_16(_arr, _len) log_array_fmt(_arr, _len, FMT16) |
| Print the content of an array. More... | |
| #define | log_array_64(_arr, _len) log_array_fmt(_arr, _len, FMT64) |
| Print the content of an array. More... | |
| #define | log_array_str(_arr, _len) log_array_fmt(_arr, _len, "%s") |
| Print the content of an array. More... | |
Logger library for our kernel
When using the logger, one must specify a domain used as a prefix for the message. The domain name is specified by defining the LOG_DOMAIN macro. If this macro is not defined, no prefix will be prefixed to the message.
For example, when logging an error related to serial devices, the caller could include this header file as follows:
| #define log_array | ( | _arr, | |
| _len | |||
| ) | log_array_fmt(_arr, _len, FMT32) |
There exists different version of this wrapper depending on the size of the types inside the array.
| #define log_array_16 | ( | _arr, | |
| _len | |||
| ) | log_array_fmt(_arr, _len, FMT16) |
There exists different version of this wrapper depending on the size of the types inside the array.
| #define log_array_64 | ( | _arr, | |
| _len | |||
| ) | log_array_fmt(_arr, _len, FMT64) |
There exists different version of this wrapper depending on the size of the types inside the array.
| #define log_array_8 | ( | _arr, | |
| _len | |||
| ) | log_array_fmt(_arr, _len, FMT8) |
There exists different version of this wrapper depending on the size of the types inside the array.
| #define log_array_fmt | ( | _arr, | |
| _len, | |||
| _fmt | |||
| ) |
| _arr | The array to print |
| _len | The number of elements inside the array |
| _fmt | The format to use for the elements (LOG_FMT_*) |
| #define log_array_str | ( | _arr, | |
| _len | |||
| ) | log_array_fmt(_arr, _len, "%s") |
There exists different version of this wrapper depending on the size of the types inside the array.
| #define log_variable | ( | _var | ) | log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT32, stringify(_var), _var) |
The name of the variable will be prefixed to the message.
There exists different version of this macro, depending on the type (numeric or string), and bit size (for numerics) of the variable.
| #define log_variable_16 | ( | _var | ) | log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT16, stringify(_var), _var) |
The name of the variable will be prefixed to the message.
There exists different version of this macro, depending on the type (numeric or string), and bit size (for numerics) of the variable.
| #define log_variable_64 | ( | _var | ) | log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT64, stringify(_var), _var) |
The name of the variable will be prefixed to the message.
There exists different version of this macro, depending on the type (numeric or string), and bit size (for numerics) of the variable.
| #define log_variable_8 | ( | _var | ) | log(LOG_LEVEL_DEBUG, "variable", "%s=" FMT8, stringify(_var), _var) |
The name of the variable will be prefixed to the message.
There exists different version of this macro, depending on the type (numeric or string), and bit size (for numerics) of the variable.
| #define log_variable_str | ( | _var | ) | log(LOG_LEVEL_DEBUG, "variable", "%s=%s", stringify(_var), _var) |
The name of the variable will be prefixed to the message.
There exists different version of this macro, depending on the type (numeric or string), and bit size (for numerics) of the variable.
| enum log_level |
| void log | ( | enum | log_level, |
| const char * | domain, | ||
| const char * | msg, | ||
| ... | |||
| ) |
All logging functions will prefix the message with the specified domain name. The latter will change color depending on the logging level.
| level | The level of the log |
| domain | Used as a prefix to the error message. |
| msg | The actual message |
| void panic | ( | u32 | esp, |
| const char * | msg, | ||
| ... | |||
| ) |
This function writes a BOLD RED message to the screen, and completely halts the kernel's execution.
This should only be called in case of unrecoverable errors, or asserts that should never be false and would prevent the kernel from functioning as expected.
@info This function's implementation is arch-specific