mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 00:43:24 +00:00
Make mprotect&munmap return fast when len is zero
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
212440dbb1
commit
aa77747f94
@ -7,6 +7,14 @@ use crate::prelude::*;
|
||||
|
||||
pub fn sys_munmap(addr: Vaddr, len: usize, ctx: &Context) -> Result<SyscallReturn> {
|
||||
debug!("addr = 0x{:x}, len = {}", addr, len);
|
||||
|
||||
if addr % PAGE_SIZE != 0 {
|
||||
return_errno_with_message!(Errno::EINVAL, "munmap addr must be page-aligned");
|
||||
}
|
||||
if len == 0 {
|
||||
return_errno_with_message!(Errno::EINVAL, "munmap len cannot be zero");
|
||||
}
|
||||
|
||||
let root_vmar = ctx.process.root_vmar();
|
||||
let len = len.align_up(PAGE_SIZE);
|
||||
debug!("unmap range = 0x{:x} - 0x{:x}", addr, addr + len);
|
||||
|
Reference in New Issue
Block a user