1.1 --- a/tests/dstest_exec.cc Wed May 04 01:16:08 2022 +0200
1.2 +++ b/tests/dstest_exec.cc Thu May 05 16:04:01 2022 +0200
1.3 @@ -67,7 +67,6 @@
1.4 {
1.5 /* UTCB location and size. */
1.6
1.7 - l4_addr_t utcb_start = Utcb_area_start;
1.8 int utcb_log2size = page_order(Default_max_threads * L4_UTCB_OFFSET);
1.9
1.10 /* Round up to at least one page. */
1.11 @@ -75,14 +74,14 @@
1.12 if (utcb_log2size < L4_PAGESHIFT)
1.13 utcb_log2size = L4_PAGESHIFT;
1.14
1.15 - return l4_fpage(utcb_start, utcb_log2size, 0);
1.16 + return l4_fpage(Utcb_area_start, utcb_log2size, 0);
1.17 }
1.18
1.19
1.20
1.21 -/* Region data structures. */
1.22 +/* Mapped region data structures. */
1.23
1.24 -class Region
1.25 +class MappedRegion
1.26 {
1.27 public:
1.28 l4_addr_t start;
1.29 @@ -90,13 +89,13 @@
1.30 l4_umword_t flags;
1.31 l4_addr_t map_start;
1.32
1.33 - explicit Region()
1.34 + explicit MappedRegion()
1.35 : start(0), log2size(0), flags(0), map_start(0)
1.36 {
1.37 }
1.38
1.39 - explicit Region(l4_addr_t start, unsigned int log2size, l4_umword_t flags,
1.40 - l4_addr_t map_start)
1.41 + explicit MappedRegion(l4_addr_t start, unsigned int log2size,
1.42 + l4_umword_t flags, l4_addr_t map_start)
1.43 : start(start), log2size(log2size), flags(flags), map_start(map_start)
1.44 {
1.45 }
1.46 @@ -109,7 +108,7 @@
1.47 class Segment
1.48 {
1.49 protected:
1.50 - Region _region;
1.51 + MappedRegion _region;
1.52
1.53 public:
1.54 /* Allocated memory. */
1.55 @@ -150,7 +149,7 @@
1.56
1.57 long fill(file_t *file);
1.58
1.59 - Region ®ion();
1.60 + MappedRegion ®ion();
1.61
1.62 l4_addr_t region_address(char *address);
1.63
1.64 @@ -178,9 +177,9 @@
1.65 return L4_EOK;
1.66 }
1.67
1.68 -Region &Segment::region()
1.69 +MappedRegion &Segment::region()
1.70 {
1.71 - _region = Region((l4_addr_t) buf, page_order(region_size), flags, region_base);
1.72 + _region = MappedRegion((l4_addr_t) buf, page_order(region_size), flags, region_base);
1.73 return _region;
1.74 }
1.75
1.76 @@ -198,15 +197,15 @@
1.77
1.78 /* A simple system pager also acting as a region mapper. */
1.79
1.80 -typedef std::map<l4_addr_t, Region> Regions;
1.81 +typedef std::map<l4_addr_t, MappedRegion> MappedRegions;
1.82
1.83 class ExecPager : public PagerObject
1.84 {
1.85 protected:
1.86 - Regions _regions;
1.87 + MappedRegions _regions;
1.88
1.89 public:
1.90 - virtual void add(Region region)
1.91 + virtual void add(MappedRegion region)
1.92 {
1.93 _regions[region.map_start] = region;
1.94 }
1.95 @@ -274,7 +273,7 @@
1.96 printf("page_fault(%lx, %lx) -> %lx (%lx) -> ", pfa, pc, addr, flags);
1.97 #endif
1.98
1.99 - Regions::iterator it = _regions.upper_bound(addr);
1.100 + MappedRegions::iterator it = _regions.upper_bound(addr);
1.101
1.102 if (it != _regions.begin())
1.103 it--;
1.104 @@ -284,7 +283,7 @@
1.105 return -L4_ENOMEM;
1.106 }
1.107
1.108 - Region &r = it->second;
1.109 + MappedRegion &r = it->second;
1.110
1.111 if ((addr >= r.map_start) && (addr < r.map_start + (1UL << r.log2size)))
1.112 {
1.113 @@ -340,7 +339,7 @@
1.114 if (flags & L4RE_RM_F_SEARCH_ADDR)
1.115 {
1.116 address_t region_start = trunc(*start, increment);
1.117 - Regions::iterator it = _regions.upper_bound(*start);
1.118 + MappedRegions::iterator it = _regions.upper_bound(*start);
1.119
1.120 if (!region_start)
1.121 region_start += increment;
1.122 @@ -353,8 +352,8 @@
1.123
1.124 while (it != _regions.end())
1.125 {
1.126 - Regions::iterator next = it;
1.127 - Region &r = it->second;
1.128 + MappedRegions::iterator next = it;
1.129 + MappedRegion &r = it->second;
1.130 address_t start_limit;
1.131 address_t end_limit = r.map_start;
1.132
1.133 @@ -366,7 +365,7 @@
1.134 else
1.135 {
1.136 it--;
1.137 - Region &pr = it->second;
1.138 + MappedRegion &pr = it->second;
1.139 start_limit = pr.map_start + (1UL << pr.log2size);
1.140 it = next;
1.141 }
1.142 @@ -407,7 +406,7 @@
1.143 printf("-> added region for %lx size %ld (%d)\n", region_start, region_size, page_order(region_size));
1.144 #endif
1.145
1.146 - add(Region(ds_start, page_order(region_size), flags & L4RE_DS_F_RIGHTS_MASK, region_start));
1.147 + add(MappedRegion(ds_start, page_order(region_size), flags & L4RE_DS_F_RIGHTS_MASK, region_start));
1.148
1.149 *start = region_start;
1.150 return L4_EOK;
1.151 @@ -841,10 +840,11 @@
1.152 NOTE: This should be directed by the ELF metadata. */
1.153
1.154 address_t program_start = 0x1000b43;
1.155 + offset_t initial_stack_size = 16 * L4_PAGESIZE;
1.156
1.157 Segment program(0x1000000, 0x28326, L4_FPAGE_RWX, 0, 0x28326);
1.158 Segment data(0x1029360, 0x8068, L4_FPAGE_RW, 0x28360, 0x2058);
1.159 - Segment stack(0x80000000 - 16 * L4_PAGESIZE, 16 * L4_PAGESIZE, L4_FPAGE_RW);
1.160 + Segment stack(Utcb_area_start - initial_stack_size, initial_stack_size, L4_FPAGE_RW);
1.161 Segment *segments[] = {&program, &data, &stack, NULL};
1.162 Segment **segment;
1.163