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

Main File for the experimental kernel & OS. More...

#include <stddef.h>
#include <stdbool.h>
#include <drivers/serial.h>
#include <drivers/console.h>
#include <drivers/keyboard.h>
#include <arch/x86_64/idt.h>
#include <arch/x86_64/gdt.h>
#include <arch/x86_64/irq.h>
#include <arch/x86_64/pic.h>
#include <arch/x86_64/pit.h>
#include <lib/kstring.h>
#include <lib/parser.h>
#include <limine/limine.h>
#include <kernel/tests.h>
#include <kernel/panic.h>
#include <kernel/assert.h>
#include <kernel/hexdump.h>
#include <kernel/kprintf.h>
#include <kernel/vars.h>
#include <kernel/log.h>
#include <mm/pmm.h>
#include "arch/x86_64/paging.h"
#include "mm/vmm.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

static void hcf (void)
 Halts the CPU, outputs the uptime, and outputs the user input to the console.
static void draw_pixel (struct limine_framebuffer *fb, uint64_t x, uint64_t y, uint8_t red, uint8_t green, uint8_t blue)
 Draws a pixel to the screen.
static void limine_request_verification (void)
 Output the limine request responses.
static bool output_init (void)
 Initialize the output systems (serial and framebuffer console) and parse any flags.
static void interrupt_system_init (void)
 Initialize the interrupt system.
static void memory_init (void)
 Initialize the memory systems (Physical Memory Manager, Virtual Memory Manager, etc) and test them.
static void gdt_idt_init (void)
 Initialize and test the GDT & IST.
static void kernel_self_tests (void)
 Run some kernel self tests.
 __attribute__ ((used, section(".limine_requests")))
 __attribute__ ((used, section(".limine_requests_end")))
 The main function called on OS boot.

Variables

int font_type
static bool out_of_memory_test_1 = false
static bool out_of_memory_test_2 = false
static bool double_free_test = false
struct console main_console
 The main console info.

Detailed Description

Main File for the experimental kernel & OS.

Author
Matheus Boscariol
Since
02/11/2026

Definition in file main.c.

Function Documentation

◆ __attribute__() [1/2]

__attribute__ ( (used, section(".limine_requests")) )

Definition at line 60 of file main.c.

◆ __attribute__() [2/2]

__attribute__ ( (used, section(".limine_requests_end")) )

The main function called on OS boot.

Definition at line 131 of file main.c.

Here is the call graph for this function:

◆ draw_pixel()

void draw_pixel ( struct limine_framebuffer * fb,
uint64_t x,
uint64_t y,
uint8_t red,
uint8_t green,
uint8_t blue )
static

Draws a pixel to the screen.

Parameters
fbReference to the framebuffer
xThe x pixel coordinate starting at 0
yThe y pixel coordinate starting at 0
redAmount of red in the pixel (0-255)
greenAmount of green in the pixel (0-255)
blueAmount of blue in the pixel (0-255)

Definition at line 275 of file main.c.

◆ gdt_idt_init()

void gdt_idt_init ( void )
static

Initialize and test the GDT & IST.

Definition at line 847 of file main.c.

Here is the call graph for this function:

◆ hcf()

void hcf ( void )
static

Halts the CPU, outputs the uptime, and outputs the user input to the console.

Definition at line 165 of file main.c.

Here is the call graph for this function:

◆ interrupt_system_init()

void interrupt_system_init ( void )
static

Initialize the interrupt system.

Definition at line 518 of file main.c.

Here is the call graph for this function:

◆ kernel_self_tests()

void kernel_self_tests ( void )
static

Run some kernel self tests.

Definition at line 878 of file main.c.

Here is the call graph for this function:

◆ limine_request_verification()

void limine_request_verification ( void )
static

Output the limine request responses.

Definition at line 295 of file main.c.

Here is the call graph for this function:

◆ memory_init()

void memory_init ( void )
static

Initialize the memory systems (Physical Memory Manager, Virtual Memory Manager, etc) and test them.

Definition at line 550 of file main.c.

Here is the call graph for this function:

◆ output_init()

bool output_init ( void )
static

Initialize the output systems (serial and framebuffer console) and parse any flags.

Returns
Was the initialization successful

Definition at line 415 of file main.c.

Here is the call graph for this function:

Variable Documentation

◆ double_free_test

bool double_free_test = false
static

Definition at line 55 of file main.c.

◆ font_type

int font_type
extern

Definition at line 17 of file console.c.

◆ main_console

struct console main_console
extern

The main console info.

Definition at line 20 of file console.c.

◆ out_of_memory_test_1

bool out_of_memory_test_1 = false
static

Definition at line 53 of file main.c.

◆ out_of_memory_test_2

bool out_of_memory_test_2 = false
static

Definition at line 54 of file main.c.