paul@366 | 1 | /* |
paul@366 | 2 | * A system pager implementation residing in a separate task. |
paul@366 | 3 | * |
paul@480 | 4 | * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@366 | 5 | * |
paul@366 | 6 | * This program is free software; you can redistribute it and/or |
paul@366 | 7 | * modify it under the terms of the GNU General Public License as |
paul@366 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@366 | 9 | * the License, or (at your option) any later version. |
paul@366 | 10 | * |
paul@366 | 11 | * This program is distributed in the hope that it will be useful, |
paul@366 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@366 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@366 | 14 | * GNU General Public License for more details. |
paul@366 | 15 | * |
paul@366 | 16 | * You should have received a copy of the GNU General Public License |
paul@366 | 17 | * along with this program; if not, write to the Free Software |
paul@366 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@366 | 19 | * Boston, MA 02110-1301, USA |
paul@366 | 20 | */ |
paul@366 | 21 | |
paul@366 | 22 | #pragma once |
paul@366 | 23 | |
paul@366 | 24 | #include <exec/pager.h> |
paul@484 | 25 | #include <fsserver/notification.h> |
paul@366 | 26 | |
paul@480 | 27 | #include "notifier_interface.h" |
paul@469 | 28 | #include "parent_pager_object_interface.h" |
paul@469 | 29 | |
paul@366 | 30 | |
paul@366 | 31 | |
paul@366 | 32 | /* A simple system pager also acting as a region mapper. */ |
paul@366 | 33 | |
paul@484 | 34 | class ExternalPager : public ExecPager, public ParentPagerObject, |
paul@484 | 35 | public NotificationSupport |
paul@366 | 36 | { |
paul@366 | 37 | public: |
paul@431 | 38 | explicit ExternalPager(address_t start = 0, address_t end = 0); |
paul@366 | 39 | |
paul@366 | 40 | /* Notification methods, implementing PagerObject. */ |
paul@366 | 41 | |
paul@366 | 42 | virtual long exception(l4_exc_regs_t regs, |
paul@366 | 43 | l4_snd_fpage_t *region); |
paul@366 | 44 | |
paul@366 | 45 | virtual long page_fault(l4_umword_t pfa, l4_umword_t pc, |
paul@366 | 46 | l4_snd_fpage_t *region); |
paul@366 | 47 | |
paul@366 | 48 | /* Region manager/mapper methods. */ |
paul@366 | 49 | |
paul@419 | 50 | virtual long attach(address_t *start, address_t size, map_flags_t flags, |
paul@366 | 51 | l4_cap_idx_t ds, address_t offset, unsigned char align); |
paul@469 | 52 | |
paul@469 | 53 | /* Parent methods. */ |
paul@469 | 54 | |
paul@469 | 55 | virtual long signal(unsigned long sig, unsigned long val); |
paul@480 | 56 | |
paul@480 | 57 | /* Notification methods. */ |
paul@480 | 58 | |
paul@485 | 59 | virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags); |
paul@484 | 60 | |
paul@488 | 61 | virtual long unsubscribe(l4_cap_idx_t notifier); |
paul@366 | 62 | }; |
paul@366 | 63 | |
paul@366 | 64 | /* vim: tabstop=2 expandtab shiftwidth=2 |
paul@366 | 65 | */ |