-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from yfblock/main
feat: Support loongarch64 and fmt clippy
- Loading branch information
Showing
4 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use core::arch::asm; | ||
|
||
const IE_MASK: usize = 1 << 2; | ||
|
||
#[inline] | ||
pub fn local_irq_save_and_disable() -> usize { | ||
let mut flags: usize = 0; | ||
// clear the `IE` bit, and return the old CSR | ||
unsafe { asm!("csrxchg {}, {}, 0x0", inout(reg) flags, in(reg) IE_MASK) }; | ||
flags & IE_MASK | ||
} | ||
|
||
#[inline] | ||
pub fn local_irq_restore(flags: usize) { | ||
// restore the `IE` bit | ||
unsafe { asm!("csrxchg {}, {}, 0x0", in(reg) flags, in(reg) IE_MASK) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ | |
//! ``` | ||
#![no_std] | ||
#![feature(asm_const)] | ||
|
||
mod arch; | ||
|
||
|