paul@366 | 1 | /* |
paul@366 | 2 | * A system pager implementation residing in the same task as a program. |
paul@366 | 3 | * |
paul@631 | 4 | * Copyright (C) 2022, 2023, 2024 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@535 | 25 | #include <resource/resource.h> |
paul@366 | 26 | |
paul@469 | 27 | #include "pager_object_interface.h" |
paul@469 | 28 | |
paul@366 | 29 | |
paul@366 | 30 | |
paul@366 | 31 | /* A simple system pager also acting as a region mapper. */ |
paul@366 | 32 | |
paul@493 | 33 | class InternalPager : public ExecPager, public PagerObject, public Resource |
paul@366 | 34 | { |
paul@366 | 35 | public: |
paul@431 | 36 | explicit InternalPager(address_t start = 0, address_t end = 0); |
paul@366 | 37 | |
paul@493 | 38 | /* Server details. */ |
paul@493 | 39 | |
paul@493 | 40 | virtual ipc_server_default_config_type config(); |
paul@493 | 41 | |
paul@493 | 42 | virtual void *interface() |
paul@493 | 43 | { return static_cast<PagerObject *>(this); } |
paul@493 | 44 | |
paul@498 | 45 | /* Resource methods. */ |
paul@498 | 46 | |
paul@498 | 47 | virtual void close(); |
paul@498 | 48 | |
paul@366 | 49 | /* Notification methods, implementing PagerObject. */ |
paul@366 | 50 | |
paul@366 | 51 | virtual long exception(l4_exc_regs_t regs, |
paul@366 | 52 | l4_snd_fpage_t *region); |
paul@366 | 53 | |
paul@366 | 54 | virtual long page_fault(l4_umword_t pfa, l4_umword_t pc, |
paul@366 | 55 | l4_snd_fpage_t *region); |
paul@366 | 56 | |
paul@366 | 57 | /* Region manager/mapper methods. */ |
paul@366 | 58 | |
paul@631 | 59 | virtual long attach(address_t *start, address_t size, rm_flags_t flags, |
paul@631 | 60 | l4_cap_idx_t ds, rm_offset_t offset, unsigned char align); |
paul@515 | 61 | |
paul@631 | 62 | virtual long detach(address_t addr, address_t size, rm_flags_t flags, |
paul@545 | 63 | address_t *start, address_t *rsize, l4_cap_idx_t *ds); |
paul@545 | 64 | |
paul@631 | 65 | virtual long reserve_area(address_t *start, address_t size, rm_flags_t flags, |
paul@515 | 66 | unsigned char align); |
paul@366 | 67 | }; |
paul@366 | 68 | |
paul@366 | 69 | /* vim: tabstop=2 expandtab shiftwidth=2 |
paul@366 | 70 | */ |