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@489 | 26 | #include <fsserver/resource.h> |
paul@366 | 27 | |
paul@480 | 28 | #include "notifier_interface.h" |
paul@469 | 29 | #include "parent_pager_object_interface.h" |
paul@469 | 30 | |
paul@366 | 31 | |
paul@366 | 32 | |
paul@366 | 33 | /* A simple system pager also acting as a region mapper. */ |
paul@366 | 34 | |
paul@484 | 35 | class ExternalPager : public ExecPager, public ParentPagerObject, |
paul@489 | 36 | public NotificationSupport, public Resource |
paul@366 | 37 | { |
paul@366 | 38 | public: |
paul@431 | 39 | explicit ExternalPager(address_t start = 0, address_t end = 0); |
paul@366 | 40 | |
paul@489 | 41 | /* Server details. */ |
paul@489 | 42 | |
paul@489 | 43 | virtual ipc_server_default_config_type config(); |
paul@489 | 44 | |
paul@489 | 45 | virtual void *interface() |
paul@489 | 46 | { return static_cast<ParentPagerObject *>(this); } |
paul@489 | 47 | |
paul@366 | 48 | /* Notification methods, implementing PagerObject. */ |
paul@366 | 49 | |
paul@366 | 50 | virtual long exception(l4_exc_regs_t regs, |
paul@366 | 51 | l4_snd_fpage_t *region); |
paul@366 | 52 | |
paul@366 | 53 | virtual long page_fault(l4_umword_t pfa, l4_umword_t pc, |
paul@366 | 54 | l4_snd_fpage_t *region); |
paul@366 | 55 | |
paul@366 | 56 | /* Region manager/mapper methods. */ |
paul@366 | 57 | |
paul@419 | 58 | virtual long attach(address_t *start, address_t size, map_flags_t flags, |
paul@366 | 59 | l4_cap_idx_t ds, address_t offset, unsigned char align); |
paul@469 | 60 | |
paul@469 | 61 | /* Parent methods. */ |
paul@469 | 62 | |
paul@469 | 63 | virtual long signal(unsigned long sig, unsigned long val); |
paul@480 | 64 | |
paul@480 | 65 | /* Notification methods. */ |
paul@480 | 66 | |
paul@485 | 67 | virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags); |
paul@484 | 68 | |
paul@488 | 69 | virtual long unsubscribe(l4_cap_idx_t notifier); |
paul@366 | 70 | }; |
paul@366 | 71 | |
paul@366 | 72 | /* vim: tabstop=2 expandtab shiftwidth=2 |
paul@366 | 73 | */ |