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.
Loading...
Searching...
No Matches
Functions
error_strings.c File Reference

Implementation of error code to string translation. More...

#include "error/error_strings.h"
Include dependency graph for error_strings.c:

Functions

const char * error_to_string (long code)
 Converts a numeric error code into a human-readable string.
 

Detailed Description

Implementation of error code to string translation.

Provides the run-time mapping from numeric kernel error codes to human- readable messages used by diagnostic subsystems.

Author
Abhin Parekadan Jose
Date
2026-04-11

Function Documentation

◆ error_to_string()

const char * error_to_string ( long  code)

Converts a numeric error code into a human-readable string.

This function maps internal kernel error constants (e.g., ERROR_CODE_NOT_EL1) to descriptive string literals. It is primarily used by the panic handler to provide diagnostic feedback over UART when a fatal error occurs.

Parameters
codeThe numeric error code triggered by the kernel or bootloader.
Returns
A pointer to a constant null-terminated string representing the error. Returns "UNKNOWN" if the code is not recognized.
Note
This function is designed to be safe for use during early boot or panic states; it does not allocate memory and relies solely on strings stored in the .rodata section.