66 Commits

Author SHA1 Message Date
83bb0c888c
system: Split heap blocks more or less equally if possible 2025-03-07 20:08:56 +01:00
cd601954a5
system+init+memory: Add basic IPC code 2025-03-07 18:00:00 +01:00
505c2baacb
system: Add a heap allocator for system processes 2025-03-07 17:58:23 +01:00
d97009e0b0
system/x86_64: Add PAGE_SIZE to the vm file to be used by everyone 2025-03-07 17:54:35 +01:00
e055eaf30c
core+system: Add a "getAddressSpace()" system call 2025-03-05 19:11:49 +01:00
166aaf5dbc
core+system+boot: Move all boot modules into the astryon/ subfolder and add that to .gitignore
Accidentally committed the memory binary as I forgot to add it to gitignore. Let's not do this in the future.
2025-02-24 21:48:28 +01:00
ad6b4bf0db
system: Add a memory manager stub 2025-02-24 19:19:09 +01:00
c4ea6f3d9c
init: Calculate the number of threads loaded
This will be quite useful in the future.
2025-02-24 19:18:51 +01:00
9af9e4fea8
core+system: Make the getPriority() and setPriority() syscalls accept a PID 2025-02-24 19:18:24 +01:00
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
f8182bd386
init: Use getThreadId() instead of relying on a fixed PID 2025-02-22 23:01:48 +01:00
b4f25a2e1f
system+init: Move userspace virtual memory code to the system library 2025-02-22 23:01:32 +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
d029d3cf46
core+system: Add a bunch of syscalls related to thread creation 2025-02-22 22:58:56 +01:00
c6df22ee39
core: Allow for non-const pointers in findMultibootTags() 2025-02-22 22:57:33 +01:00
c268c48c8e
system: Fix syscall return value constraint
The previous constraint was making the compiler discard the return value when building in release mode.
2025-02-22 22:57:10 +01:00
6691f940e4
system: Add comments to indicate which syscalls need which tokens 2025-02-22 20:13:17 +01:00
2c5152ecc3
core: Add "tokens" to determine what processes can call which syscalls 2025-02-22 20:11:07 +01:00
e7e66a95f4
core: Remove excessive ELF debug printing 2025-02-22 15:52:36 +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
cc87bf18c9
core+init: Move syscall code from init to the system library + add a setEventQueue() syscall 2025-02-22 15:41:11 +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
daea80cea6
core: Fix alignment in lookupThreadById() 2025-02-22 15:38:23 +01:00
6a441b9b6d
core+system: Add a new "system library" with a shared memory ring buffer implementation 2025-02-22 15:37:22 +01:00
32ecd325e3
readme: Correct link to easyboot's LICENSE file 2025-02-21 20:35:32 +01:00
95dbd68de2
Update README.md
Basic scheduling is now (mostly) done.
2025-02-21 19:49:03 +01:00
9d26113ca9
core: Separate thread.arch from other imports 2025-02-21 19:44:54 +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
9acbc45a80
core: Make thread.enterTask() automatically set the thread state to Running 2025-02-21 18:40:29 +01:00
c722341d3f
core: Change naming for virtual memory structures to reflect x86_64 terms 2025-02-21 18:33:36 +01:00
e6bc3afcb8
init: Fix a few errors 2025-02-20 23:01:56 +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
b2d89ab4fd
init: Add basic virtual memory code 2025-02-20 18:05:11 +01:00
2ecd24df82
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
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
b14c473a29
core: Make some functions in thread.zig private 2025-02-18 20:10:14 +01:00
0ee587a142
core: Add sleep support to the scheduler 2025-02-18 20:06:40 +01:00
e27ef97682
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
9cdf9aa71b
core/x86_64: Make in/out wrappers inline 2025-02-17 23:04:58 +01:00
c455e8ea0b
core: Fix a small error in thread.zig 2025-02-17 23:04:43 +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
d7557d84f7
init: Add system call handling code 2025-02-16 11:58:20 +01:00
46a0c8c800
core: Add memory and scheduler related system calls 2025-02-16 11:58:12 +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
6a2323c16b
core: Add thread states 2025-02-16 11:57:04 +01:00