Commit Graph

27 Commits

Author SHA1 Message Date
Drew Galbraith 8adde27d9b [Zion] Add a thread sleep call.
For now this can only sleep in increments of the scheduler quantum
(currently 50ms). It also uses a somewhat ineffecient way of tracking
the sleeping threads - it will scale linearly with the number of
sleeping threads.
2023-12-07 00:20:03 -08:00
Drew Galbraith 96063126cb [Zion] Add task switching for SSE registers and enable them in userspace. 2023-11-21 15:52:17 -08:00
Drew Galbraith 308dd6a203 [Zion] Add a framework for better process exit. 2023-11-16 23:03:27 -08:00
Drew Galbraith 46d02e5eae [Zion] Remove sleeping messages. 2023-11-15 16:27:09 -08:00
Drew Galbraith 78624d5291 [Zion] Immediately schedule enqueued threads if we are sleeping. 2023-11-02 22:28:08 -07:00
Drew Galbraith 3110087498 [zion] Don't dump process states on sleep 2023-08-01 10:42:53 -07:00
Drew Galbraith 64d355b20d [glacier] Move LinkedList to glacier. 2023-06-26 15:01:55 -07:00
Drew Galbraith a99096b0ff [zion] Move the scheduler to the IntrusiveList for runnable threads 2023-06-21 16:28:42 -07:00
Drew Galbraith e1af79b975 [zion/glacier] Move RefPtr to glacier. 2023-06-21 15:07:40 -07:00
Drew Galbraith 1cebe547c0 [zion] Allow the sleep thread to be preempted.
We can't yield it when the next thread is unblocked for now because it
may still be holding a lock that the prempted thread is waiting on.
2023-06-19 21:47:37 -07:00
Drew Galbraith 4e328c2f7a Set RSP0 on context switch
Previously we only set it on thread init which caused interrupts to
stomp on the stack of the most recently started thread, potentially
overwriting their cr3 and other variables and causing a crash.
2023-06-16 01:52:59 -07:00
Drew Galbraith 0f0e39d1e9 Further parse AHCI information.
Send an IDENTIFY command to each drive and set up a hook to handle
interrupts.
2023-06-12 19:20:51 -07:00
Drew Galbraith 2e1357255c Create a RefCounted type and use it for Thread.
This should prevent me from actually creating 2 shared ptrs of
a single kernel object with their separate ref counts.
2023-06-06 19:05:03 -07:00
Drew Galbraith de49dcc01a Move scheduler to new global class format. 2023-05-29 23:48:32 -07:00
Drew Galbraith 7fe6c24aa5 Add a ProcessManager class to store Process objects.
Trying out a new method for exposing global objects directly via a
variable.
2023-05-29 23:35:44 -07:00
Drew Galbraith b58186265e Split Yield and Preempt into separate scheduling functions.
This switch makes the logic for each much easier to parse.
2023-05-29 23:09:39 -07:00
Drew Galbraith 3fee5ac9d7 Rework scheduler to store the current thread separately.
This works better with the sleep thread and lets us check state
transitions more easily.
2023-05-29 22:54:22 -07:00
Drew Galbraith 80d2bf1aaa Move Processes and Threads to be stored in SharedPtr
Reference counting lets us pass these around a bit more easily.

SharedPtr was lightly tested using uint64_t in the main zion funcion.

Also add a sleep functionality instead of panicking. Functionally the
same right now since we don't preempt.
2023-05-29 15:50:38 -07:00
Drew Galbraith 9f3ffbf5b4 Move Process to storing Threads in a linked list.
This should really be a vector or hashmap of some sort but this is fine
for now.
2023-05-29 15:08:02 -07:00
Drew Galbraith 5cab9f843e Move process list to a linked list.
Add basic iteration ability to the linked list.
2023-05-29 14:59:23 -07:00
Drew Galbraith 71196dc90f Move scheduler threads to a linked list implementation.
Removes the internal next ptr from the Thread class.

We avoid doing a memory operation when scheduling on yield because we
simply cycle the item to the back of the list.
2023-05-29 14:32:49 -07:00
Drew Galbraith a06c9dced4 Add thread and process states.
Add a thread exit call.
2023-05-29 13:51:03 -07:00
Drew Galbraith aefb4f082b Add a kernel ELF module and load it in a new process.
Don't yet jump to userspace.
2023-05-29 00:32:54 -07:00
Drew Galbraith d3024211a7 Cycle through multiple tasks in multiple processes 2023-05-18 13:56:54 -07:00
Drew Galbraith 0d275c72a1 Have processes enqueue their own threads 2023-05-18 13:28:22 -07:00
Drew Galbraith cb41953354 Scheduler with working threads.
Currently only one process but it is a start.
2023-05-18 13:24:02 -07:00
Drew Galbraith 960cbf9519 Add Scheduler wireframe.
Right now does nothing but has containing classes for process and thread
information.
2023-05-18 12:43:53 -07:00