Skip to content

Commit

Permalink
Merge pull request #133 from RFCreations/fix_windows_zero
Browse files Browse the repository at this point in the history
Fix unaligned map_handle::zero_memory on windows and support COW
  • Loading branch information
ned14 authored Aug 22, 2024
2 parents 305647f + 5c22f5c commit 8717b58
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ result<mapped_file_handle::size_type> mapped_file_handle::_reserve(extent_type &
}
// Reserve the full reservation in address space
section_handle::flag mapflags = section_handle::flag::nocommit | section_handle::flag::read;
mapflags |= _sh.section_flags() & section_handle::flag::cow;
if(this->is_writable())
{
mapflags |= section_handle::flag::write;
Expand Down
2 changes: 1 addition & 1 deletion include/llfio/v2.0/detail/impl/windows/map_handle.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ result<void> map_handle::zero_memory(buffer_type region) noexcept
memset(region.data(), 0, region.size());
if(region.size() >= utils::page_size())
{
region = utils::round_to_page_size_larger(region, _pagesize);
region = utils::round_to_page_size_smaller(region, _pagesize);
if(region.size() > 0)
{
OUTCOME_TRYV(win32_maps_apply(region.data(), region.size(), win32_map_sought::committed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ result<mapped_file_handle::size_type> mapped_file_handle::_reserve(extent_type &
return _reservation;
}
section_handle::flag mapflags = section_handle::flag::read;
mapflags |= _sh.section_flags() & section_handle::flag::cow;
auto map_size = reservation;
// Reserve the full reservation in address space
if(this->is_writable())
Expand Down

0 comments on commit 8717b58

Please sign in to comment.