parent
65cd42028c
commit
4d8d48cf4d
@ -0,0 +1,29 @@
|
||||
#[inline(always)]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub unsafe fn disable_and_store() -> usize {
|
||||
let rflags: usize;
|
||||
asm!("pushfq; popq $0; cli" : "=r"(rflags));
|
||||
rflags & (1 << 9)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
pub unsafe fn disable_and_store() -> usize {
|
||||
let sstatus: usize;
|
||||
asm!("csrrci $0, 0x100, 1" : "=r"(sstatus));
|
||||
sstatus & 1
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub unsafe fn restore(flags: usize) {
|
||||
if flags != 0 {
|
||||
asm!("sti");
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
pub unsafe fn restore(flags: usize) {
|
||||
asm!("csrs 0x100, $0" :: "r"(flags));
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit a37a65fa13a00c5aa0068c3f2b5d55af6a37dd93
|
||||
Subproject commit f358204af01f2374ab6ed6ea059f724cd5f2fe6f
|
Loading…
Reference in new issue