Refactor context list

This commit is contained in:
Jeremy Soller 2016-08-18 08:30:45 -06:00
parent 2de2d4cac4
commit 490dd16776
6 changed files with 89 additions and 34 deletions

View file

@ -4,14 +4,14 @@ static mut INTERRUPTS_ENABLED: bool = false;
/// Clear interrupts
#[inline(always)]
pub unsafe fn disable_interrupts() {
pub unsafe fn disable() {
println!("CLEAR INTERRUPTS");
INTERRUPTS_ENABLED = false;
}
/// Set interrupts
#[inline(always)]
pub unsafe fn enable_interrupts() {
pub unsafe fn enable() {
println!("SET INTERRUPTS");
INTERRUPTS_ENABLED = true;
}
@ -22,3 +22,10 @@ pub unsafe fn halt() {
assert!(INTERRUPTS_ENABLED);
::std::thread::yield_now();
}
/// Set interrupts and halt
#[inline(always)]
pub unsafe fn enable_and_halt() {
enable();
halt();
}