Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tracking: Remove static global variables in kernel (process.rs) #1043

@bradjc

Description

@bradjc

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions