25 Commits

Author SHA1 Message Date
a243dd6dec
core: Reserve kernel physical pages + provide our own stack
This solves a very weird bug that occurred when we allocated a page that was already used for the stack.
2025-02-24 19:16:35 +01:00
6e97a89f22
core: Reserve multiboot tags and module memory + load all modules as independent threads instead of just init
Only init is started though, other modules are left in a dormant state so init can do whatever it wants and adjust them according to its needs before running them.
2025-02-22 23:00:53 +01:00
c80c7bbc6e
core+init: Instead of exporting an "arch" symbol for platform-specific code, use "usingnamespace".
This makes imports of  platform-specific files way cleaner.
2025-02-22 15:49:14 +01:00
ee7185bb83
core: Add an "event queue" to threads using a ring buffer updated by the kernel 2025-02-22 15:39:21 +01:00
c1956748f3
core: Add a struct named "platform.Registers" to cover different architectures
This replaces the architecture-independent usage of InterruptStackFrame, which is an x86_64 implementation thing.
2025-02-21 19:40:46 +01:00
7665e4cbb6
core: Add documentation to all scheduler functions + global thread list 2025-02-21 19:37:13 +01:00
50e7b6cca7
core: Check the stack is in user memory before changing it to kernel space
Otherwise, we're just adding the physical base to an address that's already in the higher half.
2025-02-21 18:47:24 +01:00
c722341d3f
core: Change naming for virtual memory structures to reflect x86_64 terms 2025-02-21 18:33:36 +01:00
5cb9689d10
core: Don't set the second thread argument to zero
This defeated the point of passing the page tables to init, since rsi would be set to zero anyway.
2025-02-20 23:01:28 +01:00
8ea5df2e4e
core: Give init a pointer to its own page tables 2025-02-20 17:57:50 +01:00
0782ff5fe7
core/x86_64: Fix function naming style 2025-02-20 17:55:56 +01:00
0ee587a142
core: Add sleep support to the scheduler 2025-02-18 20:06:40 +01:00
9cdf9aa71b
core/x86_64: Make in/out wrappers inline 2025-02-17 23:04:58 +01:00
f0d5b60b83
core: Add priority-based scheduling 2025-02-17 20:15:30 +01:00
0edcae7aae
core: Store the physical page directory alongside the virtual pointer to it 2025-02-16 13:20:02 +01:00
5eabb6bdf0
core: Add PIT timer code to preempt the scheduler 2025-02-16 11:58:01 +01:00
c86481f2e7
core: Allocate a stack for each core's idle thread 2025-02-16 11:57:27 +01:00
985d8fec0a
core: Add basic threading code 2025-02-15 22:45:32 +01:00
14578a0fee
core/x86_64: Set up a second stack in the TSS to handle system calls 2025-02-15 22:40:48 +01:00
654b228f10
core: Fix a couple of bugs in VMM and add a few utility functions 2025-02-15 22:23:00 +01:00
ffa9b78bf7
core/x86_64: Enable the NX bit before using it
Spent an embarrassing amount of time trying to figure out why there was a page fault with "reserved bits set". Turns out, I had set the NX bit without enabling it.
2025-02-15 22:22:04 +01:00
da5335410d
core/x86_64: Add general protection fault handler 2025-02-15 22:19:08 +01:00
d8236bc8f7
core: Add a page fault handler 2025-02-15 15:18:40 +01:00
18ec598394
core: Enable interrupts in platformEndInit()
This way, each architecture can re-enable interrupts whenever necessary
2025-02-15 15:18:24 +01:00
fce8a58cf6
Ready. Set. Go!
Microkernel development in Zig, should be fun! =]
2025-02-13 22:39:48 +01:00