Commit Graph

1312 Commits

Author SHA1 Message Date
bdfe7dac17
libc: Remove crti.o and crtn.o
Some checks failed
continuous-integration/drone/push Build is failing
Looks like these are now provided by the compiler.
2023-01-06 17:59:54 +01:00
8838e2cf22
Bring back the OS-Specific Toolchain on restart :^)
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 17:35:07 +01:00
e37280b0e5
ELFLoader: Set both the read-write and execute flags if the section has both
Not good for W^X, but the compiler decides to squash everything into a single program header :(
2023-01-06 17:34:24 +01:00
87a4bc91d8
arch/x86_64: Nicer display for page faults that shows a human-readable version of the error code 2023-01-06 17:31:22 +01:00
a01b56ed39
CString: Support strcpy(), strcat() and strchr() 2023-01-06 16:20:35 +01:00
30555f8e5a
Skip these because CI needed a toolchain rebuild
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-06 15:00:49 +01:00
7acef24494
Make libc depend on crt{0,i,n}.o
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 14:32:38 +01:00
71414c0653
Explicitly set the link path to make it build on CI
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 14:28:53 +01:00
db1941140c
Explicitly include system headers to make it build on CI
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 13:40:53 +01:00
08608d2344
Depend on libc headers
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 13:38:48 +01:00
f1923ce5bd
Install headers before compilation
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 13:35:57 +01:00
129e3c434a
Switch to C for userspace, with a very bare-bones libc!!
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 13:31:14 +01:00
b27cefb9c5
SystemError: Define _LUNA_SYSTEM_ERROR_EXTENSIONS to compile properly in hosted envs 2023-01-06 13:30:49 +01:00
293b979e75
ELFLoader: Do not crash on non-page-aligned sections 2023-01-06 13:30:17 +01:00
fd8a0175d9
Add a syscall infrastructure (our baby program can print to the console now!)
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-05 22:39:56 +01:00
caa3fe8c45
MemoryManager: Add validate_userspace_string()
A bit crude, should be replaced by a strdup_from_user() helper to avoid touching userspace memory directly.
But it'll do for now.
2023-01-05 22:39:09 +01:00
0ea9974512
First user process!
All checks were successful
continuous-integration/drone/push Build is passing
Putting it all together, we have a user process that successfully calls sys_exit() w/o crashing.
2023-01-05 21:55:21 +01:00
0aac6c888d
x86_64: Basic exit() syscall!
User processes need to do something, amirite?
2023-01-05 21:53:48 +01:00
a33a72915e
Scheduler: Creation, destruction and switching of userspace tasks :))
From a TarStream. Not optimal, but OK for the moment.
2023-01-05 21:52:26 +01:00
ea89b92675
Store a bit more stuff in a thread :) 2023-01-05 21:50:53 +01:00
31ea030c7f
MMU: Add functions to create and delete userspace page directories 2023-01-05 21:50:26 +01:00
c53bba0392
MemoryManager: Add an unmap_weak_and_free_vm() helper function
This function mirrors unmap_owned_and_free_vm(), but using weak unmapping (does not free the underlying physical memory)
2023-01-05 21:50:06 +01:00
d3c414af4e
ELFLoader: Do not keep track of segments
This reduces calls to kmalloc() since segment data is heap-allocated, and the segments loaded will be deleted when deleting the page directory.
2023-01-05 21:46:03 +01:00
f0e14cf7e9
Update year range in LICENSE :)
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-02 13:08:42 +01:00
5854e5e530
Add newlines at end-of-file 2023-01-02 13:07:29 +01:00
aab3a0a840
Update settings.json 2023-01-02 13:07:13 +01:00
3442970678
Add vscode configuration 2023-01-02 13:00:22 +01:00
4ef764e62e
mprotect(): Validate the entire range to protect is in userspace memory
Before this patch, sys_mprotect() only validated the starting address.
This was as bad as it sounds, in fact it let me write a fun exploit
using it.
Now, this exploit is no longer possible.

This patch is probably not relevant, since this branch will be gone in
the future, as soon as restart gets merged into main.
I made it anyways :^)
2023-01-02 11:51:08 +01:00
df8f9c6cf6
SharedPtr: adopt_shared_from_owned
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-31 12:02:15 +01:00
831711ab7e
TypeTraits: Remove const, volatile, and reference
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-31 11:50:30 +01:00
e2e21923d7
Result: Implement operator=()
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-30 19:06:47 +01:00
4081186b27
Heap: Rewrite kmalloc to use Option<HeapBlock*> instead of nullable pointers to iterate over the heap
All checks were successful
continuous-integration/drone/push Build is passing
At some point, this should be done inside LinkedList itself, but we have no such thing as break in for_each().
It's iterate over everything or nothing.

This also requires operator= in Option, might be also added to Result in the future.
2022-12-30 19:02:25 +01:00
3a3968b268
Result: Add nonnull_or_error() 2022-12-30 18:46:27 +01:00
973e39a255
LinkedList: Move nonnull_or_empty_option to Option.h so everyone can use it 2022-12-30 18:46:18 +01:00
28f53f9ccf
LinkedList: Rename the nonnull_or_error() helper to a more accurate nonnull_or_empty_option() 2022-12-30 18:44:37 +01:00
1f36ecd044
LinkedList: Make expect_first() and expect_last() show a more accurate error description on panic
Instead of showing a generic "Option::value() called on an empty Option" with no useful source location,
you will get something like "check failed: m_start_node at LinkedList.h:139"
2022-12-30 18:43:39 +01:00
24773fbece
kernel/main: Remove reference to 'extern const BOOTBOOT bootboot' 2022-12-30 18:38:50 +01:00
74aa30a44f
Init: Call efficient_halt() on magic number mismatch instead of busy-looping 2022-12-30 18:36:22 +01:00
9569385691
Remove unused include 2022-12-30 18:32:44 +01:00
400d0395a2
Result: Avoid double-checking when calling through to the underlying Option
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-30 15:00:02 +01:00
8e59a0a79f
CMakeLists improvements
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-30 11:48:18 +01:00
7952d1d8a0
x86_64: Add basic keyboard support with an ASYNC DRIVER
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-26 19:59:18 +01:00
ed34009b50
Heap: Log more details of blocks
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-26 16:17:24 +01:00
2af3997456
LinkedList: Fixed some boogs, LinkedList is now boog-free :) 2022-12-26 15:54:29 +01:00
1c70ab5a1a
Heap: Avoid combines with blocks outside a range 2022-12-26 15:20:56 +01:00
a1eca479d5
x86_64: Add a getter for the initial page directory
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-26 12:57:25 +01:00
2600acc96c
Thread: Add init_regs_user() 2022-12-26 12:46:07 +01:00
7efb79dd26
LinkedList: Check for nullptrs in detach_from_list() 2022-12-26 12:45:49 +01:00
7e62ee66be
Change heap.first().has_value() to the cheaper heap.count()
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-26 12:24:39 +01:00
73c58bd902
Init: Move platform_init() before MemoryManager::init()
All checks were successful
continuous-integration/drone/push Build is passing
This enables NX before we actually use it.
Wasn't causing problems with KVM on, but crashed with KVM off with a 'reserved bit set' page fault.
2022-12-26 12:12:55 +01:00