1.1 --- a/libexec/lib/src/segment.cc Tue May 10 22:39:15 2022 +0200
1.2 +++ b/libexec/lib/src/segment.cc Wed May 11 01:23:28 2022 +0200
1.3 @@ -33,7 +33,7 @@
1.4
1.5 /* Initialise a memory segment. */
1.6
1.7 -Segment::Segment(offset_t base, offset_t size, l4re_rm_flags_t flags,
1.8 +Segment::Segment(l4_addr_t base, offset_t size, l4re_rm_flags_t flags,
1.9 offset_t file_offset, offset_t file_contents)
1.10 : base(base), size(size), flags(flags), file_offset(file_offset),
1.11 file_contents(file_contents)
1.12 @@ -47,7 +47,14 @@
1.13
1.14 long Segment::allocate()
1.15 {
1.16 - return ipc_allocate_align(size, L4RE_RM_F_SEARCH_ADDR | flags,
1.17 + /* Make regions writable if they need to be filled. */
1.18 +
1.19 + l4re_rm_flags_t allocation_flags = flags;
1.20 +
1.21 + if (file_contents)
1.22 + allocation_flags |= L4RE_RM_F_W;
1.23 +
1.24 + return ipc_allocate_align(size, L4RE_RM_F_SEARCH_ADDR | allocation_flags,
1.25 L4_PAGESHIFT, (void **) &buf, &ds);
1.26 }
1.27