Bananymous
7ef751ba95
Kernel: Fix multiprocessor for i686
...
i686 is now actually ran with multiple processors.
2024-04-03 14:42:17 +03:00
Bananymous
f8c01418b1
Kernel: Fix multiprocessing on x86_64
...
I did not even start APs after initializing them... :D
2024-04-03 14:21:55 +03:00
Bananymous
d2df55b1ac
Kernel: Allow booting with multiple processors on i686
...
Also remove unnecessary ds clearing in x86_64.
2024-04-03 02:30:38 +03:00
Bananymous
0dd74e3c9d
Kernel: Implement syscalls for i686 and cleanup x86_64
...
This actually allows i686 to boot properly!
2024-04-03 02:23:23 +03:00
Bananymous
fe386fa819
Kernel: Implement thread start trampoline for userspace
...
This is needed on i686 to set segment registers.
2024-04-03 00:42:39 +03:00
Bananymous
4d70322eab
Kernel: Save segment registers on all interrupts on i686
2024-04-03 00:41:13 +03:00
Bananymous
d9b8391968
Kernel: Fix i686 page table global mappings
2024-04-03 00:40:16 +03:00
Bananymous
2106a9e373
Kernel: Rework scheduler/processor stacks.
2024-04-02 12:34:42 +03:00
Bananymous
5050047cef
Kernel: Rewrite whole scheduler
...
Current context saving was very hacky and dependant on compiler
behaviour that was not consistent. Now we always use iret for
context saving. This makes everything more clean.
2024-03-29 18:02:12 +02:00
Bananymous
96babec22a
Kernel: Implement Thread trampolines for x86_32
2024-03-26 21:01:18 +02:00
Bananymous
c12d1e9bd9
Kernel: Implement PageTable for x86_32
...
This is mostly copied from x86_64 with necessary modifications
2024-03-26 20:16:20 +02:00
Bananymous
d7bf34ecd0
Kernel: Write isr handler for x86_32 and cleanup x86_64
2024-03-26 20:16:20 +02:00
Bananymous
1943c3e7a1
Kernel: Unify IDT and GDT code between x86_64 and x86_32
...
The code is pretty much the same, so there are just couple macros
differiating initialization.
2024-03-26 16:42:02 +02:00
Bananymous
af050cc729
Kernel: Fix boot code for x86_32
...
Boot assembly now initializes processor and jumps to kernel
2024-03-26 13:25:22 +02:00
Bananymous
99e30a4d7d
Kernel: Replace i386 with i686
...
I don't really want to be working with i386 since it doesn't support
compare exchange instruction
2024-03-26 02:48:26 +02:00
Bananymous
fc7e96fa66
Kernel: Rewrite i386 boot code + linker script
2024-03-26 00:10:42 +02:00
Bananymous
097d9a6479
Kernel: Implement dummy IDT and GDT for i386
2024-03-26 00:10:42 +02:00
Bananymous
2dd0bfdece
Kernel: Make i386 thread tramplines crash
2024-03-26 00:10:42 +02:00
Bananymous
26585bb1d9
Kernel: Implement signal trampoline for i386
2024-03-22 15:41:15 +02:00
Bananymous
0d92719433
Kernel: Remove old i386 spinlock code
2024-03-22 15:41:15 +02:00
Bananymous
1ab2722850
Kernel: Add PageTable stub to progress linking
2024-03-22 15:41:15 +02:00
Bananymous
fe17958b9f
Kernel: Rename rsp->sp and rip->ip
...
This makes more sense if we support i386
2024-03-22 15:41:15 +02:00
Bananymous
45cea14165
Kernel: Move sys_fork trampolines to kernel/arch/ directory
2024-03-22 12:48:54 +02:00
Bananymous
26ed689d30
Kernel: Remove old GDT, IDT and MMU code from i386
...
It will be easier to just rewrite them
2024-03-22 12:47:34 +02:00
Bananymous
42469b83fe
Kernel: kernel panic is now sent to all processors
2024-03-15 13:45:01 +02:00
Bananymous
e65bc040af
Kernel: Now all active processors are used in scheduling
...
When a timer reschedule happens, ipi is broadcasted too all
processors for them to perform a reschedule!
2024-03-09 23:53:50 +02:00
Bananymous
89ca4c8a8b
Kernel: Implement IPI broadcasting
2024-03-09 23:53:38 +02:00
Bananymous
55d2a64f54
Kernel: Map interrupt handlers for all processors
...
This doesn't mean that processors will actually handle the irqs
2024-03-09 23:50:57 +02:00
Bananymous
29fd682672
Kernel: Store current processor pointer in IA32_GS_BASE
...
This allows easier access to processors fields
2024-03-07 16:05:29 +02:00
Bananymous
54f64e7618
Kernel: Move current page table to Processor
...
APs can now map kernel page table and print current time!
2024-03-06 02:19:59 +02:00
Bananymous
76b0f80169
Kernel: Move IDT to Processor
2024-03-06 00:45:54 +02:00
Bananymous
58aca68726
Kernel: Move GDT to Processor
2024-03-06 00:35:45 +02:00
Bananymous
9c36d7c338
BAN/Kernel: Rework assertion/panic system
...
BAN/Assert.h does not need any includes meaning it can be included
anywhere without problems.
2024-03-04 11:41:54 +02:00
Bananymous
8141b9977d
Kernel: Per processor information is now stored in class Processor
...
This allows us to allocate processor stacks, and other per processor
structures dynamically in runtime. Giving processor stack to
ap_trampoline feels super hacky, but it works for now.
2024-03-03 22:30:06 +02:00
Bananymous
c035d3c82c
Kernel: Start all processors on kernel boot
...
Processors don't do anything, except print hello message and halt.
2024-03-03 02:19:43 +02:00
Bananymous
ec0cb5fd54
Kernel: Remove CriticalScopes from memory handing code
2024-02-29 19:16:41 +02:00
Bananymous
d94f6388b7
Kernel: Fix all broken locks from new mutexes
2024-02-28 22:45:34 +02:00
Bananymous
9314528b9b
Kernel: Improve syscall handling
...
Syscalls are now called from a list of function pointers
2024-02-12 21:51:11 +02:00
Bananymous
139bb5c2a5
Kernel: Fix linker script
...
I have no idea why rodata was executable :D
2024-01-30 17:32:50 +02:00
Bananymous
dfe5a2d665
All: Cleanup all files
...
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00
Bananymous
b0ff2392a1
Kernel: Add some helpful debug prints
...
Log RIP when stack pointer is out of bounds.
Log all syscalls that return ENOTSUP
2024-01-03 02:08:01 +02:00
Bananymous
001e95f973
Kernel: Optimize sse saving/loading
...
Only save and load sse when new thread is trying to execute sse
instruction. There is no need to do that every time we enter kernel.
2024-01-03 02:06:49 +02:00
Bananymous
4307968182
All: Start work again on sse support
2023-12-28 19:14:42 +02:00
Bananymous
284a012509
Kernel: Add framebuffer information to kernel image
2023-12-09 17:33:58 +02:00
Bananymous
1c78671078
Kernel: Rework all signal code
...
Signal handling code was way too complex. Now everything is
simplified and there is no need for ThreadBlockers.
Only complication that this patch includes is that blocking syscalls
have to manually be made interruptable by signal. There might be some
clever solution to combat this is make this happen automatically.
2023-12-06 13:02:17 +02:00
Bananymous
84040e64b8
Kernel: Don't use multiboot2 explicitly. Parse it to common structure
...
This allows support of multiple different bootloaders
2023-11-17 18:54:59 +02:00
Bananymous
ca34ece8ef
BAN: Update ASSERT api
...
its now much harder to mix < with <= and > with >=
2023-11-02 00:01:12 +02:00
Bananymous
71ecdd7245
Kernel: Canonicalize vaddr before using it
2023-10-30 19:20:17 +02:00
Bananymous
42772611ce
Kernel: Add fast page to page table
...
Add "fast page" to KERNEL_OFFSET. This is always present in page
tables and only requires changing the page table entry to map. This
requires no interrupts since it should only be for very operations
like memcpy.
I used to map all temporary mappings to vaddr 0, but this is much
better. C++ standard always says that nullptr access is undefined
and this gets rid of it.
Fixed some bugs I found along the way
2023-10-30 19:02:09 +02:00
Bananymous
0c590821ed
Kernel: only map kernel from g_kernel_start onwards
2023-10-30 16:22:02 +02:00