-
Notifications
You must be signed in to change notification settings - Fork 6
[Refactor] Add vmmap-related calls [mmap / munmap / brk / sbrk] #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: simple-syscall
Are you sure you want to change the base?
Conversation
celinehoang177
commented
Mar 31, 2025
- Added implementation of mmap / munmap / brk / sbrk with new type conversion
src/rawposix/src/fs_calls.rs
Outdated
off_cageid: u64, | ||
) -> i32 { | ||
// TODO: Check will perform in the below logic?? | ||
println!("[mmap_syscall] selfcageid: {:?}, FD Cageid: {:?}", cageid, vfd_cageid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to still be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
/// | ||
/// # Returns | ||
/// * `u32` - Result of the `mmap` operation. See "man mmap" for details | ||
pub fn mmap_syscall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we combined all of the mmap logic into one place here, which is a good first step, but it turns out pretty hard to read. It would be cool if we could separate this out with comments a bit or find places where it would make sense to internally functionize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also thinking about priority here. Maybe we could open an issue to document this and optimize this later?
|
||
// we are replacing munmap with mmap because we do not want to really deallocate the memory region | ||
// we just want to set the prot of the memory region back to PROT_NONE | ||
// Directly call libc::mmap to improve performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this improve performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pasting from rawposix...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty good, the internal functions could possibly be cleaner but I'm not sure thats worth the effort here.