-
-
Notifications
You must be signed in to change notification settings - Fork 779
Description
Right now there are two key variables in process.rs that the kernel uses extensively:
pub static mut PROCS: &'static mut [Option<&mut Process<'static>>] = &mut [];
static mut HAVE_WORK: VolatileCell<usize> = VolatileCell::new(0);Having these global variables is probably not the best design choice, and doesn't match how the rest of Tock is structured. Plus removing them would remove a bunch of unsafe uses. This tracking issue is a place to work on what it would take to "tockify" those variables.
- Refactor
debug.rs(Refactor debug.rs to not be implemented as a kernel process #1046) - Create a
Kernelstruct that would hold this kernel-crate global state (kernel: make HAVE_WORK a member variable #1044) - Move the processes array into the
Kernelstruct somehow (Kernel: MovePROCSarray toKernelstruct #1111) - Move
CONTAINER_COUNTERtoKernelso we can ensure grants are created before process memory is setup. - Move
APP_FAULTandSCB_REGISTERSto /arch crates. (Move architecture-dependent syscall code to arch/cortex-m #1113, Move architecture-dependent debugging print code to arch/cortex-m #1115)
debug.rs makes it hard to refactor code in the kernel because it is so different from how the rest of the kernel is structured. It is predicated on the idea of "kernel processes", or code in the kernel that looks like any other app to capsules. These feel a bit bolted on and have lead to some difficult-to-maintain code. A possible replacement would be to make debug.rs not look like apps, and instead use a dedicated kernel interface from a capsule instead. Since we haven't had any other uses for kernel processes this seems reasonable.
Making process.rs not cortex-m specific will remove the global static variables that are used to move information from interrupt handlers to the kernel (like APP_FAULT and SCB_REGISTERS.