1.1 --- a/libexec/include/exec/pager.h Sat Oct 01 16:53:23 2022 +0200
1.2 +++ b/libexec/include/exec/pager.h Sat Oct 01 16:58:16 2022 +0200
1.3 @@ -1,5 +1,5 @@
1.4 /*
1.5 - * A system pager interface.
1.6 + * Common system pager functionality.
1.7 *
1.8 * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 @@ -21,30 +21,48 @@
1.11
1.12 #pragma once
1.13
1.14 +#include <map>
1.15 +
1.16 +#include <exec/mapped_region.h>
1.17 +
1.18 #include "pager_object_interface.h"
1.19
1.20
1.21
1.22 +/* Collection types. */
1.23 +
1.24 +typedef std::map<l4_addr_t, MappedRegion> MappedRegions;
1.25 +
1.26 +
1.27 +
1.28 /* A simple system pager also acting as a region mapper. */
1.29
1.30 class ExecPager : public PagerObject
1.31 {
1.32 +protected:
1.33 + address_t _start, _end;
1.34 +
1.35 + /* Region manager/mapper functionality. */
1.36 +
1.37 + MappedRegions _regions;
1.38 +
1.39 + virtual long find(address_t *start, address_t *size, map_flags_t flags,
1.40 + address_t offset, unsigned char align);
1.41 +
1.42 public:
1.43 + explicit ExecPager(address_t start = 0, address_t end = 0);
1.44 +
1.45 virtual ~ExecPager();
1.46
1.47 + virtual void add(MappedRegion ®ion);
1.48 +
1.49 /* Notification methods. */
1.50
1.51 virtual long exception(l4_exc_regs_t regs,
1.52 l4_snd_fpage_t *region) = 0;
1.53
1.54 virtual long page_fault(l4_umword_t pfa, l4_umword_t pc,
1.55 - l4_snd_fpage_t *region);
1.56 -
1.57 - /* Region manager/mapper methods. */
1.58 -
1.59 - virtual long attach(address_t *start, address_t size, map_flags_t flags,
1.60 - l4_cap_idx_t ds, address_t offset, unsigned char align);
1.61 -
1.62 + l4_snd_fpage_t *region) = 0;
1.63 };
1.64
1.65 /* vim: tabstop=2 expandtab shiftwidth=2