Open paked opened 3 years ago
so we now have a timer interrupt which pulses every so often. which can form the basis of our round robin scheduler.
in leg-os we had a one-off function called parasite_process
which took control of the main thread and began scheduling stuff. this is, imo, too much of a hack. to kick-off the scheduling bonanza i want something a bit more flexible. this was there because our scheduling logic was deeply tied to the STM32L4's interrupt logic.
i don't want to have two seperate ways of entering a process in this codebase. so, i propose we kick off the main thread with a yield
svc command. this yield command will pull in the next running process, and switch to its context.
since svc will trigger an exception, we can use the same logic we use in the IRQ handler.
so i've implemented most of this in a4013cfd6e942a988669e5461fa613091e9fc06b.
the only thing left to do is to add mark out some critical sections in our code base.
these could be:
looks like we'll need to use the daifclr and daifset registers.
implement multitasking!
this requires: