Commit 28694653 authored by Nifou's avatar Nifou

In the `mmap` syscall, map if the address is provided

parent 3342e032
......@@ -120,6 +120,31 @@ impl Syscall {
Ok(free_area_start as usize)
} else {
let mut processes = PROCESSES.write();
// Use the kernel's page table
crate::memory::switch_to_kernel_page_table();
// Get the current thread's process
let current_process = SCHEDULER.get().current().unwrap().process;
let area = MemoryArea::new(
addr as u64,
addr as u64 + len as u64,
Flags::from(prot),
);
processes
.get_mut(&current_process)
.unwrap()
.memory
.map(area);
processes
.get_mut(&current_process)
.unwrap()
.memory
.switch_page_table();
Ok(addr)
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment