Commit Graph

1299 Commits

Author SHA1 Message Date
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
0054777e7d
x86_64: Warn if NX is not supported 2022-12-26 12:11:10 +01:00
08984e1673
x86_64: Create a has_flag() helper function and remove redundant clearing of reserved bits 2022-12-26 12:10:47 +01:00
59d69f684f
x86_64: Add general protection fault handler
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-24 11:49:47 +01:00
f71ccde833
Add an overload for aligned deletes which just calls the normal operator delete 2022-12-24 11:49:12 +01:00
f2cc797599
Add a simple ELF loader
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-23 13:09:21 +01:00
e5ae2b0435
TarStream: Make read_contents and friends const 2022-12-23 13:08:31 +01:00
ad0f6546d7
Add a global initrd TarStream to make the initial ramdisk accessible everywhere
All checks were successful
continuous-integration/drone/push Build is passing
It's also mapped into virtual memory instead of directly going into the physical location!!
2022-12-23 11:33:23 +01:00
6ff92b1714
MemoryManager: Add get_kernel_mapping_for_frames()
This function allocates a continuous range of VM and maps the physical frames passed to said VM range.
2022-12-23 11:30:49 +01:00
74235c2c99
Update README.md
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-23 11:06:59 +01:00
e6384ae90d
Use the new toolchain location
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-23 11:06:37 +01:00
575752eb23
Update drone config to pull toolchain from a new purpose-built toolchain archive for CI 2022-12-23 11:04:50 +01:00
c39e54b7c6
Make TarStream::read_contents take any pointer as output 2022-12-23 10:51:55 +01:00
34e6c05cef
Fix it up a bit more
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-23 10:48:00 +01:00