mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
handle free advisories
This commit is contained in:
parent
28b415cb27
commit
168e3454f6
1 changed files with 7 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ use core::fmt;
|
||||||
use xous_kernel::{MemoryFlags, MemoryRange, PID};
|
use xous_kernel::{MemoryFlags, MemoryRange, PID};
|
||||||
|
|
||||||
pub use crate::arch::mem::{MemoryMapping, PAGE_SIZE};
|
pub use crate::arch::mem::{MemoryMapping, PAGE_SIZE};
|
||||||
use crate::arch::process::Process;
|
use crate::{arch::process::Process, swap::Swap};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum ClaimReleaseMove {
|
enum ClaimReleaseMove {
|
||||||
|
|
@ -468,6 +468,12 @@ impl MemoryManager {
|
||||||
// address from this process.
|
// address from this process.
|
||||||
if let Ok(phys) = crate::arch::mem::virt_to_phys(virt as usize) {
|
if let Ok(phys) = crate::arch::mem::virt_to_phys(virt as usize) {
|
||||||
self.release_page(phys as *mut usize, pid).ok();
|
self.release_page(phys as *mut usize, pid).ok();
|
||||||
|
#[cfg(feature = "swap")]
|
||||||
|
Swap::with_mut(|s| s.advise_alloc(pid, virt as usize, phys, false));
|
||||||
|
} else {
|
||||||
|
// return a null physical pointer if the virtual memory is just being freed
|
||||||
|
#[cfg(feature = "swap")]
|
||||||
|
Swap::with_mut(|s| s.advise_alloc(pid, virt as usize, 0, false));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Free the virtual address.
|
// Free the virtual address.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue