f83a6ace51
Kernel, libc: Add support for providing a status code to exit()
...
The exit() libc function already accepted an integer, but didn't pass it on to the kernel since we had no mechanism for it to do that.
Now, the kernel stores a task's exit status to display it later (and in the future, return it to userspace via wait()/waitpid())
2022-10-08 17:56:40 +02:00
594d79143e
Kernel: enable -Wconversion
2022-10-06 17:13:34 +02:00
7a998dda4d
Kernel: Do not stop interrupts by default in the interrupt handler
...
I always knew you can choose if interrupts are enabled for a specific ISR in the IDT entry, but at some moment there was a bug and I thought maybe that fixed it. Now reverting that doesn't break anything, so... let's do it :)
2022-10-04 18:45:46 +02:00
1c4383dea4
Add an apps/ folder and build-system to build userspace apps which can now be loaded from the initrd
2022-10-01 12:17:16 +02:00
f25014a8ed
refine syscalls
2022-09-29 19:17:43 +02:00
46f459337c
Interrupts: Remove ensure_handler and use a more reliable way of detecting if we are in a handler
2022-09-29 18:35:51 +02:00
f1a7138568
User mode (with a few syscalls)
...
IT ACTUALLY WORKS NOW.
Why wasn't it working? Oh, because I was not setting already present page tables's permissions to user mode. Just a little bug. THAT I SPENT DAYS TRYING TO FIND
Anyways, it works now. Such a relief...
2022-09-25 20:35:05 +02:00
aee4e55fdd
add a proper kernel panic
2022-09-25 16:56:00 +02:00
c3e5251687
Some more userland and font failing
2022-09-23 16:41:43 +02:00
ec01dc2927
Scheduler: Change fixed Task array for (highly inefficient) memory allocation, add userspace task support (which as memory is mapped kernel-only instantly crashes), and support for exiting a task (marking it as exited and reaping it later)
2022-09-21 21:06:00 +02:00
ee49caa6d3
Interrupts: ensure is_in_handler is true if we know we are in a handler
2022-09-21 21:03:49 +02:00
4401b31440
Remove ds from context, no need for it in x86_64, use ss instead
2022-09-21 21:03:24 +02:00
49ddb47ad4
Reorganize structure
2022-09-21 17:56:53 +02:00
4f360693bd
Make the demo reboot when you press a key
2022-09-20 20:51:59 +02:00
1c12cf016e
Add a Scheduler.
...
Finally.
Just Round Robin with sleeping, but it's still awesome. I think this can finish v0.3, with a few adjustments.
2022-09-20 19:58:04 +02:00
e6c6a1677a
Rename "SavedContext" to "Context"
...
Seemed like a more appropriate name.
2022-09-20 19:56:43 +02:00
5ee8e17b76
Ensure we are in an interrupt in the interrupt handler
2022-09-20 17:16:23 +02:00
d0d2d4381c
Add a is_in_handler function to validate being in an interrupt handler
2022-09-20 17:16:07 +02:00
ee8c2759a6
Got a stack tracer working!!
2022-09-19 21:11:43 +02:00
183c3236d4
Fix terminology in keyboard IRQ
2022-09-18 09:47:58 +02:00
f7e7a6661d
Use kernel logging in interrupts instead of plain old printf()
2022-09-18 09:43:58 +02:00
efb28d3258
Randomness and stack protection!!
2022-09-14 18:54:40 +02:00
0cb59ee17f
please work please
2022-09-11 08:23:32 +02:00
fe672e6a18
Use appropriate logging functions
2022-09-08 17:03:17 +02:00
b4484e951d
LOTS MORE LOGGING. which is great, of course.
2022-09-07 19:41:08 +02:00
97aef95daa
Fix format specifiers
2022-09-06 18:31:27 +02:00
bd0a24097f
Add a KernelMemoryManager namespace to wrap PMM + VMM
2022-09-06 18:08:15 +02:00
78fe37ddb3
Move declaration of IDTR to header
2022-09-06 11:44:37 +02:00
1367e88d88
Finally implement %l and %z format modifiers
...
Finally, we can use %zx with a 64-bit number instead of %x%x with 2 32-bit values split from a 64-bit number!
2022-09-05 16:59:45 +02:00
1b727a66ea
Ready. Set. Go!
2022-09-05 16:13:51 +02:00