summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/DRIVERS.md47
-rw-r--r--docs/FS.md0
-rw-r--r--docs/HEADERS.md0
-rw-r--r--docs/MEMORY.md0
-rw-r--r--docs/MODULES.md109
-rw-r--r--docs/PCB.md53
6 files changed, 209 insertions, 0 deletions
diff --git a/docs/DRIVERS.md b/docs/DRIVERS.md
new file mode 100644
index 0000000..e17e15e
--- /dev/null
+++ b/docs/DRIVERS.md
@@ -0,0 +1,47 @@
+# Drivers
+
+All drivers and their uses
+
+## acpi.c
+
+ACPI (Advanced Configuration and Power Interface)
+- allows powering off the system
+
+## ata.c
+
+ATA (Advanced Technology Attachment) / IDE (Integrated Drive Electronics)
+- ide/ata disk device driver
+
+## clock.c
+
+COMS real time clock driver
+
+## gpu/
+
+Contains drivers for each type of gpu
+- Bochs (QEMU default gpu device)
+- GOP (Graphics Output Protocol), UEFI framebuffer
+
+## gpu.c
+
+Functions for abstracting over current loaded gpu
+
+## pci.c
+
+PCI (Peripheral Component Interconnect)
+- driver to load pci devices (not pcie)
+
+## pit.c
+
+PIT (Programmable Interval Timer)
+- sends timer interrupts to the pic
+- set pc speaker tones
+
+## ps2.c
+
+PS2 Controller / Keyboard / Mouse driver
+- allows keyboard / mouse input
+
+## uart.c
+
+Serial (UART) driver
diff --git a/docs/FS.md b/docs/FS.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docs/FS.md
diff --git a/docs/HEADERS.md b/docs/HEADERS.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docs/HEADERS.md
diff --git a/docs/MEMORY.md b/docs/MEMORY.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docs/MEMORY.md
diff --git a/docs/MODULES.md b/docs/MODULES.md
new file mode 100644
index 0000000..cf452ff
--- /dev/null
+++ b/docs/MODULES.md
@@ -0,0 +1,109 @@
+# modules
+
+list of all kernel modules and their functions
+
+## cpu/
+
+Initalizes all cpu components and low level tabels.
+- FPU / SSE / AVX
+- IDT (Interrupt Descriptor Table)
+- PIC (Programmable Interrupt Controller)
+- TSS (Task State Segment)
+ - used for allowing kernel to switch into ring 3
+ - used for setting kernel stack on interrupt
+
+## drivers/
+
+Folder `drivers/` contains drivers for the system. See DRIVERS.md.
+
+File `drivers.c` loads each of the drivers in `drivers/`.
+
+## efi/
+
+Load UEFI components
+- UEFI memory map
+- GOP (Graphics Output Protocol), UEFI framebuffer
+
+## entry.S
+
+Entry point into the kernel along with:
+- GDT (Global Descriptor Table)
+- Multiboot header see https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html
+- Inital kernel stack
+ - not used once interrupts since interrupt stack will be used
+- Inital page tables
+ - see MEMORY.md
+
+Symbols:
+- `_start`
+ - generic legacy bios entrypoint in IA-32 mode
+
+- `_start_efi`
+ - uefi entrypoint in IA-32e mode
+
+## font/
+
+Loads psf2 font files into kernel .rodata segment
+
+## fs/
+
+See FS.md
+
+## include/
+
+All kernel headers.
+
+- SEE HEADERS.md
+
+## input.c
+
+Abstracts all input from all sources over a single keycode / mouseevent buffer.
+- uses ps2 and uart
+
+## lib/
+
+Kernel c library
+
+Notable files:
+
+- `backtrace.c` - does stack backtraces and logs them to output
+ - used during exceptions
+- `kspin.c`
+ - spinlock in kernel space
+- `panic.c`
+ - implements panic functions, along with halt called during exceptions or panic
+
+## main.c
+
+Kernel main entrypoint.
+- Loads all components of the kernel in order.
+- Loads init process
+- Dispatches init
+
+## mboot/
+
+Laod information provided by multiboot standard
+- `efi.c` - gets `EFI_SYSTEM_TABLE` & `EFI_HANDLE`
+ - read UEFI standard for more information
+- `mmap.c` - load memory map when in legacy boot
+ - memory map is loaded from `efi/` module when booting from UEFI
+- `module.c`
+ - loads initrd (ramdisk)
+- `rsdp.c`
+ - load root ACPI table, provided for the ACPI driver
+
+## memory/
+
+See MEMORY.md
+
+## procs.c
+
+Stores loaded process information and scheduler
+- multiple queues for scheduling
+ - ready - pcb is ready to be executed
+ - zombie - pcb is a zombie, and waiting to be cleaned up
+ - syscall - replaced blocked/waiting in baseline
+ - each syscall has its own queue
+ - acessed though syscall_queue[SYS_num]
+
+See PCB.md for pcb information.
diff --git a/docs/PCB.md b/docs/PCB.md
new file mode 100644
index 0000000..9eaa2a2
--- /dev/null
+++ b/docs/PCB.md
@@ -0,0 +1,53 @@
+# PCB
+
+PCB information
+
+## context
+
+Contains context infromation for the curernt process.
+- memory context (pcb->memctx)
+ - stores page directory and vitural address allocateor (see MEMORY.md)
+- context save area (pcb->regs)
+
+## medatada
+
+- `pid` - process idenfitication number
+- `parent` ` - parent of the current process
+ - can be NULL if the init process
+- `state` - the current runing state of the process
+ - `UNUSED` - proces in ptable is not used
+ - `NEW` - process in ptable has been allocated but has not been initalized
+ - `READY` - process is ready to be dispatched (and in ready queue)
+ - `RUNNING` - process is the current running process (and in no queues)
+ - `BLOCKED` - process is in a syscall queue waiting on their syscall to return
+ - `ZOMBIE` - process is a zombie and waiting to be cleaned up (in zombie queue)
+- `priority` - running process priority
+ - any number form 0 to SIZET_MAX
+ - higher priority means longer wait to be scheduled
+- `ticks` - number of ticks the process has been running for
+ - set to zero when process is not running
+
+## heap
+
+- `heap_start` is the start of the progams heap
+- `heap_len` is the length of the programs heap
+
+## open files
+
+- `open_files` is a list of currently opened files indexed by file descriptor
+
+## elf metadata
+
+- `elf_header` - the programs elf header (Elf64_Ehdr)
+- `elf_segments` - the programs loadable elf segments (Elf64_Phdr[])
+- `n_elf_segments` - the number of elf segmsnts the program has
+
+## queue linkage
+
+- `next` - the next pcb in the current queue this pcb is in
+
+## processs state information
+
+- `syscall` - the current syscall this process is blocked on
+- `wakeup` - the number of ticks until the process can be waked up (used during SYS_sleep)
+- `exit_status` - the exit status of the process when a zombie