mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
kernel: riscv: return ShareViolation when memory is shared
When memory has been shared, it is no longer valid. However, it is still "in use". Return a `ShareViolation` error in this case so we can check for it elsewhere. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
b77827f2ed
commit
3b85392877
1 changed files with 6 additions and 1 deletions
|
|
@ -583,8 +583,13 @@ pub fn virt_to_phys(virt: usize) -> Result<usize, xous_kernel::Error> {
|
|||
return Err(xous_kernel::Error::BadAddress);
|
||||
}
|
||||
|
||||
// If the page is "Valid" but shared, issue a sharing violation
|
||||
if l0_pt.entries[vpn0] & MMUFlags::S.bits() == 0 {
|
||||
return Err(xous_kernel::Error::ShareViolation);
|
||||
}
|
||||
|
||||
// Ensure the entry hasn't already been mapped.
|
||||
if l0_pt.entries[vpn0] & 1 == 0 {
|
||||
if l0_pt.entries[vpn0] & MMUFlags::VALID.bits() == 0 {
|
||||
return Err(xous_kernel::Error::BadAddress);
|
||||
}
|
||||
Ok((l0_pt.entries[vpn0] >> 10) << 12)
|
||||
|
|
|
|||
Loading…
Reference in a new issue