mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
kernel: riscv: use bit flags for irq handler
Instead of hardcoding bit values, use the symbolic names. This will ensure we don't make mistakes by using magic numbers. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
1394e1c7d5
commit
b9a4e11a64
1 changed files with 2 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::arch::current_pid;
|
use crate::arch::current_pid;
|
||||||
use crate::arch::mem::MemoryMapping;
|
use crate::arch::mem::{MemoryMapping, MMUFlags};
|
||||||
use crate::arch::process::Process as ArchProcess;
|
use crate::arch::process::Process as ArchProcess;
|
||||||
use crate::arch::process::{Thread, RETURN_FROM_ISR};
|
use crate::arch::process::{Thread, RETURN_FROM_ISR};
|
||||||
use crate::mem::{MemoryManager, PAGE_SIZE};
|
use crate::mem::{MemoryManager, PAGE_SIZE};
|
||||||
|
|
@ -145,7 +145,7 @@ pub extern "C" fn trap_handler(
|
||||||
// If the flags are nonzero, but the "Valid" bit is not 1 and
|
// If the flags are nonzero, but the "Valid" bit is not 1 and
|
||||||
// the page isn't shared, then this is a reserved page. Allocate
|
// the page isn't shared, then this is a reserved page. Allocate
|
||||||
// a real page to back it and resume execution.
|
// a real page to back it and resume execution.
|
||||||
if flags & 1 == 0 && flags != 0 && flags & (1 << 8) == 0 {
|
if flags & MMUFlags::VALID.bits() == 0 && flags != 0 && flags & MMUFlags::S.bits() == 0 {
|
||||||
let new_page = MemoryManager::with_mut(|mm| {
|
let new_page = MemoryManager::with_mut(|mm| {
|
||||||
mm.alloc_page(pid).expect("Couldn't allocate new page")
|
mm.alloc_page(pid).expect("Couldn't allocate new page")
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue