paul@355 | 1 | /* |
paul@431 | 2 | * Common system pager functionality. |
paul@355 | 3 | * |
paul@504 | 4 | * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@355 | 5 | * |
paul@355 | 6 | * This program is free software; you can redistribute it and/or |
paul@355 | 7 | * modify it under the terms of the GNU General Public License as |
paul@355 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@355 | 9 | * the License, or (at your option) any later version. |
paul@355 | 10 | * |
paul@355 | 11 | * This program is distributed in the hope that it will be useful, |
paul@355 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@355 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@355 | 14 | * GNU General Public License for more details. |
paul@355 | 15 | * |
paul@355 | 16 | * You should have received a copy of the GNU General Public License |
paul@355 | 17 | * along with this program; if not, write to the Free Software |
paul@355 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@355 | 19 | * Boston, MA 02110-1301, USA |
paul@355 | 20 | */ |
paul@355 | 21 | |
paul@355 | 22 | #pragma once |
paul@355 | 23 | |
paul@572 | 24 | #include <l4/sys/utcb.h> |
paul@572 | 25 | |
paul@515 | 26 | #include <exec/memory_area.h> |
paul@431 | 27 | |
paul@355 | 28 | |
paul@355 | 29 | |
paul@355 | 30 | /* A simple system pager also acting as a region mapper. */ |
paul@355 | 31 | |
paul@469 | 32 | class ExecPager |
paul@355 | 33 | { |
paul@431 | 34 | protected: |
paul@515 | 35 | |
paul@515 | 36 | /* Top-level area containing other areas and regions. */ |
paul@515 | 37 | |
paul@515 | 38 | AvailableMemoryArea _area; |
paul@515 | 39 | |
paul@431 | 40 | /* Region manager/mapper functionality. */ |
paul@431 | 41 | |
paul@431 | 42 | virtual long find(address_t *start, address_t *size, map_flags_t flags, |
paul@515 | 43 | unsigned char align, MemoryArea **area); |
paul@431 | 44 | |
paul@355 | 45 | public: |
paul@431 | 46 | explicit ExecPager(address_t start = 0, address_t end = 0); |
paul@431 | 47 | |
paul@366 | 48 | virtual ~ExecPager(); |
paul@355 | 49 | |
paul@497 | 50 | /* Region management methods. */ |
paul@497 | 51 | |
paul@515 | 52 | virtual void add(MemoryArea &area); |
paul@431 | 53 | |
paul@515 | 54 | virtual void remove(MemoryArea &area); |
paul@504 | 55 | |
paul@355 | 56 | /* Notification methods. */ |
paul@355 | 57 | |
paul@355 | 58 | virtual long exception(l4_exc_regs_t regs, |
paul@366 | 59 | l4_snd_fpage_t *region) = 0; |
paul@355 | 60 | |
paul@355 | 61 | virtual long page_fault(l4_umword_t pfa, l4_umword_t pc, |
paul@431 | 62 | l4_snd_fpage_t *region) = 0; |
paul@355 | 63 | }; |
paul@355 | 64 | |
paul@355 | 65 | /* vim: tabstop=2 expandtab shiftwidth=2 |
paul@355 | 66 | */ |