summaryrefslogtreecommitdiff
path: root/docs/MODULES.md
blob: cf452ffe62b0c45e479fac7bca4cf1d75cb10649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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.