PendSV Allows Simple and Efficient Context Switch on Cortex-M
Centralizing context switch logic in PendSV simplifies concurrency reasoning and enhances system performance by reducing register preservation overhead of all other exceptions.
Zhiyao Ma is a Ph.D candidate in the department of computer science at Yale University. He is advised by Professor Lin Zhong, Ph.D. His research interests lie in the field of operating systems on resource constrained platforms, programming languages, and automated code generation via large language models. Zhiyao’s current focus is on building a Rust-based embedded operating system called Hopter, which enables memory safe, memory efficient, reliable, and responsive applications via a co-design between the kernel and compiler. His future work will explore the opportunity to expedite system development facilitated by large language models, and to empower a resource constrained computer at the OS layer aided by a resourceful computer connected over the network. Zhiyao enjoys driving on tracks at HPDE, currently in the intermediate run group, and he also holds a Kendo 3rd Dan rank.
Ph.D Student in Computer Science, 2020 - Present
Yale University
MPhil in Computer Science, 2024
Yale University
MS in Computer Science, 2023
Yale University
BS in Computer Science (Summa Cum Laude), 2020
Peking University
Centralizing context switch logic in PendSV simplifies concurrency reasoning and enhances system performance by reducing register preservation overhead of all other exceptions.
Changing a Rust enum variant through a mutable reference can be achieved either by wrapping the variant attached variable inside Option
, or better, by introducing an Undef
variant in the enum.
Although ArrayQueue
contains no explicit spin lock or mutex, its code structure forms a big spin lock and thus deadlock is possible.
SVC will be pended if a higher priority exception arrives during the stacking. If the priority of SVC is raised above the previously higher priority exception inside its handler, SVC will be activated immediately, nested above the current handler, which causes problems because the register context seen by the SVC handler is not system call arguments.
Read-modify-write on the cr1
register of I²C may generate two consecutive start condition and hang the peripheral.