LF OS
Hobby operating system for amd64 with high ambitions
Loading...
Searching...
No Matches
log.c File Reference

(7c4d7d1 userspace/term: change eyecandy inclusion to use objcopy instead of xxd)

#include <config.h>
#include <stdint.h>
#include <string.h>
#include <panic.h>
#include <fbconsole.h>
#include <log.h>
#include <vm.h>
#include <scheduler.h>
#include <efi.h>
#include <io.h>
+ Include dependency graph for log.c:

Go to the source code of this file.

Data Structures

struct  logging_page
 

Functions

void log_append_page (void)
 
void log_append (char level, char *component, char *message)
 
void log (char level, char *component, char *fmt,...)
 
void sc_handle_debug_print (char *message)
 

Variables

const int logging_page_size = 4080
 
struct logging_page log_initial_page
 
struct logging_pagelog_first = &log_initial_page
 
struct logging_pagelog_last = &log_initial_page
 
uint64_t log_page_count = 1
 
uint64_t log_count = 0
 

Data Structure Documentation

◆ logging_page

struct logging_page

Definition at line 14 of file log.c.

+ Collaboration diagram for logging_page:
Data Fields
uint16_t current_end
char messages[logging_page_size - 18]
struct logging_page * next
struct logging_page * prev

Function Documentation

◆ log()

void log ( char  level,
char *  component,
char *  fmt,
  ... 
)

Append a log message to the kernel log buffer

Parameters
levelLog level of the message (D, I, W, E, F -> debug, info, warning, error, fatal)
componentSub component (kernel, mm, vm, scheduler, ...)
fmtsprintf format string
...Variables to set in the resulting message

Definition at line 120 of file log.c.

References kvsnprintf(), log_append(), logging_page_size, memset(), va_end, and va_start.

+ Here is the call graph for this function:

◆ log_append()

void log_append ( char  level,
char *  component,
char *  message 
)

Append a log message to the kernel log buffer

Parameters
levelLog level of the message (D, I, W, E, F -> debug, info, warning, error, fatal)
componentSub component (kernel, mm, vm, scheduler, ...)
messageMessage to log

Definition at line 62 of file log.c.

References logging_page::current_end, efi_append_log(), fbconsole_active, fbconsole_write(), inb(), ksnprintf(), log_append_page(), log_count, log_first, log_last, message, logging_page::messages, outb(), and strlen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log_append_page()

void log_append_page ( void  )

Definition at line 34 of file log.c.

References logging_page::current_end, log_count, log_first, log_initial_page, log_last, log_page_count, logging_page_size, memset(), logging_page::messages, logging_page::next, logging_page::prev, vm_alloc(), and vm_free().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_handle_debug_print()

void sc_handle_debug_print ( char *  message)

Definition at line 132 of file log.c.

References ksnprintf(), logd, message, scheduler_current_process, and strlen().

+ Here is the call graph for this function:

Variable Documentation

◆ log_count

uint64_t log_count = 0

Definition at line 32 of file log.c.

◆ log_first

struct logging_page* log_first = &log_initial_page

Definition at line 29 of file log.c.

◆ log_initial_page

struct logging_page log_initial_page
Initial value:
= {
.prev = 0,
.next = 0,
.current_end = 0,
}

Definition at line 23 of file log.c.

◆ log_last

struct logging_page* log_last = &log_initial_page

Definition at line 30 of file log.c.

◆ log_page_count

uint64_t log_page_count = 1

Definition at line 31 of file log.c.

◆ logging_page_size

const int logging_page_size = 4080

Definition at line 12 of file log.c.