LumaOS  v0.1.116
An experimental x86-64 OS
Loading...
Searching...
No Matches
kprintf.c File Reference

Tools for printing to the console and serial output. More...

#include <kernel/kprintf.h>
#include <drivers/console.h>
#include <drivers/serial.h>
#include <arch/x86_64/io.h>
#include <lib/kstring.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for kprintf.c:

Go to the source code of this file.

Macros

#define ANSI_NONE   0
#define ANSI_TEXT_EFFECT   1

Functions

void kprintf (const char *fmt,...)
void kvprintf (const char *fmt, va_list ap)
 Handles printing a formatted string.
void kputc (char c)
 Sends characters to print in the console and serial.
void print_unsigned (unsigned long long value, uint8_t base, bool uppercase, uint8_t _length)
 Prints unsigned integers of any base lower than base 36.
void print_signed (long long value, uint8_t len)
 Prepares a signed number to be printed through the unsigned print.

Detailed Description

Tools for printing to the console and serial output.

Author
Matheus Boscariol
Since
30/10/2026

Definition in file kprintf.c.

Function Documentation

◆ kprintf()

void kprintf ( const char * fmt,
... )

Definition at line 18 of file kprintf.c.

◆ kputc()

void kputc ( char c)

Sends characters to print in the console and serial.

Parameters
cThe character to print

Definition at line 410 of file kprintf.c.

Here is the call graph for this function:

◆ kvprintf()

void kvprintf ( const char * fmt,
va_list ap )

Handles printing a formatted string.

Parameters
fmtThe string with format characters
apThe list of extra arguments

Definition at line 28 of file kprintf.c.

Here is the call graph for this function:

◆ print_signed()

void print_signed ( long long value,
uint8_t len )

Prepares a signed number to be printed through the unsigned print.

Parameters
valueThe integer to print
lenThe minimum length for the printed integer (see print_unsigned())

Definition at line 466 of file kprintf.c.

Here is the call graph for this function:

◆ print_unsigned()

void print_unsigned ( unsigned long long value,
uint8_t base,
bool uppercase,
uint8_t _length )

Prints unsigned integers of any base lower than base 36.

Parameters
valueThe int to print
baseThe base to print in (base 10 (0-9), base 16 (0-9 + a-f), base 2 (0 & 1), etc..)
uppercaseShould it use the uppercase letters for base 11+
_lengthThe minimum length for digits (123 with _length=5 will print as "00123")

Definition at line 415 of file kprintf.c.

Here is the call graph for this function: