pub(crate) unsafe fn change_current_runlevel(level: Priority) -> Priority {
    let token: u32;
    unsafe {
        match level {
            Priority::None => core::arch::asm!("rsil {0}, 0", out(reg) token),
            Priority::Priority1 => core::arch::asm!("rsil {0}, 1", out(reg) token),
            Priority::Priority2 => core::arch::asm!("rsil {0}, 2", out(reg) token),
            Priority::Priority3 => core::arch::asm!("rsil {0}, 3", out(reg) token),
        };
    }

    let prev_interrupt_priority = token as u8 & 0x0F;

    unwrap!(Priority::try_from(prev_interrupt_priority))
}
Changes the current run level (the level below which interrupts are
masked), and returns the previous run level.

# Safety

This function must only be used to raise the runlevel and to restore it
to a previous value. It must not be used to arbitrarily lower the
runlevel.
esp-hal/src/interrupt/xtensa.rs