blob: 31d3ebae872635cb593605671fbad3a9faac4dfb (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# 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.
# syscall.c
Syscall implentation functions for each syscall
See SYSCALLS.md
# term.c
Manages text terminal. All text printed to standard out or err will be printed
to this terminal.
- contains a terminal buffer for allowing scrolling of the screen
- manages redrawing the terminal when scrolling or changing terminal handler
- vga text mode v.s. gpu framebuffer
# user.c
Loads user ELF binaries into memory and initalizes them into a PCB.
See PCB.md
- `user_load` - load a user process form the filesystem into memory
- `user_clone` - clones the user process
- `user_cleanup` - cleans up a user process
|