785335bd9a
core: Make thread.enterTask() automatically set the thread state to Running
2025-02-21 18:40:29 +01:00
14047e0c3c
core: Change naming for virtual memory structures to reflect x86_64 terms
2025-02-21 18:33:36 +01:00
43bb21af0b
init: Fix a few errors
2025-02-20 23:01:56 +01:00
930f69c498
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
240d9afe0e
init: Add basic virtual memory code
2025-02-20 18:05:11 +01:00
a8b206cac3
core: Add some annotations to managed thread variables
...
Some thread variables don't need to be set manually,
since they are updated whenever needed by some functions.
Add comments to make that clear.
2025-02-20 17:59:27 +01:00
34255d6c68
core: Give init a pointer to its own page tables
2025-02-20 17:57:50 +01:00
e9b2f5968a
core/x86_64: Fix function naming style
2025-02-20 17:55:56 +01:00
08c1e0bca2
core: Make some functions in thread.zig private
2025-02-18 20:10:14 +01:00
b87150a35f
core: Add sleep support to the scheduler
2025-02-18 20:06:40 +01:00
8f6c952331
core: Set new threads' priority to 127
...
This is halfway through the priority range, so user processes can either lower or raise their priority from the default.
2025-02-18 19:30:46 +01:00
9cbb043238
core/x86_64: Make in/out wrappers inline
2025-02-17 23:04:58 +01:00
13445bac1f
core: Fix a small error in thread.zig
2025-02-17 23:04:43 +01:00
9c92b3de4b
core: Add priority-based scheduling
2025-02-17 20:15:30 +01:00
6be2261519
core: Store the physical page directory alongside the virtual pointer to it
2025-02-16 13:20:02 +01:00
4e03fdca6a
init: Add system call handling code
2025-02-16 11:58:20 +01:00
3ce8cfb726
core: Add memory and scheduler related system calls
2025-02-16 11:58:12 +01:00
671a9b5887
core: Add PIT timer code to preempt the scheduler
2025-02-16 11:58:01 +01:00
a209ba7b99
core: Allocate a stack for each core's idle thread
2025-02-16 11:57:27 +01:00
4554bce8a8
core: Add thread states
2025-02-16 11:57:04 +01:00
f87426753b
core: Add global FrameAllocator with locking
2025-02-16 11:56:14 +01:00
14862ec271
core: Add spinlock code
2025-02-16 11:52:45 +01:00
ea952efe8a
core: Fix a few bugs in threading code
...
g_threads is processor-specific now, so it's unused, and setPageDirectory() needs the physical address.
2025-02-15 22:58:34 +01:00
58481a76b1
Update README.md
2025-02-15 22:55:13 +01:00
a76e94c517
core: Add a simple ELF loader
...
We only need the ELF loader for init, and possibly a few other modules. The bulk of loading executables is going to be done by userspace, so we only need the basics here.
2025-02-15 22:46:28 +01:00
ed324fcf9e
core: Add basic threading code
2025-02-15 22:45:32 +01:00
fa04363a51
core/x86_64: Set up a second stack in the TSS to handle system calls
2025-02-15 22:40:48 +01:00
56f2c018a7
core: Fix a couple of bugs in VMM and add a few utility functions
2025-02-15 22:23:00 +01:00
f93158645b
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
36b9832053
core/x86_64: Add general protection fault handler
2025-02-15 22:19:08 +01:00
090e4148b8
core: Reserve physical page 0
...
In the kernel's early stages we access physical memory identity-mapped, so it's not very good for us to allocate that frame and then try to use it.
2025-02-15 22:18:49 +01:00
8bfc8a5781
core: Make findMultibootTags take a context argument
...
Will be useful later.
2025-02-15 22:18:05 +01:00
adffd408bc
core: Add a page fault handler
2025-02-15 15:18:40 +01:00
8d70a0f0a1
core: Enable interrupts in platformEndInit()
...
This way, each architecture can re-enable interrupts whenever necessary
2025-02-15 15:18:24 +01:00
5d26b114a4
core: Add workaround for QEMU-specific triple-faults without KVM
...
Without KVM, qemu inserts an invalid 12-GiB reserved entry at the end of the physical address space, making the kernel reserve way more space than necessary for the page bitmap (and overwriting the page directory pages).
2025-02-15 15:16:50 +01:00
13ec4bee87
Ready. Set. Go!
...
Microkernel development in Zig, should be fun! =]
2025-02-13 22:39:48 +01:00