mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-26 19:32:06 -05:00
UserspaceEmulator: Do not pass MAP_FIXED to Kernel
Since there is usually no correlation between guest memory-layout and UE memory-layout, this option does not make any sense. Especially since we provide nullptr.
This commit is contained in:
parent
d5925f33aa
commit
22d9bd0c45
1 changed files with 3 additions and 1 deletions
|
@ -56,7 +56,9 @@ NonnullOwnPtr<MmapRegion> MmapRegion::create_anonymous(u32 base, u32 size, u32 p
|
|||
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, String name)
|
||||
{
|
||||
auto data = (u8*)mmap_with_name(nullptr, size, prot, flags, fd, offset, name.is_empty() ? nullptr : name.characters());
|
||||
// Since we put the memory to an arbitrary location, do not pass MAP_FIXED to the Kernel.
|
||||
auto real_flags = flags & ~MAP_FIXED;
|
||||
auto data = (u8*)mmap_with_name(nullptr, size, prot, real_flags, fd, offset, name.is_empty() ? nullptr : name.characters());
|
||||
VERIFY(data != MAP_FAILED);
|
||||
auto shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData");
|
||||
auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data));
|
||||
|
|
Loading…
Add table
Reference in a new issue