1.1 --- a/libexec/lib/src/internal_pager.cc Tue Dec 13 21:28:04 2022 +0100
1.2 +++ b/libexec/lib/src/internal_pager.cc Mon Feb 13 16:56:59 2023 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * A system pager implementation residing in the same task as a program.
1.6 *
1.7 - * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -24,6 +24,7 @@
1.13 #include <l4/util/util.h>
1.14
1.15 #include <mem/memory_utils.h>
1.16 +#include <systypes/base.h>
1.17
1.18 #include <stdio.h>
1.19
1.20 @@ -71,6 +72,9 @@
1.21 printf("regs = %p\n; regs->user[0] = %lx\n", regs, regs->user[0]);
1.22 #endif
1.23
1.24 + /* Find the first region whose start address is beyond the fault address,
1.25 + testing if any immediately preceding region contains the fault address. */
1.26 +
1.27 MappedRegions::iterator it = _regions.upper_bound(addr);
1.28
1.29 if (it != _regions.begin())
1.30 @@ -96,10 +100,7 @@
1.31
1.32 client_Dataspace dataspace(r.ds);
1.33 l4_snd_fpage_t rw_region = {0, l4_fpage(window_base, L4_PAGESHIFT, 0)};
1.34 - map_flags_t map_flags = (flags & 4 ? L4RE_DS_F_RX : 0) | (flags & 2 ? L4RE_DS_F_W : 0) | (flags & 1 ? L4RE_DS_F_R : 0);
1.35 -
1.36 - if (!map_flags)
1.37 - map_flags = L4RE_DS_F_R;
1.38 + map_flags_t map_flags = map_flags_for_fault(flags);
1.39
1.40 #if DEBUG
1.41 printf("window_base = %lx; window_size = %lx\n", window_base, window_size);