Skip to content
Snippets Groups Projects
Verified Commit 7bdf5e9a authored by Jacob Lorentzon's avatar Jacob Lorentzon
Browse files

Pass unaligned length to scheme for fmap.

parent afa3d7dc
No related branches found
No related tags found
1 merge request!238Demand paging
......@@ -447,15 +447,14 @@ impl UserInner {
}
fn fmap_inner(&self, dst_addr_space: Arc<RwLock<AddrSpace>>, file: usize, map: &Map) -> Result<usize> {
let aligned_size = map.size.next_multiple_of(PAGE_SIZE);
if aligned_size != map.size {
log::warn!("fmap passed length {:#0x} instead of {:#0x}", map.size, aligned_size);
}
let unaligned_size = map.size;
if aligned_size == 0 {
if unaligned_size == 0 {
return Err(Error::new(EINVAL));
}
let page_count = unaligned_size.div_ceil(PAGE_SIZE);
if map.address % PAGE_SIZE != 0 {
return Err(Error::new(EINVAL));
};
......@@ -493,15 +492,13 @@ impl UserInner {
(context.id, desc.description)
};
let page_count = aligned_size / PAGE_SIZE;
let response = self.call_extended_inner(Packet {
id: self.next_id(),
pid: pid.into(),
a: KSMSG_MMAP_PREP,
b: file,
c: map.flags.bits(),
d: page_count,
d: unaligned_size,
// The uid and gid can be obtained by the proc scheme anyway, if the pid is provided.
uid: map.offset as u32,
gid: (map.offset >> 32) as u32,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment