paul@93 | 1 | /* |
paul@93 | 2 | * A simple pager exposing a single memory region. |
paul@93 | 3 | * |
paul@93 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@93 | 5 | * |
paul@93 | 6 | * This program is free software; you can redistribute it and/or |
paul@93 | 7 | * modify it under the terms of the GNU General Public License as |
paul@93 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@93 | 9 | * the License, or (at your option) any later version. |
paul@93 | 10 | * |
paul@93 | 11 | * This program is distributed in the hope that it will be useful, |
paul@93 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@93 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@93 | 14 | * GNU General Public License for more details. |
paul@93 | 15 | * |
paul@93 | 16 | * You should have received a copy of the GNU General Public License |
paul@93 | 17 | * along with this program; if not, write to the Free Software |
paul@93 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@93 | 19 | * Boston, MA 02110-1301, USA |
paul@93 | 20 | */ |
paul@93 | 21 | |
paul@1 | 22 | #pragma once |
paul@1 | 23 | |
paul@94 | 24 | #include <fsserver/dataspace_interface.h> |
paul@94 | 25 | #include <mem/flexpage.h> |
paul@94 | 26 | #include <mem/memory.h> |
paul@94 | 27 | #include <fsserver/resource.h> |
paul@1 | 28 | |
paul@1 | 29 | |
paul@1 | 30 | |
paul@1 | 31 | /* A simple pager exposing a single memory region as a dataspace. */ |
paul@1 | 32 | |
paul@1 | 33 | class SimplePager : public Dataspace, public Resource |
paul@1 | 34 | { |
paul@1 | 35 | protected: |
paul@1 | 36 | Memory *_memory; |
paul@1 | 37 | Region *_region; |
paul@1 | 38 | |
paul@1 | 39 | public: |
paul@1 | 40 | explicit SimplePager(Memory *memory=NULL); |
paul@1 | 41 | |
paul@1 | 42 | void close(); |
paul@1 | 43 | |
paul@1 | 44 | /* Paging methods. */ |
paul@1 | 45 | |
paul@121 | 46 | long map(offset_t offset, address_t hot_spot, map_flags_t flags, l4_snd_fpage_t *region); |
paul@10 | 47 | |
paul@121 | 48 | long info(offset_t *size, map_flags_t *flags); |
paul@1 | 49 | }; |
paul@1 | 50 | |
paul@1 | 51 | // vim: tabstop=4 expandtab shiftwidth=4 |