136c0b3ae9
Scheduler: add a reset_task function
...
This can be used later to implement execve()
2022-10-12 17:08:45 +02:00
4e3ef9593d
Scheduler: Move ELF image freeing to ELFLoader
2022-10-12 17:08:17 +02:00
a6f0a7056f
Scheduler: Set the user_task field in a Task at creation time
...
We were previously looking at its segment registers to see if they were user-like, but this method is bad.
What is the task was executing a system call?
So now, we store that value at creation time.
2022-10-12 17:07:39 +02:00
d3cb642e5f
Scheduler: add FIXME
2022-10-12 14:30:57 +02:00
0ee9bd7290
Scheduler: free a task's ELF image.
...
Now that we have support for larger pages, this works!!
2022-10-12 14:30:46 +02:00
cf160d1260
Scheduler: Use misc/utils.h instead of doing everything manually.
...
That way the code is cleaner + we have one single point of failure.
2022-10-12 13:18:35 +02:00
0131193379
ELFLoader, Scheduler: Transition to use VFS
...
We should start to drop the old InitRD API, which only allows for files to be loaded from the initrd, and which forces pathnames to be relative (bin/init)
With VFS, we can load any kind of file from any kind of filesystem, and using paths that make sense (/bin/init)
2022-10-11 19:33:48 +02:00
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
309058888c
Bugfix: remove duplicate error check when loading a userspace ELF program
...
Also, remember to delete the allocated task, since we do not want memory leaks :)
2022-10-08 13:12:19 +00:00
abcf1b6118
Define PAGE_SIZE as 4096 and use it everywhere instead of using 4096 as a magic number
2022-10-08 14:52:28 +02:00
dc389da74e
Implement an ELFImage struct
...
This struct allows us to keep track of what memory is used by the loaded executable. For some reason, freeing this memory when the task exits triggers a kernel page fault, so I'm not doing that right now.
2022-10-07 17:54:05 +02:00
594d79143e
Kernel: enable -Wconversion
2022-10-06 17:13:34 +02:00
38470724dc
Scheduler: adjust SSE saving conditions
2022-10-02 19:13:21 +02:00
1ecd24f5d6
Kernel: Add SSE support (enable SSE on boot and save context (user tasks only) on task switch)
2022-10-02 18:53:54 +02:00
03db57bbf9
Sanity checks
2022-10-01 12:32:09 +02:00
66bee86a8b
Scheduler: add a load_user_task function that directly loads a file from the initrd
2022-10-01 12:28:32 +02:00
9012ccc49e
Remove _userspace and move the idle task to assembly
2022-10-01 12:16:30 +02:00
f25014a8ed
refine syscalls
2022-09-29 19:17:43 +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
57bb1164e9
change 4 pages of stack per stack to a #define
2022-09-25 18:13:20 +02:00
d3527b8824
Use new and delete in Scheduler
2022-09-25 18:12:12 +02:00
19dff40ee2
Scheduler: track total CPU time of tasks
2022-09-25 17:49:51 +02:00
aee4e55fdd
add a proper kernel panic
2022-09-25 16:56:00 +02:00
059bf86ddf
Scheduler: use kmalloc and kfree
2022-09-24 23:18:33 +02:00
3891d0c52e
Rename KernelMemoryManager to MemoryManager
...
Kind of a more catchy name, isn't it?
2022-09-24 21:45:13 +02:00
c3e5251687
Some more userland and font failing
2022-09-23 16:41:43 +02:00
11dd165a8e
Scheduler: add proper support for user tasks (still faults though)
2022-09-22 08:14:04 +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
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
1dce3a0cf7
Give 1 tick of CPU time to the idle task
2022-09-20 20:48:49 +02:00
ddbe9b8b8b
Few small adjustments to the scheduler
2022-09-20 20:02:08 +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
245d5e514d
Optimizations in Spinlock.asm
2022-09-19 16:36:34 +02:00
99e681aeb4
Forgot to add volatile
...
Did I check to see if it compiled before making the previous commit? Yes, of course, why are you asking? ...
2022-09-18 20:16:46 +02:00
d4a982306f
Add spinlocks
2022-09-18 20:15:19 +02:00