IBNOS
Functions
main.c File Reference
#include <multiboot/multiboot.h>
#include <console/console.h>
#include <memory/physmem.h>
#include <memory/paging.h>
#include <memory/allocator.h>
#include <hardware/gdt.h>
#include <hardware/pic.h>
#include <hardware/keyboard.h>
#include <hardware/pit.h>
#include <process/object.h>
#include <process/process.h>
#include <process/thread.h>
#include <process/pipe.h>
#include <process/timer.h>
#include <process/filesystem.h>
#include <process/handle.h>
#include <loader/elf.h>
#include <util/list.h>
#include <util/util.h>
Include dependency graph for main.c:

Go to the source code of this file.

Functions

uint32_t __getCR0 ()
 
 asm (".text\align 4\ "__getCR0:\" " movl %cr0, %eax\" " ret\")
 
uint32_t __setCR0 (uint32_t value)
 
 asm (".text\align 4\ "__setCR0:\" " movl 4(%esp), %eax\" " movl %eax, %cr0\" " ret\")
 
void fpuInit ()
 Initializes the FPU related bits in the CR0 register. More...
 
struct processloadELFModule (void *addr, uint32_t length)
 Spawns a new process, and afterwards loads the ELF module into it. More...
 
void kernel_main (multiboot_info_t *bootInfo)
 Kernel main entry point. More...
 

Function Documentation

◆ __getCR0()

uint32_t __getCR0 ( )

◆ __setCR0()

uint32_t __setCR0 ( uint32_t  value)

◆ asm() [1/2]

asm ( ".text\ign 4\__getCR0:\ " movl %  cr0,
%eax\" " ret\"   
)

◆ asm() [2/2]

asm ( ".text\lign 4\"__setCR0:\" " movl   4%esp,
%eax\" " movl %  eax,
%cr0\" " ret\"   
)

◆ fpuInit()

void fpuInit ( )

Initializes the FPU related bits in the CR0 register.

Definition at line 72 of file main.c.

◆ kernel_main()

void kernel_main ( multiboot_info_t bootInfo)

Kernel main entry point.

This function is the kernel main entry point, which is called after GRUB has loaded the kernel into the physical memory address specified in the linker script (linker.ld). The passed argument contains information about the kernel command line arguments and the memory layout returned by the BIOS. This function will never return.

Parameters
bootInfoBootinfo structure filled by the GRUB bootloader

Definition at line 125 of file main.c.

◆ loadELFModule()

struct process* loadELFModule ( void *  addr,
uint32_t  length 
)

Spawns a new process, and afterwards loads the ELF module into it.

The provided memory address and length should represent an ELF module which is loaded into the kernel memory. This function will spawn a new process, copy the ELF sections into newly allocated memory, and create the main thread which is initialized to start with the entry point.

Parameters
addrAddress pointing to the begin of the ELF module
lengthLength of the ELF module in bytes
Returns
Kernel process object

Definition at line 95 of file main.c.