Source file descriptions

From Dexter
Jump to navigationJump to search

This page provides a list of source files that make up the Dexter kernel and provides a brief description of each. This page is a work in progress.

src/fs

disk.c

disk.c is the low level disk functions to initialize the disk devices and read from individual disk sectors. disk.h should be included to use the disk functions in the disk.c file. It also contains definitions for the disk struct type and DEXTER_DISK_TYPE.

file.c

file.c provides functions required for initializing and interacting with file systems at the vfs level. These functions are independent of any specific file system implementation. file.h contains the structure definitions for a filesystem and file_descriptor as well as important typedef declarations. Header should be included to call non-static functions in file.c.

pathparser.c

pathparser.c contains functions for parsing file paths by the internal file system. pathparser.h contains function and struct declarations for pathparser.c.

src/lib

console.c

console.c is where you'll find functions to initialize the text console as well as writing to the screen. The print and cprint functions are the current preferred way to write to the console. console.h should be included to use the terminal functions in the console.c file. It also defines VGA_HEIGHT and VGA_WIDTH.

string.c

string.c provides a minimal set of string manipulation functions. This set of functions will grow over time as the need for more string related functions arise. Include string.h to use the string manipulation functions in string.c.

utility.c

utility.c contains a miscellaneous set of functions from the C standard library. Anything that doesn't belong in string.c or console.c will be placed here for now. It currently contains implementation of rand and srand, but more will be added as required. Include utility.h to use the utility functions implemented from the C standard library.

src/mem

heap.c

heap.c contains the heap memory implementation including heap creation and utility functions. It also includes versions of malloc and free for allocating and freeing memory on the heap. heap.h needs to be included if you need to allocate memory on the heap. It also contains the heap and heap_table structure definitions.

memory.c

memory.c provides common memory functions from the C standard library. memset and memcpy are the only two functions implemented so far as of this update. memory.h needs to be included to call memory utility functions from memory.c.

src/proc

task.c

task.c contains the functions required to initialize, create, and manage tasks within the kernel. task.h contains definitions for the task and registers structures. It also contains function definitions for task_new(struct process* process) and many other task related functions.

src/sys

boot.asm

boot.asm contains the assembly code that starts the boot process and changes the CPU from 16-bit real mode to 32-bit protected mode.

config.h

config.h contains definitions providing text replacements for magic numbers.

io.asm

io.asm contains the low level assembly routines we call from C to communicate directly with hardware ports. This includes outb, outw, insb, and insw. Include io.h to access the in and out functions defined in io.asm.

kernel.asm

Assembly instructions to initialize the various segments, set the base pointer, enable the A20 line, and remap the master pick. It then calls an external function which is the kernel_main C function defined in kernel.c.

kernel.c

kernel.c contains the kernel_main function which is the C entry point for the kernel. All code executed prior to kernel_main are assembly instructions. Its primary purpose is to call functions from various other files to initialize various parts of the operating system. kernel.h contains definitions for kernel.c as well as some general kernel definitions.

status.h

status.h contains definitions of error codes and will be used to store other status related values later.